Ver Fonte

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

yusheng há 10 meses atrás
pai
commit
15f25478ec

+ 2 - 0
src/api/system/file/index.js

@@ -188,6 +188,8 @@ export async function importPBom(data) {
   data.multiPartFiles.forEach((item, index) => {
     formData.append(`multiPartFiles`, item);
   });
+  formData.append(`categoryId`, data.categoryId);
+
   const res = await request.post(`/main/bomCategory/importPBom`, formData);
   if (res.data.code === '0') {
     return res.data;

+ 49 - 23
src/views/material/BOMmanage/components/detailedList.vue

@@ -38,6 +38,7 @@
             <el-input
               placeholder="请输入"
               v-model.number="attributeData.baseCount"
+              disabled
             >
               <template #append>
                 {{
@@ -90,7 +91,7 @@
       </template>
 
       <template v-slot:attributeType="{ row }">
-        <el-select
+        <!-- <el-select
           v-model="row.attributeType"
           filterable
           disabled
@@ -103,7 +104,8 @@
             :value="item.value"
             :label="item.label"
           ></el-option>
-        </el-select>
+        </el-select> -->
+        {{ attributeTypeText(row.attributeType) }}
       </template>
 
       <template v-slot:componentAttribute="{ row }">
@@ -428,22 +430,22 @@
         ],
 
         attributeList: [
-          {
-            label: '总装',
-            value: 1
-          },
-          {
-            label: '部件',
-            value: 2
-          },
-          {
-            label: '零件',
-            value: 3
-          },
-          {
-            label: '原材料',
-            value: 4
-          }
+          // {
+          //   label: '总装',
+          //   value: 1
+          // },
+          // {
+          //   label: '部件',
+          //   value: 2
+          // },
+          // {
+          //   label: '零件',
+          //   value: 3
+          // },
+          // {
+          //   label: '原材料',
+          //   value: 4
+          // }
         ],
 
         sxtList: [
@@ -521,6 +523,10 @@
           {
             label: '废品',
             value: 28
+          },
+          {
+            label: '周转车',
+            value: 7
           }
         ],
 
@@ -539,6 +545,7 @@
     },
 
     created() {
+      this.getAttriButeList('inventory_type');
       // this.getDictList('productionType');
       // this.getZeroPartPros('zeroPartPros');
       this.getContactList();
@@ -606,18 +613,37 @@
     //   }
     // },
 
-    mounted() {
-      console.log(this.attributeData, 'attributeData');
-      console.log(this.isWt, 'isWt');
-    },
+    mounted() {},
 
     methods: {
+      attributeTypeText(v) {
+        if (v) {
+          let a = this.attributeList.find((item) => item.value == v);
+          return a.label;
+        }
+      },
+
+      async getAttriButeList(code) {
+        let { data: res } = await getByCode(code);
+        this.attributeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
       rootCategoryLevelIdText(v) {
         console.log(v, '111111');
+        console.log(
+          this.rootCategoryLevelIdList,
+          'this.rootCategoryLevelIdList'
+        );
 
         if (v) {
           let a = this.rootCategoryLevelIdList.find((item) => item.value == v);
-          return a.label;
+          return a ? a.label : '';
         }
       },
 

+ 20 - 2
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -1253,12 +1253,14 @@
         );
       },
       determineChoose(title, row, idx) {
+        console.log('111111111111111');
         let type = '';
         if (this.activeName === '材料定额') {
           type = 'materialQuota';
         } else if (this.activeName === '制造资源') {
           type = 'resource';
         }
+
         if (title == '选择物料') {
           this.$set(
             this.tableData.taskParam[this.currentIndex][type][idx],
@@ -1295,6 +1297,11 @@
             'modelType',
             row.modelType
           );
+          this.$set(
+            this.tableData.taskParam[this.currentIndex][type][idx],
+            'rootCategoryLevelId',
+            row.categoryLevelPathIdParent
+          );
         }
       },
       uploadedSuccess(data, row) {
@@ -1464,13 +1471,18 @@
 
         this.tableData.taskParam[this.currentIndex][type].push({
           subCode,
+          bomArtFiles: '',
           categoryId: '',
           categoryName: '',
           isReworkBom: 0,
           brandNum: '',
           count: '',
           modelType: '',
-          unit: ''
+          unit: '',
+          rootCategoryLevelId: '',
+          categoryCode: '',
+          id: '',
+          specification: ''
         });
       },
       /* 表格数据源 */
@@ -1613,6 +1625,12 @@
         this.resourceBomId = resourceBomId;
         this.attributeData = attributeData;
 
+        if (this.attributeData) {
+          this.form.baseCount = this.attributeData.baseCount;
+        } else {
+          this.form.baseCount = 1;
+        }
+
         if (!this.isView) {
           this.columns = this.defaultColumns.concat({
             columnKey: 'action',
@@ -1645,7 +1663,7 @@
 
         console.log(rowData, 'rowData');
 
-        this.form.baseCount = rowData.baseCount || 1;
+        // this.form.baseCount = rowData.baseCount || 1;
         this.form.baseCountUnit = rowData.baseCountUnit;
 
         this.baseCount2 = rowData.baseCount2;

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

@@ -3,6 +3,7 @@
     <el-drawer
       title=""
       :visible.sync="drawer"
+      v-if="drawer"
       :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
       :before-close="handleClose"
       :with-header="false"
@@ -63,7 +64,9 @@
                 (currentNodeData.approvalStatus == 0 ||
                   currentNodeData.approvalStatus == 3) &&
                 $hasPermission('main:categoryparam:deleteBom') &&
-                (currentNodeData.parentId == '0' || !currentNodeData.parentId)
+                (currentNodeData.parentId == '0' ||
+                  !currentNodeData.parentId) &&
+                isNotData
               "
             >
               删除
@@ -93,7 +96,6 @@
               plain
               >导入</el-button
             >
-
             <el-button
               type="primary"
               size="mini"
@@ -103,7 +105,9 @@
               :disabled="currentNodeData.approvalStatus != 2"
               v-if="
                 currentNodeData.bomType == 4 &&
-                (currentNodeData.parentId == '0' || !currentNodeData.parentId)
+                (currentNodeData.parentId == '0' ||
+                  !currentNodeData.parentId) &&
+                isNotData
               "
               >转换PBOM</el-button
             >
@@ -161,7 +165,9 @@
               v-if="
                 (currentNodeData.approvalStatus == 0 ||
                   currentNodeData.approvalStatus == 3) &&
-                (currentNodeData.parentId == '0' || !currentNodeData.parentId)
+                (currentNodeData.parentId == '0' ||
+                  !currentNodeData.parentId) &&
+                isNotData
               "
             >
               提交发布
@@ -235,7 +241,7 @@
                 style="width: 70%; margin: 6px 0"
                 v-model="searchObj.versions"
                 placeholder="请选择bom版本"
-                @change="getTreeData"
+                @change="getTreeDataList"
                 :disabled="isWt"
               >
                 <el-option
@@ -255,7 +261,7 @@
                 filterable
                 multiple
                 placeholder="请选择属性类型"
-                @change="getTreeData"
+                @change="getTreeDataList"
                 :disabled="isWt"
               >
                 <el-option
@@ -387,6 +393,7 @@
     <importDialog
       :defModule="moudleName"
       ref="importDialogRef"
+      :categoryId="searchObj.categoryId"
       @success="getTreeData"
     />
 
@@ -539,17 +546,19 @@
           this.currentNodeData.bomType = row.bomType;
         }
         this.drawer = true;
+        this.treeList = [];
 
         if (
-          this.currentNodeData.bomType == 2 ||
-          this.currentNodeData.bomType == 3
+          (this.currentNodeData.bomType == 2 ||
+            this.currentNodeData.bomType == 3) &&
+          !this.isWt
         ) {
           this.searchObj.componentAttribute = [1];
         } else {
           this.searchObj.componentAttribute = [];
         }
 
-        this.getTreeData();
+        // this.getTreeData();
         this.getVersion();
       },
 
@@ -561,6 +570,12 @@
           isProduct: false,
           isTemp: 0
         };
+
+        this.currentNodeData = {
+          bomType: 1,
+          children: [],
+          parentId: ''
+        };
         this.activeName = '属性';
         this.drawer = false;
       },
@@ -587,29 +602,43 @@
       bomChange(e) {
         this.searchObj.versions = '';
         this.searchObj.componentAttribute = [];
+        this.treeList = [];
+
+        // this.currentNodeData = {
+        //   children: [],
+        //   parentId: ''
+        // };
+
         this.currentNodeData.bomType = e;
 
         if (
-          this.currentNodeData.bomType == 2 ||
-          this.currentNodeData.bomType == 3
+          (this.currentNodeData.bomType == 2 ||
+            this.currentNodeData.bomType == 3) &&
+          !this.isWt
         ) {
           this.searchObj.componentAttribute = [1];
         } else {
           this.searchObj.componentAttribute = [];
         }
 
-        this.getTreeData();
+        // this.getTreeData();
         this.getVersion();
       },
 
+      getTreeDataList() {
+        if (this.searchObj.versions) {
+          this.getTreeData();
+        } else {
+          this.getVersion();
+        }
+      },
+
       async getTreeData() {
         try {
           this.treeLoading = true;
 
           let componentAttribute = '';
 
-          console.log(this.searchObj.componentAttribute);
-
           if (
             this.searchObj.componentAttribute &&
             this.searchObj.componentAttribute.length != 0
@@ -683,13 +712,21 @@
           this.versList = res || [];
           if (type == 'del' || type == 'add') {
             if (this.versList.length >= 1) {
+              // if (!this.searchObj.versions) {
               this.searchObj.versions =
                 this.versList[this.versList.length - 1].versions;
+              // }
+              this.getTreeData();
             } else {
               this.searchObj.versions = '';
+              this.isNotData = false;
+            }
+          } else {
+            if (this.versList.length != 0) {
+              this.getTreeData();
+            } else {
+              this.isNotData = false;
             }
-
-            this.getTreeData();
           }
         });
       },
@@ -751,7 +788,7 @@
 
               this.currentNodeData.bomType = _type;
               this.searchObj.versions = '';
-              this.getTreeData();
+              // this.getTreeData();
               this.getVersion();
             }
           })
