|
@@ -17,6 +17,16 @@
|
|
|
:datasource="datasource"
|
|
:datasource="datasource"
|
|
|
:selection.sync="selection"
|
|
:selection.sync="selection"
|
|
|
>
|
|
>
|
|
|
|
|
+ <!-- 单选列 -->
|
|
|
|
|
+ <template v-slot:radio="{ row }">
|
|
|
|
|
+ <el-radio
|
|
|
|
|
+ class="radio"
|
|
|
|
|
+ v-model="currentRowId"
|
|
|
|
|
+ :label="row.id"
|
|
|
|
|
+ @change="radioChange($event, row)"
|
|
|
|
|
+ ><i></i
|
|
|
|
|
+ ></el-radio>
|
|
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
<template v-slot:footer>
|
|
<template v-slot:footer>
|
|
@@ -53,21 +63,14 @@
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
columns() {
|
|
columns() {
|
|
|
- return [
|
|
|
|
|
|
|
+ const list = [
|
|
|
{
|
|
{
|
|
|
columnKey: 'index',
|
|
columnKey: 'index',
|
|
|
label: '序号',
|
|
label: '序号',
|
|
|
type: 'index',
|
|
type: 'index',
|
|
|
width: 55,
|
|
width: 55,
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- fixed: 'left'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- width: 45,
|
|
|
|
|
- type: 'selection',
|
|
|
|
|
- columnKey: 'selection',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
|
|
+ showOverflowTooltip: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
prop: 'code',
|
|
prop: 'code',
|
|
@@ -190,6 +193,25 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|
|
|
|
|
+
|
|
|
|
|
+ if (this.multiple) {
|
|
|
|
|
+ list.unshift({
|
|
|
|
|
+ type: 'selection',
|
|
|
|
|
+ width: 50,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ fixed: 'left'
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ list.unshift({
|
|
|
|
|
+ prop: 'radio',
|
|
|
|
|
+ width: 50,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ fixed: 'left',
|
|
|
|
|
+ slot: 'radio'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
@@ -198,7 +220,9 @@
|
|
|
visible: false,
|
|
visible: false,
|
|
|
selection: [],
|
|
selection: [],
|
|
|
produceTaskId: '',
|
|
produceTaskId: '',
|
|
|
- reportWorkType: '' // 记录规则报工类型 产前、过程、产后
|
|
|
|
|
|
|
+ reportWorkType: '', // 记录规则报工类型 产前、过程、产后
|
|
|
|
|
+ currentRowId: null,
|
|
|
|
|
+ currentRow: null
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -212,6 +236,8 @@
|
|
|
|
|
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
this.selection = [];
|
|
this.selection = [];
|
|
|
|
|
+ this.currentRowId = null;
|
|
|
|
|
+ this.currentRow = null;
|
|
|
this.reportWorkType = reportWorkType || '';
|
|
this.reportWorkType = reportWorkType || '';
|
|
|
this.produceTaskId = produceTaskId || '';
|
|
this.produceTaskId = produceTaskId || '';
|
|
|
this.reload(); // 刷新表格
|
|
this.reload(); // 刷新表格
|
|
@@ -244,21 +270,24 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
confirmSelection() {
|
|
confirmSelection() {
|
|
|
- if (this.selection.length === 0) {
|
|
|
|
|
|
|
+ if (this.multiple && this.selection.length === 0) {
|
|
|
this.$message.warning('请先选择记录规则');
|
|
this.$message.warning('请先选择记录规则');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!this.multiple && this.selection.length > 1) {
|
|
|
|
|
- this.$message.warning('只能选择一条记录规则');
|
|
|
|
|
|
|
+ if (!this.multiple && !this.currentRow) {
|
|
|
|
|
+ this.$message.warning('请先选择记录规则');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.$emit(
|
|
this.$emit(
|
|
|
'chooseRules',
|
|
'chooseRules',
|
|
|
- this.multiple ? this.selection : this.selection[0]
|
|
|
|
|
|
|
+ this.multiple ? this.selection : this.currentRow
|
|
|
);
|
|
);
|
|
|
this.visible = false;
|
|
this.visible = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ radioChange(_, row) {
|
|
|
|
|
+ this.currentRow = row;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|