Quellcode durchsuchen

放行单模板参数修改、批记录列表修改

lucw vor 8 Monaten
Ursprung
Commit
6781c9b4e7

+ 10 - 0
src/api/main/index.js

@@ -58,3 +58,13 @@ export async function getIndicatorRootNodeList() {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 获取指标类型列表 /main/indicatorManage/getIndicatorTypeList
+export async function getIndicatorUseLevel() {
+  const res = await request.post(`/main/indicator/getIndicatorUseLevel`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 5 - 0
src/views/batchRecord/components/tables/craftFilesTable.vue

@@ -15,6 +15,8 @@
         </el-link>
       </template>
     </ele-pro-table>
+
+    <fileBrowse ref="fileBrowseRef"></fileBrowse>
   </div>
 </template>
 
@@ -22,9 +24,11 @@
   import dictMixins from '@/mixins/dictMixins';
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
   import { craftFiles } from '@/api/produce/workOrder.js';
+  import fileBrowse from '@/views/produce/components/picking/fileBrowse.vue';
 
   export default {
     mixins: [dictMixins, tableColumnsMixin],
+    components: { fileBrowse },
     props: {
       tableQuery: {
         type: Object,
@@ -137,6 +141,7 @@
       },
       goToDetail(row) {
         console.log('row', row);
+        this.$refs.fileBrowseRef.setFileUrl(row);
       }
     }
   };

+ 80 - 78
src/views/checklistManagement/components/templateAdd.vue

@@ -81,14 +81,14 @@
         <template v-slot:businessType="{ row }">
           <el-select
             v-model="row.businessType"
-            placeholder="请选择"
+            placeholder="请选择业务类型"
             @change="businessTypeChange(row)"
           >
             <el-option
-              v-for="i in indicatorRootNodeList"
-              :key="i.value"
-              :label="i.name"
-              :value="i.value"
+              v-for="i in indicatorUseLevelList"
+              :key="i.businessType"
+              :label="i.businessName"
+              :value="i.businessType"
             >
             </el-option>
           </el-select>
@@ -97,15 +97,15 @@
           <el-select
             v-if="row.businessType !== -1"
             v-model="row.indicator"
-            placeholder="请选择"
+            placeholder="请选择考核指标"
             :key="row.businessType"
-            @change="businessTypeChagne(row)"
+            @change="indicatorChange(row)"
           >
             <el-option
               v-for="i in getIndicatorList(row.businessType)"
-              :key="i.value"
-              :label="i.name"
-              :value="i.value"
+              :key="i.indicator"
+              :label="i.indicatorName"
+              :value="i.indicator"
             >
             </el-option>
           </el-select>
@@ -119,14 +119,12 @@
           <el-select
             v-if="row.businessType !== -1"
             v-model="row.mainIndicatorId"
-            placeholder="请选择"
-            :key="
-              row.indicator + row.mainIndicatorId + indicatorNameCacheKey
-            "
+            placeholder="请选择指标名称"
+            :key="row.indicator"
             @change="mainIndicatorIdChange(row)"
           >
             <el-option
-              v-for="i in getIndicatorCacheList(
+              v-for="i in getMainIndicatorIdList(
                 row.businessType,
                 row.indicator
               )"
@@ -154,11 +152,13 @@
           </div>
         </template>
       </ele-pro-table>
+
       <header-title title="质检放行规则">
         <el-button type="primary" icon="el-icon-plus" @click="addDetails(2)">
           添加规则指标
         </el-button>
       </header-title>
+
       <ele-pro-table
         ref="zjTable"
         row-key="id"
@@ -168,14 +168,14 @@
         <template v-slot:businessType="{ row }">
           <el-select
             v-model="row.businessType"
-            placeholder="请选择"
+            placeholder="请选择业务类型"
             @change="businessTypeChange(row)"
           >
             <el-option
-              v-for="i in indicatorRootNodeList"
-              :key="i.value"
-              :label="i.name"
-              :value="i.value"
+              v-for="i in indicatorUseLevelList"
+              :key="i.businessType"
+              :label="i.businessName"
+              :value="i.businessType"
             >
             </el-option>
           </el-select>
@@ -184,15 +184,15 @@
           <el-select
             v-if="row.businessType !== -1"
             v-model="row.indicator"
-            placeholder="请选择"
+            placeholder="请选择考核指标"
             :key="row.businessType"
-            @change="businessTypeChagne(row)"
+            @change="indicatorChange(row)"
           >
             <el-option
               v-for="i in getIndicatorList(row.businessType)"
-              :key="i.value"
-              :label="i.name"
-              :value="i.value"
+              :key="i.indicator"
+              :label="i.indicatorName"
+              :value="i.indicator"
             >
             </el-option>
           </el-select>
@@ -206,14 +206,12 @@
           <el-select
             v-if="row.businessType !== -1"
             v-model="row.mainIndicatorId"
-            placeholder="请选择"
-            :key="
-              row.indicator + row.mainIndicatorId + indicatorNameCacheKey
-            "
+            placeholder="请选择指标名称"
+            :key="row.indicator"
             @change="mainIndicatorIdChange(row)"
           >
             <el-option
-              v-for="i in getIndicatorCacheList(
+              v-for="i in getMainIndicatorIdList(
                 row.businessType,
                 row.indicator
               )"
@@ -274,7 +272,7 @@
     checktemplateSave,
     checklisttemplateUpdate
   } from '@/api/checklisttemplate/index';
