Bläddra i källkod

禅道需求158开发 禅道 bug2525修复

jingshuyong 1 år sedan
förälder
incheckning
13bb5531b2

+ 41 - 10
src/views/materialPlan/components/producePlan.vue

@@ -74,7 +74,7 @@
             icon="el-icon-plus"
             class="ele-btn-icon"
             @click="produceAdd"
-            v-if="type != 'detail'"
+            v-if="type != 'detail' && sourceType != 2"
           >
             添加生产计划
           </el-button>
@@ -93,7 +93,7 @@
             v-model="row.bomId"
             placeholder="请选择"
             style="width: 100%"
-            :disabled="type == 'detail'"
+            :disabled="type == 'detail' || sourceType == 2"
             @change="changeVersions(row)"
           >
             <!-- <el-option
@@ -165,11 +165,11 @@
             v-model="row.bomType"
             placeholder="请选择"
             style="width: 100%"
-            :disabled="type == 'detail'"
+            :disabled="type == 'detail' || sourceType == 2"
             @change="changeType(row, row.bomType, $index)"
           >
             <el-option
-              v-for="item in bomTypeList"
+              v-for="item in row.producedList"
               :key="item.id"
               :label="item.label"
               :value="item.id"
@@ -512,7 +512,8 @@
           remark: '',
           detailRemoveIds: [],
           materialRemoveIds: [],
-          orderType: 2
+          orderType: 2,
+          sourceType:1
         },
         demandTypeList: [
           {
@@ -547,7 +548,8 @@
             }
           ]
         },
-        gysList: []
+        gysList: [],
+        sourceType: 1
       };
     },
 
@@ -868,6 +870,7 @@
 
         if (row) {
           this.getDetail(row.id);
+          this.sourceType = row.sourceType || 1;
         } else {
           this.$nextTick(() => {
             this.$refs.table.setData([]);
@@ -894,6 +897,7 @@
           this.$set(this.formData, 'remark', res.remark);
           this.formData['id'] = res.id;
           if (res.salesOrderList) {
+            res.salesOrderList = this.getBpmList(res.salesOrderList);
             this.$refs.table.setData([...res.salesOrderList]);
             // 展开所有行
             this.expandedRowKeys = this.$refs.table
@@ -908,6 +912,31 @@
           });
         });
       },
+      // 获取bom列表数据
+      getBpmList(data) {
+        if (!data || data.length == 0) return data;
+        let list = JSON.parse(JSON.stringify(data));
+        list.forEach((item) => {
+          if (!item.bomCategoryList || item.bomCategoryList.length == 0) {
+            return;
+          }
+          let listMap = {
+            1: { id: '1', label: 'PBOM' },
+            2: { id: '2', label: 'MBOM' },
+            3: { id: '3', label: 'ABOM' }
+          };
+          let arr = [];
+          item.bomCategoryList.forEach((el) => {
+            if (listMap[el.bomType]) {
+              arr.push(listMap[el.bomType]);
+              delete listMap[el.bomType];
+            }
+          });
+
+          item.producedList = arr;
+        });
+        return list;
+      },
       produceAdd() {
         this.tableData = this.$refs.table.getData();
         this.$refs.produceOrderRef.open(this.tableData);
@@ -949,8 +978,9 @@
               (item) => !tableList.some((existing) => existing.id === item.id)
             );
             console.log(finalData, 'finalData');
-
-            this.$refs.table.setData([...tableList, ...finalData]);
+            let dataList = this.getBpmList(finalData);
+            // this.$refs.table.setData([...tableList, ...finalData]);
+             this.$refs.table.setData([...tableList, ...dataList]);
 
             this.$nextTick(() => {
               this.expandedRowKeys = this.$refs.table
@@ -1226,14 +1256,15 @@
       },
       cancel() {
         this.visible = false;
-
+        this.sourceType = 1;
         this.formData = {
           demandType: '1',
           name: '',
           remark: '',
           detailRemoveIds: [],
           materialRemoveIds: [],
-          orderType: 2
+          orderType: 2,
+          sourceType: 1
         };
         this.$refs.table.setData([]);
         this.$refs.formRef.resetFields();

+ 1 - 0
src/views/productionPlan/components/disassemblePlanPop.vue

@@ -633,6 +633,7 @@
           produceType: this.formData.produceType,
           id: this.formData.id
         };
+
         batchSave(param).then((res) => {
           this.$emit('close', true);
           // this.visible = false;

+ 12 - 6
src/views/productionPlan/components/factoryAdd/index.vue

@@ -381,7 +381,7 @@
               >
             </template>
           </ele-pro-table>
-          <div class="add-product" @click="addEquipment">
+          <div class="add-product">
             <i class="el-icon-circle-plus-outline"></i>
           </div>
         </el-row>
@@ -437,6 +437,10 @@
       factoryObj: {
         type: Object,
         default: () => {}
+      },
+      isAdd:{
+        type:Boolean,
+        default:true
       }
     },
     watch: {
@@ -675,7 +679,7 @@
     data() {
       return {
         visible: false,
-        title: '',
+        title: '新增临时生产计划',
         type: 3,
         weightList: [
           { code: 1, name: 'A' },
@@ -860,15 +864,17 @@
                 }
               });
               if (listMap[2]) {
-                list.push({ code: 2, name: '加工(MBOM)' });
+                list.push({ code: 2, name: 'MBOM' });
               }
               if (listMap[3]) {
-                list.push({ code: 3, name: '装配(ABOM)' });
+                list.push({ code: 3, name: 'ABOM' });
               }
                this.form.productInfoList[0].producedList = list;
             }
           }
           this.$forceUpdate();
+        }else{
+          this.title = '新增临时生产计划'
         }
         this.visible = true;
 
@@ -980,12 +986,12 @@
               }
             });
             if (listMap[2]) {
-              list.push({ code: 2, name: '加工(MBOM)' });
+              list.push({ code: 2, name: 'MBOM' });
               arr = listMap[2];
               result[0].productType = 2;
             }
             if (listMap[3]) {
-              list.push({ code: 3, name: '装配(ABOM)' });
+              list.push({ code: 3, name: 'ABOM' });
               if (!listMap[2]) {
                 arr = listMap[3];
                 result[0].productType = 3;

+ 269 - 71
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -45,7 +45,11 @@
           </el-row>
         </el-form>
         <div class="form-wrapper">
-          <div class="left_tree" v-show="leftShow" :style="{ width: leftWidth }">
+          <div
+            class="left_tree"
+            v-show="leftShow"
+            :style="{ width: leftWidth }"
+          >
             <el-tree
               ref="treeRef"
               :expand-on-click-node="false"
@@ -62,14 +66,30 @@
                 ref="table"
                 :needPage="false"
                 :columns="columns"
-                key="checkTable"
                 :init-load="false"
                 :datasource="datasourceList"
+                row-key="code"
+                :cache-key="`ProductionPlanTable`"
+                border
+                height="40vh"
+                key="id"
+                :selection.sync="selection"
               >
                 <template v-slot:toolbar>
-                  <!-- <el-button type="primary" @click="bulkPurchase" size="mini"
-                  >采购申请</el-button
-                > -->
+                  <el-button
+                    v-if="produceType == 2"
+                    type="primary"
+                    @click="bulkPurchase"
+                    size="mini"
+                    >下发采购计划</el-button
+                  >
+                  <el-button
+                    v-if="produceType == 1"
+                    type="primary"
+                    @click="issuePlan"
+                    size="mini"
+                    >下发生产计划</el-button
+                  >
                 </template>
                 <template v-slot:toolkit>
                   <el-form
@@ -179,6 +199,30 @@
                     {{ row.finalStateText }}
                   </div>
                 </template>
+
+                <template v-slot:numberProductionStateText="{ row }">
+                  <div
+                    :class="
+                      row.numberProductionStateText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.numberProductionStateText }}
+                  </div>
+                </template>
+                <template v-slot:productFinalStateText="{ row }">
+                  <div
+                    :class="
+                      row.productFinalStateText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.productFinalStateText }}
+                  </div>
+                </template>
+
                 <template v-slot:finishCount="{ row }">
                   <div>
                     <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
@@ -186,14 +230,14 @@
                   </div>
                 </template>
                 <!-- <template v-slot:action="{ row }">
-                <el-link
-                  type="primary"
-                  :underline="false"
-                  @click="purchase(row)"
-                >
-                  采购申请
-                </el-link>
-              </template> -->
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    @click="issuePlan(row)"
+                  >
+                    下发生产计划
+                  </el-link>
+                </template> -->
               </ele-pro-table>
             </div>
           </div>
@@ -208,7 +252,13 @@
     <stockDetailDialog ref="stockDetailDialog" />
     <currentDetailDialog ref="currentDetailDialog" />
     <producePlan ref="produceRef" @success="reloads"></producePlan>
