完成调查问卷

This commit is contained in:
Zy
2026-04-15 17:32:03 +08:00
parent 40f13be704
commit cf9a1f1585
25 changed files with 2325 additions and 254 deletions

View File

@@ -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]);
}