lilei 2 роки тому
батько
коміт
80a1ddc547

+ 58 - 6
src/views/power/role/menuModal.vue

@@ -18,6 +18,12 @@
           :label-col="formItemLayout.labelCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
+         <div style="display:flex;justify-content: flex-end;align-items: center;" v-if="authType==0">
+           <div style="width:270px;text-align: right;flex:1;">快捷全选:</div>
+           <div style="padding:0 10px;">
+            <a-checkbox-group :value="authAllPrice" :options="priceOptions" @change="onPriceChange" />
+           </div>
+         </div>
          <div style="height: 500px;overflow-y: auto;">
             <a-tree
             checkable
@@ -81,6 +87,9 @@ export default {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
+      authAllPrice: [],
+      leafNode:[],
+      checkLeafNode:[],
       form: {},
       rules: {},
       authType: '1',
@@ -97,16 +106,47 @@ export default {
       this.halfCheckedKeys = info.halfCheckedKeys
       this.checkedKeys = checkedKeys
     },
+    // 判断某分类是否全选
+    // 全选某分类价格
+    allSelect(data,authPrice,flag){
+      const _this = this
+      for (let i = 0; i < data.length; i++) {
+        const node = data[i]
+        const a = node.code.split('_')
+        if(a[a.length-1] == authPrice){
+          // 全选
+          if(flag){
+            _this.checkedKeys.push(node.id)
+          }else{
+            // 取消
+            _this.checkedKeys = _this.checkedKeys.filter(item => item != node.id)
+          }
+        } 
+        if (node.children && node.children.length) {
+          _this.allSelect(node.children, authPrice, flag)
+        }
+      }
+    },
+    onPriceChange(val){
+      // 全选
+      if(this.authAllPrice.length < val.length){
+        let tempVal = val.filter(item=>!this.authAllPrice.includes(item))
+        console.log(tempVal)
+        this.allSelect(this.nowData.allMenuList, tempVal[0], true)
+      }else{
+        // 取消
+        let tempVal = this.authAllPrice.filter(item=>!val.includes(item))
+        this.allSelect(this.nowData.allMenuList, tempVal[0], false)
+      }
+      this.authAllPrice = val
+    },
     // 保存提交
     handleSubmit () {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          if (this.checkedKeys.length == 0) {
-            return this.$message.warning('请先选择菜单')
-          }
           const arr = [...this.checkedKeys, ...this.halfCheckedKeys, ...this.checkedData].filter((x, index,self)=>self.indexOf(x)===index) 
-          console.log(arr,this.checkedData)
+          console.log(this.checkedData)
 
           _this.spinning = true
           addMenuPower({ id: this.id, menuIds: arr.join(',') }).then(res => {
@@ -166,6 +206,9 @@ export default {
       const _this = this
       for (let i = 0; i < data.length; i++) {
         const node = data[i]
+        const a = node.code.split('_')
+        // 已选节点勾选
+        const hasNode = arr.find(item => item == node.id)
         if(!_this.isPriceNode(node)){
           // 删除此节点
           node.checkable = false
@@ -176,11 +219,16 @@ export default {
         }else{
           node.class = 'leafNode'
           _this.expandedKeys.push(node.id)
-          // 已选节点勾选
-          const hasNode = arr.find(item => item == node.id)
+          // 默认回显已选节点
           const hasCheck = _this.checkedKeys.find(item => item == node.id)
           if (hasNode && !hasCheck) {
             _this.checkedKeys.push(node.id)
+            _this.checkLeafNode.push({pr:a[a.length-1],id:node.id})
+          }
+          // 统计价格节点
+          const hasLeaf = _this.leafNode.find(item => item.id == node.id)
+          if(!hasLeaf){
+            _this.leafNode.push({pr:a[a.length-1],id:node.id})
           }
         }
 
@@ -206,6 +254,8 @@ export default {
       }
       if(this.authType == 0){
         this.findPrice(treeData, this.checkedData)
+        console.log(this.leafNode)
+        console.log(this.checkLeafNode)
       }
       this.checkedData = this.checkedData.filter(item => !this.checkedKeys.includes(item))
       // console.log(this.checkedData)
@@ -237,6 +287,8 @@ export default {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
         this.id = ''
+        this.authAllPrice = []
+        this.leafNode = []
         this.checkedKeys = []
         this.expandedKeys = []
         this.titleText = '新增角色'

+ 1 - 1
src/views/salesManagement/salesQuery/edit.vue

@@ -182,7 +182,7 @@
         <a-alert type="info" style="margin-bottom: 10px;">
           <div slot="message" class="total-bar">
             <div>
-              <span v-if="$hasPermissions('B_salesEdit_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalPromoCost || detailData.totalPromoCost==0) ? toThousands(detailData.totalPromoCost) : '--' }}</strong>;</span>
+              <span>总成本:<strong>{{ detailData&&(detailData.totalPromoCost || detailData.totalPromoCost==0) ? toThousands(detailData.totalPromoCost) : '--' }}</strong>;</span>
               总款数:<strong>{{ detailData&&(detailData.totalPromoCategory || detailData.totalPromoCategory==0) ? detailData.totalPromoCategory : '--' }}</strong>;
               总数量:<strong>{{ detailData&&(detailData.totalPromoQty || detailData.totalPromoQty==0) ? detailData.totalPromoQty : '--' }}</strong>;
             </div>

+ 2 - 2
vue.config.js

@@ -107,9 +107,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.111:8602/ocs-admin',
+        // target: 'http://192.168.2.111:8602/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        // target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
+        target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {