ysy 2 éve
szülő
commit
68bf054171

+ 237 - 0
src/components/select/SelectProduct/index.vue

@@ -0,0 +1,237 @@
+<template>
+  <el-dialog :title="title" :visible.sync="visible" v-if="visible" :before-close="handleClose"
+    :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="75%">
+    <el-card shadow="never">
+      <ProductSearch @search="reload" ref="searchRef" />
+
+      <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
+        <div class="ele-border-lighter split-layout-right-content">
+          <AssetTree ref="assetTreeRef" :id="categoryLevelId" @handleNodeClick="handleNodeClick" />
+        </div>
+        <!-- 表格 -->
+        <template v-slot:content>
+          <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection"  row-key="id" height="calc(100vh - 350px)"
+            class="dict-table">
+
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+  
+<script>
+import AssetTree from '@/components/AssetTree';
+import ProductSearch from '@/views/technology/productParam/components/product-search.vue'
+import { getMaterialList } from '@/api/material/list.js';
+export default {
+  components: { AssetTree, ProductSearch },
+  data() {
+    return {
+      visible: false,
+
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'selection',
+          type: 'selection',
+          width: 45,
+          align: 'center',
+          selectable: (row, index) => {
+            return !this.processData.some((it) => it.id == row.id);
+          },
+          reserveSelection: true,
+          fixed: 'left'
+        },
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 45,
+          align: 'center',
+          reserveSelection: true
+        },
+        {
+          prop: 'code',
+          label: '编码'
+        },
+        {
+          prop: 'name',
+          label: '名称',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'brandNum',
+          label: '牌号'
+        },
+
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measuringUnit',
+          label: '计量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'weightUnit',
+          label: '重量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'roughWeight',
+          label: '毛重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'netWeight',
+          label: '净重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+
+        {
+          prop: 'packingUnit',
+          align: 'center',
+          label: '包装单位',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryLevelPath',
+          label: '分类',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
+        {
+          action: 'action',
+          slot: 'action',
+          align: 'center',
+          label: '选择'
+        }
+      ],
+
+
+      // 表格选中数据
+      selection: [],
+
+      processData: [],
+
+      title: null,
+      categoryLevelId: null,
+      current: null,
+
+      isCategory: true
+    }
+  },
+
+  watch: {
+
+  },
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, where, limit }) {
+      return getMaterialList({
+        ...where,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.isCategory ? this.categoryLevelId : null,
+
+      });
+    },
+    handleNodeClick(data) {
+      this.isCategory = true
+      this.categoryLevelId = data.id;
+      this.$refs.table.reload({ pageNum: 1, where: {} });
+      this.$refs.searchRef.reset2()
+
+
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.isCategory = false
+      this.$refs.table.reload({ pageNum: 1, where: where });
+    },
+    open(item, title, categoryLevelId, current) {
+      this.processData = item
+      this.title = title
+      this.categoryLevelId = categoryLevelId
+      this.current = current
+      this.visible = true
+    },
+
+
+
+
+
+
+    handleClose() {
+      this.visible = false
+      this.$refs.table.setSelectedRows([]);
+      this.selection = []
+
+    },
+    selected() {
+      if (!this.selection.length) {
+        this.$message.error('请至少选择一条数据');
+        return;
+      }
+      console.log(this.current)
+      this.$emit('chooseProcess', this.selection, this.current)
+      this.handleClose()
+    },
+  }
+}
+</script>
+  
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+
+.table_col {
+  padding-left: 10px;
+
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+
+.topsearch {
+  margin-bottom: 15px;
+}
+</style>
+  

+ 161 - 125
src/views/material/product/components/mouldDialog.vue

@@ -42,40 +42,29 @@
                 </el-col>
             </el-row>
 
-            <header-title title="工序">
-            </header-title>
-
-            <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="datasource" row-key="produceTaskId">
+            <header-title title="工序"> </header-title>
 
+            <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="datasource"
+                row-key="produceTaskId">
                 <!-- 表头工具栏 -->
                 <template v-slot:toolbar>
                     <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
                         @click="openEdit">新增</el-button>
-
-
                 </template>
 
-                <template v-slot:palletName="{ row, $index }">
-                    <el-input :value="row.palletName" placeholder="请选择"
-                        @click.native="palletSelect(row, $index)"></el-input>
+                <template v-slot:palletBomCode="{ row }">
+                    <el-input :value="row.palletBomCode" placeholder="请输入模具BOM编码"></el-input>
                 </template>
 
-                <template v-slot:palletCode="{ row }">
-                    <el-input :value="row.palletCode" disabled placeholder="自动带入"></el-input>
+                <template v-slot:palletBomName="{ row }">
+                    <el-input :value="row.palletBomName" placeholder="请输入模具BOM名称"></el-input>
                 </template>
 
-
-                <template v-slot:palletModelType="{ row }">
-                    <el-input :value="row.palletModelType" disabled placeholder="自动带入"></el-input>
-                </template>
-
-
-
-
-
-
                 <!-- 操作列 -->
                 <template v-slot:action="{ row, $index }">
+                    <el-link type="primary" @click="openMould(row)" :underline="false">
+                        配置模具
+                    </el-link>
 
                     <el-popconfirm class="ele-action" title="确定要删除当前工序吗?" @confirm="handleDel(row, $index)">
                         <template v-slot:reference>
@@ -86,12 +75,27 @@
                     </el-popconfirm>
                 </template>
 
-
-
-
+                <template v-slot:expand="{ row }">
+                    <div style="width: 100%; min-height: 60px" v-if="row.palletList">
+                        <ele-pro-table :toolbar="false" toolsTheme="none" ref="table2" :need-page="false"
+                            :datasource="row.palletList" :columns="columns2" row-key="id">
+
+                            <!-- 操作列 -->
+                            <template v-slot:action="{ row }">
+                                <el-popconfirm class="ele-action" title="确定要删除当前模具吗?" @confirm="remove2(row)">
+                                    <template v-slot:reference>
+                                        <el-link type="danger" :underline="false" icon="el-icon-delete">
+                                            删除
+                                        </el-link>
+                                    </template>
+                                </el-popconfirm>
+                            </template>
+
+
+                        </ele-pro-table>
+                    </div>
+                </template>
             </ele-pro-table>
-
-
         </el-form>
 
         <div slot="footer" class="footer">
@@ -99,24 +103,22 @@
             <el-button @click="visible = false">返回</el-button>
         </div>
 
-
         <processModal ref="processRefs" @chooseProcess="chooseProcess"></processModal>
-        <ProductModal ref="productRefs" @changeProduct='determineChoose' />
 
+        <!-- 选择模具 -->
+        <SelectProduct ref="productRefs" @chooseProcess="chooseModal"></SelectProduct>
     </ele-modal>
 </template>
   
 <script>
+import processModal from '@/views/technology/productParam/components/processModal.vue';
+import SelectProduct from '@/components/select/SelectProduct';
 
-
-import processModal from '@/views/technology/productParam/components/processModal.vue'
-import ProductModal from '@/views/technology/productParam/components/ProductModal.vue'
-import { categoryTaskPallet, getCategoryTaskPallet } from '@/api/material/list'
+import { categoryTaskPallet, getCategoryTaskPallet } from '@/api/material/list';
 export default {
     components: {
         processModal,
-        ProductModal
-
+        SelectProduct
     },
     props: {
         // 弹窗是否打开
@@ -149,34 +151,20 @@ export default {
                 ]
             },
 
-
-
             // 提交状态
             loading: false,
             current: null,
 
             columns: [
-
                 {
-                    label: '模具名称',
-                    prop: 'palletName',
-                    slot: 'palletName',
-                    minWidth: 110
-                },
-
-                {
-                    label: '模具编码',
-                    prop: 'palletCode',
-                    slot: 'palletCode',
-                    minWidth: 110
+                    width: 45,
+                    type: 'expand',
+                    columnKey: 'palletList',
+                    align: 'center',
+                    slot: 'expand'
                 },
 
-                {
-                    label: '模具型号',
-                    prop: 'palletModelType',
-                    slot: 'palletModelType',
-                    minWidth: 110
-                },
+          
 
                 {
                     prop: 'code',
@@ -208,6 +196,21 @@ export default {
                     minWidth: 110
                 },
 
+                {
+                    prop: 'palletBomCode',
+                    label: '模具BOM编码',
+                    align: 'center',
+                    slot: 'palletBomCode',
+                    minWidth: 150
+                },
+                {
+                    prop: 'palletBomName',
+                    label: '模具BOM名称',
+                    align: 'center',
+                    slot: 'palletBomName',
+                    minWidth: 150
+                },
+
                 {
                     columnKey: 'action',
                     label: '操作',
@@ -219,12 +222,50 @@ export default {
                 }
             ],
 
-            removeList: [],
-            categoryId: null
 
+            // 表格列配置
+            columns2: [
+
+                {
+                    prop: 'code',
+                    label: '编码'
+                },
+                {
+                    prop: 'name',
+                    label: '名称',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'brandNum',
+                    label: '牌号'
+                },
+
+                {
+                    prop: 'modelType',
+                    label: '型号',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'specification',
+                    label: '规格',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
 
 
+                {
+                    columnKey: 'action',
+                    label: '操作',
+                    align: 'center',
+                    resizable: false,
+                    slot: 'action',
+                    showOverflowTooltip: true
+                }
+            ],
 
+            removeList: [],
+            categoryId: null
         };
     },
     computed: {
@@ -234,127 +275,122 @@ export default {
         }
     },
     methods: {
-
         /* 表格数据源 */
         datasource({ page, limit, where }) {
             return [];
         },
 
-
-
         /* 更新visible */
         updateVisible(value) {
             this.$emit('update:visible', value);
         },
 
         openEdit() {
-            let _arr = this.$refs.table.getData()
+            let _arr = this.$refs.table.getData();
             _arr.map((m) => {
-                m.id = m.produceTaskId
-                delete m.produceTaskId
-              return {
-                ...m,
-              } 
-            })
-            this.$refs.processRefs.open(_arr)
+                m.id = m.produceTaskId;
+                delete m.produceTaskId;
+                return {
+                    ...m
+                };
+            });
+            this.$refs.processRefs.open(_arr);
         },
 
         chooseProcess(data) {
             data.map((m) => {
-                m['produceTaskId'] = m.id
-                delete m.id
-              return {
-                ...m,
-                
-              }
-            })
+                m['produceTaskId'] = m.id;
+                delete m.id;
+                return {
+                    ...m
+                };
+            });
             this.$refs.table.setData([...data, ...this.$refs.table.getData()]);
         },
 