@@ -777,7 +814,8 @@
       },
 
       handleRefresh() {
-        this.getTreeData();
+        this.getVersion();
+        // this.getTreeData();
       },
 
       handSubmit() {

+ 474 - 419
src/views/material/BOMmanage/index.vue

@@ -1,11 +1,15 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <BOMSearch @search="reload" :statusOpt="statusOpt" :categoryCode="where.categoryCode" />
+      <BOMSearch
+        @search="reload"
+        :statusOpt="statusOpt"
+        :categoryCode="where.categoryCode"
+      />
 
       <!--  -->
-      
-      <el-tabs v-model="activeName" type="border-card"  @tab-click="handleClick">
+
+      <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
         <el-tab-pane label="EBOM" name="4"> </el-tab-pane>
         <el-tab-pane label="PBOM" name="1"> </el-tab-pane>
         <el-tab-pane label="MBOM" name="2"> </el-tab-pane>
@@ -22,39 +26,61 @@
           :cache-key="cacheKeyUrl"
         >
           <template v-slot:approvalStatus="{ row }">
-            <el-link type="primary" :underline="false" @click="handleDetails(row)">
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="handleDetails(row)"
+            >
               {{ approvalStatusOpt[+row.approvalStatus] }}
             </el-link>
           </template>
 
-          <template v-slot:versions="{ row }">
-            V{{ row.versions }}.0
-          </template>
+          <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
           <template v-slot:isTemp="{ row }">
             <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
           </template>
 
-
           <template v-slot:rootCategoryLevelId="{ row }">
-            {{  rootCategoryLevelIdText(row.rootCategoryLevelId) }}
+            {{ rootCategoryLevelIdText(row.rootCategoryLevelId) }}
           </template>
           <template v-slot:componentAttribute="{ row }">
-            <el-select v-model="row.componentAttribute" filterable multiple disabled class="ele-block" size="mini">
-            <el-option v-for="item in sxtList" :key="item.value" :value="item.value" :label="item.label"></el-option>
+            <el-select
+              v-model="row.componentAttribute"
+              filterable
+              multiple
+              disabled
+              class="ele-block"
+              size="mini"
+            >
+              <el-option
+                v-for="item in sxtList"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              ></el-option>
             </el-select>
             <!-- {{  attributeTypeText(row.attributeType) }} -->
-
           </template>
 
           <template v-slot:attributeType="{ row }">
-    
-            {{  attributeTypeText(row.attributeType) }}
-
+            {{ attributeTypeText(row.attributeType) }}
           </template>
 
           <template v-slot:produceType="{ row }">
-            <el-select v-model="row.produceType" filterable multiple disabled class="ele-block" size="mini">
-            <el-option v-for="item in produceTypeList" :key="item.value" :value="item.value" :label="item.label"></el-option>
+            <el-select
+              v-model="row.produceType"
+              filterable
+              multiple
+              disabled
+              class="ele-block"
+              size="mini"
+            >
+              <el-option
+                v-for="item in produceTypeList"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              ></el-option>
             </el-select>
           </template>
 
@@ -62,12 +88,28 @@
           <template v-slot:action="{ row }">
             <el-link type="primary" @click="handelDetail(row)">详情</el-link>
 
-            <el-link v-if="row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)&&$hasPermission('main:bomcategory:delete')" type="primary"
-              @click="handSubmit(row)">发布</el-link>
-
-            <el-link type="danger" :underline="false"
-              v-if="activeName == 1 && row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)&&$hasPermission('main:bomcategory:delete')"
-              @click="handDel(row)">
+            <el-link
+              v-if="
+                row.status != 1 &&
+                (row.approvalStatus == 0 || row.approvalStatus == 3) &&
+                $hasPermission('main:bomcategory:delete')
+              "
+              type="primary"
+              @click="handSubmit(row)"
+              >发布</el-link
+            >
+
+            <el-link
+              type="danger"
+              :underline="false"
+              v-if="
+                activeName == 1 &&
+                row.status != 1 &&
+                (row.approvalStatus == 0 || row.approvalStatus == 3) &&
+                $hasPermission('main:bomcategory:delete')
+              "
+              @click="handDel(row)"
+            >
               删除
             </el-link>
           </template>
@@ -75,7 +117,13 @@
       </el-tabs>
     </el-card>
 
-    <el-dialog title="发布" :visible.sync="isSubmit" v-if="isSubmit" width="30%" center>
+    <el-dialog
+      title="发布"
+      :visible.sync="isSubmit"
+      v-if="isSubmit"
+      width="30%"
+      center
+    >
       <div>
         <el-radio v-model="radioSubmit" :label="1">药品</el-radio>
         <el-radio v-model="radioSubmit" :label="2">器械</el-radio>
@@ -93,444 +141,451 @@
 </template>
 
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
-import { produceTypeList } from '@/enum/dict.js';
-
-import BOMSearch from './components/BOM-search.vue';
-import {
-  getBomPageList,
-  startAndStop,
-  bomSubmit,
-  jsBomSubmit,
-  deviceBomSubmit,
-  deleteBomTreeList
-} from '@/api/material/BOM';
-import LCdetail from './components/LCdetail.vue';
-import { getByCode } from '@/api/system/dictionary-data';
-import BomDetailsPop from '../BOMmanage/detailsPop.vue'
-export default {
-  name: 'SystemDictionary',
-  components: { BOMSearch, LCdetail, BomDetailsPop },
-  mixins: [tabMixins],
-  data() {
-    return {
-      produceTypeList,
-      // 表格列配置
-      columns: [
-        {
-          label: '序号',
-          columnKey: 'index',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'code',
-          label: 'BOM编码',
-          showOverflowTooltip: true,
-          slot: 'code',
-          sortable: true
-        },
-        {
-          prop: 'name',
-          label: 'BOM名称',
-          showOverflowTooltip: true,
-          slot: 'name',
-          sortable: true
-        },
-        {
-          prop: 'categoryCode',
-          label: '编码',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryName',
-          label: '名称',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'modelType',
-          label: '型号',
-          showOverflowTooltip: true
-        },
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import { produceTypeList } from '@/enum/dict.js';
+
+  import BOMSearch from './components/BOM-search.vue';
+  import {
+    getBomPageList,
+    startAndStop,
+    bomSubmit,
+    jsBomSubmit,
+    deviceBomSubmit,
+    deleteBomTreeList
+  } from '@/api/material/BOM';
+  import LCdetail from './components/LCdetail.vue';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import BomDetailsPop from '../BOMmanage/detailsPop.vue';
+  export default {
+    name: 'SystemDictionary',
+    components: { BOMSearch, LCdetail, BomDetailsPop },
+    mixins: [tabMixins],
+    data() {
+      return {
+        produceTypeList,
+        // 表格列配置
+        columns: [
+          {
+            label: '序号',
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: 'BOM编码',
+            showOverflowTooltip: true,
+            slot: 'code',
+            sortable: true
+          },
+          {
+            prop: 'name',
+            label: 'BOM名称',
+            showOverflowTooltip: true,
+            slot: 'name',
+            sortable: true
+          },
+          {
+            prop: 'categoryCode',
+            label: '编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryName',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'rootCategoryLevelId',
+            slot: 'rootCategoryLevelId',
+            label: '物品分类',
+            showOverflowTooltip: true
+          },
+          {
+            slot: 'componentAttribute',
+            prop: 'componentAttribute',
+            label: '属性类型',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            slot: 'attributeType',
+            prop: 'attributeType',
+            label: '存货类型',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'produceType',
+            slot: 'produceType',
+            label: '生产类型',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+
+          {
+            prop: 'versions',
+            slot: 'versions',
+            label: '版本'
+          },
+          {
+            prop: 'status ',
+            label: '状态',
+            formatter: (row) => {
+              return this.statusOpt[+row.status];
+            }
+          },
+          {
+            prop: 'approvalStatus',
+            label: '审核状态',
+            slot: 'approvalStatus'
+          },
+
+          // {
+          //   width: 100,
+          //   prop: 'isTemp',
+          //   slot: 'isTemp',
+          //   label: '主数据'
+          // },
+
+          {
+            prop: 'createName',
+            label: '创建人',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            showOverflowTooltip: true,
+            slot: 'createTime',
+            sortable: true
+          },
+          {
+            columnKey: 'action',
+            slot: 'action',
+            label: '操作'
+          }
+        ],
+        sxtList: [
+          {
+            label: '自制件',
+            value: 1
+          },
+          {
+            label: '采购件',
+            value: 2
+          },
+          {
+            label: '外协件',
+            value: 3
+          },
+          {
+            label: '受托件',
+            value: 4
+          }
+        ],
+        statusOpt: {
+          0: '草稿',
+          1: '已发布',
+          2: '已停用'
+        },
+
+        approvalStatusOpt: {
+          0: '未提交',
+          1: '审核中',
+          2: '审核通过',
+          3: '审核不通过'
+        },
+        loading: false,
+        loadingInstance: null,
+        dictList: [],
+        where: {},
+        attributeList: [
+          // {
+          //   label: '总装',
+          //   value: 1
+          // },
+          // {
+          //   label: '部件',
+          //   value: 2
+          // },
+          // {
+          //   label: '零件',
+          //   value: 3
+          // },
+          // {
+          //   label: '原材料',
+          //   value: 4
+          // }
+        ],
+        sort: {},
+        rootCategoryLevelIdList: [
+          {
+            label: '产品',
+            value: 9
+          },
+          {
+            label: '物料',
+            value: 1
+          },
+          {
+            label: '生产设备',
+            value: 4
+          },
+          {
+            label: '模具',
+            value: 5
+          },
+          {
+            label: '备品备件',
+            value: 6
+          },
+          {
+            label: '零部件',
+            value: 3
+          },
+          {
+            label: '舟皿',
+            value: 8
+          },
+          {
+            label: '消耗材料',
+            value: 10
+          },
+          {
+            label: '包装材料',
+            value: 13
+          },
+          {
+            label: '生产辅助设备',
+            value: 14
+          },
+          {
+            label: '仪表计量设备',
+            value: 15
+          },
+          {
+            label: '会计科目',
+            value: 23
+          },
+          {
+            label: '周转盘',
+            value: 26
+          },
+          {
+            label: '废品',
+            value: 28
+          }
+        ],
 
-        {
-          prop: 'rootCategoryLevelId',
-          slot: 'rootCategoryLevelId',
-          label: '物品分类',
-          showOverflowTooltip: true
-        },
-        {
-          slot: 'componentAttribute',
-          prop: 'componentAttribute',
-          label: '属性类型',
-          showOverflowTooltip: true,
-          minWidth: 100,
-        },
-        {
-          slot: 'attributeType',
-          prop: 'attributeType',
-          label: '存货类型',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'produceType',
-          slot: 'produceType',
-          label: '生产类型',
-          showOverflowTooltip: true,
-          minWidth: 100,
-        },
+        activeName: '1',
 
+        isSubmit: false,
+        JsRId: null,
+        radioSubmit: 1,
 
-        {
-          prop: 'versions',
-          slot: 'versions',
-          label: '版本'
-        },
-        {
-          prop: 'status ',
-          label: '状态',
-          formatter: (row) => {
-            return this.statusOpt[+row.status];
-          }
-        },
-        {
-          prop: 'approvalStatus',
-          label: '审核状态',
-          slot: 'approvalStatus'
-        },
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '68be265a-material-BOMmanage'
+      };
+    },
 
-        // {
-        //   width: 100,
-        //   prop: 'isTemp',
-        //   slot: 'isTemp',
-        //   label: '主数据'
-        // },
-
-        {
-          prop: 'createName',
-          label: '创建人',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'createTime',
-          label: '创建日期',
-          showOverflowTooltip: true,
-          slot: 'createTime',
-          sortable: true
-        },
-        {
-          columnKey: 'action',
-          slot: 'action',
-          label: '操作'
+    computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+
+    created() {
+      this.getDictList('productionType');
+      this.getAttriButeList('inventory_type');
+    },
+    methods: {
+      attributeTypeText(v) {
+        if (v) {
+          let a = this.attributeList.find((item) => item.value == v);
+          return a.label;
         }
-      ],
-      sxtList: [
-        {
-          label: '自制件',
-          value: 1
-        },
-        {
-          label: '采购件',
-          value: 2
-        },
-        {
-          label: '外协件',
-          value: 3
-        },
-        {
-          label: '受托件',
-          value: 4
+      },
+      rootCategoryLevelIdText(v) {
+        if (v) {
+          let a = this.rootCategoryLevelIdList.find((item) => item.value == v);
+          if (a) return a.label;
         }
-      ],
-      statusOpt: {
-        0: '草稿',
-        1: '已发布',
-        2: '已停用'
       },
 
-      approvalStatusOpt: {
-        0: '未提交',
-        1: '审核中',
-        2: '审核通过',
-        3: '审核不通过'
+      async getAttriButeList(code) {
+        let { data: res } = await getByCode(code);
+        this.attributeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
       },
-      loading: false,
-      loadingInstance: null,
-      dictList:[],
-      where: {},
-      attributeList: [
-        {
-          label: '总装',
-          value: 1
-        },
-        {
-          label: '部件',
-          value: 2
-        },
-        {
-          label: '零件',
-          value: 3
-        },
-        {
-          label: '原材料',
-          value: 4
-        }
-      ],
-      sort:{},
-      rootCategoryLevelIdList: [
-        {
-          label: '产品',
-          value: 9
-        },
-        {
-          label: '物料',
-          value: 1
-        },
-        {
-          label: '生产设备',
-          value: 4
-        },
-        {
-          label: '模具',
-          value: 5
-        },
-        {
-          label: '备品备件',
-          value: 6
-        },
-        {
-          label: '零部件',
-          value: 3
-        },
-        {
-          label: '舟皿',
-          value: 8
-        },
-        {
-          label: '消耗材料',
-          value: 10
-        },
-        {
-          label: '包装材料',
-          value: 13
-        },
-        {
-          label: '生产辅助设备',
-          value: 14
-        },
-        {
-          label: '仪表计量设备',
-          value: 15
-        },
-        {
-          label: '会计科目',
-          value: 23
-        },
-        {
-          label: '周转盘',
-          value: 26
-        },
-        {
-          label: '废品',
-          value: 28
-        },
-      
-      ],
-
-      activeName: '1',
 
-      isSubmit: false,
-      JsRId: null,
-      radioSubmit: 1,
-
-      pageSize: this.$store.state.tablePageSize,
-      cacheKeyUrl: '68be265a-material-BOMmanage'
-    };
-  },
-
-  computed: {
-    clientEnvironmentId() {
-      return this.$store.state.user.info.clientEnvironmentId;
-    }
-  },
-
-  created() {
-    this.getDictList('productionType');
-  },
-  methods: {
-    attributeTypeText(v){
-      if(v){
-        let a = this.attributeList.find(item=>item.value==v)
-        return a.label
-      }
-    },
-    rootCategoryLevelIdText(v){
-      if(v){
-        let a = this.rootCategoryLevelIdList.find(item=>item.value==v)
-        if(a) return a.label
-      }
-    },
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
 
-    async getDictList(code) {
-      let { data: res } = await getByCode(code);
-      this.dictList = res.map((item) => {
-        let values = Object.keys(item);
-        return {
-          value: Number(values[0]),
-          label: item[values[0]]
-        };
-      });
-    },
+      handSubmit(row) {
+        if (this.clientEnvironmentId == 5) {
+          this.JsRId = row.id;
+          this.isSubmit = true;
+        } else {
+          this.$alert('确定要发布吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
+            .then(() => {
+              bomSubmit({ businessId: row.id }).then((res) => {
+                if (res?.code == '0') {
+                  this.$message.success('发布成功');
+                  this.reload();
+                }
+              });
+            })
+            .catch(() => {});
+        }
+      },
 
-    handSubmit(row) {
-      if (this.clientEnvironmentId == 5) {
-        this.JsRId = row.id;
-        this.isSubmit = true;
-      } else {
+      handJsSubmit() {
+        let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
         this.$alert('确定要发布吗?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
         })
           .then(() => {
-            bomSubmit({ businessId: row.id }).then((res) => {
-              if (res?.code == '0') {
-                this.$message.success('发布成功');
-                this.reload();
-              }
-
+            URL({ businessId: this.JsRId }).then((res) => {
+              this.isSubmit = false;
+              this.$message.success('发布成功');
+              this.reload();
             });
           })
-          .catch(() => { });
-      }
-    },
-
-    handJsSubmit() {
-      let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
-      this.$alert('确定要发布吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          URL({ businessId: this.JsRId }).then((res) => {
-            this.isSubmit = false;
-            this.$message.success('发布成功');
-            this.reload();
-
-          });
-        })
-        .catch(() => { });
-    },
-
-    /* 表格数据源 */
-    datasource({ where, page, limit }) {
-      return getBomPageList({
-        ...where,
-        ...this.sort,
-        bomType: Number(this.activeName),
-        isTemp: true,
-        pageNum: page,
-        size: limit
-      });
-    },
-    handelDetail(row) {
-      let rowData = {
-        categoryId: row.categoryId,
-        categoryName: row.categoryName,
-        code: row.code,
-        versions: row.versions,
-        rootPathIdParent: row.categoryLevelPathIdParent,
-        isProduct: true,
-        bomType: Number(this.activeName),
-        isTemp: row.isTemp
-        
-      };
-      this.$refs.bomDrawer.open(rowData);
+          .catch(() => {});
+      },
 
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ where });
-    },
+      /* 表格数据源 */
+      datasource({ where, page, limit }) {
+        return getBomPageList({
+          ...where,
+          ...this.sort,
+          bomType: Number(this.activeName),
+          isTemp: true,
+          pageNum: page,
+          size: limit
+        });
+      },
+      handelDetail(row) {
+        console.log(row.versions, 'row.versions');
+        let rowData = {
+          categoryId: row.categoryId,
+          categoryName: row.categoryName,
+          code: row.code,
+          versions: row.versions,
+          rootPathIdParent: row.categoryLevelPathIdParent,
+          isProduct: true,
+          bomType: Number(this.activeName),
+          isTemp: row.isTemp
+        };
+        this.$refs.bomDrawer.open(rowData);
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ where });
+      },
 
-    handleClick(tab) {
-      this.activeName = tab.name;
-      this.reload();
-    },
+      handleClick(tab) {
+        this.activeName = tab.name;
+        this.reload();
+      },
 
-    onSortChange(e) {
-        console.log(111111111,e);
+      onSortChange(e) {
+        console.log(111111111, e);
 
-      let sort = {
-        orderBy: e.order,
-          sortName: e.prop,
-      };
-      this.sort = sort;
-      this.reload();
-    },
+        let sort = {
+          orderBy: e.order,
+          sortName: e.prop
+        };
+        this.sort = sort;
+        this.reload();
+      },
 
-    handDel(row) {
-      this.$confirm('是否确认删除?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          deleteBomTreeList([row.id]).then(() => {
-            this.reload();
-          });
+      handDel(row) {
+        this.$confirm('是否确认删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         })
-        .catch(() => {
-          this.$message({
-            type: 'info',
-            message: '已取消删除'
+          .then(() => {
+            deleteBomTreeList([row.id]).then(() => {
+              this.reload();
+            });
+          })
+          .catch(() => {
+            this.$message({
+              type: 'info',
+              message: '已取消删除'
+            });
           });
-        });
-    },
+      },
 
-    handleDetails(row) {
-      if (!row.processInstanceId) {
-        this.$message.info('未提交没有审核流程');
-      } else {
-        this.$refs.detailRef.open(row.processInstanceId);
+      handleDetails(row) {
+        if (!row.processInstanceId) {
+          this.$message.info('未提交没有审核流程');
+        } else {
+          this.$refs.detailRef.open(row.processInstanceId);
+        }
       }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.ele-body {
-  height: 100%;
-
-  ::v-deep .el-card {
+  .ele-body {
     height: 100%;
 
-    .el-card__body {
+    ::v-deep .el-card {
       height: 100%;
-      display: flex;
-      flex-direction: column;
 
-      .dict-table {
-        flex: 1;
-        overflow: hidden;
+      .el-card__body {
+        height: 100%;
         display: flex;
         flex-direction: column;
 
-        .el-table {
+        .dict-table {
           flex: 1;
-          overflow-y: auto;
+          overflow: hidden;
+          display: flex;
+          flex-direction: column;
+
+          .el-table {
+            flex: 1;
+            overflow-y: auto;
+          }
         }
       }
     }
   }
-}
 </style>

+ 19 - 10
src/views/material/BOMmanage/qualityTesting/import-dialog.vue

@@ -56,7 +56,11 @@
 
   export default {
     props: {
-      defModule: ''
+      defModule: '',
+      categoryId: {
+        type: String,
+        default: ''
+      }
     },
     //注册组件
     data() {
@@ -117,16 +121,21 @@
 
         await importPBom({
           module: this.module,
-          multiPartFiles: this.attaments
-        });
-
-        setTimeout(() => {
-          this.loading = false;
-        }, 10000);
+          multiPartFiles: this.attaments,
+          categoryId: this.categoryId
+        })
+          .then((res) => {
+            setTimeout(() => {
+              this.loading = false;
+            }, 2000);
 
-        this.$message.success('操作成功!');
-        this.dialogVisible = false;
-        this.$emit('success');
+            this.$message.success('操作成功!');
+            this.dialogVisible = false;
+            this.$emit('success');
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
       }
     }
   };

+ 18 - 3
src/views/material/BOMmanage/qualityTesting/inspectionClassify/components/user-search.vue

@@ -8,8 +8,22 @@
   >
     <el-row :gutter="15">
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-        <el-form-item label="质检名称:">
-          <el-input clearable v-model="where.name" placeholder="请输入" />
+        <el-form-item label="参数名称:">
+          <el-input
+            clearable
+            v-model="where.inspectionName"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="参数编码:">
+          <el-input
+            clearable
+            v-model="where.inspectionCode"
+            placeholder="请输入"
+          />
         </el-form-item>
       </el-col>
 
@@ -51,7 +65,8 @@
     data() {
       // 默认表单数据
       const defaultWhere = {
-        name: '',
+        inspectionName: '',
+        inspectionCode: '',
         status: 1
       };
 

+ 229 - 219
src/views/material/product/oneProduct.vue

@@ -45,14 +45,19 @@
                       </div>
                     </el-form-item>
                   </el-col>
-                  <el-col v-bind="styleResponsive ? { sm: 3 } : { span: 3 }">
+                  <el-col v-bind="styleResponsive ? { sm: 4 } : { span: 4 }">
                     <el-form-item label="状态:">
                       <div class="ele-text-secondary">
-                        {{ current.isEnabled == 0 ? '停用' : current.isEnabled == 1 ? '启用' : '' }}
+                        {{
+                          current.isEnabled == 0
+                            ? '停用'
+                            : current.isEnabled == 1
+                            ? '启用'
+                            : ''
+                        }}
                       </div>
                     </el-form-item>
                   </el-col>
-
                 </el-row>
                 <el-row :gutter="15" v-else>
                   <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
@@ -79,10 +84,16 @@
                     </el-form-item>
                   </el-col>
 
-                  <el-col v-bind="styleResponsive ? { sm: 3 } : { span: 3 }">
+                  <el-col v-bind="styleResponsive ? { sm: 4 } : { span: 4 }">
                     <el-form-item label="状态:">
                       <div class="ele-text-secondary">
-                        {{ current.isEnabled == 0 ? '停用' : current.isEnabled == 1 ? '启用' : '' }}
+                        {{
+                          current.isEnabled == 0
+                            ? '停用'
+                            : current.isEnabled == 1
+                            ? '启用'
+                            : ''
+                        }}
                       </div>
                     </el-form-item>
                   </el-col>
@@ -90,8 +101,8 @@
               </el-form>
             </div>
 
-            <IndexSearch  ref="searchRef"  @search="reload" />
-            
+            <IndexSearch ref="searchRef" @search="reload" />
+
             <!-- //产品 -->
             <IndexData
               ref="listData"
@@ -106,7 +117,6 @@
               lyType="cp"
             >
             </IndexData>
-            
           </div>
         </template>
       </ele-split-layout>
@@ -114,243 +124,243 @@
   </div>
 </template>
 <script>
-import IndexData from './components/index-data.vue';
-import IndexSearch from './components/index-search.vue';
-
-import dictMixins from '@/mixins/dictMixins';
-import { getTreeByPid } from '@/api/classifyManage';
-
-import { getInfoById } from '@/api/classifyManage';
-
-import { deepClone } from '@/utils';
-
-export default {
-  components: {
-    IndexData,
-    IndexSearch
-  },
-  mixins: [dictMixins],
-  data() {
-    return {
-      loading: false,
-      current: {},
-      curNode: {},
-      currentData: {},
-      treeList: [],
-      treeLoading: false,
-      formData: {},
-      rootTreeId: null,
-      defaultProps: {
-        children: 'children',
-        label: 'name'
-      }
-    };
-  },
+  import IndexData from './components/index-data.vue';
+  import IndexSearch from './components/index-search.vue';
 
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    },
+  import dictMixins from '@/mixins/dictMixins';
+  import { getTreeByPid } from '@/api/classifyManage';
 
-    rootId() {
-      return this.$route.query.id;
-    },
+  import { getInfoById } from '@/api/classifyManage';
 
-    fullName() {
-      let str = '';
-      let codeStr = '';
-      let node = this.curNode;
-      while (node?.data?.name) {
-        str = node.data.name + '-' + str;
-        codeStr = node.data.code + '-' + codeStr;
-        node = node?.parent;
-      }
+  import { deepClone } from '@/utils';
 
-      return str.substring(str, str.length - 1);
-    }
-  },
-  created() {
-    this.getTreeData();
-  },
-  methods: {
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
-
-        const res = await getTreeByPid(9);
-        this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
-
-          if (!this.$route.query.categoryLevelId) {
-            this.$nextTick(() => {
-              //默认高亮第一级树节点;
-              if (this.treeList[0]) {
-                this.rootTreeId = this.treeList[0].id;
-                this.getDetail(this.treeList[0].id);
-                console.log(this.treeList[0].id, 'rootTreeId');
-                this.publicfun(this.treeList[0]);
-              }
-            });
-          } else {
-            this.getDetail(this.$route.query.categoryLevelId);
-            this.$nextTick(() => {
-              this.$refs.treeRef.setCurrentKey(
-                this.$route.query.categoryLevelId
-              );
-            });
-            const objByid = this.findNodeById(
-              this.treeList,
-              this.$route.query.categoryLevelId
-            );
-            console.log(objByid, '当前选择的产品');
-            this.publicfun(objByid);
-          }
-          return this.treeList;
+  export default {
+    components: {
+      IndexData,
+      IndexSearch
+    },
+    mixins: [dictMixins],
+    data() {
+      return {
+        loading: false,
+        current: {},
+        curNode: {},
+        currentData: {},
+        treeList: [],
+        treeLoading: false,
+        formData: {},
+        rootTreeId: null,
+        defaultProps: {
+          children: 'children',
+          label: 'name'
         }
-      } catch (error) {}
-      this.treeLoading = false;
+      };
     },
 
-    async getDetail(id) {
-      this.loading = true;
-      const res = await getInfoById(id);
-      this.loading = false;
-      if (res.code == '0') {
-        this.current = res.data;
-        this.$nextTick(() => {
-          this.$refs.treeRef.setCurrentKey(this.current.id);
-        });
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+
+      rootId() {
+        return this.$route.query.id;
+      },
+
+      fullName() {
+        let str = '';
+        let codeStr = '';
+        let node = this.curNode;
+        while (node?.data?.name) {
+          str = node.data.name + '-' + str;
+          codeStr = node.data.code + '-' + codeStr;
+          node = node?.parent;
+        }
+
+        return str.substring(str, str.length - 1);
       }
     },
-
-    findNodeById(tree, targetId) {
-      function traverse(nodes) {
-        for (let node of nodes) {
-          if (node.id === targetId) {
-            return node;
-          } else if (node.children && node.children.length > 0) {
-            const foundNode = traverse(node.children);
-            if (foundNode) {
-              return foundNode;
+    created() {
+      this.getTreeData();
+    },
+    methods: {
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await getTreeByPid(9);
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+
+            if (!this.$route.query.categoryLevelId) {
+              this.$nextTick(() => {
+                //默认高亮第一级树节点;
+                if (this.treeList[0]) {
+                  this.rootTreeId = this.treeList[0].id;
+                  this.getDetail(this.treeList[0].id);
+                  console.log(this.treeList[0].id, 'rootTreeId');
+                  this.publicfun(this.treeList[0]);
+                }
+              });
+            } else {
+              this.getDetail(this.$route.query.categoryLevelId);
+              this.$nextTick(() => {
+                this.$refs.treeRef.setCurrentKey(
+                  this.$route.query.categoryLevelId
+                );
+              });
+              const objByid = this.findNodeById(
+                this.treeList,
+                this.$route.query.categoryLevelId
+              );
+              console.log(objByid, '当前选择的产品');
+              this.publicfun(objByid);
             }
+            return this.treeList;
           }
+        } catch (error) {}
+        this.treeLoading = false;
+      },
+
+      async getDetail(id) {
+        this.loading = true;
+        const res = await getInfoById(id);
+        this.loading = false;
+        if (res.code == '0') {
+          this.current = res.data;
+          this.$nextTick(() => {
+            this.$refs.treeRef.setCurrentKey(this.current.id);
+          });
+        }
+      },
+
+      findNodeById(tree, targetId) {
+        function traverse(nodes) {
+          for (let node of nodes) {
+            if (node.id === targetId) {
+              return node;
+            } else if (node.children && node.children.length > 0) {
+              const foundNode = traverse(node.children);
+              if (foundNode) {
+                return foundNode;
+              }
+            }
+          }
+          return null;
         }
-        return null;
-      }
-
-      return traverse(tree);
-    },
-    handleNodeClick(data, node) {
-      this.$route.query.categoryLevelId = '';
-
-        if(this.$refs.searchRef) {
-        this.$refs.searchRef.resetAllSearch();
-      }
-
-      this.curNode = node;
-      this.publicfun(data);
 
-      this.getDetail(data.id);
-    },
+        return traverse(tree);
+      },
+      handleNodeClick(data, node) {
+        this.$route.query.categoryLevelId = '';
 
-    publicfun(data) {
-      this.pathList = this.findParent([], data, this.treeList);
-      this.rootTreeId = null;
-      if (this.pathList.length == 0) {
-        this.rootTreeId = data.id;
-      } else {
-        this.rootTreeId =
-          this.pathList[this.pathList.length - 1] &&
-          this.pathList[this.pathList.length - 1].id;
-      }
+        if (this.$refs.searchRef) {
+          this.$refs.searchRef.resetAllSearch();
+        }
 
-      let ruleCode = null;
-      if (this.pathList.length == 0) {
-        ruleCode = data.ruleCode;
-      } else {
-        ruleCode =
-          this.pathList[this.pathList.length - 1] &&
-          this.pathList[this.pathList.length - 1].ruleCode;
-      }
+        this.curNode = node;
+        this.publicfun(data);
 
-      this.pathList.unshift(data);
-      const PathInfo = {
-        categoryLevelPath: '',
-        categoryLevelPathId: [],
-        // rootCategoryLevelId: null,
-        categoryLevelId: '',
-        categoryLevelName: '',
-        ruleCode: ''
-      };
-      const pathName = [];
-      this.pathList.map((item) => {
-        pathName.unshift(item.name);
-        PathInfo.categoryLevelPathId.unshift(item.id);
-        // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
-      });
-      PathInfo.categoryLevelPath = pathName.join('-');
-      PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
-      PathInfo.categoryLevelId = data.id;
-      PathInfo.categoryLevelName = data.name;
-      PathInfo.ruleCode = ruleCode;
-
-      this.currentData = deepClone(PathInfo);
-      console.log(this.currentData, '选中的产品分类');
-    },
+        this.getDetail(data.id);
+      },
 
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.listData.reload(where);
-    },
+      publicfun(data) {
+        this.pathList = this.findParent([], data, this.treeList);
+        this.rootTreeId = null;
+        if (this.pathList.length == 0) {
+          this.rootTreeId = data.id;
+        } else {
+          this.rootTreeId =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].id;
+        }
 
-    // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
-    findParent(parents, childNode, treeList) {
-      for (let i = 0; i < treeList.length; i++) {
-        // 父节点查询条件
-        if (treeList[i].id === childNode.parentId) {
-          // 如果找到结果,保存当前节点
-          parents.push(treeList[i]);
-          // 用当前节点再去原数据查找当前节点的父节点
-          this.findParent(parents, treeList[i], this.treeList);
-          break;
+        let ruleCode = null;
+        if (this.pathList.length == 0) {
+          ruleCode = data.ruleCode;
         } else {
-          if (treeList[i].children instanceof Array) {
-            //	没找到,遍历该节点的子节点
-            this.findParent(parents, childNode, treeList[i].children);
+          ruleCode =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].ruleCode;
+        }
+
+        this.pathList.unshift(data);
+        const PathInfo = {
+          categoryLevelPath: '',
+          categoryLevelPathId: [],
+          // rootCategoryLevelId: null,
+          categoryLevelId: '',
+          categoryLevelName: '',
+          ruleCode: ''
+        };
+        const pathName = [];
+        this.pathList.map((item) => {
+          pathName.unshift(item.name);
+          PathInfo.categoryLevelPathId.unshift(item.id);
+          // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
+        });
+        PathInfo.categoryLevelPath = pathName.join('-');
+        PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
+        PathInfo.categoryLevelId = data.id;
+        PathInfo.categoryLevelName = data.name;
+        PathInfo.ruleCode = ruleCode;
+
+        this.currentData = deepClone(PathInfo);
+        console.log(this.currentData, '选中的产品分类');
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.listData.reload(where);
+      },
+
+      // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
+      findParent(parents, childNode, treeList) {
+        for (let i = 0; i < treeList.length; i++) {
+          // 父节点查询条件
+          if (treeList[i].id === childNode.parentId) {
+            // 如果找到结果,保存当前节点
+            parents.push(treeList[i]);
+            // 用当前节点再去原数据查找当前节点的父节点
+            this.findParent(parents, treeList[i], this.treeList);
+            break;
+          } else {
+            if (treeList[i].children instanceof Array) {
+              //	没找到,遍历该节点的子节点
+              this.findParent(parents, childNode, treeList[i].children);
+            }
           }
         }
+        return parents;
       }
-      return parents;
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped>
-.sys-organization-list {
-  height: calc(100vh - 165px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
-
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 30px;
-
-  & > .el-tree-node__expand-icon {
-    margin-left: 10px;
+  .sys-organization-list {
+    height: calc(100vh - 165px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
   }
-}
 
-.form-content {
-  height: 50px;
-  border: 1px solid;
-  box-sizing: border-box;
-}
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 30px;
 
-.form-wrapper {
-  padding: 12px 24px;
-}
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
+  }
+
+  .form-content {
+    height: 50px;
+    border: 1px solid;
+    box-sizing: border-box;
+  }
+
+  .form-wrapper {
+    padding: 12px 24px;
+  }
 </style>

+ 42 - 1
src/views/technology/production/index.vue

@@ -49,6 +49,15 @@
           >
             导入
           </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="batchUpdateWorkCenter()"
+            v-if="$hasPermission('main:producetask:save')"
+          >
+            批量修改工作中心
+          </el-button>
         </template>
 
         <template v-slot:name="{ row }">
@@ -123,6 +132,8 @@
       ref="importDialogRef"
       @success="reload"
     />
+
+    <WorkCenter ref="centerRefs" @changeCenter="determineChoose" />
   </div>
 </template>
 
@@ -136,6 +147,7 @@
   import control from '@/api/technology/control';
   import importDialog from '@/components/upload/comm-dialog.vue';
   import work from '@/api/technology/work';
+  import WorkCenter from './components/WorkCenter.vue';
 
   export default {
     name: 'technologyProduction',
@@ -145,7 +157,8 @@
       UserEdit,
       UserSetting,
       SampleParam,
-      importDialog
+      importDialog,
+      WorkCenter
     },
     data() {
       return {
@@ -324,6 +337,14 @@
         return res;
       },
 
+      batchUpdateWorkCenter() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$refs.centerRefs.open(this.selection[0]);
+      },
+
       /* 刷新表格 */
       reload(where) {
         this.$refs.table.reload({ page: 1, where: where });
@@ -337,6 +358,26 @@
           this.$refs.userEdit.$refs.form.clearValidate();
       },
 
+      determineChoose(row) {
+        // this.loading = true;
+        // for (let i = 0; i < this.selection.length; i++) {
+        //   this.selection[i].workCenterName = row.name;
+        //   this.selection[i].workCenterId = row.id;
+        //   producetask
+        //     .save(this.selection[i])
+        //     .then((msg) => {
+        //       if (this.selection.length == i) {
+        //         this.loading = false;
+        //         this.$message.success('修改成功');
+        //       }
+        //     })
+        //     .catch((e) => {
+        //       this.loading = false;
+        //       return;
+        //     });
+        // }
+      },
+
       getControlList() {
         const params = {
           pageNum: 1,

+ 4 - 5
src/views/technology/work/components/user-edit.vue

@@ -130,8 +130,8 @@
             { required: true, message: '请输入工序名称', trigger: 'blur' }
           ],
           code: [
-            { required: true, message: '工作中心编码', trigger: 'change' },
-            { validator: this.codeExists, trigger: 'blur' }
+            { required: true, message: '工作中心编码', trigger: 'change' }
+            // { validator: this.codeExists, trigger: 'blur' }
           ],
           factoryId: [
             { required: true, message: '请选择所属工厂', trigger: 'blur' }
@@ -211,12 +211,11 @@
               this.isUpdate = true;
             } else {
               this.isUpdate = false;
-              this.form.code = await getCode('work_center')
+              this.form.code = await getCode('work_center');
             }
           } else {
             this.isUpdate = false;
-            this.form.code = await getCode('work_center')
-
+            this.form.code = await getCode('work_center');
           }
         } else {
           this.$refs.form.clearValidate();

+ 125 - 123
src/views/workforceManagement/team/index.vue

@@ -59,7 +59,6 @@
             title="确定要删除此角色吗?"
             @confirm="remove(row)"
             v-if="$hasPermission('main:team:delete')"
-
           >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -75,138 +74,141 @@
   </div>
 </template>
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
+  import tabMixins from '@/mixins/tableColumnsMixin';
 
-import edit from './components/edit.vue';
-import setclasses from './components/setclasses.vue';
-import { getteampage, deleteteam } from '@/api/workforceManagement/team';
-import search from './components/search.vue';
-export default {
-  mixins: [tabMixins],
-  components: {
-    search,
-    edit,
-    setclasses
-  },
-  data() {
-    return {
-      selection: [],
-      columns: [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          width: 45,
-          type: 'index',
-          columnKey: 'index',
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          prop: 'code',
-          label: '编码'
-        },
-        {
-          label: '名称',
-          prop: 'name'
-        },
-
-        {
-          label: '所属工厂',
-          prop: 'factoryName'
-        },
+  import edit from './components/edit.vue';
+  import setclasses from './components/setclasses.vue';
+  import { getteampage, deleteteam } from '@/api/workforceManagement/team';
+  import search from './components/search.vue';
+  export default {
+    mixins: [tabMixins],
+    components: {
+      search,
+      edit,
+      setclasses
+    },
+    data() {
+      return {
+        selection: [],
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            label: '名称',
+            prop: 'name'
+          },
 
-        // {
-        //   label: '所属厂房',
-        //   prop: 'workshopPlanName'
-        // },
+          {
+            label: '所属工厂',
+            prop: 'factoryName'
+          },
 
-        {
-          label: '所属产线',
-          prop: 'productionLineName'
-        },
-        {
-          label: '工作中心',
-          prop: 'workCenterNames'
-        },
+          // {
+          //   label: '所属厂房',
+          //   prop: 'workshopPlanName'
+          // },
 
+          {
+            label: '所属产线',
+            prop: 'productionLineName'
+          },
+          {
+            label: '工作中心',
+            prop: 'workCenterNames'
+          },
 
-        {
-          label: '工艺类型',
-          prop: 'produceVersionName'
-        },
-        {
-          label: '人数',
-          prop: 'userNumber'
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 220,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true,
-          fixed: 'right'
-        }
-      ],
-      dict: {
-        enabled: {
-          1: '生效',
-          0: '未生效'
+          {
+            label: '工艺类型',
+            prop: 'produceVersionName'
+          },
+          {
+            label: '班组长',
+            prop: 'leaderUserName'
+          },
+          {
+            label: '人数',
+            prop: 'userNumber'
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 220,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ],
+        dict: {
+          enabled: {
+            1: '生效',
+            0: '未生效'
+          },
+          groupId: []
         },
-        groupId: []
-      },
-      pageSize: this.$store.state.tablePageSize,
-      cacheKeyUrl: '000a249c-workforceManagement-team'
-    };
-  },
-  methods: {
-    datasource({ page, where, limit }) {
-      let data = getteampage({
-        ...where,
-        pageNum: page,
-        size: limit
-      });
-      return data;
-    },
-    openEdit(type, row) {
-      this.$refs.edit.open(type, row);
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '000a249c-workforceManagement-team'
+      };
     },
-    remove(row) {
-      let par = [row.id];
-      deleteteam(par)
-        .then((message) => {
-          this.$message.success(message);
-          this.done();
-        })
-        .catch((e) => {
-          this.$message.error(e.message);
+    methods: {
+      datasource({ page, where, limit }) {
+        let data = getteampage({
+          ...where,
+          pageNum: page,
+          size: limit
         });
-    },
+        return data;
+      },
+      openEdit(type, row) {
+        this.$refs.edit.open(type, row);
+      },
+      remove(row) {
+        let par = [row.id];
+        deleteteam(par)
+          .then((message) => {
+            this.$message.success(message);
+            this.done();
+          })
+          .catch((e) => {
+            this.$message.error(e.message);
+          });
+      },
 
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ page: 1, where: where });
-    },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
 
-    done() {
-      this.$refs.table.reload({
-        page: 1
-      });
-    },
-    openclass() {
-      if (this.selection.length <= 0) {
-        this.$message.error('请选择班组');
-        return;
+      done() {
+        this.$refs.table.reload({
+          page: 1
+        });
+      },
+      openclass() {
+        if (this.selection.length <= 0) {
+          this.$message.error('请选择班组');
+          return;
+        }
+        let list = this.selection.map((n) => n.id);
+        this.$refs.setclasses.open(list);
       }
-      let list = this.selection.map((n) => n.id);
-      this.$refs.setclasses.open(list);
     }
-  }
-};
+  };
 </script>

+ 1 - 0
vue.config.js

@@ -38,6 +38,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
         target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.116:18086',
+        // target: 'http://192.168.1.251:18186',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''