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