Преглед изворни кода

Merge remote-tracking branch 'origin/dev' into dev

chenping пре 11 месеци
родитељ
комит
5e0b6369a9

+ 1 - 1
src/views/material/BOMmanage/components/detailedList.vue

@@ -22,7 +22,7 @@
               type="primary"
               size="mini"
               @click="handleAdd"
-              v-if="!isWt"
+              v-if="!isWt && attributeData.attributeType != 4"
               >新增</el-button
             >
             <el-button

+ 370 - 221
src/views/material/BOMmanage/components/standardOutput.vue

@@ -1,21 +1,51 @@
 <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-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' }">
+      <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>
+          <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
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            row-key="id"
+            height="calc(100vh - 350px)"
+            class="dict-table"
+          >
+            <template v-slot:componentAttribute="{ row }">
+              <div>
+                <!-- {{ }} -->
+                {{ getDictValueFn(row.componentAttribute) }}
+              </div>
+            </template>
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -28,249 +58,368 @@
 </template>
 
 <script>
-import ProductSearch from '@/components/select/bom/product-search.vue';
-import { getMaterialList } from '@/api/material/list.js';
-import { sourceBomVersion } from '@/api/material/BOM';
-import { getTreeByGroup } from '@/api/classifyManage';
-export default {
-  components: { ProductSearch },
-  data() {
-    return {
-      visible: false,
-      type: 1,
-      selection: [],
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'selection',
-          type: 'selection',
-          width: 45,
-          align: 'center',
-          selectable: (row, index) => {
-            if (Array.isArray(this.selectList)) {
-              return !this.selectList.some((it) => row.id == it.id);
-            } else {
-              return true;
+  import ProductSearch from '@/components/select/bom/product-search.vue';
+  import { getMaterialList } from '@/api/material/list.js';
+  import { sourceBomVersion } from '@/api/material/BOM';
+  import { getTreeByGroup } from '@/api/classifyManage';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import { produceTypeList } from '@/enum/dict.js';
+
+  const measureTypeList = [
+    {
+      label: '数量',
+      value: 1
+    },
+    {
+      label: '重量',
+      value: 2
+    },
+    {
+      label: '体积',
+      value: 3
+    },
+    {
+      label: '容积',
+      value: 4
+    },
+    {
+      label: '面积',
+      value: 5
+    }
+  ];
+  export default {
+    components: { ProductSearch },
+    data() {
+      return {
+        visible: false,
+        type: 1,
+        selection: [],
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            selectable: (row, index) => {
+              if (Array.isArray(this.selectList)) {
+                return !this.selectList.some((it) => row.id == it.id);
+              } else {
+                return true;
+              }
+            },
+            reserveSelection: true
+          },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'componentAttribute',
+            slot: 'componentAttribute',
+            align: 'center',
+            label: '属性类型',
+            showOverflowTooltip: true
+            // formatter: (row, column) => {
+            //   return row?.produceType
+            //     ?.map((item) => {
+            //       {{row}}
+            //       return this.getDictValueFn(item);
+            //     })
+            //     ?.toString();
+            // }
+          },
+          {
+            prop: 'attributeType',
+            align: 'center',
+            label: '存货类型',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              const item = this.attributeList.find(
+                (item) => item[row.attributeType] !== undefined
+              );
+              return item ? item[row.attributeType] : null; // 如果找不到返回 null
             }
+          },
+          {
+            prop: 'produceType',
+            align: 'center',
+            label: '生产类型',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              return produceTypeList.find(
+                (item) => item.value == row.produceType
+              )?.label;
+            }
+          },
+          {
+            prop: 'measureType',
+            align: 'center',
+            label: '计量类型',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              return measureTypeList.find(
+                (item) => item.value == row.measureType
+              )?.label;
+            }
+          },
 
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
           },
-          reserveSelection: true,
-        },
-        {
-          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: 'weightUnit',
-          label: '重量单位',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
+          {
+            prop: 'roughWeight',
+            label: '毛重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
 
-        {
-          prop: 'roughWeight',
-          label: '毛重',
-          showOverflowTooltip: true,
-          minWidth: 90
-        },
+          {
+            prop: 'netWeight',
+            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
+          },
 
-        {
-          prop: 'packingUnit',
-          align: 'center',
-          label: '包装单位',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryLevelPath',
-          label: '分类',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
+        isshow: false,
+        title: null,
+        categoryLevelId: null,
+        radio: null,
+        idx: null,
 
-        {
-          action: 'action',
-          slot: 'action',
-          align: 'center',
-          label: '选择'
-        }
-      ],
-      isshow:false,
-      title: null,
-      categoryLevelId: null,
-      radio: null,
-      idx: null,
+        isCategory: true,
 
-      isCategory: true,
+        current: {},
 
-      current: {},
+        treeList: [],
+        treeLoading: false,
+
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        },
+        attributeList: [],
+        sxtList: [
+          {
+            label: '自制件',
+            value: 1
+          },
+          {
+            label: '采购件',
+            value: 2
+          },
+          {
+            label: '外协件',
+            value: 3
+          },
+          {
+            label: '受托件',
+            value: 4
+          }
+        ]
+      };
+    },
 
