ysy %!s(int64=2) %!d(string=hai) anos
pai
achega
f50d9d5e92

+ 53 - 3
src/views/material/materialBOM/components/edit-dialog.vue

@@ -78,6 +78,12 @@
             </el-select>
           </el-form-item>
         </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="工序" prop="taskId">
+            <el-input placeholder="请选择" @click.native="openTask" readonly v-model="form.taskName"></el-input>
+          </el-form-item>
+        </el-col>
       </el-row>
     </el-form>
     <ele-pro-table ref="table" :columns="columns" :datasource="tableData" height="calc(100vh - 550px)" :need-page="false">
@@ -114,6 +120,19 @@
 
     <ProductModal ref="productRefs" @changeProduct='determineChoose' />
 
+    <!-- 添加工序 -->
+
+    <ele-modal width="1720px" :visible="addDialog" :append-to-body="true" :close-on-click-modal="true"
+      @update:visible="closeAdd">
+      <Production :tableData="productionList" ref="ProductionCom" :isRadio="true" />
+      <template v-slot:footer>
+        <el-button @click="closeAdd">取消</el-button>
+        <el-button type="primary" @click="addParamrter">
+          添加
+        </el-button>
+      </template>
+    </ele-modal>
+
   </ele-modal>
 </template>
 
@@ -124,8 +143,9 @@ import factorySelect from '@/components/CommomSelect/factory-select.vue';
 import { getCode } from '@/api/codeManagement/index.js';
 import { getVersionCode, bomSave, bomUpdate, getById, detailPage } from '@/api/material/BOM';
 import { pageList } from '@/api/technology/version/version.js';
+import Production from '@/views/technology/route/components/production/index.vue'
 export default {
-  components: { ProductModal, factorySelect },
+  components: { ProductModal, factorySelect, Production },
   props: {
     statusOpt: Object
   },
@@ -158,6 +178,7 @@ export default {
         baseCount: '',
         baseCountUnit: '',
         status: '-1',
+        taskId: ''
 
       },
       removeSubBomIdList: [],
@@ -179,6 +200,10 @@ export default {
       ],
       tableData: [],
       versionList: [],
+
+      productionList: [],
+      addDialog: false,
+
       columns: [
         {
           type: 'index',
@@ -238,6 +263,9 @@ export default {
 
         baseCount: [
           { validator: baseCountVa, trigger: 'blur' }
+        ],
+        taskId: [
+          { required: true, message: '请选择工序', trigger: 'blur' }
         ]
       },
 
@@ -294,7 +322,7 @@ export default {
     },
     selectProd() {
       this.$refs.productRefs.open(this.form, '选择产品', '9')
-      
+
     },
 
 
@@ -308,7 +336,7 @@ export default {
         this.$set(this.form, 'categoryId', row.id)
         this.$set(this.form, 'categoryCode', row.code)
         this.getVersion()
-       
+
 
       }
       else if (title == '选择物料') {
@@ -389,10 +417,32 @@ export default {
     async _getById(id) {
       const data = await getById(id);
       this.form = data;
+      this.productionList = [ { id:  this.form.taskId, name: this.form.taskName }]
       this.form.status = this.form.status + ''
     },
 
 
+    openTask() {
+      this.addDialog = true
+    },
+
+    /*关闭选择参数*/
+    closeAdd() {
+      // this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
+      this.addDialog = false;
+    },
+
+    addParamrter() {
+      let arr = this.$refs.ProductionCom.getRowData();
+      this.productionList = [ arr ]
+      this.form['taskId'] = arr.id
+      this.form['taskName'] = arr.name
+      this.addDialog = false;
+
+ 
+
+    }
+
   }
 };
 </script>

+ 1 - 1
src/views/material/product/components/MaterialModal.vue

@@ -386,7 +386,7 @@ export default {
 
         /*关闭选择参数*/
         closeAdd() {
-            this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
+            // this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
             this.addDialog = false;
         },
 

+ 4 - 0
src/views/material/product/detail.vue

@@ -217,6 +217,10 @@ export default {
 
         weightUnit: [
         { required: true, message: '请选择重量单位', trigger: 'change' }
+        ],
+
+        packingUnit: [
+        { required: true, message: '请选择包装单位', trigger: 'change' }
         ]
       },
       PathInfo: {},

+ 49 - 3
src/views/technology/route/components/production/index.vue

@@ -5,7 +5,8 @@
       <user-search @search="reload" />
       <!-- 数据表格 -->
 
-      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
+
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource"  @selection-change="selectListChange" row-key="id">
         <!-- 状态列 -->
 
         <!-- 操作列 -->
@@ -36,7 +37,15 @@ export default {
     tableData: {
       type: Array,
       default: () => []
+    },
+
+    isRadio: {
+      type: Boolean,
+      default: false
     }
+
+
+
   },
   data() {
     return {
@@ -48,7 +57,7 @@ export default {
           width: 45,
           align: 'center',
           selectable: (row, index) => {
-            return !this.tableData.some((it) => it.sourceTaskId == row.id);
+            return !this.tableData.some((it) => it.sourceTaskId == row.id || it.id == row.id);
           },
 
           reserveSelection: true,
@@ -95,10 +104,13 @@ export default {
       // 是否显示编辑弹窗
       showEdit: false,
       // 是否显示参数弹窗
-      showSetting: false
+      showSetting: false,
+
+      rowData: []
     };
   },
 
+
   methods: {
     /*配置工艺参数 */
     openSetting(row) {
@@ -165,11 +177,45 @@ export default {
             })
             .catch((e) => {
               loading.close();
+
+
+
+
+
+
               // this.$message.error(e.message);
             });
         })
         .catch(() => { });
+    },
+
+    // 表格某一行的单击事件
+    selectListChange(selection) {
+
+      if(this.isRadio) {
+        if (Array.isArray(selection) && selection.length > 1) {//点击勾选框
+        this.$refs.table.toggleRowSelection(selection[0],false);
+        this.$refs.table.toggleRowSelection(selection[1],true);
+
+      }else if(!Array.isArray(selection)){//点击行
+        this.$refs.table.toggleRowSelection(selection,false);
+        this.$refs.table.toggleRowSelection(selection,true);
+
+      }else{
+        this.rowData = []
+        this.rowData = Array.isArray(selection)?selection[0]:selection;
+
+      }
+      }
+ 
+
+
+    },
+
+    getRowData() {
+      return   this.rowData
     }
+
   }
 };
 </script>