|
|
@@ -43,10 +43,11 @@ export default {
|
|
|
mixins: [tabMixins],
|
|
|
data() {
|
|
|
return {
|
|
|
- cacheKeyUrl: 'qms-c2e9664a-inspectionTemplate-components-inspectionTemplateDialog',
|
|
|
+ cacheKeyUrl:
|
|
|
+ 'qms-c2e9664a-inspectionTemplate-components-inspectionTemplateDialog',
|
|
|
type: '',
|
|
|
equipmentdialog: false,
|
|
|
- selection: [], // 存储单选结果(仅一条数据)
|
|
|
+ selection: [],
|
|
|
tableHeight: 'calc(100vh - 605px)',
|
|
|
columns: [
|
|
|
{
|
|
|
@@ -54,7 +55,7 @@ export default {
|
|
|
type: 'selection',
|
|
|
columnKey: 'selection',
|
|
|
align: 'center',
|
|
|
- reserveSelection: false // 关闭保留选中(避免切换页签残留)
|
|
|
+ reserveSelection: false
|
|
|
},
|
|
|
{
|
|
|
columnKey: 'index',
|
|
|
@@ -130,27 +131,26 @@ export default {
|
|
|
},
|
|
|
// 单选控制:仅保留最后一个选中项
|
|
|
handleSelectionChange(val) {
|
|
|
- if (val.length > 1) {
|
|
|
- const lastVal = val[val.length - 1];
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- this.$refs.table.toggleRowSelection(lastVal, true);
|
|
|
- this.selection = [lastVal];
|
|
|
- } else {
|
|
|
- this.selection = val;
|
|
|
- }
|
|
|
-},
|
|
|
-// 子组件:选择按钮(校验并传值)
|
|
|
-selected() {
|
|
|
- if (this.selection.length !== 1) {
|
|
|
- this.$message.error('请选择一条数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$emit('choose', this.selection); // 传递单选结果(数组形式)
|
|
|
- this.handleClose();
|
|
|
-},
|
|
|
+ if (val.length > 1) {
|
|
|
+ const lastVal = val[val.length - 1];
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ this.$refs.table.toggleRowSelection(lastVal, true);
|
|
|
+ this.selection = [lastVal];
|
|
|
+ } else {
|
|
|
+ this.selection = val;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selected() {
|
|
|
+ if (this.selection.length !== 1) {
|
|
|
+ this.$message.error('请选择一条数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$emit('choose', this.selection);
|
|
|
+ this.handleClose();
|
|
|
+ },
|
|
|
search(where) {
|
|
|
this.$refs.table.reload({ page: 1, where });
|
|
|
- this.selection = []; // 搜索时清空选中
|
|
|
+ this.selection = [];
|
|
|
}
|
|
|
}
|
|
|
};
|