|
@@ -11,10 +11,7 @@
|
|
|
:selection.sync="selection"
|
|
:selection.sync="selection"
|
|
|
>
|
|
>
|
|
|
<template v-slot:toolbar>
|
|
<template v-slot:toolbar>
|
|
|
- <el-button
|
|
|
|
|
- @click="handAdd"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="primary"
|
|
|
|
|
|
|
+ <el-button @click="handAdd" size="mini" type="primary"
|
|
|
>新增质检项</el-button
|
|
>新增质检项</el-button
|
|
|
>
|
|
>
|
|
|
</template>
|
|
</template>
|
|
@@ -78,7 +75,7 @@
|
|
|
<el-popconfirm
|
|
<el-popconfirm
|
|
|
class="ele-action"
|
|
class="ele-action"
|
|
|
title="确定要删除当前质检项吗?"
|
|
title="确定要删除当前质检项吗?"
|
|
|
- @confirm="remove(row)"
|
|
|
|
|
|
|
+ @confirm="handDel($index)"
|
|
|
>
|
|
>
|
|
|
<template v-slot:reference>
|
|
<template v-slot:reference>
|
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
@@ -95,7 +92,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import termPop from './inspectionClassify/index.vue';
|
|
import termPop from './inspectionClassify/index.vue';
|
|
|
- import { EventBus } from '@/utils/eventBus';
|
|
|
|
|
|
|
+
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import { getByCode } from '@/api/system/dictionary-data';
|
|
import { getByCode } from '@/api/system/dictionary-data';
|
|
|
export default {
|
|
export default {
|
|
@@ -172,32 +169,11 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
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.requestDict('质检标准类型');
|
|
|
- this.getDictList('mathematical_symbol'); // 数学字符
|
|
|
|
|
|
|
+ // this.getDictList('mathematical_symbol'); // 数学字符
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
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) {
|
|
handDel(index) {
|
|
|
this.$confirm('是否删除该质检项', '删除', {
|
|
this.$confirm('是否删除该质检项', '删除', {
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
@@ -209,7 +185,7 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handAdd() {
|
|
handAdd() {
|
|
|
- this.$refs.termRef.open()
|
|
|
|
|
|
|
+ this.$refs.termRef.open(this.list);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async getDictList(code) {
|
|
async getDictList(code) {
|
|
@@ -223,8 +199,6 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- remove() {},
|
|
|
|
|
-
|
|
|
|
|
getDate() {
|
|
getDate() {
|
|
|
return this.list;
|
|
return this.list;
|
|
|
},
|
|
},
|