-      treeList: [],
-      treeLoading: false,
+    watch: {},
 
-      defaultProps: {
-        children: 'children',
-        label: 'name'
-      }
-    };
-  },
-
-  watch: {},
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, where, limit }) {
-      return getMaterialList({
-        ...where,
-        pageNum: page,
-        size: limit,
-        categoryLevelId: this.isCategory ? this.categoryLevelId : null
+    created() {
+      getByCode('inventory_type').then((res) => {
+        if (res.code === '0') {
+          this.attributeList = res.data;
+        }
       });
+      this.requestDict('生产类型');
     },
-    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(list) {
-      
-      if (Array.isArray(list)) {
-        this.isshow = true;
-        this.selectList = list;
-      } else {
-        this.isshow = false;
-        this.type = list;
-      }
-      this.getTreeData();
-      this.visible = true;
-    },
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+        return getMaterialList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.isCategory ? this.categoryLevelId : null
+        });
+      },
 
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
-
-        const res = await getTreeByGroup({ type: 1 });
-        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);
-              });
-            }
+      getDictValueFn(e) {
+        // console.log(e,'3333333333333');
+        if (e.length) {
+          let arr = [];
+          e.map((v) => {
+            arr.push(this.findFn(v)?.label);
           });
-          return this.treeList;
+
+          return arr.join(',');
+        } else {
+          return '';
         }
-      } catch (error) { }
-      this.treeLoading = false;
-    },
-    handleClose() {
-      this.visible = false;
-      this.current = null;
-      this.radio = '';
-    },
+        // let a =
 
-    selected() {
-      if (this.selection.length <= 0) {
-        return this.$message.warning('请至少选择一条数据');
-      }
-      
-      console.log(this.selection, '我是选择数据',this.type,this.isshow);
+        // return a?.label||''
+      },
 
+      findFn(e) {
+        return this.sxtList.find((item) => item.value == Number(e));
+      },
+
+      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(list) {
+        if (Array.isArray(list)) {
+          this.isshow = true;
+          this.selectList = list;
+        } else {
+          this.isshow = false;
+          this.type = list;
+        }
+        this.getTreeData();
+        this.visible = true;
+      },
 
-      if (Array.isArray(this.selection)&&this.isshow) {
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
 
-        this.$emit('selection', this.selection);
+          const res = await getTreeByGroup({ type: 1 });
+          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('请至少选择一条数据');
+        }
 
-      } else {
+        console.log(this.selection, '我是选择数据', this.type, this.isshow);
 
-        this.$emit('selection', this.type, this.selection);
+        if (Array.isArray(this.selection) && this.isshow) {
+          this.$emit('selection', this.selection);
+        } else {
+          this.$emit('selection', this.type, this.selection);
+        }
+        this.handleClose();
       }
-      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;
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
   }
-}
 
