فهرست منبع

销售订单 生产计划 增加验收跟机型字段

jingshuyong 10 ماه پیش
والد
کامیت
d7b76657ef

+ 3 - 1
src/enum/dict.js

@@ -24,7 +24,9 @@ export default {
   外协委外: 'outsource_dict',
   工作流任务分配规则的类型: 'bpm_task_assign_rule_type',
   工作流任务分配自定义脚本: 'bpm_task_assign_script',
-  流程实例的结果: 'bpm_process_instance_result'
+  流程实例的结果: 'bpm_process_instance_result',
+  物品机型: 'product_model_key',
+  物品颜色: 'product_color_key'
 };
 
 export const numberList = [

+ 83 - 7
src/views/productionPlan/components/factoryAdd/index.vue

@@ -140,6 +140,42 @@
             height="40vh"
             key="id"
           >
+            <template v-slot:modelKey="{ row, $index }">
+              <el-select
+                clearable
+                v-model="row.modelKey"
+                multiple
+                filterable
+                allow-create
+                default-first-option
+              >
+                <el-option
+                  v-for="item in modelList"
+                  :key="item.label"
+                  :value="item.label"
+                  :label="item.label"
+                >
+                </el-option>
+              </el-select>
+            </template>
+            <template v-slot:colorKey="{ row, $index }">
+              <el-select
+                clearable
+                v-model="row.colorKey"
+                multiple
+                filterable
+                allow-create
+                default-first-option
+              >
+                <el-option
+                  v-for="item in colorList"
+                  :key="item.label"
+                  :value="item.label"
+                  :label="item.label"
+                >
+                </el-option>
+              </el-select>
+            </template>
             <template v-slot:requiredFormingNum="{ row, $index }">
               <el-input
                 v-model.number="row.requiredFormingNum"
@@ -413,6 +449,7 @@
   import { getCode } from '@/api/codeManagement';
   import ProcessRoute from '@/components/selectionDialog/processRoute.vue';
   import { parameterGetByCode } from '@/api/mainData/index';
+  import { getByCode } from '@/api/system/dictionary-data';
   import {
     bomRoutingList,
     bomListByPlan,
@@ -438,9 +475,9 @@
         type: Object,
         default: () => {}
       },
-      isAdd:{
-        type:Boolean,
-        default:true
+      isAdd: {
+        type: Boolean,
+        default: true
       }
     },
     watch: {
@@ -567,7 +604,20 @@
             align: 'center',
             minWidth: 140
           },
-
+          {
+            slot: 'modelKey',
+            prop: 'modelKey',
+            label: '机型',
+            align: 'center',
+            minWidth: 240
+          },
+          {
+            slot: 'colorKey',
+            prop: 'colorKey',
+            label: '颜色',
+            align: 'center',
+            minWidth: 240
+          },
           {
             slot: 'requiredFormingNum',
             prop: 'requiredFormingNum',
@@ -771,6 +821,7 @@
     //   }
     // },
     mounted() {
+      this.getCodeData();
       // 生产类型跟BOM版本字段是否必填
       parameterGetByCode({
         code: 'production_plan_code'
@@ -782,6 +833,31 @@
       });
     },
     methods: {
+      // 获取
+      async getCodeData() {
+        let arr1 = await this.getLevelCode('product_model_key');
+        let arr2 = await this.getLevelCode('product_color_key');
+        this.modelList = arr1;
+        this.colorList = arr2;
+      },
+      async getLevelCode(code) {
+        try {
+          const res = await getByCode(code);
+          if (res.code == 0) {
+            let list = Object.values(res.data).map((el) => {
+              let k = Object.keys(el)[0];
+              let v = Object.values(el)[0];
+              return {
+                label: v,
+                value: k
+              };
+            });
+            return list;
+          }
+        } catch (err) {
+          this.$message.error(err.message);
+        }
+      },
       selectFactory(e, row) {
         let data = this.factoryList.find((item) => item.id === e);
         this.$set(row, 'factoriesName', data.name);
@@ -869,12 +945,12 @@
               if (listMap[3]) {
                 list.push({ code: 3, name: 'ABOM' });
               }
-               this.form.productInfoList[0].producedList = list;
+              this.form.productInfoList[0].producedList = list;
             }
           }
           this.$forceUpdate();
-        }else{
-          this.title = '新增临时生产计划'
+        } else {
+          this.title = '新增临时生产计划';
         }
         this.visible = true;
 

+ 30 - 5
src/views/productionPlan/index.vue

@@ -594,7 +594,32 @@
             width: 140,
             showOverflowTooltip: true
           },
