瀏覽代碼

禅道bug修改

jingshuyong 11 月之前
父節點
當前提交
7d1e5af852

+ 43 - 16
src/views/productionPlan/components/disassemblePlanPop.vue

@@ -8,6 +8,7 @@
     custom-class="ele-dialog-form"
     :title="'计划分解'"
     :maxable="true"
+    @close="cancel"
   >
     <div class="form-wrapper">
       <el-form :model="requestData" label-width="0" :show-message="false">
@@ -65,6 +66,8 @@
           @update:selection="handleSelectionChange"
           tool-class="ele-toolbar-actions"
           max-height="360px"
+          @select-all="selectAll"
+          @select="select"
         >
           <template v-slot:toolbar>
             <div class="toolbar_box">
@@ -129,7 +132,7 @@
 
 <script>
   import { deepClone } from '@/utils';
-  import { getBom , batchSave} from '@/api/productionPlan/index.js';
+  import { getBom, batchSave } from '@/api/productionPlan/index.js';
   import { routeList } from '@/api/saleOrder';
   import EquipmentDialog from './EquipmentDialog.vue';
 
@@ -140,24 +143,18 @@
     data() {
       return {
         visible: false,
-
         formData: {},
         requestData: {},
         bomList: [],
         baseCount: '',
         unit: '',
-
         selection: [],
-
         jhList: [],
-
         rules: {},
-
         producedList: [
-        { code: 2, name: '加工(MBOM)' },
-        { code: 3, name: '装配(ABOM)' }
+          { code: 2, name: '加工(MBOM)' },
+          { code: 3, name: '装配(ABOM)' }
         ],
-
         routingList: [],
         columns: [
           {
@@ -232,13 +229,11 @@
             showOverflowTooltip: true
           }
         ],
-
         statusOpt: {
           '': '全部',
           0: '已停用',
           1: '已发布'
         },
-
         jsColumns: [
           {
             prop: 'productCode',
@@ -294,7 +289,9 @@
             label: '计量单位',
             showOverflowTooltip: true
           }
-        ]
+        ],
+        // bom信息map数据存储
+        bomListMap: {}
       };
     },
     methods: {
@@ -305,6 +302,33 @@
         this.getRouteListFn();
       },
 
+      // 全选/取消全选
+      selectAll(selection) {
+        // 说明是全选
+        if (selection.length > 0) {
+          this.bomList.forEach((el) => {
+            this.bomListMap[el.id] = true;
+          });
+        } else {
+          // 取消全选
+          this.bomList.forEach((el) => {
+            delete this.bomListMap[el.id];
+          });
+        }
+
+        console.log(this.bomListMap, '看你数据');
+      },
+
+      // 勾选 取消勾选
+      select(selection, row) {
+        // 存在说明已勾选
+        if (this.bomListMap[row.id]) {
+          delete this.bomListMap[row.id];
+        }else{
+          this.bomListMap[row.id] = true;
+        }
+      },
+
       getBomList() {
         let params = {
           id: this.formData.id,
@@ -314,6 +338,7 @@
           size: -1
         };
         getBom(params).then((res) => {
+          console.log(res, 'res 切换数据');
           this.bomList = res?.bomList || [];
           (this.baseCount = res.baseCount),
             (this.unit = res.unit),
@@ -344,7 +369,8 @@
             resourceType: 0
           };
         });
-        this.jhList = _arr;
+        this.jhList.push(..._arr);
+        // this.jhList = _arr;
       },
 
       handleAdd() {
@@ -381,8 +407,9 @@
 
       cancel() {
         this.formData = {};
-        this.jhList = []
+        this.jhList = [];
         this.visible = false;
+        this.bomListMap = {};
       },
 
       getRouteListFn() {
@@ -413,8 +440,8 @@
           id: this.formData.id
         };
         batchSave(param).then((res) => {
-           this.$emit('close', true);
-           this.visible = false;
+          this.$emit('close', true);
+          this.visible = false;
         });
       }
     }

+ 13 - 9
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -860,6 +860,9 @@
         },
         deep: true,
         immediate: true
+      },
+      'form.produceType'(newVal, oldVal) {
+        console.log(newVal, '值');
       }
     },
     mounted() {
@@ -912,9 +915,7 @@
         });
       },
       // 查询库存数量
-      inventory(id){
-        
-      }, 
+      inventory(id) {},
       // 验证时间是否超期
       changeDate(item, i) {
         if (this.isTimeAGreaterThanB(item.deliveryTime, item.reqMoldTime)) {
@@ -961,7 +962,7 @@
       async _getInventory() {
         let code = [this.form.productCode];
         const res = await getInventoryTotalAPI(code);
-        console.log(res,'这是库存的数据 ---')
+        console.log(res, '这是库存的数据 ---');
         this.form.stockCountBase = res[0].stockCountBase;
       },
 
@@ -1077,10 +1078,13 @@
             res.produceRoutingId || this.$route.query.produceRoutingId;
           this.form.factoriesId =
             res.factoriesId || this.$route.query.factoriesId;
-          this.form.produceType =
-            res.produceType || this.$route.query.produceType
-              ? parseInt(this.$route.query.produceType)
-              : null;
+          // this.form.produceType =
+          //   res.produceType || this.$route.query.produceType
+          //     ? parseInt(this.$route.query.produceType)
+          //     : null;
+          this.form.produceType = this.$route.query.produceType
+            ? parseInt(this.$route.query.produceType)
+            : res.produceType;
           this.changeProduceType();
           this.form.bomCategoryId =
             res.bomCategoryId || this.$route.query.bomCategoryId;
@@ -1207,7 +1211,7 @@
         let flag = true;
         if (!this.form.startTime) {
           this.$message.warning('请选择计划开始时间');
-            return false;
+          return false;
         }
         if (!this.form.endTime) {
           this.$message.warning('请选择计划结束时间');