-.pagination {
-  text-align: right;
-  padding: 10px 0;
-}
+  .table_col {
+    padding-left: 10px;
 
-.btns {
-  text-align: center;
-  padding: 10px 0;
-}
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
 
-.topsearch {
-  margin-bottom: 15px;
-}
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
 </style>

+ 36 - 5
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -433,13 +433,29 @@
                       >
                       </el-input>
                     </el-form-item>
-
                     <el-form-item prop="baseCountUnit" label="单位">
-                      <DictSelection
+                      <!-- <DictSelection
                         dictName="计量单位"
-                        :disabled="isView"
+                        clearable
+                        :disabled="true"
                         v-model="form.baseCountUnit"
-                      />
+                      ></DictSelection> -->
+                      <!-- <el-form-item label="单位:" prop="unit"> -->
+                      <el-select
+                        :disabled="isView || form.baseCountUnit"
+                        v-model="form.baseCountUnit"
+                        filterable
+                        class="ele-block"
+                        @change="changeUnit"
+                      >
+                        <el-option
+                          v-for="item in unitList"
+                          :key="item.value"
+                          :value="item.value"
+                          :label="item.label"
+                        ></el-option>
+                      </el-select>
+                      <!-- </el-form-item> -->
                     </el-form-item>
                   </el-form>
                 </div>
@@ -1157,12 +1173,14 @@
         fileShow: false,
         resourceBomId: '',
         level: '',
-        attributeData: {}
+        attributeData: {},
+        unitList: []
       };
     },
     created() {
       this.requestDict('工种类型');
       this.getDictList('time_unit');
+      this.getDicTUnitList('measuring_uint');
     },
     methods: {
       addFile() {
@@ -1186,6 +1204,19 @@
         }
       },
 
+      async getDicTUnitList(code) {
+        let { data: res } = await getByCode(code);
+
+        this.unitList = res.reduce((acc, curr) => {
+          let key = Object.keys(curr)[0]; // 获取当前对象的键
+          let value = curr[key]; // 获取当前对象的值
+          acc.push({ value, label: value }); // 将 { value, label } 格式的对象添加到数组中
+          return acc;
+        }, []); // 初始值为空数组 []
+
+        console.log(this.unitList, 'this.unitList');
+      },
+
       async detailsList() {
         console.log(this.rowData, 'this.rowData');
         await getDetailList({

+ 18 - 10
src/views/material/BOMmanage/detailsPop.vue

@@ -99,6 +99,7 @@
               icon="el-icon-refresh"
               plain
               @click="transformation('P')"
+              :disabled="currentNodeData.approvalStatus != 2"
               v-if="
                 currentNodeData.bomType == 4 &&
                 (currentNodeData.parentId == '0' || !currentNodeData.parentId)
@@ -111,6 +112,7 @@
               size="mini"
               icon="el-icon-refresh"
               plain
+              :disabled="currentNodeData.approvalStatus != 2"
               @click="transformation('E')"
               v-if="
                 currentNodeData.bomType == 1 &&
@@ -124,6 +126,7 @@
               size="mini"
               icon="el-icon-refresh"
               plain
+              :disabled="currentNodeData.approvalStatus != 2"
               @click="transformation('M')"
               v-if="
                 currentNodeData.bomType == 1 &&
@@ -139,6 +142,7 @@
               size="mini"
               icon="el-icon-refresh"
               plain
+              :disabled="currentNodeData.approvalStatus != 2"
               @click="transformation('A')"
               v-if="
                 currentNodeData.bomType == 1 &&
@@ -738,17 +742,21 @@
         ULR({
           versions: this.searchObj.versions,
           categoryId: this.searchObj.categoryId
-        }).then((data) => {
-          if (data.code == '0') {
-            this.loadingInstance.close();
-            this.$message.success('转换成功');
+        })
+          .then((data) => {
+            if (data.code == '0') {
+              this.loadingInstance.close();
+              this.$message.success('转换成功');
 
-            this.currentNodeData.bomType = _type;
-            this.searchObj.versions = '';
-            this.getTreeData();
-            this.getVersion();
-          }
-        });
+              this.currentNodeData.bomType = _type;
+              this.searchObj.versions = '';
+              this.getTreeData();
+              this.getVersion();
+            }
+          })
+          .catch((err) => {
+            this.loadingInstance.close();
+          });
       },
 
       handleAdd() {

+ 3 - 3
src/views/material/product/components/index-data.vue

@@ -485,7 +485,7 @@
             },
             showOverflowTooltip: true
           },
-          
+
           {
             prop: 'measuringUnit',
             label: '计量单位',
@@ -627,8 +627,8 @@
           this.attributeList = res.data;
         }
       });
-      this.requestDict('生产类型');
-      this.getFieldModel();
+      // this.requestDict('生产类型');
+      // this.getFieldModel();
     },
 
     methods: {