|
|
@@ -1,199 +1,98 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-button
|
|
|
- @click="() => this.$refs.termRef.open()"
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- >新增</el-button
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="list"
|
|
|
+ height="calc(100vh - 605px)"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ cache-key="inspectionClassify"
|
|
|
+ row-key="qualityLevelId"
|
|
|
+ :selection.sync="selection"
|
|
|
>
|
|
|
-
|
|
|
- <div class="content_box" v-if="list.length > 0">
|
|
|
- <div class="content_box_list" v-for="(item, idx) in list" :key="idx">
|
|
|
- <div class="content_ll">
|
|
|
- <div class="name">质检类型</div>
|
|
|
- <div>
|
|
|
- {{
|
|
|
- item.categoryLevelName
|
|
|
- }}
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button @click="handAdd" size="mini" type="primary"
|
|
|
+ >新增质检项</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:textType="{ row }">
|
|
|
+ {{
|
|
|
+ row.textType == 1
|
|
|
+ ? '数值'
|
|
|
+ : row.textType == 2
|
|
|
+ ? '选择'
|
|
|
+ : row.textType == 3
|
|
|
+ ? '上下限'
|
|
|
+ : row.textType == 4
|
|
|
+ ? '规格'
|
|
|
+ : row.textType == 5
|
|
|
+ ? '时间'
|
|
|
+ : row.textType == 6
|
|
|
+ ? '范围'
|
|
|
+ : ''
|
|
|
+ }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:type="{ row }">
|
|
|
+ {{ getDictValue('质检标准类型', row.qualityStandardType) }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:defaultValue="{ row }">
|
|
|
+ <div style="display: flex">
|
|
|
+ <div
|
|
|
+ v-if="row.textType == 3"
|
|
|
+ style="display: flex; align-items: center"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ style="width: 132px"
|
|
|
+ v-model="row.minValue"
|
|
|
+ ></el-input>
|
|
|
+ <span> -</span>
|
|
|
+ <el-input
|
|
|
+ style="width: 132px; margin-left: 10px"
|
|
|
+ v-model="row.maxValue"
|
|
|
+ ></el-input>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
|
|
|
- <div class="content_ll">
|
|
|
-
|
|
|
- <div class="name">标准类型</div>
|
|
|
- <div>
|
|
|
- {{
|
|
|
- getDictValue(
|
|
|
- '质检标准类型',
|
|
|
- item.qualityStandard && item.qualityStandard.type
|
|
|
- )
|
|
|
- }}
|
|
|
+ <div v-else style="width: 290px">
|
|
|
+ <el-input
|
|
|
+ v-model="row.defaultValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
-
|
|
|
- <div class="content_ll">
|
|
|
- <div class="name">标准编码</div>
|
|
|
- <div class="">{{
|
|
|
- item.qualityStandard && item.qualityStandard.code
|
|
|
- }}</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="content_ll">
|
|
|
- <div class="name">标准名称</div>
|
|
|
- <div class="">{{
|
|
|
- item.qualityStandard && item.qualityStandard.name
|
|
|
- }}</div>
|
|
|
+ <el-input
|
|
|
+ style="margin-left: 10px; width: 80px"
|
|
|
+ v-model="row.unit"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</div>
|
|
|
+ </template>
|
|
|
|
|
|
- <el-link
|
|
|
- type="danger"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handDel(idx)"
|
|
|
+ <template v-slot:action="{ row, $index }">
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除当前质检项吗?"
|
|
|
+ @confirm="handDel($index)"
|
|
|
>
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
-
|
|
|
- <el-form ref="form" style="width: 100%">
|
|
|
- <el-table
|
|
|
- style="margin-top: 15px"
|
|
|
- :data="
|
|
|
- item.qualityStandard && item.qualityStandard.parameterStandards
|
|
|
- "
|
|
|
- border
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- :label="
|
|
|
- item.qualityStandard &&
|
|
|
- item.qualityStandard.singleWeightDivision
|
|
|
- "
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- label="参数上限"
|
|
|
- align="center"
|
|
|
- v-if="
|
|
|
- item.qualityStandard &&
|
|
|
- item.qualityStandard.parameterType == 3
|
|
|
- "
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item label-width="0" prop="finalValue">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- :disabled="type == 'detail'"
|
|
|
- v-model="scope.row.finalValue"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="参数下限"
|
|
|
- align="center"
|
|
|
- v-if="
|
|
|
- item.qualityStandard &&
|
|
|
- item.qualityStandard.parameterType == 3
|
|
|
- "
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item label-width="0" prop="initialValue">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="scope.row.initialValue"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="默认值"
|
|
|
- align="center"
|
|
|
- v-if="
|
|
|
- item.qualityStandard &&
|
|
|
- item.qualityStandard.parameterType != 3
|
|
|
- "
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item label-width="0" prop="defaultValue">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="scope.row.defaultValue"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- :label="item.qualityStandard && item.qualityStandard.tolerance"
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <el-table-column label="质检标准" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item label-width="0" prop="inspectionStandard">
|
|
|
-
|
|
|
- <!-- <el-select
|
|
|
- v-model="scope.row.symbol"
|
|
|
- style="width: 100px"
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in dictList"
|
|
|
- :key="item.value"
|
|
|
- :value="item.value"
|
|
|
- :label="item.label"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- -->
|
|
|
-
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="scope.row.toleranceValue"
|
|
|
- placeholder="请输入"
|
|
|
- >
|
|
|
-
|
|
|
- <DictSelection
|
|
|
- style="width: 100px"
|
|
|
- slot="prepend"
|
|
|
- clearable
|
|
|
- dictName="数学字符"
|
|
|
- v-model="scope.row.symbol"
|
|
|
- ></DictSelection>
|
|
|
-
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="操作" align="center" width="70">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link
|
|
|
- type="danger"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handDel2(idx, scope.$index)"
|
|
|
- >
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <termPop ref="termRef"></termPop>
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <termPop ref="termRef" @selectChange="selectChange"></termPop>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import termPop from './inspectionClassify/index.vue';
|
|
|
- import { EventBus } from '@/utils/eventBus';
|
|
|
+
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import { getByCode } from '@/api/system/dictionary-data';
|
|
|
export default {
|
|
|
@@ -219,37 +118,64 @@
|
|
|
data() {
|
|
|
return {
|
|
|
list: [],
|
|
|
- dictList: []
|
|
|
+ dictList: [],
|
|
|
+
|
|
|
+ selection: [],
|
|
|
+
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ prop: 'categoryLevelName',
|
|
|
+ label: '质检类型',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'inspectionName',
|
|
|
+ label: '质检名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'defaultValue',
|
|
|
+ slot: 'defaultValue',
|
|
|
+ label: '工艺参数',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 260
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ label: '工艺要求',
|
|
|
+ prop: 'inspectionStandard',
|
|
|
+ formatter: (row, column, cellValue) => {
|
|
|
+ return (
|
|
|
+ row.symbol + ' ' + cellValue + ' ' + row.unit
|
|
|
+ );
|
|
|
+ },
|
|
|
+ minWidth: 350
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
- EventBus.$on('inspectionSelection', (data) => {
|
|
|
- let _arr = this.updateOrCreateObjectInArray(this.list, data.message);
|
|
|
- this.list = JSON.parse(JSON.stringify(_arr));
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
-
|
|
|
this.requestDict('质检标准类型');
|
|
|
- this.getDictList('mathematical_symbol');
|
|
|
+ // this.getDictList('mathematical_symbol'); // 数学字符
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- updateOrCreateObjectInArray(array, newObj, idKey = 'id') {
|
|
|
- // 用来检查是否已存在具有特定 id 的对象
|
|
|
- const exists = array.some((obj) => obj[idKey] === newObj[idKey]);
|
|
|
-
|
|
|
- if (exists) {
|
|
|
- // 如果存在,使用 map 来替换找到的对象
|
|
|
- return array.map((obj) =>
|
|
|
- obj[idKey] === newObj[idKey] ? newObj : obj
|
|
|
- );
|
|
|
- } else {
|
|
|
- // 如果不存在,将新对象添加到数组中
|
|
|
- return [...array, newObj];
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
handDel(index) {
|
|
|
this.$confirm('是否删除该质检项', '删除', {
|
|
|
type: 'warning'
|
|
|
@@ -260,6 +186,10 @@
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
|
|
|
+ handAdd() {
|
|
|
+ this.$refs.termRef.open(this.list);
|
|
|
+ },
|
|
|
+
|
|
|
async getDictList(code) {
|
|
|
let { data: res } = await getByCode(code);
|
|
|
this.dictList = res.map((item) => {
|
|
|
@@ -271,43 +201,17 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- handDel2(idx, index) {
|
|
|
- this.list[idx].qualityStandard.parameterStandards.splice(index, 1);
|
|
|
- },
|
|
|
-
|
|
|
getDate() {
|
|
|
return this.list;
|
|
|
+ },
|
|
|
+
|
|
|
+ selectChange(list) {
|
|
|
+ this.list = list;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .content_box {
|
|
|
- width: 100%;
|
|
|
- margin-top: 12px;
|
|
|
- max-height: 42vh;
|
|
|
- overflow-y: scroll;
|
|
|
- }
|
|
|
|
|
|
- .content_box_list {
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- margin-bottom: 30px;
|
|
|
- }
|
|
|
-
|
|
|
- .content_ll {
|
|
|
- width: 23%;
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
-
|
|
|
- margin: auto;
|
|
|
- margin-top: 10px;
|
|
|
-
|
|
|
- .name {
|
|
|
- width: 130px;
|
|
|
- color: #000;
|
|
|
- font-weight: 500;
|
|
|
- }
|
|
|
- }
|
|
|
</style>
|