-
+          {
+            prop: 'modelKey',
+            label: '机型',
+            align: 'center',
+            minWidth: 120,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.modelKey) {
+                return row.modelKey.toString();
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'colorKey',
+            label: '颜色',
+            align: 'center',
+            minWidth: 120,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.colorKey) {
+                return row.colorKey.toString();
+              }
+              return '';
+            }
+          },
           {
             prop: 'productNum',
             label: '计划数量',
@@ -939,7 +964,7 @@
           let produceType = '';
           let params = { categoryId: categoryId };
           const res = await listBomType(params);
-          console.log(res,'res 000');
+          console.log(res, 'res 000');
           let bomMap = {
             1: { code: 1, name: 'PBOM' },
             2: { code: 2, name: 'MBOM' },
@@ -947,9 +972,9 @@
           };
           let arr = [];
           res.map((item) => {
-            if(bomMap[item.bomType]){
-               arr.push(bomMap[item.bomType]);
-               delete bomMap[item.bomType];
+            if (bomMap[item.bomType]) {
+              arr.push(bomMap[item.bomType]);
+              delete bomMap[item.bomType];
             }
           });
           // const res = await findBomCategoryByCategoryId(categoryId);

+ 91 - 22
src/views/saleOrder/components/create-order.vue

@@ -179,6 +179,66 @@
           </el-table-column>
           <el-table-column label="重量单位" align="center" prop="weightUnit">
           </el-table-column>
+          <el-table-column
+            label="机型"
+            align="center"
+            prop="modelKey"
+            width="240"
+          >
+            <template slot-scope="scope">
+              <el-form-item
+                label-width="0px"
+                :prop="'productInfoList.' + scope.$index + '.modelKey'"
+              >
+                <el-select
+                  clearable
+                  v-model="scope.row.modelKey"
+                  multiple
+                  filterable
+                  allow-create
+                  default-first-option
+                >
+                  <el-option
+                    v-for="item in modelList"
+                    :key="item.label"
+                    :value="item.label"
+                    :label="item.label"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="颜色"
+            align="center"
+            prop="colorKey"
+            width="240"
+          >
+            <template slot-scope="scope">
+              <el-form-item
+                label-width="0px"
+                :prop="'productInfoList.' + scope.$index + '.colorKey'"
+              >
+                <el-select
+                  clearable
+                  v-model="scope.row.colorKey"
+                  multiple
+                  filterable
+                  allow-create
+                  default-first-option
+                >
+                  <el-option
+                    v-for="item in colorList"
+                    :key="item.label"
+                    :value="item.label"
+                    :label="item.label"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+          </el-table-column>
           <el-table-column
             label="生产编号"
             align="center"
@@ -552,6 +612,7 @@
   import dayjs from 'dayjs';
   import { multiply } from '@/utils/math';
   import contactDialog from '@/components/contactDialog/openContactDialog.vue';
+  import { getByCode } from '@/api/system/dictionary-data';
   export default {
     name: 'CreateOrder',
     components: {
@@ -644,7 +705,9 @@
         ],
         selectIndex: 0, // 选择工艺路线的当前数据下标
         processingRequired: 0, // 生产类型跟BOM 版本是否必填 1:是 0:否
-        sourceSalesOrderId: '' // 源销售订单ID
+        sourceSalesOrderId: '', // 源销售订单ID
+        modelList: [], // 机型数据
+        colorList: [] // 颜色数据
       };
     },
     watch: {
@@ -693,8 +756,34 @@
     mounted() {
       this.mandatoryField();
       this.getFactoryList();
+      this.getCodeData();
     },
     methods: {
+      // 获取
+      async getCodeData() {
+        let arr1 = await this.getLevelCode('product_model_key');
+        let arr2 = await this.getLevelCode('product_color_key');
+        this.modelList = arr1;
+        this.colorList = arr2;
+      },
+      async getLevelCode(code) {
+        try {
+          const res = await getByCode(code);
+          if (res.code == 0) {
+            let list = Object.values(res.data).map((el) => {
+              let k = Object.keys(el)[0];
+              let v = Object.values(el)[0];
+              return {
+                label: v,
+                value: k
+              };
+            });
+            return list;
+          }
+        } catch (err) {
+          this.$message.error(err.message);
+        }
+      },
       // 是否必填
       mandatoryField() {
         parameterGetByCode({
@@ -786,20 +875,6 @@
           });
           await Promise.all(promiseProduct);
           // // 如果没有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);
-          // });
         });
       },
       // 获取bom信息
@@ -823,13 +898,6 @@
         // this.$set(data, 'producedList', arr);
         data.producedList = arr;
         console.log(arr, 'arr');
-        // if (!data.productType || !data.bomCategoryId) {
-        // this.$set(data, 'productType', arr[0].code);
-        // console.log(333333);
-        // this.changeProductType(data, index);
-        // }
-        // console.log(data, 'data');
-        // data.producedList = arr;
       },
 
       cancel() {
@@ -963,6 +1031,7 @@
           let flag = this.parameterVerification();
           // 必填参数校验
           if (!flag) return;
+          console.log(this.form, '33333333333');
           this.loading = true;
           let params = {
             ...this.form,

+ 26 - 0
src/views/saleOrder/index.vue

@@ -259,6 +259,32 @@
             minWidth: 120,
             showOverflowTooltip: true
           },
+          {
+            prop: 'modelKey',
+            label: '机型',
+            align: 'center',
+            minWidth: 120,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.modelKey) {
+                return row.modelKey.toString();
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'colorKey',
+            label: '颜色',
+            align: 'center',
+            minWidth: 120,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.colorKey) {
+                return row.colorKey.toString();
+              }
+              return '';
+            }
+          },
           {
             prop: 'specification',
             label: '规格',

+ 85 - 7
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -373,6 +373,56 @@
             prop="lackNum"
           >
           </el-table-column>
+          <el-table-column
+            label="机型"
+            align="center"
+            prop="modelKey"
+            width="240"
+          >
+            <template slot-scope="scope">
+              <el-select
+                clearable
+                v-model="scope.row.modelKey"
+                multiple
+                filterable
+                allow-create
+                default-first-option
+              >
+                <el-option
+                  v-for="item in modelList"
+                  :key="item.label"
+                  :value="item.label"
+                  :label="item.label"
+                >
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="颜色"
+            align="center"
+            prop="colorKey"
+            width="240"
+          >
+            <template slot-scope="scope">
+              <el-select
+                clearable
+                v-model="scope.row.colorKey"
+                multiple
+                filterable
+                allow-create
+                default-first-option
+              >
+                <el-option
+                  v-for="item in colorList"
+                  :key="item.label"
+                  :value="item.label"
+                  :label="item.label"
+                >
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
           <el-table-column
             label="批次号"
             width="160"
@@ -875,7 +925,9 @@
         loading: false,
         processingRequired: 0, // 生产类型跟BOM 版本是否必填 1:是 0:否
         selectionRowShow: false, // 工艺路线输入框展示 状态
-        validDate
+        validDate,
+        modelList: [], // 机型数据
+        colorList: [] // 颜色数据
       };
     },
     props: {
@@ -919,6 +971,7 @@
     },
     mounted() {
       this.mandatoryField();
+      this.getCodeData();
     },
     computed: {
       clientEnvironmentId() {
@@ -956,11 +1009,36 @@
     },
 
     methods: {
+      // 获取
+      async getCodeData() {
+        let arr1 = await this.getLevelCode('product_model_key');
+        let arr2 = await this.getLevelCode('product_color_key');
+        this.modelList = arr1;
+        this.colorList = arr2;
+      },
+      async getLevelCode(code) {
+        try {
+          const res = await getByCode(code);
+          if (res.code == 0) {
+            let list = Object.values(res.data).map((el) => {
+              let k = Object.keys(el)[0];
+              let v = Object.values(el)[0];
+              return {
+                label: v,
+                value: k
+              };
+            });
+            return list;
+          }
+        } catch (err) {
+          this.$message.error(err.message);
+        }
+      },
       async getProducedData() {
-        console.log(111111111111111)
+        console.log(111111111111111);
         let query = this.$route.query;
-        console.log(query,'query');
-        
+        console.log(query, 'query');
+
         if (!query.producedList || query.producedList.length == 0) {
           this.producedList = [
             { code: 2, name: 'MBOM' },
@@ -1096,9 +1174,9 @@
           bomType: this.form.produceType || null,
           categoryId: categoryId
         };
-        console.log(param,'param')
+        console.log(param, 'param');
         bomListByPlan(param).then((res) => {
-          console.log(res,'res 查出来没')
+          console.log(res, 'res 查出来没');
           this.bomVersionList = res || [];
           if (res.length) {
             let o = res[0];
@@ -1192,7 +1270,7 @@
           this.form.produceType = this.$route.query.produceType
             ? parseInt(this.$route.query.produceType)
             : res.produceType;
-          console.log(this.form.produceType,'这里吗')
+          console.log(this.form.produceType, '这里吗');
           this.changeProduceType('init');
           this.form.bomCategoryId =
             res.bomCategoryId || this.$route.query.bomCategoryId;