chencc 1 жил өмнө
parent
commit
db921d21a7

+ 417 - 196
src/views/productionPlan/components/factoryAdd/index.vue

@@ -1,6 +1,7 @@
 <template>
   <!-- :close-on-click-modal="false" -->
-  <ele-modal width="80vw" :visible.sync="visible" custom-class="ele-dialog-form" :title="title" :maxable="true">
+  <ele-modal width="80vw" :visible.sync="visible" custom-class="ele-dialog-form" :before-close="cancel" :title="title"
+    :maxable="true">
 
     <div class="form-wrapper">
 
@@ -92,7 +93,6 @@
 
         </el-row>
 
-
         <headerTitle title="产品信息"> </headerTitle>
 
         <el-row :gutter="24">
@@ -133,7 +133,8 @@
         </el-row>
 
         <el-row :gutter="24">
-          <div v-if="clientEnvironmentId == 4">
+          <!-- clientEnvironmentId == 4 -->
+          <div v-if="false">
             <el-col :span="6">
               <el-form-item label="模数:" prop="requiredFormingNum">
                 <el-input v-model.number="form.moCount" @input="tableHandleKeyUp(form, 'moCount')" size="mini"
@@ -175,110 +176,120 @@
               </el-form-item>
             </el-col>
           </div>
-          <el-table :data="form.productInfoList" border height="40vh" key="id">
-            <el-table-column label="序号" align="center" width="60">
-              <template slot-scope="scope">
-                <span>{{ scope.$index + 1 }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column label="行号" align="center" prop="lineNumber">
-            </el-table-column>
-            <el-table-column label="产品名称" align="center" prop="productName">
-            </el-table-column>
-            <el-table-column label="物料编码" align="center" prop="productCode">
-            </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">
-            </el-table-column>
-            <el-table-column label="单重" align="center" prop="productUnitWeight">
-            </el-table-column>
-            <el-table-column label="重量单位" align="center" prop="weightUnit">
-            </el-table-column>
-            <el-table-column label="要求生产数量" width="140" align="center" prop="">
-              <template slot-scope="scope">
-                <!-- :prop="'requiredFormingNum.' + scope.$index + '.requiredFormingNum'" :rules="{
+          <!-- <ele-pro-table
+        ref="table"
+        :key="activeName"
+        :initLoad="false"
+        :columns="newColumns"
+        :datasource="datasource"
+        row-key="code"
+        :selection.sync="selection"
+        :cache-key="`${activeName}ProductionPlanTable`"
+        @sort-change="onSortChange"
+        autoAmendPage
+        :parse-data="parseData"
+        @update:selection="handleSelectionChange"
+      ></ele-pro-table> -->
+          <ele-pro-table ref="tableRef" :columns="columns" row-key="code" :cache-key="`ProductionPlanTable`"
+            :datasource="form.productInfoList" border height="40vh" key="id">
+
+
+            <template v-slot:requiredFormingNum="{ row, $index }">
+              <!-- :prop="'requiredFormingNum.' + scope.$index + '.requiredFormingNum'" :rules="{
                   required: true,
                   message: '请输入要求生产数量',
                   trigger: 'blur'
                 }" -->
 
-                <el-form-item label-width="0px">
-                  <el-input v-model.number="scope.row.requiredFormingNum" size="small" type="number" style="width: 100%"
-                    placeholder="输入数量" @input="inputNumber(scope.row, scope.$index)"></el-input>
-                </el-form-item>
-              </template>
-            </el-table-column>
 
+              <el-input v-model.number="row.requiredFormingNum" size="small" type="number" style="width: 100%"
+                placeholder="输入数量" @input="tableHandleKeyUp(row, 'sum')"></el-input>
 
+            </template>
 
-            <el-table-column label="加工方式" width="140" align="center" prop="productType">
-              <template slot-scope="scope">
-                <el-form-item label-width="0px" :prop="'productInfoList.' + scope.$index + '.productType'">
+            <template v-slot:blockCount="{ row, $index }">
 
-                  <el-select v-model="scope.row.productType" @change="changeProductType(scope.row, scope.$index)"
-                    :key="scope.$index">
-                    <el-option v-for="item of producedList" :key="scope.$index + item.code" :label="item.name"
-                      :value="item.code"></el-option>
-                  </el-select>
+              <el-input v-model.number="row.blockCount" size="small" type="number" style="width: 100%"
+                placeholder="输入数量" @input="inputNumber(row, $index)"></el-input>
 
-                </el-form-item>
-              </template>
-            </el-table-column>
+            </template>
 
 
 
-            <el-table-column label="BOM版本" width="140" align="center" prop="bomCategoryId"
-              v-if="clientEnvironmentId != 4">
-              <template slot-scope="scope">
-                <el-form-item label-width="0px" :prop="'productInfoList.' + scope.$index + '.bomCategoryId'"
-                  :key="scope.$index">
+            <template v-slot:productType="{ row, $index }">
 
-                  <el-select v-model="scope.row.bomCategoryId" @change="changeBomId(scope.row, scope.$index)">
-                    <el-option v-for="item of scope.row.bomVersionList" :key="item.id"
-                      :label="item.name + '(V' + item.versions + '.0)'" :value="item.id"></el-option>
-                  </el-select>
+              <el-select v-model="row.productType" @change="changeProductType(row, $index)" :key="$index">
+                <el-option v-for="item of producedList" :key="$index + item.code" :label="item.name"
+                  :value="item.code"></el-option>
+              </el-select>
 
-                </el-form-item>
-              </template>
-            </el-table-column>
+            </template>
 
-            <el-table-column label="工艺路线" width="140" align="center" prop="produceRoutingId"
-              v-if="clientEnvironmentId != 4">
-              <template slot-scope="scope">
-                <el-form-item label-width="0px" :prop="'productInfoList.' + scope.$index + '.produceRoutingId'">
-                  <el-select v-model="scope.row.produceRoutingId">
-                    <el-option v-for="item of scope.row.routingList" :key="item.id" :label="item.name"
-                      :value="item.id"></el-option>
-                  </el-select>
 
-                </el-form-item>
-              </template>
-            </el-table-column>
 
-            <el-table-column label="工艺路线" align="center" prop="produceRoutingName" v-if="clientEnvironmentId == 4">
-              <template slot-scope="scope">
-                <el-form-item label-width="0px" :prop="'productInfoList.' + scope.$index + '.produceRoutingName'">
-                  <el-input v-model="form.produceRoutingName" style="width: 100%" readonly></el-input>
+            <template v-slot:bomCategoryId="{ row, $index }" >
 
-                </el-form-item>
-              </template>
-            </el-table-column>
+              <el-select v-model="row.bomCategoryId" @change="changeBomId(row, $index)">
+                <el-option v-for="item of row.bomVersionList" :key="item.id"
+                  :label="item.name + '(V' + item.versions + '.0)'" :value="item.id"></el-option>
+              </el-select>
 
