完成调查问卷
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
/>
|
||||
<div>
|
||||
<el-button @click="conback">退出</el-button>
|
||||
<el-button type="primary" @click="confim"> 确定 </el-button>
|
||||
<el-button type="primary" @click="confirm"> 确定 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -69,17 +69,17 @@ interface tableType extends ResidentVO {
|
||||
|
||||
const props = defineProps({
|
||||
userid: {
|
||||
type: String || Number
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
returnvalue: {
|
||||
type: String,
|
||||
default: 'id',
|
||||
required: true
|
||||
default: 'id'
|
||||
}
|
||||
});
|
||||
const { userid } = toRefs(props);
|
||||
const emit = defineEmits<{
|
||||
change: [value: string | number];
|
||||
change: [value: string | number | tableType];
|
||||
}>();
|
||||
|
||||
const dialog = ref({
|
||||
@@ -108,10 +108,10 @@ const loading = ref(false);
|
||||
const treedata = ref([]);
|
||||
|
||||
// 存储选中项
|
||||
const multipleSelection = ref([]);
|
||||
const multipleSelection = ref<tableType[]>([]);
|
||||
|
||||
// 单选点击事件(完全替代 selection-change)
|
||||
const handleRowClick = (row) => {
|
||||
const handleRowClick = (row: tableType) => {
|
||||
multipleTableRef.value?.clearSelection();
|
||||
multipleTableRef.value?.toggleRowSelection(row, true);
|
||||
multipleSelection.value = [row];
|
||||
@@ -177,11 +177,12 @@ function conback() {
|
||||
}
|
||||
|
||||
// 确定
|
||||
function confim() {
|
||||
function confirm() {
|
||||
dialog.value.dialogVisible = false;
|
||||
console.log(multipleSelection.value, props.returnvalue);
|
||||
if (multipleSelection.value.length > 0) {
|
||||
if (props.returnvalue === 'id') {
|
||||
emit('change', multipleSelection.value[0].id);
|
||||
emit('change', multipleSelection.value[0].userId);
|
||||
} else if (props.returnvalue === 'value') {
|
||||
emit('change', multipleSelection.value[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user