ysy 1 سال پیش
والد
کامیت
85b111c4f9

+ 270 - 0
src/views/material/BOMmanage/components/standardOutput.vue

@@ -0,0 +1,270 @@
+<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">
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :default-expanded-keys="current && current.id ? [current.id] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
+        </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 ProductSearch from '@/components/select/bom/product-search.vue';
+  import { getMaterialList } from '@/api/material/list.js';
+
+  import { getTreeByPid } from '@/api/classifyManage';
+  export default {
+    components: { ProductSearch },
+    data() {
+      return {
+        visible: false,
+        type: 1,
+        selection: [],
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center'
+          },
+          {
+            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: '选择'
+          }
+        ],
+        title: null,
+        categoryLevelId: null,
+        radio: null,
+        idx: null,
+
+        isCategory: true,
+
+        current: {},
+
+        treeList: [],
+        treeLoading: false,
+
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        }
+      };
+    },
+
+    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(type) {
+        this.type = type;
+        this.getTreeData();
+        this.visible = true;
+      },
+
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await getTreeByPid(9);
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.rootTreeId = this.treeList[0].id;
+                this.$nextTick(() => {
+                  this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                });
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
+        this.treeLoading = false;
+      },
+      handleClose() {
+        this.visible = false;
+        this.current = null;
+        this.radio = '';
+      },
+      selected() {
+        if (this.selection.length <= 0) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        this.$emit('selection', this.selection);
+        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>

+ 106 - 84
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -971,100 +971,21 @@
 
         <el-tab-pane label="标准产出" name="标准产出">
           <ele-pro-table
-            ref="fileTable"
-            :columns="jobColumns1"
+            ref="standard"
+            :columns="standardCol"
             :datasource="datasource"
             :need-page="false"
             :immediate="true"
           >
             <!-- 表头工具栏 -->
             <template v-if="!isView" v-slot:toolbar>
-              <el-button type="primary" @click="addFile">添加</el-button>
+              <el-button type="primary" @click="add">添加</el-button>
             </template>
             <template v-slot:action="{ row, $index }">
-              <el-link type="primary" @click="handleDel(row, $index)"
+              <el-link    type="danger" @click="handleDel(row, $index)"
                 >删除</el-link
               >
             </template>
-            <template v-slot:type="{ row }">
-              <div v-if="isView">{{ row.type }}</div>
-              <el-input
-                v-else
-                v-model="row.type"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:code="{ row }">
-              <div v-if="isView">{{ row.code }}</div>
-              <el-input
-                v-else
-                v-model="row.code"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:versions="{ row }">
-              <div v-if="isView">{{ row.versions }}</div>
-              <el-input
-                v-else
-                v-model="row.versions"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:status="{ row }">
-              <div v-if="isView">{{
-                statusOption.filter((item) => item.value == row.status)[0].label
-              }}</div>
-              <div v-else>
-                <template>
-                  <el-select v-model="row.status" placeholder="请选择">
-                    <el-option
-                      v-for="item in statusOption"
-                      :label="item.label"
-                      :value="item.value"
-                      :key="item.value"
-                    >
-                    </el-option>
-                  </el-select>
-                </template>
-              </div>
-            </template>
-
-            <template v-slot:path="{ row }">
-              <div v-if="isView">附件</div>
-              <div v-else
-                ><div class="downLoad">
-                  <fileUpload
-                    v-model="jobFiledList"
-                    :show-file-list="false"
-                    module="main"
-                    @input="uploadedJobSuccess($event, row)"
-                    :showLib="false"
-                    :limit="1"
-                  />
-                  <div v-if="row.path">
-                    <el-button
-                      style="margin-left: 10px"
-                      size="mini"
-                      type="primary"
-                      @click="downloadFile(row.path)"
-                      >下载</el-button
-                    >
-                  </div></div
-                >
-              </div>
-            </template>
-
-            <template v-slot:remark="{ row }">
-              <div v-if="isView">{{ row.remark }}</div>
-              <el-input
-                v-else
-                v-model="row.remark"
-                placeholder="请输入"
-              ></el-input>
-            </template>
           </ele-pro-table>
         </el-tab-pane>
       </el-tabs>
@@ -1078,6 +999,11 @@
       @selection="addProductList"
     ></ProductModalMultiple>
 
+    <standardOutput
+      ref="standardOutputRefs"
+      @selection="chooseStandardList"
+    ></standardOutput>
+
     <div class="btns">
       <el-button type="primary" size="small" @click="save">{{
         isView ? '确定' : '保存'
@@ -1098,6 +1024,7 @@
   import ProductModalMultiple from './ProductModalMultiple.vue';
   import userSearch from './user-search.vue';
   import jobDialog from './jobDialog.vue';
+  import standardOutput from './standardOutput.vue';
   export default {
     components: {
       userSearch,
@@ -1105,7 +1032,8 @@
       fileUpload,
       ProductModal,
       jobDialog,
-      ProductModalMultiple
+      ProductModalMultiple,
+      standardOutput
     },
     mixins: [dictMixins],
     data() {
@@ -1406,6 +1334,78 @@
           }
         ],
 
+        standardCol: [
+          {
+            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
+          },
+
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+
         rowData: {},
         treeData: {},
         currentIndex: 0,
@@ -1522,7 +1522,11 @@
           type = 'aptitudeParam';
         } else if (this.activeName === '工艺文件') {
           type = 'fileParam';
+        } else if (this.activeName === '标准产出') {
+          type = 'standardOutput';
         }
+
+        console.log(this.currentIndex,44)
         this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
       },
       addProductList(list) {
@@ -1600,6 +1604,9 @@
         if (this.activeName === '材料定额') {
           this.$refs.productMultipleRefs.open(1);
           return;
+        } else if (this.activeName === '标准产出') {
+          this.$refs.standardOutputRefs.open();
+          return;
         } else if (this.activeName === '制造资源') {
           type = 'resource';
         } else if (this.activeName === '替代料') {
@@ -1695,6 +1702,10 @@
               this.tableData.taskParam[this.currentIndex].fileParam
             );
           }
+        } else if (this.activeName === '标准产出') {
+          this.$refs.standard.setData(
+            this.tableData.taskParam[this.currentIndex].standardOutput || []
+          );
         }
       },
       openParam(type) {
@@ -1720,6 +1731,17 @@
           dom.getData()
         );
       },
+
+      chooseStandardList(data) {
+        let dom = null;
+        dom = this.$refs.standard;
+        dom.setData([ data[0]]);
+
+        this.$set(
+          this.tableData.taskParam[this.currentIndex],
+          dom.getData()
+        );
+      },
       remove(row, type) {
         let dom = null;
         if (type === '工艺') {