-    <purchaseDialog ref="purchaseDialogRef" />
+    <purchaseDialog ref="purchaseDialogRef" :orderType="2" @success="success" />
+    <factoryAdd
+      ref="factoryAddRef"
+      :isAdd="false"
+      :factoryType="3"
+      @close="factoryClose"
+    ></factoryAdd>
   </div>
 </template>
 
@@ -220,43 +270,32 @@
     findBomCategoryByCategoryId,
     getBom
   } from '@/api/productionPlan/index.js';
+  import factoryAdd from './factoryAdd';
   import { listBomByPlanIdsOverride } from '@/api/materialPlan/index';
   import stockDetailDialog from './stockDetailDialog.vue';
   import currentDetailDialog from './currentDetailDialog.vue';
   import producePlan from '@/views/materialPlan/components/producePlan.vue';
   import purchaseDialog from './purchaseDialog.vue';
+  import { batchSave } from '@/api/productionPlan/index.js';
   export default {
     components: {
       stockDetailDialog,
       currentDetailDialog,
       producePlan,
-      purchaseDialog
+      purchaseDialog,
+      factoryAdd
     },
-    data() {
-      return {
-        visible: false,
-        requiredFormingNum: 0,
-        formInline: {
-          finalState: 0
-        },
-        finalStateList: [
-          {
-            label: '全部',
-            value: 0
-          },
+    computed: {
+      columns() {
+        return [
           {
-            label: '齐套',
-            value: 1
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            slot: 'selection',
+            fixed: 'left'
           },
-          {
-            label: '缺料',
-            value: 2
-          }
-        ],
-        // form: {
-        //   homogeneityInspect: []
-        // },
-        columns: [
           {
             columnKey: 'index',
             label: '序号',
@@ -265,14 +304,6 @@
             align: 'center',
             fixed: 'left'
           },
-          // {
-          //   width: 45,
-          //   type: 'selection',
-          //   columnKey: 'selection',
-          //   align: 'center',
-          //   slot: 'selection',
-          //   fixed: 'left'
-          // },
           {
             prop: 'batchNo',
             label: '批次号',
@@ -307,6 +338,13 @@
             showOverflowTooltip: true,
             align: 'center'
           },
+          {
+            prop: 'totalUnshippedQuantity',
+            label: '未发总数',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
           {
             slot: 'inventoryQuantity',
             prop: 'inventoryQuantity',
@@ -353,6 +391,30 @@
             align: 'center',
             minWidth: 80
           },
+          {
+            prop: 'totalNumberProduction',
+            label: '在制总数',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
+          {
+            prop: 'numberProductionStateText',
+            slot: 'numberProductionStateText',
+            label: '在制齐套',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
+          {
+            prop: 'productFinalStateText',
+            slot: 'productFinalStateText',
+            label: '成品的最终齐套',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 160,
+            show: this.produceType == 1
+          },
           {
             label: '最终可用数量',
             prop: 'finalAvailableQuantity',
@@ -365,12 +427,23 @@
             align: 'center',
             minWidth: 120
           },
+
+          {
+            label: '下发状态',
+            align: 'center',
+            minWidth: 90,
+            fixed: 'right',
+            formatter: (row) => {
+              return row.hasIssued ? '已下发' : '未下发';
+            }
+          },
           {
             slot: 'finalStateText',
             prop: 'finalStateText',
             label: '最终状态',
             align: 'center',
-            minWidth: 80
+            minWidth: 80,
+            fixed: 'right'
           }
           // {
           //   columnKey: 'action',
@@ -379,8 +452,32 @@
           //   align: 'center',
           //   resizable: false,
           //   fixed: 'right',
+          //   show: this.produceType == 1,
           //   slot: 'action'
           // }
+        ];
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        // requiredFormingNum: 0,
+        formInline: {
+          finalState: 0
+        },
+        finalStateList: [
+          {
+            label: '全部',
+            value: 0
+          },
+          {
+            label: '齐套',
+            value: 1
+          },
+          {
+            label: '缺料',
+            value: 2
+          }
         ],
         ids: [],
         leftShow: false,
@@ -400,7 +497,9 @@
         bomListType: [], // BOM 类型
         planId: '',
         selectNodeId: '',
-        loading: false
+        loading: false,
+        produceType: 1,
+        selection: []
       };
     },
     watch: {
@@ -459,7 +558,11 @@
       },
       // 获取物料数据信息
       async getMaterialData(data) {
-        let params = { planId: this.planId, bomVersionId: data.bomId };
+        let params = {
+          planId: this.planId,
+          bomVersionId: data.bomId,
+          produceType: this.produceType
+        };
         const result = await findMaterialInfoByPlanId(params);
         result.map((item) => {
           item.batchNo = this.planInfo.batchNo;
@@ -485,30 +588,58 @@
         );
       },
       // 批量采购
-      async bulkPurchase(list) {
-        if (list.length == 0) {
+      async bulkPurchase() {
+        if (this.selection.length == 0) {
           return this.$message.warning('请至少选择一条数据');
         }
+        for (let i = 0; i < this.selection.length; i++) {
+          let el = this.selection[i];
+          if (el.finalState == 1) {
+            return this.$message.warning('必须选择最终状态为缺料的数据');
+          }
+          if (el.hasIssued) {
+            return this.$message.warning('必须选择下发状态为未下发的数据');
+          }
+        }
+        let arr = JSON.parse(JSON.stringify(this.selection));
+        let obj = this.bomListType.find(
+          (el) => el.id === this.formInline.bomType
+        );
+        let data = {
+          ...this.planInfo,
+          bomId: this.formInline.bomId,
+          bomType: obj.bomType
+        };
+        this.$refs.purchaseDialogRef.open(arr, data);
         // let planIds = list.map((item) => item.id);
         // let data = {
         //   planIds: ['1948548495278911490', '1948548022580850689'],
         //   demandType: '1'
         // };
         // this.$refs.produceRef.visible = true;
-        const o = this.cardList.find((el) => el.id === this.selectNodeId);
-        let obj = JSON.parse(JSON.stringify(o));
-        obj.materialList = list;
-        this.$nextTick(() => {
-          this.$refs.purchaseDialogRef.open([obj], '生产计划');
-        });
+        // const o = this.cardList.find((el) => el.id === this.selectNodeId);
+        // let obj = JSON.parse(JSON.stringify(o));
+        // obj.materialList = list;
+        // this.$nextTick(() => {
+        //   this.$refs.purchaseDialogRef.open([obj], '生产计划');
+        // });
         // const result = await listBomByPlanIdsOverride(data);
       },
-      // 采购申请
-      purchase(row) {
-        this.bulkPurchase([row]);
+      success() {
+        this.bomVChange(this.formInline.bomId);
       },
-      async open(dataList) {
+      // 采购申请
+      // purchase(row) {
+      //   this.bulkPurchase([row]);
+      // },
+      async open(dataList, produceType) {
         this.visible = true;
+
+        this.$nextTick(() => {
+          this.produceType = produceType;
+          this.$refs.table.reRenderTable();
+        });
+        // this.$refs.table.reRenderTable();
         this.cardList = dataList;
         if (dataList.length === 1) {
           this.leftShow = false;
@@ -540,8 +671,8 @@
         try {
           this.planId = data.id;
           const res = await findBomCategoryByCategoryId(data.categoryId);
+           this.loading = false;
           if (!res || res.length == 0) {
-            this.loading = false;
             this.bomListD = [];
             this.datasourceList = [];
             return;
@@ -550,10 +681,13 @@
           let bomMap = {
             1: 'PBOM',
             2: 'MBOM',
-            3: 'ABOM',
-            4: 'EBOM'
+            3: 'ABOM'
           };
-          res.map((el) => {
+          if (this.produceType == 1) {
+            delete bomMap[1];
+          }
+          let result = res.filter((item) => item.bomType != 1);
+          result.map((el) => {
             el.bomName = bomMap[el.bomType];
             let OBMINFO = {
               bomId: el.bomId,
@@ -567,6 +701,8 @@
             }
           });
           let list = Object.values(obj);
+          console.log(list,'list')
+          if(list.length == 0) return;
           this.bomListType = list;
           await this.bomTypeChange(list[0].id);
           this.loading = false;
@@ -576,15 +712,77 @@
         }
       },
 
-      confirm() {
-        this.visible = false;
+      issuePlan() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        for (let i = 0; i < this.selection.length; i++) {
+          let el = this.selection[i];
+          if (el.finalState == 1) {
+            return this.$message.warning('必须选择最终状态为缺料的数据');
+          }
+          if (el.hasIssued) {
+            return this.$message.warning('必须选择下发状态为未下发的数据');
+          }
+        }
+        let obj = this.bomListType.find(
+          (el) => el.id === this.formInline.bomType
+        );
+        const addPOList = this.fieldProcessing(this.selection);
+        this.$alert('确定要将所选的数据下发生产计划吗', {
+          confirmButtonText: '确定',
+          callback: (action) => {
+            let param = {
+              addPOList: addPOList,
+              produceType: obj.bomType,
+              id: this.planInfo.id
+            };
+
+            batchSave(param).then((res) => {
+              this.$message.success('操作成功');
+              this.bomVChange(this.formInline.bomId);
+            });
+          }
+        });
+        console.log(row, 'row');
+        // this.$refs.factoryAddRef.open();
+        // this.$refs.factoryAddRef.confirmChoose([row]);
       },
-      async merge() {
-        this.reload({ planIds: this.ids, productType: 1, merge: 2 });
+
+      // 字段处理
+      fieldProcessing(arr) {
+        let list = arr.map((item) => {
+          return {
+            id: this.planInfo.id,
+            categoryId: item.categoryId,
+            productCode: this.planInfo.productCode,
+            productName: this.planInfo.productName,
+            specification: item.specification,
+            produceRoutingId: this.planInfo.produceRoutingId,
+            produceRoutingName: this.planInfo.produceRoutingName,
+            requiredFormingNum: this.planInfo.requiredFormingNum,
+            startTime: this.planInfo.startTime,
+            endTime: this.planInfo.endTime,
+            unit: item.unit,
+            brandNo: this.planInfo.brandNo,
+            model: this.planInfo.model,
+            resourceType: 0
+          };
+        });
+        return list || [];
       },
-      tabClick() {
-        this.reload({ planIds: this.ids, productType: 1 });
+      factoryClose(val) {
+        // this.factoryObj = {};
       }
+      // confirm() {
+      //   this.visible = false;
+      // },
+      // async merge() {
+      //   this.reload({ planIds: this.ids, productType: 1, merge: 2 });
+      // },
+      // tabClick() {
+      //   this.reload({ planIds: this.ids, productType: 1 });
+      // }
     }
   };
 </script>

+ 598 - 135
src/views/productionPlan/components/purchaseDialog.vue

@@ -9,8 +9,47 @@
     width="80%"
     :maxable="true"
   >
-    <el-form>
-      <ele-pro-table
+    <el-form
+      :model="formData"
+      ref="formRef"
+      label-width="120px"
+      class="ele-body"
+      :rules="rules"
+    >
+      <el-row :gutter="24">
+        <el-col :span="8">
+          <el-form-item label="需求类型" prop="demandType">
+            <el-select
+              v-model="formData.demandType"
+              :key="formData.demandType"
+              placeholder="请选择"
+              style="width: 100%"
+              disabled
+            >
+              <el-option
+                v-for="item in demandTypeList"
+                :key="item.dictCode"
+                :label="item.dictValue"
+                :value="item.dictCode"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="计划名称" prop="name">
+            <el-input placeholder="请选择" v-model="formData.name"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="备注" prop="remark">
+            <el-input placeholder="备注" v-model="formData.remark"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <!-- <ele-pro-table
         ref="tableRef3"
         :columns="columns"
         :datasource="tableList"
@@ -28,20 +67,8 @@
             >
               添加物料
             </el-link>
-            <!-- <el-popconfirm
-              class="ele-action"
-              title="确定要删除此生产计划吗?"
-              @confirm="remove(row, $index)"
-            >
-              <template v-slot:reference>
-                <el-link type="danger" :underline="false" icon="el-icon-delete">
-                  删除
-                </el-link>
-              </template>
-            </el-popconfirm> -->
           </template>
         </template>
-
         <template v-slot:expand="{ row, $index }">
           <div
             style="
@@ -59,127 +86,367 @@
               :toolkit="[]"
             ></ele-pro-table> </div
         ></template>
+      </ele-pro-table> -->
+      <ele-pro-table
+        :columns="columns2"
+        :datasource="materialList"
+        :need-page="false"
+        height="300px"
+        class="el-form-box"
+        :toolkit="[]"
+        :selection.sync="selection"
+      >
+        <template v-slot:toolbar>
+          <el-button @click="categorySelect" type="primary">添加物料</el-button>
+          <el-button @click="batchUpdateDeliveryMethod"
+            >批量修改到货方式</el-button
+          >
+        </template>
+        <template v-slot:demandQuantity="{ row }">
+          <div>
+            <!-- 需求数量 -->
+            <el-input
+              v-model="row.demandQuantity"
+              placeholder="请输入"
+              @input="
+                (value) =>
+                  (row.demandQuantity = value.replace(
+                    /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                    '$1$2.$3'
+                  ))
+              "
+            ></el-input>
+          </div>
+        </template>
+
+        <template v-slot:purchasingCycle="{ row }">
+          {{ row.purchasingCycle }}{{ row.purchasingCycleUnit }}
+        </template>
+        <template v-slot:purchaseQuantity="{ row }">
+          <el-input
+            v-model="row.purchaseQuantity"
+            placeholder="请输入"
+            @input="
+              (value) =>
+                (row.purchaseQuantity = value.replace(
+                  /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                  '$1$2.$3'
+                ))
+            "
+          ></el-input>
+        </template>
+        <template v-slot:deliveryMethod="{ row, $index }">
+          <el-select
+            clearable
+            class="ele-block"
+            v-model="row.deliveryMethod"
+            placeholder="请选择"
+          >
+            <el-option
+              label="一次性到货"
+              :value="1"
+              @click.native="row.timeList = null"
+            />
+            <el-option
+              label="分批到货"
+              :value="2"
+              @click.native="
+                handleMethod(row, $index);
+                row.requireDeliveryTime = null;
+              "
+            />
+          </el-select>
+        </template>
+        <template v-slot:requireDeliveryTime="{ row, $index }">
+          <el-date-picker
+            style="width: 100%"
+            clearable
+            v-model="row.requireDeliveryTime"
+            type="date"
+            v-if="row.deliveryMethod == 1"
+            value-format="yyyy-MM-dd"
+            placeholder="请选择日期"
+            :pickerOptions="{
+              disabledDate: (time) =>
+                time.getTime() <
+                new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+            }"
+          >
+          </el-date-picker>
+
+          <el-link
+            type="primary"
+            :underline="false"
+            v-if="row.deliveryMethod == 2"
+            @click.native="handleMethod(row, $index)"
+          >
+            设置分批时间
+          </el-link>
+        </template>
+        <template v-slot:imgUrl="{ row }">
+          <fileMain
+            v-model="row.imgUrl"
+            module="main"
+            :showLib="false"
+            :limit="1"
+          />
+        </template>
+        <template v-slot:files="{ row }">
+          <fileMain
+            v-model="row.files"
+            module="main"
+            :showLib="false"
+            :limit="1"
+          />
+        </template>
+        <template v-slot:action="{ row, $index }">
+          <el-popconfirm
+            v-if="row.isDel"
+            class="ele-action"
+            title="确定要删除此物料吗?"
+            @confirm="remove(row, $index)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
       </ele-pro-table>
     </el-form>
     <ProductModal ref="productRefs" @chooseModal="chooseModal" />
+    <timeDialog ref="timeDialogRef" @chooseTime="chooseTime"></timeDialog>
+    <ele-modal
+      :visible.sync="batchVisible"
+      title="批量选择"
+      width="25vw"
+      append-to-body
+      @close="handleCancel"
+      :maxable="true"
+    >
+      <el-form :model="formData2" label-width="100px">
+        <el-form-item label="到货方式" prop="deliveryMethod">
+          <el-select
+            clearable
+            v-model="formData2.deliveryMethod"
+            placeholder="请选择"
+          >
+            <el-option label="一次性到货" :value="1" />
+            <el-option
+              label="分批到货"
+              :value="2"
+              @click.native="handleMethod()"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="要求到货时间" prop="requireDeliveryTime">
+          <el-date-picker
+            clearable
+            v-model="formData2.requireDeliveryTime"
+            type="date"
+            v-show="formData2.deliveryMethod == 1"
+            value-format="yyyy-MM-dd"
+            placeholder="请选择日期"
+            :pickerOptions="{
+              disabledDate: (time) =>
+                time.getTime() <
+                new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+            }"
+          >
+          </el-date-picker>
+          <el-link
+            type="primary"
+            :underline="false"
+            v-show="formData2.deliveryMethod == 2"
+            @click.native="handleMethod()"
+          >
+            设置分批时间
+          </el-link>
+        </el-form-item>
+      </el-form>
+      <template v-slot:footer>
+        <el-button @click="handleCancel">取消</el-button>
+        <el-button type="primary" @click="handleConfirm">确认</el-button>
+      </template>
+    </ele-modal>
+    <div slot="footer">
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" @click="confirm">保存</el-button>
+    </div>
   </ele-modal>
 </template>
 
 <script>
   import ProductModal from '@/views/materialPlan/components/ProductModal.vue';
+  import timeDialog from '@/views/materialPlan/components/timeDialog.vue';
+  import { getCode } from '@/api/codeManagement';
+  import { save } from '@/api/materialPlan/index';
+
   export default {
+    props: {
+      orderType: {
+        type: Number,
+        default: 2
+      }
+    },
     components: {
       ProductModal,
+      timeDialog
     },
     data() {
       return {
         buVisible: false,
-        tableList: []
-      };
-    },
-    computed: {
-      columns() {
-        return [
-          {
-            width: 45,
-            type: 'expand',
-            columnKey: 'materialList',
-            align: 'center',
-            slot: 'expand'
-          },
-
-          {
-            width: 50,
-            label: '序号',
-            type: 'index',
-            align: 'center',
-            slot: 'index'
-          },
-          {
-            prop: 'producePlanCode',
-            label: '计划编号',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 170,
-            sortable: true
-          },
+        // tableList: []
+        materialList: [],
+        planData: {},
+        selection: [],
+        batchVisible: false,
+        demandTypeList: [
           {
-            prop: 'code',
-            label: '销售订单号',
-            slot: 'code',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 170,
-            sortable: true
+            dictCode: '1',
+            dictValue: '生产性物资采购'
           },
           {
-            prop: 'customerName',
-            label: '客户名称',
-            align: 'center',
-            showOverflowTooltip: true
+            dictCode: '6',
+            dictValue: '外协自供料采购'
           },
           {
-            prop: 'deliveryNum',
-            label: '客户代号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'productCode',
-            label: '编码',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 140
-          },
+            dictCode: '7',
+            dictValue: '外协客供料采购'
+          }
+        ],
+        formData: {
+          demandType: '1',
+          name: '',
+          remark: '',
+          detailRemoveIds: [],
+          materialRemoveIds: []
+        },
+        formData2: {
+          deliveryMethod: 1,
+          requireDeliveryTime: '',
+          timeList: []
+        },
+        rules: {
+          demandType: [
+            {
+              required: true,
+              message: '请选择需求类型',
+              trigger: ['blur', 'change']
+            }
+          ],
+          name: [
+            {
+              required: true,
+              message: '请输入配料计划名称',
+              trigger: ['blur', 'change']
+            }
+          ]
+        }
+      };
+    },
+    computed: {
+      // columns() {
+      //   return [
+      //     {
+      //       width: 45,
+      //       type: 'expand',
+      //       columnKey: 'materialList',
+      //       align: 'center'
+      //     },
+      //     {
+      //       width: 50,
+      //       label: '序号',
+      //       type: 'index',
+      //       align: 'center',
+      //       slot: 'index'
+      //     },
+      //     {
+      //       prop: 'producePlanCode',
+      //       label: '计划编号',
+      //       showOverflowTooltip: true,
+      //       align: 'center',
+      //       minWidth: 170,
+      //       sortable: true
+      //     },
+      //     {
+      //       prop: 'code',
+      //       label: '销售订单号',
+      //       slot: 'code',
+      //       showOverflowTooltip: true,
+      //       align: 'center',
+      //       minWidth: 170,
+      //       sortable: true
+      //     },
+      //     {
+      //       prop: 'customerName',
+      //       label: '客户名称',
+      //       align: 'center',
+      //       showOverflowTooltip: true
+      //     },
+      //     {
+      //       prop: 'deliveryNum',
+      //       label: '客户代号',
+      //       align: 'center',
+      //       showOverflowTooltip: true
+      //     },
+      //     {
+      //       prop: 'productCode',
+      //       label: '编码',
+      //       align: 'center',
+      //       showOverflowTooltip: true,
+      //       minWidth: 140
+      //     },
 
-          {
-            prop: 'productName',
-            label: '名称',
-            align: 'center',
-            minWidth: 120
-          },
+      //     {
+      //       prop: 'productName',
+      //       label: '名称',
+      //       align: 'center',
+      //       minWidth: 120
+      //     },
 
-          {
-            prop: 'model',
-            label: '型号',
-            align: 'center',
-            minWidth: 120
-          },
+      //     {
+      //       prop: 'model',
+      //       label: '型号',
+      //       align: 'center',
+      //       minWidth: 120
+      //     },
 
-          {
-            prop: 'brandNo',
-            label: '牌号',
-            align: 'center'
-          },
+      //     {
+      //       prop: 'brandNo',
+      //       label: '牌号',
+      //       align: 'center'
+      //     },
 
-          {
-            prop: 'deliveryTime',
-            label: '交付日期',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'contractNum',
-            label: '订单数量',
-            align: 'center'
-          },
-          {
-            prop: 'lackNum',
-            label: '欠交数量',
-            align: 'center'
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 150,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ];
-      },
-      materiaList() {
+      //     {
+      //       prop: 'deliveryTime',
+      //       label: '交付日期',
+      //       align: 'center',
+      //       showOverflowTooltip: true
+      //     },
+      //     {
+      //       prop: 'contractNum',
+      //       label: '订单数量',
+      //       align: 'center'
+      //     },
+      //     {
+      //       prop: 'lackNum',
+      //       label: '欠交数量',
+      //       align: 'center'
+      //     },
+      //     {
+      //       columnKey: 'action',
+      //       label: '操作',
+      //       width: 150,
+      //       align: 'center',
+      //       resizable: false,
+      //       slot: 'action',
+      //       showOverflowTooltip: true
+      //     }
+      //   ];
+      // },
+      columns2() {
         return [
           {
             columnKey: 'selection',
@@ -188,20 +455,13 @@
             align: 'center',
             fixed: 'left'
           },
-          {
-            width: 50,
-            label: '序号',
-            prop: 'sort',
-            slot: 'sort',
-            align: 'center'
-          },
-
           {
             label: '物料名称',
             prop: 'name',
             align: 'center',
-            minWidth: 120,
-            fixed: 'left'
+            minWidth: 170,
+            fixed: 'left',
+            showOverflowTooltip: true
           },
 
           {
@@ -209,12 +469,15 @@
             prop: 'code',
             align: 'center',
             minWidth: 120,
-            fixed: 'left'
+            fixed: 'left',
+            showOverflowTooltip: true
           },
           {
             label: '牌号',
             prop: 'brandNum',
-            align: 'center'
+            align: 'center',
+            minWidth: 120,
+            showOverflowTooltip: true
           },
           {
             prop: 'specification',
@@ -226,42 +489,50 @@
           {
             label: '型号',
             prop: 'modelType',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
           {
             prop: 'inventoryQuantity',
             label: '库存',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'secureInventory',
             label: '安全库存',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'lockQuantity',
             label: '锁库数量',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'inTransitNum',
             label: '在途数量',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'inTransitOrdersNum',
             label: '在途已关联数量',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'availableQuantity',
             label: '可用数量',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'unit',
             label: '计量单位',
             showOverflowTooltip: true,
+            align: 'center',
             action: 'unit',
             slot: 'unit'
           },
@@ -292,7 +563,8 @@
           {
             label: '采购周期',
             slot: 'purchasingCycle',
-            action: 'purchasingCycle',
+            // action: 'purchasingCycle',
+            prop: 'purchasingCycle',
             align: 'center',
             minWidth: 160
           },
@@ -318,28 +590,219 @@
             action: ' files',
             align: 'center',
             minWidth: 140
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 110,
+            align: 'center',
+            slot: 'action'
           }
         ];
       }
     },
     methods: {
-      open(list) {
-        console.log(list, 'list 000000000000');
-        this.tableList = list;
+      async open(list, planInfo) {
+        this.planData = planInfo;
+        const name = await getCode('purchase_apply_plan_name');
+        this.formData.name = name;
+        // this.tableList = list;
+        this.materialList = list || [];
         this.buVisible = true;
       },
+      handleMethod(row, index) {
+        if (row) {
+          this.multipleSelection = [];
+        }
+        this.$refs.timeDialogRef.open(row || {}, index);
+      },
+      batchUpdateDeliveryMethod() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请最少选择一条数据');
+        }
+        this.formData2 = {
+          deliveryMethod: 1,
+          requireDeliveryTime: '',
+          timeList: []
+        };
+        this.batchVisible = true;
+      },
       cancel() {
         this.buVisible = false;
+        this.materialList = [];
+        (this.formData = {
+          demandType: '1',
+          name: '',
+          remark: '',
+          detailRemoveIds: [],
+          materialRemoveIds: []
+        }),
+          (this.formData2 = {
+            deliveryMethod: 1,
+            requireDeliveryTime: '',
+            timeList: []
+          });
+      },
+      handleCancel() {
+        this.batchVisible = false;
+      },
+      chooseTime(current, timeList, currentIndex) {
+        let timeData = JSON.parse(JSON.stringify(timeList));
+        if (current && current.categoryId) {
+          let data = this.materialList[0];
+          this.$set(data, 'timeList', timeData);
+          // 单独修改逻辑:直接操作当前物料的 timeList
+          // tableList.forEach((item) => {
+          //   if (item.id === current.detailId) {
+          //     const material = item.materialList[currentIndex];
+          //     this.$set(
+          //       material,
+          //       'timeList',
+          //       JSON.parse(JSON.stringify(timeList))
+          //     );
+          //   }
+          // });
+        } else if (this.multipleSelection.length > 0) {
+          // 批量修改逻辑
+          // tableList.forEach((item) => {
+          // item.materialList.forEach((material) => {
+          this.materialList.forEach((material) => {
+            if (
+              this.selection.some(
+                (selected) => selected.categoryId === material.categoryId
+              )
+            ) {
+              this.$set(
+                material,
+                'deliveryMethod',
+                this.formData2.deliveryMethod
+              );
+              this.$set(material, 'timeList', timeData);
+            }
+          });
+          // });
+          this.$refs.timeDialogRef.handleClose();
+          this.batchVisible = false;
+        }
+
+        // this.$refs.table.setData([...tableList]);
+      },
+      handleConfirm() {
+        const { deliveryMethod, requireDeliveryTime } = this.formData2;
+        // const tableData = this.$refs.table.getData();
+
+        // 创建深拷贝的 timeList 模板(假设当前表单中已填写了分批时间)
+        const timeListTemplate = JSON.parse(
+          JSON.stringify(this.formData2.timeList)
+        );
+
+        // tableData.forEach((item) => {
+        //   item.materialList.forEach((m) => {
+        this.materialList.forEach((m) => {
+          if (
+            this.selection.some(
+              (selected) => selected.categoryId === m.categoryId
+            )
+          ) {
+            this.$set(m, 'deliveryMethod', deliveryMethod);
+            if (deliveryMethod === 1) {
+              //一次性到货逻辑
+              this.$set(m, 'requireDeliveryTime', requireDeliveryTime);
+              this.$set(m, 'timeList', null);
+            } else if (deliveryMethod === 2) {
+              this.$set(
+                m,
+                'timeList',
+                JSON.parse(JSON.stringify(timeListTemplate))
+              );
+            }
+          }
+        });
+        // this.$refs.table.setData([...tableData]);
+        this.batchVisible = false;
       },
       categorySelect(row) {
+        this.$refs.productRefs.open(this.materialList, {});
         // this.$refs.productRefs.open(row.materialList, row, this.type);
       },
-      chooseModal() {},
+      chooseModal(data) {
+        let list = data.map((el) => {
+          el.isDel = true;
+          return el;
+        });
+        this.materialList.push(...list);
+      },
       remove(row, index) {
+        this.materialList.splice(index, 1);
         // this.formData.detailRemoveIds.push(row.id);
         // let _arr = this.$refs.table.getData() || [];
         // _arr.splice(index, 1);
         // this.$refs.table.setData([..._arr]);
+      },
+      confirm() {
+        this.$refs.formRef.validate(async (value) => {
+          if (value) {
+            let params = {};
+            if (this.orderType == 2) {
+              params = this.planDataS();
+            } else {
+              params = this.orderData();
+            }
+            params['type'] = 1;
+            params.baitingType = 2;
+            params.sourceType = 2;
+            params.orderType = this.orderType;
+
+            // console.log(params,'params 333');
+            // return
+            await save(params);
+            this.$message.success('保存成功!');
+            this.$emit('success');
+            this.cancel();
+          }
+        });
+      },
+      orderData() {
+        let data = JSON.parse(JSON.stringify(this.planData));
+        data.salesOrderCode = data.code;
+        data.salesOrderId = data.id;
+        let salesList = data.salesOrderSimpleInfoList;
+        if (salesList && salesList.length > 0) {
+          data.salesOrderCode = salesList[0].salesOrderCode;
+          data.salesOrderId = salesList[0].salesOrderId;
+        }
+        delete data.code;
+        delete data.id;
+        delete data.salesCode;
+        delete data.salesOrderSimpleInfoList;
+        let formData = JSON.parse(JSON.stringify(this.formData));
+        data.materialList = this.materialList.map((el) => {
+          delete el.id;
+          return el;
+        });
+        formData['salesOrderList'] = [data];
+        return formData;
+      },
+      planDataS() {
+        let data = JSON.parse(JSON.stringify(this.planData));
+        data.producePlanCode = data.code;
+        data.producePlanId = data.id;
+        let salesList = data.salesOrderSimpleInfoList;
+        if (salesList && salesList.length > 0) {
+          data.salesOrderCode = salesList[0].salesOrderCode;
+          data.salesOrderId = salesList[0].salesOrderId;
+        }
+        delete data.code;
+        delete data.id;
+        delete data.salesCode;
+        delete data.salesOrderSimpleInfoList;
+        let formData = JSON.parse(JSON.stringify(this.formData));
+        data.materialList = this.materialList.map((el) => {
+          delete el.id;
+          return el;
+        });
+        formData['salesOrderList'] = [data];
+        return formData;
       }
     }
   };

+ 65 - 17
src/views/productionPlan/index.vue

@@ -86,9 +86,16 @@
           @click="factAdd(3)"
           >新增</el-button
         >
-        <el-button type="success" size="mini" @click="homogeneityInspect"
+        <!-- <el-button type="success" size="mini" @click="homogeneityInspect"
           >齐套性检查</el-button
-        >
+        > -->
+        <el-dropdown trigger="click" @command="homogeneityInspect">
+          <el-button size="mini" type="success">齐套性检查</el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="1"> 自制件 </el-dropdown-item>
+            <el-dropdown-item command="2"> 采购件 </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
         <el-button
           type="primary"
           size="mini"
@@ -325,7 +332,7 @@
   import { fieldModel } from '@/api/saleOrder';
   import { debounce } from 'lodash';
   import tabMixins from '@/mixins/tableColumnsMixin';
-
+  import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   export default {
     mixins: [tabMixins],
     components: {
@@ -391,7 +398,8 @@
         factoryType: 3,
         factoryObj: {},
         cardSpan: 3,
-        columnsVersion: 1
+        columnsVersion: 1,
+        homogeneityDialog: false
       };
     },
     computed: {
@@ -549,10 +557,10 @@
             width: 120,
             formatter: (row) => {
               if (row.produceType == 2) {
-                return '加工(MBOM)';
+                return 'MBOM';
               }
               if (row.produceType == 3) {
-                return '装配(ABOM)';
+                return 'ABOM';
               }
               return '';
             }
@@ -802,12 +810,21 @@
         console.log(res);
         this.planStatistics = res;
       },
-      homogeneityInspect() {
+
+      // handleClick(val) {
+      //   console.log(val, 'val');
+      //   // this.$emit('check');
+      // },
+
+      homogeneityInspect(val) {
         if (this.selection.length == 0) {
           this.$message.warning('请至少选择一条计划!');
           return;
         }
-        this.$refs.homogeneityInspectDialog.open(this.selection);
+        this.homogeneityDialog = true;
+        this.$nextTick(() => {
+          this.$refs.homogeneityInspectDialog.open(this.selection, val);
+        });
         // let flag = false;
         // let type = 0;
         // for (let item of this.selection) {
@@ -893,20 +910,51 @@
         // });
       },
       // 修改计划
-      planEdit(row) {
+      async planEdit(row) {
+        console.log(row, 'row 11');
         if (row.timeDimensionPlanType == 3) {
           this.factoryObj = row;
           // this.factoryType = ;
           // this.factoryShow = true;
           this.$refs.factoryAddRef.open(row);
         } else {
-          this.$router.push({
-            path: '/saleOrder/salesToProduction',
-            query: {
-              type: 'edit',
-              id: row.id
-            }
-          });
+          let categoryId = row.categoryId;
+          let produceType = '';
+          const res = await findBomCategoryByCategoryId(categoryId);
+          let arr = [];
+          if (res.length > 0) {
+            let obj = res.find((item) => item.id === row.bomCategoryId);
+            produceType = obj ? obj.bomType : produceType;
+            let listMap = {
+              1: { code: 1, name: 'PBOM' },
+              2: { code: 2, name: 'MBOM' },
+              3: { code: 3, name: 'ABOM' }
+            };
+            res.forEach((el) => {
+              if (listMap[el.bomType]) {
+                arr.push(listMap[el.bomType]);
+                delete listMap[el.bomType];
+              }
+            });
+          }
+          console.log(row, 'row');
+          this.$router
+            .push({
+              path: '/saleOrder/salesToProduction',
+              query: {
+                type: 'edit',
+                id: row.id,
+                produceType,
+                categoryId,
+                producedList: JSON.stringify(arr)
+              }
+            })
+            .catch((error) => {
+              // 忽略重复导航错误
+              if (error.name !== 'NavigationDuplicated') {
+                console.error('路由跳转失败:', error);
+              }
+            });
         }
       },
 
@@ -1029,7 +1077,7 @@
 
       // 拆批
       toUnpack(row) {
-        console.log(1111111111111)
+        console.log(1111111111111);
         if (!row.batchNo) {
           return this.$message.error('请先填写批次号!');
         }

+ 83 - 10
src/views/saleOrder/components/create-order.vue

@@ -147,15 +147,33 @@
           </el-table-column>
           <el-table-column label="行号" align="center" prop="lineNumber">
           </el-table-column>
-          <el-table-column label="名称" align="center" prop="productName"  width="150" show-overflow-tooltip>
+          <el-table-column
+            label="名称"
+            align="center"
+            prop="productName"
+            width="150"
+            show-overflow-tooltip
+          >
           </el-table-column>
-          <el-table-column label="编码" align="center" prop="productCode" width="150" show-overflow-tooltip>
+          <el-table-column
+            label="编码"
+            align="center"
+            prop="productCode"
+            width="150"
+            show-overflow-tooltip
+          >
           </el-table-column>
           <el-table-column label="牌号" align="center" prop="brandNo">
           </el-table-column>
           <el-table-column label="型号" align="center" prop="model">
           </el-table-column>
-          <el-table-column label="规格" align="center" prop="specification" width="150" show-overflow-tooltip>
+          <el-table-column
+            label="规格"
+            align="center"
+            prop="specification"
+            width="150"
+            show-overflow-tooltip
+          >
           </el-table-column>
           <el-table-column label="单重" align="center" prop="productUnitWeight">
           </el-table-column>
@@ -260,6 +278,7 @@
                   v-model="scope.row.productType"
                   @change="changeProductType(scope.row, scope.$index)"
                   :key="scope.$index"
+                  :disabled="!isAdd"
                 >
                   <el-option
                     v-for="item of scope.row.producedList"
@@ -294,6 +313,7 @@
                 <el-select
                   v-model="scope.row.bomCategoryId"
                   @change="changeBomId(scope.row, scope.$index)"
+                  :disabled="!isAdd"
                 >
                   <el-option
                     v-for="item of scope.row.bomVersionList"
@@ -463,13 +483,13 @@
           </el-table-column>
           <el-table-column label="操作" align="center" width="160">
             <template slot-scope="scope">
-              <el-link
+              <!-- <el-link
                 type="primary"
                 :underline="false"
                 @click="homogeneityInspect(scope.row)"
               >
                 齐套性检查
-              </el-link>
+              </el-link> -->
               <el-button
                 type="text"
                 @click="handleDeleteItem(scope.$index)"
@@ -479,7 +499,7 @@
             </template>
           </el-table-column>
         </el-table>
-        <div class="add-product" @click="addEquipment">
+        <div class="add-product" @click="addEquipment" v-if="isAdd">
           <i class="el-icon-circle-plus-outline"></i>
         </div>
       </el-form>
@@ -532,6 +552,7 @@
   import { multiply } from '@/utils/math';
   import contactDialog from '@/components/contactDialog/openContactDialog.vue';
   export default {
+    name: 'CreateOrder',
     components: {
       EquipmentDialog,
       orderHomogeneityInspectDialog,
@@ -539,6 +560,12 @@
       ProcessRoute,
       contactDialog
     },
+    props: {
+      isAdd: {
+        type: Boolean,
+        default: true
+      }
+    },
     data() {
       return {
         visible: false,
@@ -615,7 +642,8 @@
           }
         ],
         selectIndex: 0, // 选择工艺路线的当前数据下标
-        processingRequired: 0 // 生产类型跟BOM 版本是否必填 1:是 0:否
+        processingRequired: 0, // 生产类型跟BOM 版本是否必填 1:是 0:否
+        sourceSalesOrderId: '' // 源销售订单ID
       };
     },
     watch: {
@@ -711,6 +739,7 @@
       },
       getDetail(code) {
         getOrderDetail(code).then(async (res) => {
+          console.log(res, 'res');
           if (res.productInfoList) {
             for (let item of res.productInfoList) {
               if (!item.bomCategoryId) {
@@ -734,8 +763,24 @@
             const data = await findBomCategoryByCategoryIds(ids);
             this.handleResult(res.productInfoList, data, 'init');
           }
+
           this.disabledList = res.productInfoList;
           this.form = res;
+          // 如果没有bom版本的选择的话
+          this.disabledList.forEach((item, index) => {
+            if (item.bomVersionList && item.bomVersionList.length > 0) {
+              return;
+            }
+            let productType = item.productType;
+            let list = item.producedList;
+            if (!productType && list && list.length > 0) {
+              productType = list[0].code;
+            }
+            if (!productType) {
+              return;
+            }
+            this.changeProductType(item, index);
+          });
         });
       },
       cancel() {
@@ -870,7 +915,15 @@
           // 必填参数校验
           if (!flag) return;
           this.loading = true;
-          createOrUpdate(this.form)
+          let params = {
+            ...this.form,
+            sourceType: this.isAdd ? 1 : 2
+          };
+          if (!this.isAdd) {
+            params.sourceSalesOrderId = this.sourceSalesOrderId;
+            params.productInfoList.forEach((el) => delete el.id);
+          }
+          createOrUpdate(params)
             .then((res) => {
               this.loading = false;
               this.$message.success('成功');
@@ -1027,8 +1080,8 @@
         let list = [];
         let listMap = {
           1: { code: 1, name: 'PBOM' },
-          2: { code: 2, name: '加工(MBOM)' },
-          3: { code: 3, name: '装配(ABOM)' }
+          2: { code: 2, name: 'MBOM' },
+          3: { code: 3, name: 'ABOM' }
         };
         data.forEach((el) => {
           if (listMap[el.bomType]) {
@@ -1040,6 +1093,7 @@
       },
       //
       async handleResult(result, res, type) {
+        console.log(result, 'result 1111');
         result.forEach((item) => {
           if (!res[item.categoryId]) {
             return;
@@ -1059,6 +1113,15 @@
             // arr.map((el) => (el.bomCategoryId = el.id));
             item.bomCategoryId = arr[0].id;
           }
+
+          // if (type) {
+          //   let obj = item.bomVersionList.find(
+          //     (el) => el.id == item.bomCategoryId
+          //   );
+          //   if (obj) return;
+          //   this.changeBomId(item.bomVersionList[0],0)
+          //   console.log(obj,'obj 11')
+          // }
         });
         result.forEach(async (ele) => {
           ele = await this.getFindRoutingListByBomId(ele);
@@ -1101,6 +1164,15 @@
         }
       },
 
+      getProcessRouteData(list, sourceSalesOrderId) {
+        this.sourceSalesOrderId = sourceSalesOrderId;
+        list.map(async (row, index) => {
+          await this.changeBomId(row, index);
+        });
+
+        this.changeLineNumber();
+      },
+
       // 清空BOM 跟工艺路线
       wipeData(index) {
         let row = this.form.productInfoList[index];
@@ -1147,6 +1219,7 @@
 
       // 选择BOM
       async changeBomId(row, index) {
+        console.log(row, '这里看看吧');
         const res = await bomRoutingList(row.bomCategoryId);
         let arr = res || [];
         // if (arr.length == 0) {

+ 60 - 23
src/views/saleOrder/components/order-search.vue

@@ -355,9 +355,17 @@
             >
               交期预估</el-button
             > -->
-            <el-button @click="homogeneityInspect" size="mini" type="success">
+            <!-- <el-button @click="homogeneityInspect" size="mini" type="success">
               齐套性检查</el-button
-            >
+            > -->
+            <el-dropdown trigger="click" @command="homogeneityInspect">
+              <el-button size="mini" type="success">齐套性检查</el-button>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item command="1"> 自制件 </el-dropdown-item>
+                <el-dropdown-item command="2"> 采购件 </el-dropdown-item>
+                <!-- <el-dropdown-item command="3"> 外协件 </el-dropdown-item> -->
+              </el-dropdown-menu>
+            </el-dropdown>
             <el-button
               @click="goProduct"
               size="mini"
@@ -423,6 +431,7 @@
 </template>
 
 <script>
+  import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   import ImportException from '../components/import-exception.vue';
   import CreateOrder from '../components/create-order.vue';
   import GroupOrder from '../components/group-order.vue';
@@ -558,8 +567,8 @@
       toGroup() {
         this.$refs.groupDialog.open();
       },
-      goProduct() {
-        console.log(this.selection,'this.selection 33')
+      async goProduct() {
+        console.log(this.selection, 'this.selection 33');
         if (!this.selection.length) {
           return this.$message.warning('请先勾选一个或多个订单!');
         }
@@ -620,24 +629,52 @@
           }
           list.push(item.id);
         });
-        if(produceRoutingId && !bomCategoryId){
+        if (produceRoutingId && !bomCategoryId) {
           produceType = '';
         }
-        this.$router.push({
-          path: '/saleOrder/salesToProduction',
-          query: {
-            orderType,
-            selection: JSON.stringify(list),
-            produceRoutingId: produceRoutingId,
-            produceRoutingName: this.selection[0].produceRoutingName,
-            factoriesId: factoriesId,
-            factoriesIdName:factoriesIdName,
-            bomCategoryId: bomCategoryId,
-            produceType: produceType,
-            startTime,
-            endTime
-          }
-        });
+        console.log(this.selection, 'this.selection 3333');
+        let categoryId = this.selection[0].categoryId;
+        const res = await findBomCategoryByCategoryId(categoryId);
+        let arr = [];
+        if (res.length > 0) {
+          let obj = res.find((item) => item.id === bomCategoryId);
+          produceType = obj ? obj.bomType : produceType;
+          let listMap = {
+            1: { code: 1, name: 'PBOM' },
+            2: { code: 2, name: 'MBOM' },
+            3: { code: 3, name: 'ABOM' }
+          };
+          res.forEach((el) => {
+            if (listMap[el.bomType]) {
+              arr.push(listMap[el.bomType]);
+              delete listMap[el.bomType];
+            }
+          });
+        }
+        this.$router
+          .push({
+            path: '/saleOrder/salesToProduction',
+            query: {
+              orderType,
+              selection: JSON.stringify(list),
+              produceRoutingId: produceRoutingId,
+              produceRoutingName: this.selection[0].produceRoutingName,
+              categoryId: this.selection[0].categoryId,
+              factoriesId: factoriesId,
+              factoriesIdName: factoriesIdName,
+              bomCategoryId: bomCategoryId,
+              produceType: produceType,
+              startTime,
+              endTime,
+              producedList: JSON.stringify(arr)
+            }
+          })
+          .catch((error) => {
+            // 忽略重复导航错误
+            if (error.name !== 'NavigationDuplicated') {
+              console.error('路由跳转失败:', error);
+            }
+          });
       },
       // 比较时间大小
       compareTimes(timeStr1, timeStr2) {
@@ -728,9 +765,9 @@
           this.reset();
         });
       },
-      payBudget() {},
-      homogeneityInspect() {
-        this.$emit('check');
+      // payBudget() {},
+      homogeneityInspect(val) {
+        this.$emit('check', val);
       }
     }
   };

+ 233 - 56
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -79,7 +79,24 @@
                 key="checkTable"
                 :init-load="false"
                 :datasource="datasourceList"
+                :selection.sync="selection"
               >
+                <template v-slot:toolbar>
+                  <el-button
+                    v-if="produceType == 2"
+                    type="primary"
+                    @click="bulkPurchase"
+                    size="mini"
+                    >下发采购计划</el-button
+                  >
+                  <!-- <el-button
+                    v-if="produceType == 1"
+                    type="primary"
+                    @click="issuePlan"
+                    size="mini"
+                    >下发销售订单</el-button
+                  > -->
+                </template>
                 <template v-slot:toolkit>
                   <el-form
                     :inline="true"
@@ -218,64 +235,45 @@
         <el-button plain @click="cancel">取消</el-button>
         <!-- <el-button type="primary" @click="confirm">确定</el-button> -->
       </div>
+      <CreateOrder
+        ref="createDialog"
+        name="createDialog1"
+        :is-add="false"
+        v-if="orderShow"
+        @refresh="refresh"
+      ></CreateOrder>
     </ele-modal>
 
     <stockDetailDialog ref="stockDetailDialog" />
-
     <currentDetailDialog ref="currentDetailDialog" />
+    <purchaseDialog ref="purchaseDialogRef" :orderType="1" @success="success" />
+    <!-- <create-order ref="createDialog" /> -->
   </div>
 </template>
 
 <script>
   import {
-    homogeneityInspect,
-    homogeneityInspectMerge,
     findBomSalesorderCategoryId,
     findMaterialInfoSalesorder,
-    findMaterialInfoByCategory,
-    getBom
+    findMaterialInfoByCategory
   } from '@/api/productionPlan/index.js';
   import { orderHomogeneityInspect } from '@/api/saleOrder/index.js';
   import stockDetailDialog from '../../productionPlan/components/stockDetailDialog.vue';
   import currentDetailDialog from '../../productionPlan/components/currentDetailDialog.vue';
+  import purchaseDialog from '@/views/productionPlan/components/purchaseDialog.vue';
+  import CreateOrder from './create-order.vue';
+  // import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
+  // import CreateOrder from '../components/create-order.vue';
   export default {
     components: {
+      CreateOrder,
       stockDetailDialog,
-      currentDetailDialog
+      currentDetailDialog,
+      purchaseDialog
     },
-    data() {
-      return {
-        visible: false,
-
-        bomIdList: [],
-        requiredFormingNum: 0,
-        formInline: {
-          finalState: 0
-        },
-        finalStateList: [
-          {
-            label: '全部',
-            value: 0
-          },
-          {
-            label: '齐套',
-            value: 1
-          },
-          {
-            label: '缺料',
-            value: 2
-          }
-        ],
-        loading: false,
-        datasourceAllList: [], // 表格物料全部数据
-        datasourceList: [], // 表格物料数据
-        bomListV: [], // BOM版本
-        bomListType: [], // BOM 类型
-        form: {
-          homogeneityInspect: []
-        },
-
-        columns: [
+    computed: {
+      columns() {
+        return [
           {
             columnKey: 'index',
             label: '序号',
@@ -326,6 +324,13 @@
             showOverflowTooltip: true,
             align: 'center'
           },
+          {
+            prop: 'totalUnshippedQuantity',
+            label: '未发总数',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
           {
             prop: 'inventoryQuantity',
             slot: 'inventoryQuantity',
@@ -372,6 +377,30 @@
             align: 'center',
             minWidth: 80
           },
+          {
+            prop: 'totalNumberProduction',
+            label: '在制总数',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
+          {
+            prop: 'numberProductionStateText',
+            slot: 'numberProductionStateText',
+            label: '在制齐套',
+            showOverflowTooltip: true,
+            align: 'center',
+            show: this.produceType == 1
+          },
+          {
+            prop: 'productFinalStateText',
+            slot: 'productFinalStateText',
+            label: '成品的最终齐套',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 160,
+            show: this.produceType == 1
+          },
           {
             label: '最终可用数量',
             prop: 'finalAvailableQuantity',
@@ -384,23 +413,57 @@
             align: 'center',
             minWidth: 120
           },
+          {
+            label: '下发状态',
+            align: 'center',
+            minWidth: 90,
+            fixed: 'right',
+            formatter: (row) => {
+              return row.hasIssued ? '已下发' : '未下发';
+            }
+          },
           {
             slot: 'finalStateText',
             prop: 'finalStateText',
             label: '最终状态',
             align: 'center',
-            minWidth: 80
+            minWidth: 80,
+            fixed: 'right'
+          }
+        ];
+      }
+    },
+    data() {
+      return {
+        visible: false,
+
+        bomIdList: [],
+        requiredFormingNum: 0,
+        formInline: {
+          finalState: 0
+        },
+        finalStateList: [
+          {
+            label: '全部',
+            value: 0
+          },
+          {
+            label: '齐套',
+            value: 1
+          },
+          {
+            label: '缺料',
+            value: 2
           }
-          // {
-          //   columnKey: 'action',
-          //   label: '操作',
-          //   width: 120,
-          //   align: 'center',
-          //   resizable: false,
-          //   fixed: 'right',
-          //   slot: 'action'
-          // }
         ],
+        loading: false,
+        datasourceAllList: [], // 表格物料全部数据
+        datasourceList: [], // 表格物料数据
+        bomListV: [], // BOM版本
+        bomListType: [], // BOM 类型
+        form: {
+          homogeneityInspect: []
+        },
         ids: [],
         leftShow: false,
         leftWidth: '0%',
@@ -421,7 +484,10 @@
         salesOrderId: '',
         // 来源
         source: 'list',
-        bomCode: ''
+        bomCode: '',
+        produceType: 1,
+        selection: [],
+        orderShow: false
       };
     },
     watch: {
@@ -457,7 +523,12 @@
       currentDetail(row) {
         this.$refs.currentDetailDialog.open({ bomCode: row.code });
       },
-      open(dataList, order, source = 'list') {
+      open(dataList, order, source, produceType) {
+        this.$nextTick(() => {
+          this.produceType = produceType;
+          // console.log(this.$refs.table, '11111111111');
+          // this.$refs.treeRef.reRenderTable();
+        });
         this.source = source;
         this.visible = true;
         this.cardList = dataList.map((el) => {
@@ -467,7 +538,6 @@
             codeH: el.code ? `${el.code}--${el.lineNumber}` : ''
           };
         });
-        console.log(this.cardList, '333333333333');
         if (dataList.length === 1) {
           this.leftShow = false;
         } else {
@@ -501,7 +571,11 @@
         this.clearData();
         this.visible = false;
       },
-
+      refresh() {
+        this.cancel();
+        this.orderShow = false;
+        this.$emit('reload');
+      },
       confirm() {
         this.visible = false;
       },
@@ -520,8 +594,8 @@
         try {
           this.salesOrderId = data.id;
           const res = await findBomSalesorderCategoryId(data.categoryId);
+          this.loading = false;
           if (!res || res.length == 0) {
-            this.loading = false;
             this.bomListD = [];
             this.datasourceList = [];
             return;
@@ -562,7 +636,12 @@
         this.bomCode = '';
         let data = this.bomListType.find((el) => el.id === e);
         if (!data) return;
-        this.bomListV = data.bomList;
+        this.bomListV = data.bomList.map((el) => {
+          return {
+            ...el,
+            name: data.name
+          };
+        });
         await this.bomVChange(data.bomList[0].bomId);
       },
       // 选择BOM版本
@@ -580,7 +659,8 @@
         if (this.source == 'list') {
           params = {
             salesOrderId: this.salesOrderId,
-            bomVersionId: data.bomId
+            bomVersionId: data.bomId,
+            produceType: this.produceType
           };
           api = findMaterialInfoSalesorder;
         } else {
@@ -617,6 +697,103 @@
           (item) => item.finalState === e
         );
       },
+      // 批量采购
+      async bulkPurchase() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        for (let i = 0; i < this.selection.length; i++) {
+          let el = this.selection[i];
+          if (el.finalState == 1) {
+            return this.$message.warning('必须选择最终状态为缺料的数据');
+          }
+          if (el.hasIssued) {
+            return this.$message.warning('必须选择下发状态为未下发的数据');
+          }
+        }
+        let arr = JSON.parse(JSON.stringify(this.selection));
+        let obj = this.bomListType.find(
+          (el) => el.id === this.formInline.bomType
+        );
+        let data = {
+          ...this.orderInfo,
+          bomId: this.formInline.bomId,
+          bomType: obj.bomType
+        };
+        this.$refs.purchaseDialogRef.open(arr, data);
+      },
+      success() {
+        this.bomVChange(this.formInline.bomId);
+      },
+      // issuePlan() {
+      //   if (this.selection.length == 0) {
+      //     return this.$message.warning('请至少选择一条数据');
+      //   }
+      //   for (let i = 0; i < this.selection.length; i++) {
+      //     let el = this.selection[i];
+      //     if (el.finalState == 1) {
+      //       return this.$message.warning('必须选择最终状态为缺料的数据');
+      //     }
+      //     if (el.hasIssued) {
+      //       return this.$message.warning('必须选择下发状态为未下发的数据');
+      //     }
+      //   }
+
+      //   this.orderShow = true;
+      //   // 获取新建销售订单数据
+      //   const list = this.getSalaOrder();
+      //   console.log(this.$refs, 'this.$refs');
+
+      //   this.$nextTick(() => {
+      //     this.$refs.createDialog.open();
+      //     this.$refs.createDialog.form.productInfoList = list;
+      //     this.$refs.createDialog.getProcessRouteData(list, this.orderInfo.id);
+      //   });
+      // },
+      // 获取新建销售订单数据
+      getSalaOrder() {
+        let obj = {};
+        let producedList = this.bomListType.map((item) => {
+          if (item.id === this.formInline.bomType) {
+            obj = item;
+          }
+          return {
+            code: item.bomType,
+            name: item.bomName
+          };
+        });
+        let o = {};
+        const bomListV = this.bomListV.map((el) => {
+          if (el.bomId === this.formInline.bomId) {
+            o = el;
+          }
+          let versions = this.getIntegerPart(el.versions);
+          return {
+            ...el,
+            id: el.bomId,
+            versions: versions
+          };
+        });
+        let list = this.selection.map((item) => {
+          return {
+            ...item,
+            producedList,
+            productType: obj.bomType,
+            bomVersionList: bomListV,
+            bomCategoryId: o.bomId
+          };
+        });
+        return list;
+      },
+      getIntegerPart(str) {
+        // 使用正则表达式匹配数字部分(包括整数和小数)
+        const numMatch = str.match(/\d+\.\d+/);
+        if (numMatch) {
+          // 分割小数点,取前面的整数部分并转为数字
+          return parseInt(numMatch[0].split('.')[0], 10);
+        }
+        return null; // 没有匹配到符合格式的数据
+      },
       clearData() {
         this.formInline = {
           finalState: 0

+ 4 - 4
src/views/saleOrder/index.vue

@@ -106,6 +106,7 @@
 
     <orderHomogeneityInspectDialog
       ref="orderHomogeneityInspectDialog"
+      @reload="reload"
     ></orderHomogeneityInspectDialog>
     <orderHomogeneityInspectInstallDialog
       ref="orderHomogeneityInspectInstallDialog"
@@ -116,11 +117,10 @@
 <script>
   import OrderSearch from './components/order-search.vue';
   import OrderDetail from './components/order-detail.vue';
-  import CreateOrder from './components/create-order.vue';
   import orderHomogeneityInspectDialog from './components/orderHomogeneityInspectDialog';
   import orderHomogeneityInspectInstallDialog from './components/orderHomogeneityInspectInstallDialog';
   import PlanStatistics from '@/components/statistics/PlanStatistics.vue';
-
+  import CreateOrder from './components/create-order.vue';
   import {
     getPageList,
     deleteOrder,
@@ -439,7 +439,7 @@
       this.requestDict('生产状态');
     },
     methods: {
-      async check() {
+      async check(val) {
         if (this.selection.length > 0) {
           let codeList = [];
           this.selection.map((ele) => {
@@ -496,7 +496,7 @@
               }
             }
           }
-          this.$refs.orderHomogeneityInspectDialog.open(data2, first);
+          this.$refs.orderHomogeneityInspectDialog.open(data2, first, 'list',val);
           // if (flag) {
           //   // 齐料
           //   if (type == 2) {

+ 1 - 0
src/views/saleOrder/salesToProduction.vue

@@ -116,6 +116,7 @@
       }
     },
     created() {
+      console.log(111111111111111111)
       this.requestDict('按单按库');
       this.requestDict('订单类型');
       this.requestDict('交付要求');

+ 16 - 2
src/views/saleOrder/salesToProductionNew.vue

@@ -276,6 +276,7 @@
   import AdditionalOrder from './components/AdditionalOrder.vue';
   import PlanSubmit from './components/plan-submit.vue';
   import ProductionVersion from '@/components/CreatePlan/ProductionVersion2.vue';
+  import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   import {
     productionToPlan,
     saveSaleToPlan,
@@ -347,8 +348,8 @@
         ], //是否开槽
 
         producedList: [
-          { code: 2, name: '加工(MBOM)' },
-          { code: 3, name: '装配(ABOM)' }
+          // { code: 2, name: '加工(MBOM)' },
+          // { code: 3, name: '装配(ABOM)' }
         ],
 
         form: {
@@ -420,6 +421,7 @@
       }
     },
     created() {
+      this.getProducedData();
       this.requestDict('按单按库');
       this.requestDict('订单类型');
       this.requestDict('交付要求');
@@ -434,6 +436,18 @@
       this.mandatoryField();
     },
     methods: {
+      async getProducedData() {
+        let query = this.$route.query;
+        if (!query.producedList || query.producedList.length == 0) {
+          this.producedList = [
+            { code: 2, name: 'MBOM' },
+            { code: 3, name: 'ABOM' }
+          ];
+          return;
+        }
+        const producedList = JSON.parse(this.$route.query.producedList);
+        this.producedList = producedList;
+      },
       // 是否必填
       mandatoryField() {
         parameterGetByCode({

+ 25 - 5
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -373,7 +373,12 @@
             prop="lackNum"
           >
           </el-table-column>
-          <el-table-column label="批次号" width="160" align="center" prop="batchNo">
+          <el-table-column
+            label="批次号"
+            width="160"
+            align="center"
+            prop="batchNo"
+          >
             <template slot-scope="scope">
               <el-input
                 v-model.number="scope.row.batchNo"
@@ -779,7 +784,7 @@
     getFactoryList,
     getInventoryTotalAPI
   } from '@/api/saleOrder';
-
+  import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   import { getByCode } from '@/api/system/dictionary-data';
   import { parameterGetByCode } from '@/api/mainData/index';
   import dictMixins from '@/mixins/dictMixins';
@@ -809,8 +814,8 @@
           { code: 2, name: '否' }
         ], //是否开槽
         producedList: [
-          { code: 2, name: '加工(MBOM)' }, //2 待确认
-          { code: 3, name: '装配(ABOM)' }
+          // { code: 2, name: '加工(MBOM)' }, //2 待确认
+          // { code: 3, name: '装配(ABOM)' }
         ],
         form: {
           planType: 1,
@@ -878,12 +883,14 @@
 
     watch: {
       objData: {
-        handler(val) {
+        async handler(val) {
+          await this.getProducedData();
           this.requestDict('按单按库');
           this.requestDict('订单类型');
           this.requestDict('交付要求');
           this.getByCodeFn();
           this.getFactoryList();
+
           // 查询库存数量
           // this.inventory(val.id);
           if (val.type == 'edit') {
@@ -945,6 +952,18 @@
     },
 
     methods: {
+      async getProducedData() {
+        let query = this.$route.query;
+        if (!query.producedList || query.producedList.length == 0) {
+          this.producedList = [
+            { code: 2, name: 'MBOM' },
+            { code: 3, name: 'ABOM' }
+          ];
+          return;
+        }
+        const producedList = JSON.parse(this.$route.query.producedList);
+        this.producedList = producedList;
+      },
       // 初始化时间赋值
       initTime() {
         let data = this.$route.query;
@@ -1021,6 +1040,7 @@
       },
 
       getByCodeFn() {
+        console.log('78910');
         getByCode('margin_code').then((res) => {
           let _arr = [];
           res.data.map((item) => {