-
-
-
         handleDel(row, index) {
-            let _arr = this.$refs.table.getData()
-            _arr.splice(index, 1)
-            this.$refs.table.setData(_arr)
+            let _arr = this.$refs.table.getData();
+            _arr.splice(index, 1);
+            this.$refs.table.setData(_arr);
             if (row?.produceTaskId) {
-                this.removeList.push(row.produceTaskId)
+                this.removeList.push(row.produceTaskId);
             }
         },
 
-        palletSelect(row, idx) {
-            let _arr = this.$refs.table.getData()
-            let param = {
-                categoryId: _arr[idx].palletId,
-                categoryName: _arr[idx].palletName,
-                categoryCode: _arr[idx].palletCode
-            }
-            this.$refs.productRefs.open(param, '模具', '5', idx)
+        openMould(row) {
+            this.$refs.productRefs.open([], '模具', '5', row);
         },
 
-        determineChoose(title, row, idx) {
+        chooseModal(data, current) {
+            data.map((m => {
+                m.parentId = current.produceTaskId
+                return {
+                    ...m,
+                }
+            }))
 
-            if (title == '模具') {
-                let _arr = this.$refs.table.getData()
-                this.$set(_arr[idx], 'palletId', row.id)
-                this.$set(_arr[idx], 'palletName', row.name)
-                this.$set(_arr[idx], 'palletCode', row.code)
-                this.$set(_arr[idx], 'palletModelType', row.modelType)
+            let tableList = [];
+            tableList = this.$refs.table.getData();
+            tableList.forEach((e) => {
+                if (e.produceTaskId == current.produceTaskId) {
+                    e.palletList = data;
+                }
+            });
+            this.$refs.table.setData([...tableList]);
+        },
 
+        remove2(row) {
 
-                this.$nextTick(() => {
-                    this.$refs.table.setData(_arr);
-                })
+            const data = this.$refs.table.getData() ?? [];
 
-            }
+            data.forEach((e) => {
+                if (row.parentId == e.produceTaskId) {
+                    e.palletList = e.palletList.filter((d) => d.id !== row.id);
+                }
+            })
 
+            this.$refs.table.setData([...data])
 
         },
 
-      async  getCategoryTaskDetail() {
-         const res =   await getCategoryTaskPallet(this.categoryId)
-         this.$refs.table.setData(res);
- 
-        },
 
+        async getCategoryTaskDetail() {
+            const res = await getCategoryTaskPallet(this.categoryId);
+            this.$refs.table.setData(res);
+        },
 
         save() {
-            let _arr = this.$refs.table.getData()
+            let _arr = this.$refs.table.getData();
             let param = {
                 categoryId: this.categoryId,
                 taskList: _arr
-            }
-            categoryTaskPallet(param).then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.visible = false;
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-            this.$message.error(e.message);
-          });
-        },
-
-
-
+            };
+            categoryTaskPallet(param)
+                .then((msg) => {
+                    this.loading = false;
+                    this.$message.success(msg);
+                    this.visible = false;
+                    this.$emit('done');
+                })
+                .catch((e) => {
+                    this.loading = false;
+                    this.$message.error(e.message);
+                });
+        }
     },
 
     watch: {
         async visible(visible) {
             if (visible) {
-              
                 if (this.data) {
-                    this.categoryId = this.data.id
+                    this.categoryId = this.data.id;
                     this.$util.assignObject(this.form, {
                         ...this.data
                     });
                 } else {
                 }
 
-                this.getCategoryTaskDetail()
-
+                this.getCategoryTaskDetail();
             } else {
                 this.$refs.form.clearValidate();
                 this.form = { ...this.defaultForm };

+ 2 - 1
src/views/technology/productParam/components/process.vue

@@ -18,7 +18,8 @@
         <template v-slot:expand="{ row }">
 
           <div style="width:100%; min-height: 60px" v-if="row.produceList">
-            <ele-pro-table ref="table2" :need-page="false" :datasource="row.produceList" :columns="columns2"
+            <ele-pro-table        :toolbar="false"
+            toolsTheme="none" ref="table2" :need-page="false" :datasource="row.produceList" :columns="columns2"
               row-key="code">