Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
FLL 2025-08-04 10:22:05 +08:00
commit 14d70b22d1

View File

@ -1,35 +1,35 @@
<script lang="ts" setup> <script lang="ts" setup>
import {ref, watch} from 'vue'; import {onMounted, ref, watch} from 'vue';
import {Select} from 'ant-design-vue'; import {Select} from 'ant-design-vue';
import {resident_unitList,resident_unitInfo} from "#/api/property/resident/unit"; import {resident_unitList, resident_unitInfo} from "#/api/property/resident/unit";
defineOptions({name: 'QueryUnitList'}); defineOptions({name: 'QueryUnitList'});
const props= withDefaults(defineProps<{ const props = withDefaults(defineProps<{
disabled?: boolean; disabled?: boolean;
placeholder?: string; placeholder?: string;
isUpdate?:boolean; isUpdate?: boolean;
unitId?:string; unitId?: string;
}>(), { }>(), {
disabled: false, disabled: false,
placeholder: '可根据单位名称进行搜索...', placeholder: '可根据单位名称进行搜索...',
isUpdate:false, isUpdate: false,
unitId:'', unitId: '',
}); });
async function queryUnit(value: string, callback: any) { async function queryUnit(value: string|undefined, callback: any) {
const queryData = { const queryData = {
name: value, name: value,
pageSize: 100, pageSize: 100,
pageNum: 1, pageNum: 1,
state:1, state: 1,
} }
const res = await resident_unitList(queryData); const res = await resident_unitList(queryData);
const options = res.rows.map((unit) => ({ const options = res.rows.map((unit) => ({
label: unit.name+'-'+unit.id, label: unit.name + '-' + unit.id,
value: unit.id, value: unit.id,
name:unit.name, name: unit.name,
unitNumber:unit.unitNumber, unitNumber: unit.unitNumber,
})); }));
callback(options); callback(options);
} }
@ -46,24 +46,28 @@ const handleChange = (val: string) => {
emit('update:unitInfo', unitInfo); emit('update:unitInfo', unitInfo);
}; };
async function getUnitInfo(val:string) { async function getUnitInfo(val: string) {
const unit = await resident_unitInfo(val) const unit = await resident_unitInfo(val)
if (unit) { if (unit) {
data.value = [{ data.value = [{
label: unit.name+'-'+unit.id, label: unit.name + '-' + unit.id,
value: unit.id, value: unit.id,
name:unit.name, name: unit.name,
unitNumber:unit.id, unitNumber: unit.id,
}] }]
} }
} }
watch(() => props.unitId, watch(() => props.unitId,
(newX) => { (newX) => {
if (props.isUpdate&&newX) { if (props.isUpdate && newX) {
getUnitInfo(newX) getUnitInfo(newX)
} }
}, {immediate: true}) }, {immediate: true})
onMounted(()=>{
queryUnit(undefined, (d: any[]) => (data.value = d));
})
</script> </script>
<template> <template>