-  import { getIndicatorRootNodeList } from '@/api/main/index';
+  import { getIndicatorUseLevel } from '@/api/main/index';
   import { getByTypeAndIndicator } from '@/api/eom/index';
 
   export default {
@@ -284,7 +282,7 @@
         id: null,
         createUserName: '',
         details: [],
-        enable: null,
+        enable: 1,
         remark: '',
         templateCode: '',
         templateName: '',
@@ -311,10 +309,7 @@
           ]
         },
         // 业务类型和考核指标
-        indicatorRootNodeList: [],
-        // 指标名称缓存数据
-        indicatorNameCache: {},
-        indicatorNameCacheKey: '',
+        indicatorUseLevelList: [],
         // 操作类型 add-新增 edit-编辑 clone-克隆
         type: 'add',
         loading: false,
@@ -385,7 +380,7 @@
       }
     },
     created() {
-      this.getIndicatorRootNodeList();
+      this.getIndicatorUseLevel();
     },
     methods: {
       // 外部调用,打开弹窗
@@ -410,10 +405,6 @@
           const res = await checklisttemplateGetById(id);
           console.log('res', res);
           this.$util.assignObject(this.form, res);
-          // 获取指标名称列表
-          this.form.details.forEach((item) => {
-            this.getIndicatorNameList(item.businessType, item.indicator);
-          });
 
           this.loading = false;
         } catch (error) {
@@ -504,28 +495,35 @@
         });
       },
       // 获取获取指标根节点列表
-      async getIndicatorRootNodeList() {
-        const data = await getIndicatorRootNodeList();
+      async getIndicatorUseLevel() {
+        const data = await getIndicatorUseLevel();
         // 添加其他选项
         data.push({
-          name: '其他',
-          value: -1,
-          nodes: []
+          businessName: '其他',
+          businessType: -1,
+          children: []
         });
-        this.indicatorRootNodeList = data;
-        console.log('this.indicatorRootNodeList', this.indicatorRootNodeList);
+        this.indicatorUseLevelList = data;
+        console.log('this.getIndicatorUseLevel', this.indicatorUseLevelList);
       },
 
       // 添加规则指标 1-生产放行规则,2-质检放行规则
       addDetails(checkType = 1) {
+        const maxSortNum = this.form.details.reduce((max, item) => {
+          return item.sortNum > max ? item.sortNum : max;
+        }, 0);
+
+        const newSortNum = maxSortNum + 1;
+
         this.form.details.push({
           businessType: null,
+          businessName: '',
           checkType: checkType,
-          createUserName: '',
+          createUserName: this.$store.state.user?.info.name,
           indicator: null,
           indicatorName: '',
           isAutoCheck: 1,
-          sortNum: 0,
+          sortNum: newSortNum,
           mainIndicatorId: null,
           mainIndicatorName: '',
           templateId: null,
@@ -535,42 +533,46 @@
       },
       // 业务类型 考核指标
       getIndicatorList(businessType) {
-        const item = this.indicatorRootNodeList.find(
-          (item) => item.value == businessType
+        const item = this.indicatorUseLevelList.find(
+          (item) => item.businessType == businessType
         );
-        return item ? item.nodes : [];
-      },
-      // 修改
-      businessTypeChagne(row) {
-        row.mainIndicatorId = null;
-        // 重置指标名称
-        this.getIndicatorNameList(row.businessType, row.indicator);
-      },
-      // 指标名称lieb
-      async getIndicatorNameList(businessType, indicator) {
-        // 排除其他
-        if (businessType == -1) return;
-        // 已经存在缓存数据
-        if (this.indicatorNameCache[`${businessType}_${indicator}`]) return;
-        const data = await getByTypeAndIndicator({
-          type: businessType,
-          assessmentIndicators: indicator
-        });
-        console.log('data 指标名称', data);
-        this.indicatorNameCache[`${businessType}_${indicator}`] = data;
-        this.indicatorNameCacheKey = new Date().getTime();
-      },
-      // 获取指标名称缓存列表
-      getIndicatorCacheList(businessType, indicator) {
-        return this.indicatorNameCache[`${businessType}_${indicator}`] || [];
+        return item ? item.children : [];
       },
       // 业务类型改变 重置指标和指标名称
       businessTypeChange(row) {
+        const item = this.indicatorUseLevelList.find(
+          (item) => item.businessType == row.businessType
+        );
+        row.businessName = item ? item.businessName : '';
+
         row.indicator = null;
         row.indicatorName = '';
         row.mainIndicatorId = null;
         row.mainIndicatorName = '';
       },
+      // 修改 考核指标
+      indicatorChange(row) {
+        const list = this.getIndicatorList(row.businessType);
+        const indicatorItem = list?.find(
+          (item) => item.indicator == row.indicator
+        );
+
+        row.indicatorName = indicatorItem?.indicatorName || '';
+        row.mainIndicatorId = null;
+        row.mainIndicatorName = '';
+      },
+      // 指标名称列表
+      getMainIndicatorIdList(businessType, indicator) {
+        // 排除其他
+        if (businessType == -1) return;
+        const indicatorList = this.getIndicatorList(businessType);
+        const indicatorItem = indicatorList?.find(
+          (item) => item.indicator == indicator
+        );
+        console.log('indicatorItem', indicatorItem);
+        return indicatorItem?.children || [];
+      },
+
       // 删除行
       deleteRow(row) {
         this.form.details = this.form.details.filter(
@@ -579,7 +581,7 @@
       },
       // 选择指标名称
       mainIndicatorIdChange(row) {
-        const list = this.getIndicatorCacheList(
+        const list = this.getMainIndicatorIdList(
           row.businessType,
           row.indicator
         );

+ 2 - 2
vue.config.js

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