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
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
commit
14d70b22d1
@ -1,35 +1,35 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref, watch} from 'vue';
|
||||
import {onMounted, ref, watch} from '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'});
|
||||
|
||||
const props= withDefaults(defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
disabled?: boolean;
|
||||
placeholder?: string;
|
||||
isUpdate?:boolean;
|
||||
unitId?:string;
|
||||
isUpdate?: boolean;
|
||||
unitId?: string;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
placeholder: '可根据单位名称进行搜索...',
|
||||
isUpdate:false,
|
||||
unitId:'',
|
||||
isUpdate: false,
|
||||
unitId: '',
|
||||
});
|
||||
|
||||
async function queryUnit(value: string, callback: any) {
|
||||
async function queryUnit(value: string|undefined, callback: any) {
|
||||
const queryData = {
|
||||
name: value,
|
||||
pageSize: 100,
|
||||
pageNum: 1,
|
||||
state:1,
|
||||
state: 1,
|
||||
}
|
||||
const res = await resident_unitList(queryData);
|
||||
const options = res.rows.map((unit) => ({
|
||||
label: unit.name+'-'+unit.id,
|
||||
label: unit.name + '-' + unit.id,
|
||||
value: unit.id,
|
||||
name:unit.name,
|
||||
unitNumber:unit.unitNumber,
|
||||
name: unit.name,
|
||||
unitNumber: unit.unitNumber,
|
||||
}));
|
||||
callback(options);
|
||||
}
|
||||
@ -46,24 +46,28 @@ const handleChange = (val: string) => {
|
||||
emit('update:unitInfo', unitInfo);
|
||||
};
|
||||
|
||||
async function getUnitInfo(val:string) {
|
||||
async function getUnitInfo(val: string) {
|
||||
const unit = await resident_unitInfo(val)
|
||||
if (unit) {
|
||||
data.value = [{
|
||||
label: unit.name+'-'+unit.id,
|
||||
label: unit.name + '-' + unit.id,
|
||||
value: unit.id,
|
||||
name:unit.name,
|
||||
unitNumber:unit.id,
|
||||
name: unit.name,
|
||||
unitNumber: unit.id,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.unitId,
|
||||
(newX) => {
|
||||
if (props.isUpdate&&newX) {
|
||||
if (props.isUpdate && newX) {
|
||||
getUnitInfo(newX)
|
||||
}
|
||||
}, {immediate: true})
|
||||
|
||||
onMounted(()=>{
|
||||
queryUnit(undefined, (d: any[]) => (data.value = d));
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Loading…
Reference in New Issue
Block a user