-            <!-- <el-table-column label="所属工厂" width="140" align="center" prop="factoriesId">
-              <template slot-scope="scope">
-                <el-form-item label-width="0px">
 
-                  <el-select v-model="scope.row.factoriesId" :key="scope.row.factoriesId">
-                    <el-option v-for="item of factoryList" :key="item.id" :label="item.name"
-                      :value="item.id"></el-option>
-                  </el-select>
+            </template>
+
+            <!-- //权重等级 -->
+            <template v-slot:weight="{ row, $index }" v-if="clientEnvironmentId == 4">
+
+              <el-select v-model="row.weight" style="width: 100%" @change="changeProduceType" size="mini">
+                <el-option v-for="item of weightList" :key="item.code" :label="item.name"
+                  :value="item.code"></el-option>
+              </el-select>
+
+
+
+            </template>
+
+            <!-- 是否开槽 -->
+            <template v-slot:isSlotting="{ row, $index }" v-if="clientEnvironmentId == 4">
+
+              <el-select v-model="row.isSlotting" style="width: 100%" @change="changeProduceType" size="mini">
+                <el-option v-for="item of isSlotting" :key="item.code" :label="item.name"
+                  :value="item.code"></el-option>
+              </el-select>
+
+            </template>
+
+
+            <!-- 开槽类型 -->
+            <template v-slot:slottingType="{ row, $index }" v-if="clientEnvironmentId == 4">
+
+              <DictSelection dictName="开槽类型" v-model="row.slottingType" size="mini">
+              </DictSelection>
+
+            </template>
+
+            <!-- 工艺路线 -->
+            <template v-slot:produceRoutingId="{ row, $index }" v-if="clientEnvironmentId != 4">
+              <el-select v-model="row.produceRoutingId">
+                <el-option v-for="item of row.routingList" :key="item.id" :label="item.name"
+                  :value="item.id"></el-option>
+              </el-select>
+
+            </template>
+
+            <template v-slot:produceRoutingId="{ row, $index }" v-else>
+              <el-input v-model="row.produceRoutingName" style="width: 100%" readonly></el-input>
+            </template>
+
+
+            <template v-slot:factoriesId="{ row, $index }">
+
+              <el-select v-model="row.factoriesId" :key="row.factoriesId">
+                <el-option v-for="item of factoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+
+            </template>
 
-                </el-form-item>
-              </template>
-            </el-table-column> -->
 
             <!-- <el-table-column label="所属工厂" width="140" align="center" prop="factoriesId">
               <template slot-scope="scope">
@@ -294,52 +305,40 @@
             </el-table-column> -->
 
 
+            <!-- 模具数量 -->
+            <template v-slot:moCount="{ row, $index }" v-if="clientEnvironmentId == '4'">
+              <div>
+                <el-input style="width: 100%" size="small" v-model="row.moCount"
+                  oninput="value=value.replace(/[^0-9.]/g,'')" @input="
+                    tableHandleKeyUp(row, 'moCount')
+                    " placeholder="请输入">
+                </el-input>
+              </div>
+            </template>
 
+            <!-- 块数 -->
+            <template v-slot:blockCount="{ row, $index }" v-if="clientEnvironmentId == '4'">
+              <div>
+                <el-input size="small" style="width: 100%" @input="tableHandleKeyUp(row, 'blockCount')
 
-            <el-table-column label="计量单位" align="center" prop="measuringUnit">
+                  " v-model="row.blockCount" placeholder="请输入"></el-input>
+              </div>
+            </template>
 
-            </el-table-column>
-            <el-table-column label="模数" align="center" width="100" v-if="clientEnvironmentId == '4'">
-              <template slot-scope="scope">
-                <div>
-                  <el-input style="width: 100%" size="small" v-model="scope.row.moCount"
-                    oninput="value=value.replace(/[^0-9.]/g,'')" @input="
-                      tableHandleKeyUp(scope.row, scope.$index, $event, 'moCount')
-                      " placeholder="请输入">
-                  </el-input>
-                </div>
-              </template>
-            </el-table-column>
 
-            <el-table-column align="center" width="100" label="块数" v-if="clientEnvironmentId == '4'">
-              <template slot-scope="scope">
-                <div>
-                  <el-input size="small" style="width: 100%" @input="
-                    tableHandleKeyUp(
-                      scope.row,
-                      scope.$index,
-                      $event,
-                      'blockCount'
-                    )
-                    " v-model="scope.row.blockCount" placeholder="请输入"></el-input>
-                </div>
-              </template>
-            </el-table-column>
-            <el-table-column label="订单重量" align="center" prop="productWeight">
-              <template slot-scope="{ row }">
-                <span>{{ row.productWeight ? row.productWeight : '-' }}</span>
-              </template>
-            </el-table-column>
-            <!-- <el-table-column label="操作" align="center" width="70">
-              <template slot-scope="scope">
-                <el-link type="primary" :underline="false" @click="homogeneityInspect(scope.row)">
-                  齐套性检查
-                </el-link>
-                <el-button type="text" @click="handleDeleteItem(scope.$index)" v-if="!scope.row.id">删除</el-button>
-              </template>
+            <template v-slot:productWeight="{ row, $index }">
+              <span>{{ row.productWeight ? row.productWeight : '-' }}</span>
+            </template>
 
-            </el-table-column> -->
-          </el-table>
+
+            <template v-slot:set="{ row, $index }">
+
+              <el-button type="text" @click="handleDeleteItem($index)" v-if="!row.id">删除</el-button>
+
+            </template>
+
+
+          </ele-pro-table>
           <div class="add-product" @click="addEquipment">
             <i class="el-icon-circle-plus-outline"></i>
           </div>
@@ -400,7 +399,7 @@ export default {
         this.title = !val.id ? '新增临时生产计划' : '编辑临时生产计划';
         // this.form = this.factoryObj;
 
-        // this.getFactoryList();
+        this.getFactoryList();
 
         this.form = val;
         // 修改
@@ -421,6 +420,199 @@ export default {
     clientEnvironmentId() {
       return this.$store.state.user.info.clientEnvironmentId;
     },
+    columns() {
+      return [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
+        {
+          slot: 'lineNumber',
+          prop: 'lineNumber',
+          label: '行号',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'productName',
+          prop: 'productName',
+          label: '产品名称',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'productCode',
+          prop: 'productCode',
+          label: '物料编码',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'brandNo',
+          prop: 'brandNo',
+          label: '牌号',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'model',
+          prop: 'model',
+          label: '型号',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'specification',
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'productUnitWeight',
+          prop: 'productUnitWeight',
+          label: '单重',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'weightUnit',
+          prop: 'weightUnit',
+          label: '重量单位',
+          align: 'center',
+          minWidth: 140,
+
+        },
+
+
+
+        {
+          slot: 'requiredFormingNum',
+          prop: 'requiredFormingNum',
+          label: '要求生产数量',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'productType',
+          prop: 'productType',
+          label: '加工方式',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'bomCategoryId',
+          prop: 'bomCategoryId',
+          label: 'BOM版本',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId !== 4
+
+        },
+        {
+          slot: 'produceRoutingId',
+          prop: 'produceRoutingId',
+          label: '工艺路线',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'measuringUnit',
+          prop: 'measuringUnit',
+          label: '计量单位',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'moCount',
+          prop: 'moCount',
+          label: '模数',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId == 4
+        },
+        {
+          slot: 'blockCount',
+          prop: 'blockCount',
+          label: '块数',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId == 4
+
+        },
+        {
+          slot: 'factoriesId',
+          prop: 'factoriesId',
+          label: '所属工厂',
+          align: 'center',
+          minWidth: 140,
+
+        },
+
+        {
+          slot: 'weight',
+          prop: 'weight',
+          label: '权重等级',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId == 4
+        },
+        {
+          slot: 'isSlotting',
+          prop: 'isSlotting',
+          label: '是否开槽',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId == 4
+
+        },
+        {
+          slot: 'slottingType',
+          prop: 'slottingType',
+          label: '开槽类型',
+          align: 'center',
+          minWidth: 140,
+          show: this.clientEnvironmentId == 4
+
+        },
+
+        {
+          slot: 'productWeight',
+          prop: 'productWeight',
+          label: '订单重量',
+          align: 'center',
+          minWidth: 140,
+
+        },
+        {
+          slot: 'set',
+          prop: 'set',
+          label: '操作',
+          align: 'center',
+          minWidth: 140,
+
+        },
+
+
+      ];
+    }
+
   },
   data() {
     return {
@@ -444,6 +636,10 @@ export default {
         { label: '改型计划', value: '4' },
         { label: '返工返修计划', value: '5' },
       ],
+
+
+
+
       loading: false,
       form: {
         timeDimensionPlanType: 3,
@@ -500,12 +696,13 @@ export default {
     };
   },
 
-  computed: {
-    clientEnvironmentId() {
-      return this.$store.state.user.info.clientEnvironmentId;
-    }
-  },
+  // computed: {
+  //   clientEnvironmentId() {
+  //     return this.$store.state.user.info.clientEnvironmentId;
+  //   }
+  // },
   methods: {
+
     async getFactoryList() {
       this.factoryList = await getFactoryList();
     },
@@ -528,28 +725,25 @@ export default {
     },
 
     confirmChoose(list) {
+
       if (this.clientEnvironmentId == 4) {
-        let data = {};
-        if (list[0].name.includes('板材')) {
-
-          data = {
-            id: '1856970794952372226',
-            name: '板材',
-            produceVersionName: '板材'
-          };
-        } else {
-          data = {
-            id: '1857313733642596353',
-            name: '砌块',
-            produceVersionName: '砌块'
-          };
-        }
-        this.$set(this.form, 'produceRoutingName', data.name);
-        this.$set(this.form, 'produceRoutingId', data.id);
-        this.$set(this.form, 'produceVersionName', data.produceVersionName);
-      }
+        list.map(v => {
+
+          if (v.name.includes('板材')) {
+
+            v.produceRoutingId = '1856970794952372226';
+            v.produceRoutingName = '板材';
+            v.produceVersionName = '板材';
+          } else {
+            v.produceRoutingId = '1857313733642596353',
+              v.produceRoutingName = '砌块',
+              v.produceVersionName = '砌块'
 
-      console.log('list', list);
+          }
+
+        })
+
+      }
 
 
       list = list.filter(
@@ -559,7 +753,7 @@ export default {
           )
       )
         .map((item, index) => {
-
+          console.log(item, '555555555555');
           if (item.productCode) {
             return item;
           } else {
@@ -572,17 +766,20 @@ export default {
               model: item.modelType,
               specification: item.specification,
               brandNo: item.brandNum,
-              measuringUnit: item.measuringUnit
+              measuringUnit: item.measuringUnit,
+              produceRoutingId: item.produceRoutingId,
+              produceRoutingName: item.produceRoutingName,
+              produceVersionName: item.produceVersionName
             };
           }
         })
         .concat(this.disabledList);
+
       this.form.productInfoList = [];
 
-      console.log('list', list);
-      console.log('this.form.productInfoList', this.form);
 
-      // 取出在弹窗中选中并且不在表格中的数据
+      console.log(list, 'list');
+      //  取出在弹窗中选中并且不在表格中的数据
       const result = list.filter(
         (i) =>
           this.form.productInfoList.findIndex(
@@ -597,10 +794,6 @@ export default {
 
       for (let i = this.form.productInfoList.length - 1; i >= 0; i--) {
         for (let j in del) {
-          console.log(
-            this.form.productInfoList[i].productCode,
-            del[j].productCode
-          );
           if (this.form.productInfoList[i].productCode === del[j].productCode) {
             this.form.productInfoList.splice(i, 1);
             break;
@@ -608,23 +801,27 @@ export default {
         }
       }
       // bomVersionList
+
+
+
       this.form.productInfoList = this.form.productInfoList.concat(result);
 
-      console.log(this.form.productInfoList, '11111111111111');
+      console.log(this.form.productInfoList, '1111111111');
 
+      this.$refs.tableRef.setData(this.form.productInfoList);
 
       this.changeLineNumber();
 
 
 
 
-      this.$set(this.form, 'categoryId', list[0].id);
-      this.$set(this.form, 'productName', list[0].name);
-      this.$set(this.form, 'productCode', list[0].code);
-      this.$set(this.form, 'specification', list[0].specification);
-      this.$set(this.form, 'brandNum', list[0].brandNum);
-      this.$set(this.form, 'modelType', list[0].modelType);
-      this.$set(this.form, 'measuringUnit', list[0].measuringUnit);
+      // this.$set(this.form, 'categoryId', list[0].id);
+      // this.$set(this.form, 'productName', list[0].name);
+      // this.$set(this.form, 'productCode', list[0].code);
+      // this.$set(this.form, 'specification', list[0].specification);
+      // this.$set(this.form, 'brandNum', list[0].brandNum);
+      // this.$set(this.form, 'modelType', list[0].modelType);
+      // this.$set(this.form, 'measuringUnit', list[0].measuringUnit);
 
       //重置
       this.$set(this.form, 'produceType', '');
@@ -642,7 +839,16 @@ export default {
       });
     },
     handleDeleteItem(index) {
-      this.form.salesOrders.splice(index, 1);
+      this.$confirm('确定删除当前数据?', '提示')
+        .then(() => {
+
+          const newArray = this.form.productInfoList.filter((item, i) => i !== index)
+
+          this.$refs.tableRef.setData(newArray);
+
+        })
+        .catch(() => { });
+
     },
 
     async getPlanCode() {
@@ -686,6 +892,7 @@ export default {
       })
     },
     changeProductType(row, index) {
+      console.log(row, '11111');
       let param = {
         bomType: row.productType,
         categoryId: row.categoryId
@@ -696,7 +903,10 @@ export default {
           row.bomCategoryId = '';
         }
         console.log(arr);
-        this.$set(this.form.productInfoList[index], 'bomVersionList', arr);
+
+        row.bomVersionList = arr;
+        // this.$set(this.form.productInfoList[index], 'bomVersionList', arr);
+
         this.$forceUpdate()
       })
 
@@ -705,18 +915,25 @@ export default {
     save() {
 
       this.$refs.form.validate(async (valid) => {
-        console.log(this.$refs.form, 'validvalid', valid);
+        console.log(this.form, 'validvalid', valid);
         if (!valid) {
           return false;
         }
-       
+
 
         if (!this.form.id) {
-          this.form.productInfoList.map((item, index) => {
-            item.bomCategoryName = item.bomVersionList[0].name;
-            item.bomCategoryVersions = item.bomVersionList[0].versions;
-            item.produceRoutingName = item.routingList[0].name;
-          });
+
+          if (this.form.productInfoList.length) {
+            this.form.productInfoList.map((item, index) => {
+              if (item.bomVersionList && item.bomVersionList.length) {
+                item.bomCategoryName = item.bomVersionList[0].name;
+                item.bomCategoryVersions = item.bomVersionList[0].versions;
+                item.produceRoutingName = item.routingList[0].name;
+              }
+
+            });
+          }
+
           this.form.timeDimensionPlanType = this.type;
           await this.getPlanCode();
           this.loading = true;
@@ -779,18 +996,23 @@ export default {
     tableHandleKeyUp(row, name) {
       // return
       // , index, e, name
-      if (this.form.specification && this.clientEnvironmentId == 4) {
 
-        let modelArr = this.form.specification.split('*');
+      console.log(row, name, '99999999999');
+
+      if (row.specification && this.clientEnvironmentId == 4) {
+
+        let modelArr = row.specification.split('*');
         let modelLong = modelArr[0]; // model规格长度
         let modeWide = modelArr[1]; // model规格宽度
         let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
         modeHight = Number(modeHight);
 
+
+        console.log(modeHight, '111111');
         if (name === 'moCount') {
           // 模数
 
-          this.$set(this.form, 'moCount', row.moCount);
+          this.$set(row, 'moCount', row.moCount);
           // 计算块数的公式:
           // (一模6米长度 / model规格长度) * (一模1.2米宽度 / model规格宽度) = 每一模的块数
           // 每一模的块数*模数moCount = 总块数
@@ -803,11 +1025,14 @@ export default {
               Math.floor(60 / modeWide) *
               row.moCount;
 
-            this.$set(this.form, 'blockCount', blockCount);
+
+
+            row.blockCount = blockCount;
+            // this.$set(row, 'blockCount', blockCount);
 
 
           } else if (row.productName.includes('砌块')) {
-            console.log(1);
+
 
             let modelLongFixed = (600 / modelLong).toFixed(2);
             modelLongFixed = modelLongFixed.substring(
@@ -827,33 +1052,30 @@ export default {
             let num =
               Math.floor(modelLongFixed * modeWideFixed * modeHightFixed) *
               row.moCount;
-
-            this.$set(this.form, 'blockCount', num);
+            row['blockCount'] = num;
           }
 
           let numNew =
             (Number((modelLong * modeWide * modeHight) / 1000000).toFixed(5) *
               row.blockCount).toFixed(5);
-
-
-          this.$set(this.form, 'requiredFormingNum', numNew);
+          row['requiredFormingNum'] = numNew;
 
         } else if (name === 'sum') {
-          let e = this.form.requiredFormingNum
+          let e = row.requiredFormingNum
           console.log('方数');
 
           //方数
-          this.form.planProductNum = e;
+          row.planProductNum = e;
 
-          this.form.blockCount = Math.floor(
+          row.blockCount = Math.floor(
             e / ((modelLong * modeWide * modeHight) / 1000000)
           );
 
-          if (this.form.productName.includes('板材')) {
+          if (row.productName.includes('板材')) {
 
 
             let num = Math.ceil(
-              this.form.blockCount /
+              row.blockCount /
               (Math.floor(600 / modelLong) *
                 Math.floor(120 / modeHight) *
                 Math.floor(60 / modeWide))
@@ -875,7 +1097,7 @@ export default {
           //块数
           // row.blockCount = row.moCount;
 
-          this.$set(this.form, 'blockCount', row.blockCount);
+          row.blockCount = row.blockCount
 
           if (row.productName.includes('板材')) {
 
@@ -900,8 +1122,7 @@ export default {
           let a =
             ((Number(this.form.blockCount) * modelLong * modeWide * modeHight) / 1000000).toFixed(5);
 
-
-          this.$set(this.form, 'requiredFormingNum', a);
+          row.requiredFormingNum = a;
 
         }
       }

+ 1 - 1
src/views/productionPlan/index.vue

@@ -588,7 +588,7 @@
           },
 
           {
-            prop: 'factoryName',
+            prop: 'factoriesName',
             label: '所属工厂',
             align: 'center'
           },

+ 3 - 2
src/views/saleOrder/components/EquipmentDialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog
+  <ele-modal
     title="选择产品"
     :visible.sync="equipmentdialog"
     :before-close="handleClose"
@@ -7,6 +7,7 @@
     :close-on-press-escape="false"
     append-to-body
     width="60%"
+    :maxable="true"
   >
     <div>
       <el-row>
@@ -65,7 +66,7 @@
       <el-button type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
-  </el-dialog>
+  </ele-modal>
 </template>
 
 <script>

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

@@ -330,7 +330,7 @@
           },
           {
             prop: 'deliveryTime',
-            label: '交付日期',
+            label: '客户期望交期',
             align: 'center',
             showOverflowTooltip: true
           },

+ 14 - 3
src/views/saleOrder/salesToProductionNew.vue

@@ -319,6 +319,9 @@ export default {
 
     async getFactoryList() {
       this.factoryList = await getFactoryList();
+      this.$nextTick(() => {
+        this.form.factoriesId = this.factoryList[0].id
+      })
     },
     async getPlanInfo(id) {
       const data = await getUpdateInfoById(id);
@@ -358,7 +361,15 @@ export default {
 
       if (this.form.bomCategoryId) {
         bomRoutingList(this.form.bomCategoryId).then((res) => {
-          this.routingList = res || []
+          this.routingList = res || [];
+          if (res.length) {
+            this.$nextTick(() => {
+
+              this.$set(this.form, 'produceRoutingId', res[0].id)
+            })
+
+            console.log(this.form.produceRoutingId, '222222222');
+          }
         })
       }
 
@@ -416,6 +427,7 @@ export default {
 
       this.bomVersionList.forEach((f) => {
         if (f.id == this.form.bomCategoryId) {
+
           this.$set(this.form, 'bomCategoryName', f.name);
           this.$set(this.form, 'bomCategoryVersions', f.versions);
         }
@@ -429,8 +441,7 @@ export default {
 
     changeRoute() {
 
-      console.log(this.routingList);
-      console.log(this.form.produceRoutingId);
+
       this.$forceUpdate();
       this.routingList.forEach((f) => {
         if (f.id == this.form.produceRoutingId) {

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

@@ -29,6 +29,7 @@
                     </el-col>
 
                     <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }" v-if="clientEnvironmentId != 4">
+
                         <el-form-item label="BOM版本:" prop="bomCategoryId">
                             <el-select v-model="form.bomCategoryId" style="width: 100%" @change="changeBomId">
                                 <el-option v-for="item of bomVersionList" :key="item.id"
@@ -150,17 +151,17 @@
                     <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
                         <el-form-item label="订单总数量:">{{
                             form.contractNum
-                            }}</el-form-item>
+                        }}</el-form-item>
                     </el-col>
                     <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 4 }">
                         <el-form-item label="订单总重量:">{{
                             form.sumOrderWeight
-                            }}</el-form-item>
+                        }}</el-form-item>
                     </el-col>
                     <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
                         <el-form-item label="产品编码:">{{
                             form.productCode
-                            }}</el-form-item>
+                        }}</el-form-item>
                     </el-col>
                     <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
                         <el-form-item label="牌号:">{{ form.brandNo }}</el-form-item>
@@ -310,15 +311,16 @@
                             {{ getDictValue('订单类型', row.orderType) }}
                         </template>
                     </el-table-column>
-                    <el-table-column label="交付日期" align="center" prop="deliveryTime" width="160">
+                    <el-table-column label="客户期望交期" align="center" prop="deliveryTime" width="160">
                         <template slot-scope="scope">
                             <el-form-item label-width="0px" :prop="'salesOrders.' + scope.$index + '.deliveryTime'"
                                 :rules="{
                                     required: true,
-                                    message: '请选择交付日期',
+                                    message: '请选择客户期望交期',
                                     trigger: 'blur'
                                 }" class="table-item">
                                 <el-date-picker style="width: 100%" v-model="scope.row.deliveryTime"
+
                                     @change="changeDate(scope.row, scope.$index)" :pickerOptions="{
                                         disabledDate: (time) =>
                                             time.getTime() <
@@ -330,6 +332,27 @@
                             </el-form-item>
                         </template>
                     </el-table-column>
+
+                    <el-table-column label="生产交期" align="center" prop="produceDeliveryDeadline" width="160">
+                        <template slot-scope="scope">
+                            <el-form-item label-width="0px" :prop="'salesOrders.' + scope.$index + '.produceDeliveryDeadline'"
+                                :rules="{
+                                    required: true,
+                                    message: '请选择生产交期',
+                                    trigger: 'blur'
+                                }" class="table-item">
+                                <el-date-picker style="width: 100%" v-model="scope.row.produceDeliveryDeadline"
+                                    @change="changeDate(scope.row, scope.$index)" :pickerOptions="{
+                                        disabledDate: (time) =>
+                                            time.getTime() <
+                                            new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+
+                                    }" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" disabled>
+                                </el-date-picker>
+
+                            </el-form-item>
+                        </template>
+                    </el-table-column>
                     <el-table-column label="要求完成日期" align="center" prop="reqMoldTime" width="180">
                         <template slot-scope="scope">
                             <el-form-item label-width="0px" :prop="'salesOrders.' + scope.$index + '.reqMoldTime'"
@@ -553,6 +576,10 @@ export default {
 
         async getFactoryList() {
             this.factoryList = await getFactoryList();
+            this.$nextTick(() => {
+                this.form.factoriesId = this.factoryList[0].id
+            })
+            // console.log(this.factoryList, 'factoryList');
         },
         async getPlanInfo(id) {
             const data = await getUpdateInfoById(id);
@@ -590,9 +617,18 @@ export default {
 
         getPlanRouting() {
             console.log(this.form.bomCategoryId);
-            if (this.form.bomCategoryId&&this.form.bomCategoryId!='null') {
+            if (this.form.bomCategoryId && this.form.bomCategoryId != 'null') {
                 bomRoutingList(this.form.bomCategoryId).then((res) => {
                     this.routingList = res || []
+
+                    if (res.length) {
+                        this.$nextTick(() => {
+                            
+                            this.$set(this.form, 'produceRoutingId', res[0].id)
+                        })
+
+                        console.log(this.form.produceRoutingId, '222222222');
+                    }
                 })
             }
 
@@ -650,6 +686,7 @@ export default {
 
             this.bomVersionList.forEach((f) => {
                 if (f.id == this.form.bomCategoryId) {
+                    console.log(f, 'ffffffff');
                     this.$set(this.form, 'bomCategoryName', f.name);
                     this.$set(this.form, 'bomCategoryVersions', f.versions);
                 }
@@ -718,9 +755,10 @@ export default {
                     item.slottingType = item.slottingType && item.slottingType + '';
                     item.priority = index + 1;
 
-                    item.reqMoldTime = dayjs(
-                        new Date(item.deliveryTime).getTime() - 3600 * 1000 * 24 * 10
-                    ).format('YYYY-MM-DD');
+                    item.reqMoldTime =item.deliveryTime
+                    // dayjs(
+                    //     new Date(item.deliveryTime).getTime() - 3600 * 1000 * 24 * 10
+                    // ).format('YYYY-MM-DD');
                 });
                 if (this.form.salesOrders.every((itm) => itm.orderType == 2)) {
                     this.form.planType = 2;

+ 413 - 471
src/views/workOrder/index.vue

@@ -21,20 +21,11 @@
         autoAmendPage
         :parse-data="parseData"
       > -->
-      <ele-pro-table
-        ref="table"
-        :columns="newColumns"
-        :datasource="datasource"
-        cache-key="workOrderTable"
-        row-key="id"
-        @sort-change="onSortChange"
-        autoAmendPage
-        :parse-data="parseData"
-       
-      >
-      <!-- :key="activeName" -->
-      <!-- :selection.sync="selection" -->
-      <!-- @update:selection="handleSelectionChange" -->
+      <ele-pro-table ref="table" :columns="newColumns" :datasource="datasource" cache-key="workOrderTable" row-key="id"
+        @sort-change="onSortChange" autoAmendPage :parse-data="parseData">
+        <!-- :key="activeName" -->
+        <!-- :selection.sync="selection" -->
+        <!-- @update:selection="handleSelectionChange" -->
 
         <template v-slot:code="{ row }">
           {{ row.code }}
@@ -46,21 +37,9 @@
 
         <template v-slot:priority="{ row }">
           <div style="display: flex">
-            <el-input
-              v-model="row.priority"
-              type="number"
-              size="mini"
-              :min="0"
-              :max="10"
-              @change="priorityChange(row)"
-              style="width: 80px"
-            ></el-input>
-            <el-popover
-              placement="right"
-              width="200"
-              trigger="hover"
-              content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
-            >
+            <el-input v-model="row.priority" type="number" size="mini" :min="0" :max="10" @change="priorityChange(row)"
+              style="width: 80px"></el-input>
+            <el-popover placement="right" width="200" trigger="hover" content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)">
               <div class="sort-wrap" slot="reference">
                 <i class="el-icon-caret-top" @click="sortTop(row)"></i>
                 <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
@@ -76,33 +55,22 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link
-            type="primary"
-            :underline="false"
-            @click="toUnpack(row)"
-            v-if="
-              (clientEnvironmentId != '4' && row.status == 8) ||
-              (clientEnvironmentId == '4' &&
-                !row.productName.includes('板材') &&
-                row.status == 8)
-            "
-          >
+          <el-link type="primary" :underline="false" @click="toUnpack(row)" v-if="
+            (clientEnvironmentId != '4' && row.status == 8) ||
+            (clientEnvironmentId == '4' &&
+              !row.productName.includes('板材') &&
+              row.status == 8)
+          ">
             拆单
           </el-link>
 
-          <el-link
-            type="primary"
-            :underline="false"
-            icon="el-icon-truck"
-            @click="toRelease(row)"
-            v-if="
-            row.isSplit != 1  &&
-              (clientEnvironmentId != '4' && row.status == 8) ||
-              (clientEnvironmentId == '4' &&
-                !row.productName.includes('板材') &&
-                row.status == 8)
-            "
-          >
+          <el-link type="primary" :underline="false" icon="el-icon-truck" @click="toRelease(row)" v-if="
+            row.isSplit != 1 &&
+            (clientEnvironmentId != '4' && row.status == 8) ||
+            (clientEnvironmentId == '4' &&
+              !row.productName.includes('板材') &&
+              row.status == 8)
+          ">
             派单
           </el-link>
         </template>
@@ -110,15 +78,10 @@
     </el-card>
 
     <el-dialog :visible.sync="visible" title="派单" width="500px">
-      <el-form
-        ref="form"
-        :model="form"
-        :rules="rules"
-        label-position="left"
-        label-width="100px"
-      >
+
+      <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="100px">
         <el-form-item label="报工类型:" prop="singleReport">
-          <el-radio-group v-model="form.singleReport" >
+          <el-radio-group v-model="form.singleReport">
             <el-radio :label="1" v-if="clientEnvironmentId != 2">单件报工</el-radio>
             <el-radio :label="0">批量报工</el-radio>
           </el-radio-group>
@@ -132,62 +95,27 @@
         </el-form-item>
 
         <el-form-item label="班组:" prop="teamId">
-          <el-select
-            class="ele-block"
-            v-model="form.teamId"
-            placeholder="请选择班组"
-            size="mini"
-            filterable
-            @change="stationChange"
-          >
-            <el-option
-              v-for="item in teamsList"
-              :key="item.id"
-              :label="item.name + '(' + item.code + ')'"
-              :value="item.id"
-            >
+
+          <el-select class="ele-block" v-model="form.teamId" placeholder="请选择班组" size="mini" filterable
+            @change="stationChange">
+            <el-option v-for="item in teamsList" :key="item.id" :label="item.name + '(' + item.code + ')'"
+              :value="item.id">
             </el-option>
           </el-select>
         </el-form-item>
 
-        <el-form-item
-          label="工位:"
-          prop="workstationIds"
-          v-if="form.assignType == 1"
-        >
-          <el-select
-            class="ele-block"
-            v-model="form.workstationIds"
-            placeholder="请选择工位"
-            size="mini"
-            multiple
-            filterable
-          >
-            <el-option
-              v-for="item in stationList"
-              :key="item.id"
-              :label="item.name + '(' + item.code + ')'"
-              :value="item.id"
-            >
+        <el-form-item label="工位:" prop="workstationIds" v-if="form.assignType == 1">
+          <el-select class="ele-block" v-model="form.workstationIds" placeholder="请选择工位" size="mini" multiple
+            filterable>
+            <el-option v-for="item in stationList" :key="item.id" :label="item.name + '(' + item.code + ')'"
+              :value="item.id">
             </el-option>
           </el-select>
         </el-form-item>
 
         <el-form-item label="人员:" prop="crewIds" v-if="form.assignType == 2">
-          <el-select
-            class="ele-block"
-            v-model="form.crewIds"
-            placeholder="请选择班组"
-            size="mini"
-            filterable
-            multiple
-          >
-            <el-option
-              v-for="item in crewList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id"
-            >
+          <el-select class="ele-block" v-model="form.crewIds" placeholder="请选择班组" size="mini" filterable multiple>
+            <el-option v-for="item in crewList" :key="item.id" :label="item.name" :value="item.id">
             </el-option>
           </el-select>
         </el-form-item>
@@ -204,410 +132,424 @@
 </template>
 
 <script>
-  import {
-    getList,
-    releaseWorkOrder,
-    updatePriority
-  } from '@/api/workOrder/index.js';
-  import {
-    teamPage,
-    listByFirstTaskId,
-    listByWorkCenterId,
-    listUserByIds
-  } from '@/api/mainData/index.js';
-  import OrderSearch from './components/order-search.vue';
-  import unpackDialog from './components/unpackDialog.vue';
-
-  import { fieldModel } from '@/api/saleOrder';
-
-  import { debounce } from 'lodash';
-  import PlanStatistics from "@/components/statistics/PlanStatistics.vue";
-  export default {
-    components: {
-      PlanStatistics,
-      OrderSearch,
-      unpackDialog
+import {
+  getList,
+  releaseWorkOrder,
+  updatePriority
+} from '@/api/workOrder/index.js';
+import {
+  teamPage,
+  listByFirstTaskId,
+  listByWorkCenterId,
+  listUserByIds
+} from '@/api/mainData/index.js';
+import OrderSearch from './components/order-search.vue';
+import unpackDialog from './components/unpackDialog.vue';
+
+import { fieldModel } from '@/api/saleOrder';
+
+import { debounce } from 'lodash';
+import PlanStatistics from "@/components/statistics/PlanStatistics.vue";
+export default {
+  components: {
+    PlanStatistics,
+    OrderSearch,
+    unpackDialog
+  },
+  data() {
+    return {
+      visible: false,
+      loading: false,
+
+      form: {
+        assignType: 1,
+        singleReport: this.clientEnvironmentId == 2 ? 0 : 1
+      },
+      rules: {
+        singleReport: [
+          {
+            required: true,
+            message: '请选择报工类型',
+            trigger: ['blur', 'change']
+          }
+        ],
+        workstationIds: [
+          {
+            required: true,
+            message: '请选择工位',
+            trigger: ['blur']
+          }
+        ],
+        teamId: [
+          {
+            required: true,
+            message: '请选择班组',
+            trigger: ['blur']
+          }
+        ]
+      },
+
+      teamList: [],
+
+      statusOpt: [
+        { label: '待生产', value: 4 },
+        { label: '生产中', value: 5 },
+        { label: '待下达', value: 8 }
+      ],
+
+      newColumns: [],
+
+      stationList: [],
+      teamsList: [],
+      crewList: [],
+
+      current: null
+    };
+  },
+  computed: {
+    teamId() {
+      return this.$store.state.user.info.teamId;
     },
-    data() {
-      return {
-        visible: false,
-        loading: false,
+    clientEnvironmentId() {
+      return this.$store.state.user.info.clientEnvironmentId;
+    },
+    // 表格列配置
+    columns() {
+      return [
+        {
+          columnKey: 'index',
+          slot: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          slot: 'code',
+          label: '生产订单号',
+          align: 'center',
+          minWidth: 210,
+          sortable: true
+        },
+        {
+          prop: 'productionPlanCode',
+          label: '计划编号',
+          align: 'center',
+          minWidth: 150
+        },
+        {
+          prop: 'produceRoutingName',
+          label: '工艺路线',
+          align: 'center',
+          minWidth: 170
+        },
+        {
+          prop: 'productCode',
+          label: '编码',
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          prop: 'productName',
+          label: '名称',
+          align: 'center',
+          minWidth: 170
+        },
+        {
+          prop: 'brandNo',
+          label: '牌号',
+          align: 'center'
+        },
 
-        form: {
-          assignType: 1,
-          singleReport: this.clientEnvironmentId == 2 ? 0 : 1
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          minWidth: 100,
+          showOverflowTooltip: true
         },
-        rules: {
-          singleReport: [
-            {
-              required: true,
-              message: '请选择报工类型',
-              trigger: ['blur', 'change']
-            }
-          ],
-          workstationIds: [
-            {
-              required: true,
-              message: '请选择工位',
-              trigger: ['blur']
-            }
-          ],
-          teamId: [
-            {
-              required: true,
-              message: '请选择班组',
-              trigger: ['blur', 'change']
-            }
-          ]
+        {
+          prop: 'model',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
         },
 
-        teamList: [],
+        {
+          prop: 'priority',
+          label: '优先级',
+          align: 'center',
+          minWidth: 120,
+          slot: 'priority',
+          sortable: 'custom'
+        },
 
-        statusOpt: [
-          { label: '待生产', value: 4 },
-          { label: '生产中', value: 5 },
-          { label: '待下达', value: 8 }
-        ],
+        {
+          prop: 'formingNum',
+          label: '要求生产数量',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'formingWeight',
+          label: '要求生产重量',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          slot: 'formingWeight'
+        },
+        {
+          prop: 'planStartTime',
+          label: '计划开始时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
 
-        newColumns: [],
+        {
+          prop: 'planCompleteTime',
+          label: '计划结束时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
 
-        stationList: [],
-        teamsList: [],
-        crewList: [],
+        {
+          prop: 'workCenterName',
+          label: '工作中心',
+          align: 'center',
+          minWidth: 110,
+          showOverflowTooltip: true
+        },
 
-        current: null
-      };
-    },
-    computed: {
-      clientEnvironmentId() {
-        return this.$store.state.user.info.clientEnvironmentId;
-      },
-      // 表格列配置
-      columns() {
-        return [
-          {
-            columnKey: 'index',
-            slot: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            slot: 'code',
-            label: '生产订单号',
-            align: 'center',
-            minWidth: 210,
-            sortable: true
-          },
-          {
-            prop: 'productionPlanCode',
-            label: '计划编号',
-            align: 'center',
-            minWidth: 150
-          },
-          {
-            prop: 'produceRoutingName',
-            label: '工艺路线',
-            align: 'center',
-            minWidth: 170
-          },
-          {
-            prop: 'productCode',
-            label: '编码',
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            prop: 'productName',
-            label: '名称',
-            align: 'center',
-            minWidth: 170
-          },
-          {
-            prop: 'brandNo',
-            label: '牌号',
-            align: 'center'
-          },
+        {
+          prop: 'firstTaskName',
+          label: '首工序',
+          align: 'center',
+          minWidth: 110,
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'batchNo',
-            label: '批次号',
-            align: 'center',
-            minWidth: 100,
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'model',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          sortable: 'custom'
+        },
+        {
+          slot: 'status',
+          label: '状态',
+          align: 'center',
+          formatter: (row) => {
+            const obj = this.statusOpt.find((i) => i.value == row.status);
+            return obj && obj.label;
+          }
+        },
 
-          {
-            prop: 'priority',
-            label: '优先级',
-            align: 'center',
-            minWidth: 120,
-            slot: 'priority',
-            sortable: 'custom'
-          },
+        {
+          prop: 'serialNo',
+          label: '客户代号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'formingNum',
-            label: '要求生产数量',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'formingWeight',
-            label: '要求生产重量',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            slot: 'formingWeight'
-          },
-          {
-            prop: 'planStartTime',
-            label: '计划开始时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
+        {
+          prop: 'simpleName',
+          label: '客户简称',
+          align: 'center',
+          showOverflowTooltip: true
+        }
+      ];
+    }
+  },
+  created() {
+    this.getFieldModel();
+  },
+
+  methods: {
+    statusFormatter(status) {
+      const obj = this.statusOpt.find((i) => i.value == status);
+      return obj && obj.label;
+    },
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      if (where.status) {
+        where.statusList = [];
+        where.statusList.push(where.status);
+      }
+      return getList({
+        pageNum: page,
+        size: limit,
+        ...where,
+        ...this.sort
+      });
+    },
 
-          {
-            prop: 'planCompleteTime',
-            label: '计划结束时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
+    /* 数据转为树形结构 */
+    parseData(data) {
+      return {
+        ...data,
+        list: this.$util.toTreeData({
+          data: data.list,
+          count: data.total,
+
+          idField: 'code',
+          parentIdField: 'originalCode'
+        })
+      };
+    },
 
+    getFieldModel() {
+      fieldModel({ fieldModel: 't_main_category' }).then((res) => {
+        const privateColumn = [
           {
-            prop: 'workCenterName',
-            label: '工作中心',
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
             align: 'center',
-            minWidth: 110,
-            showOverflowTooltip: true
-          },
+            resizable: false,
+            fixed: 'right',
+            slot: 'action'
+          }
+        ];
 
-          {
-            prop: 'firstTaskName',
-            label: '首工序',
+        let newRes = res.map((m) => {
+          return {
+            prop: 'extField.' + m.prop,
+            label: m.label,
             align: 'center',
-            minWidth: 110,
             showOverflowTooltip: true
-          },
+          };
+        });
 
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            sortable: 'custom'
-          },
-          {
-            slot: 'status',
-            label: '状态',
-            align: 'center',
-            formatter: (row) => {
-              const obj = this.statusOpt.find((i) => i.value == row.status);
-              return obj && obj.label;
-            }
-          },
+        this.newColumns = [...this.columns, ...newRes, ...privateColumn];
 
-          {
-            prop: 'serialNo',
-            label: '客户代号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        this.$forceUpdate();
+      });
+    },
 
-          {
-            prop: 'simpleName',
-            label: '客户简称',
-            align: 'center',
-            showOverflowTooltip: true
+    // 下达
+    toRelease(row) {
+      this.current = row;
+      this.visible = true;
+
+      this.FirstTaskIdFn();
+      this.WorkCenterIdFn();
+    },
+    // 下达
+    confirm() {
+      const loading = this.$loading({ text: '加载中...' });
+      releaseWorkOrder({
+        id: this.current.id,
+        ...this.form
+      })
+        .then((res) => {
+          if (res) {
+            this.$message.success('成功');
+            this.reload();
+            this.visible = false;
           }
-        ];
-      }
+        })
+        .finally(() => {
+          loading.close();
+        });
     },
-    created() {
-      this.getFieldModel();
+    /* 刷新表格 */
+    reload(where) {
+      this.$nextTick(() => {
+        this.$refs.table.reload({ page: 1, where });
+      });
     },
-    methods: {
-      statusFormatter(status) {
-        const obj = this.statusOpt.find((i) => i.value == status);
-        return obj && obj.label;
-      },
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        if (where.status) {
-          where.statusList = [];
-          where.statusList.push(where.status);
-        }
-        return getList({
-          pageNum: page,
-          size: limit,
-          ...where,
-          ...this.sort
-        });
-      },
-
-      /* 数据转为树形结构 */
-      parseData(data) {
-        return {
-          ...data,
-          list: this.$util.toTreeData({
-            data: data.list,
-            count: data.total,
-
-            idField: 'code',
-            parentIdField: 'originalCode'
-          })
-        };
-      },
 
-      getFieldModel() {
-        fieldModel({ fieldModel: 't_main_category' }).then((res) => {
-          const privateColumn = [
-            {
-              columnKey: 'action',
-              label: '操作',
-              width: 120,
-              align: 'center',
-              resizable: false,
-              fixed: 'right',
-              slot: 'action'
-            }
-          ];
-
-          let newRes = res.map((m) => {
-            return {
-              prop: 'extField.' + m.prop,
-              label: m.label,
-              align: 'center',
-              showOverflowTooltip: true
-            };
-          });
-
-          this.newColumns = [...this.columns, ...newRes, ...privateColumn];
-
-          this.$forceUpdate();
-        });
-      },
+    onSortChange(e) {
+      let sort = {
+        orderBy: e.order,
+        sortName: e.prop
+      };
+      this.sort = sort;
+      this.reload();
+    },
 
-      // 下达
-      toRelease(row) {
-        this.current = row;
-        this.visible = true;
+    sortTop(row) {
+      row.priority = Number(row.priority) + 1;
+      this.priorityChange(row);
+    },
+    sortBottom(row) {
+      if (row.priority <= 1) {
+        return;
+      }
+      row.priority = Number(row.priority) - 1;
+      this.priorityChange(row);
+    },
 
-        this.FirstTaskIdFn();
-        this.WorkCenterIdFn();
-      },
-      // 下达
-      confirm() {
-        const loading = this.$loading({ text: '加载中...' });
-        releaseWorkOrder({
-          id: this.current.id,
-          ...this.form
-        })
-          .then((res) => {
-            if (res) {
-              this.$message.success('成功');
-              this.reload();
-              this.visible = false;
-            }
-          })
-          .finally(() => {
-            loading.close();
-          });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$nextTick(() => {
-          this.$refs.table.reload({ page: 1, where });
-        });
-      },
+    FirstTaskIdFn() {
+      listByFirstTaskId(this.current.firstTaskId).then((res) => {
+        this.stationList = res;
+      });
+    },
 
-      onSortChange(e) {
-        let sort = {
-          orderBy: e.order,
-          sortName: e.prop
-        };
-        this.sort = sort;
-        this.reload();
-      },
+    WorkCenterIdFn() {
+      listByWorkCenterId(this.current.workCenterId).then((res) => {
+        this.teamsList = res;
 
-      sortTop(row) {
-        row.priority = Number(row.priority) + 1;
-        this.priorityChange(row);
-      },
-      sortBottom(row) {
-        if (row.priority <= 1) {
-          return;
-        }
-        row.priority = Number(row.priority) - 1;
-        this.priorityChange(row);
-      },
+        this.$nextTick(() => {
+          if(this.teamId){
+      
+            this.$set(this.form, 'teamId', this.teamId);
 
-      FirstTaskIdFn() {
-        listByFirstTaskId(this.current.firstTaskId).then((res) => {
-          this.stationList = res;
-        });
-      },
+          }
+          
+          // this.$refs.form.clearValidate();
+        })
 
-      WorkCenterIdFn() {
-        listByWorkCenterId(this.current.workCenterId).then((res) => {
-          this.teamsList = res;
-        });
-      },
+      });
+    },
 
-      // 拆分
-      toUnpack(row) {
-        this.$refs.unpackRef.open(row);
-      },
+    // 拆分
+    toUnpack(row) {
+      this.$refs.unpackRef.open(row);
+    },
 
-      createSuccess() {
-        this.reload();
-      },
+    createSuccess() {
+      this.reload();
+    },
 
-      stationChange() {
-        this.crewList = [];
-        this.crewIds = [];
+    stationChange() {
+      this.crewList = [];
+      this.crewIds = [];
 
-        listUserByIds([this.form.teamId]).then((res) => {
-          this.crewList = res;
-        });
-      },
+      listUserByIds([this.form.teamId]).then((res) => {
+        this.crewList = res;
+      });
+    },
 
-      priorityChange(row) {
-        if (row.priority > 10) {
-          row.priority = 10; // 如果大于 10,则设置为 10
-        } else if (row.priority < 0) {
-          row.priority = 0; // 如果小于 0,则设置为 0
-        }
+    priorityChange(row) {
+      if (row.priority > 10) {
+        row.priority = 10; // 如果大于 10,则设置为 10
+      } else if (row.priority < 0) {
+        row.priority = 0; // 如果小于 0,则设置为 0
+      }
 
-        this.priorityFn(row);
-      },
+      this.priorityFn(row);
+    },
 
-      priorityFn: debounce(function (row) {
-        let params = {
-          id: row.id,
-          priority: row.priority
-        };
-        updatePriority(params).then((res) => {});
-      }, 800)
-    }
-  };
+    priorityFn: debounce(function (row) {
+      let params = {
+        id: row.id,
+        priority: row.priority
+      };
+      updatePriority(params).then((res) => { });
+    }, 800)
+  }
+};
 </script>
 
 <style lang="scss" scoped>
 // ::v-deep .el-table__row {
 //   height: 51px !important;
-// }
-</style>
+// }</style>

+ 1 - 1
vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
         // target: 'http://192.168.1.103:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.158:18086',
-        // target: 'http://192.168.1.158:18086',
+        // target: 'http://192.168.1.251:18086',
         target: 'http://192.168.1.125:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域