This commit is contained in:
@@ -198,3 +198,8 @@ function handleInfo(row: Required<PersonForm>) {
|
||||
<PersonDetail></PersonDetail>
|
||||
</Page>
|
||||
</template>
|
||||
<style scoped>
|
||||
:where(.css-dev-only-do-not-override-aza1th).ant-avatar{
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
|
@@ -26,6 +26,7 @@ let userInfo = reactive({
|
||||
gender: '',
|
||||
});
|
||||
let unitName = ref('');
|
||||
const userId = ref<number | string>(0);
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -67,6 +68,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await personInfo(id);
|
||||
userId.value = record.userId;
|
||||
console.log(userId.value,'====================1111')
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -119,7 +122,7 @@ function getUnitInfo(unit: { name: string }) {
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
<template #userId="slotProps">
|
||||
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :disabled="isUpdate"/>
|
||||
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userId="userId"/>
|
||||
</template>
|
||||
<template #unitId="slotProps">
|
||||
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :disabled="isUpdate"/>
|
||||
|
@@ -1,8 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue';
|
||||
import {Select} from 'ant-design-vue';
|
||||
// import {resident_unitList} from "#/api/property/resident/unit";
|
||||
import {userList} from "#/api/system/user";
|
||||
import {resident_unitList} from "#/api/property/resident/unit";
|
||||
|
||||
defineOptions({name: 'QueryUnitList'});
|
||||
|
||||
@@ -10,30 +9,17 @@ withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
|
||||
disabled: false,
|
||||
placeholder: '可根据单位名称进行搜索...',
|
||||
});
|
||||
//todo
|
||||
// async function queryUnit(value: string, callback: any) {
|
||||
// const queryData = {
|
||||
// nickName: value,
|
||||
// pageSize: 100,
|
||||
// pageNum: 1,
|
||||
// }
|
||||
// const res = await resident_unitList(queryData);
|
||||
// const options = res.rows.map((unit) => ({
|
||||
// label: unit.name+'-'+unit.unitNumber,
|
||||
// value: unit.id,
|
||||
// }));
|
||||
// callback(options);
|
||||
// }
|
||||
|
||||
async function queryUnit(value: string, callback: any) {
|
||||
const queryData = {
|
||||
nickName: value,
|
||||
name: value,
|
||||
pageSize: 100,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await userList(queryData);
|
||||
const res = await resident_unitList(queryData);
|
||||
const options = res.rows.map((unit) => ({
|
||||
label: unit.nickName+'-'+unit.phonenumber,
|
||||
value: unit.userId,
|
||||
label: unit.name+'-'+unit.id,
|
||||
value: unit.id,
|
||||
}));
|
||||
callback(options);
|
||||
}
|
||||
|
@@ -1,15 +1,28 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue';
|
||||
import {ref, watch} from 'vue';
|
||||
import {Select} from 'ant-design-vue';
|
||||
import {userList} from "#/api/system/user";
|
||||
import {findUserInfo, userList} from "#/api/system/user";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
|
||||
defineOptions({name: 'QueryUserList'});
|
||||
|
||||
withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
|
||||
const props = withDefaults(defineProps<{
|
||||
disabled?: boolean;
|
||||
placeholder?: string;
|
||||
isUpdate?: boolean;
|
||||
userId?: number;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
placeholder: '可根据员工姓名进行搜索...',
|
||||
isUpdate: false,
|
||||
userId: 0
|
||||
});
|
||||
watch(() => props.isUpdate,
|
||||
(newX) => {
|
||||
if (newX) {
|
||||
getUserInfo()
|
||||
}
|
||||
}, {immediate: true})
|
||||
|
||||
async function queryUser(value: string, callback: any) {
|
||||
const queryData = {
|
||||
@@ -21,36 +34,47 @@ async function queryUser(value: string, callback: any) {
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
|
||||
value: user.userId,
|
||||
userName: user.userName,
|
||||
gender: user.sex,
|
||||
phone: user.phonenumber,
|
||||
}));
|
||||
callback(options);
|
||||
}
|
||||
|
||||
|
||||
const data = ref<any[]>([]);
|
||||
const value = ref();
|
||||
const value = ref('');
|
||||
|
||||
const handleSearch = (val: string) => {
|
||||
queryUser(val, (d: any[]) => (data.value = d));
|
||||
};
|
||||
const emit = defineEmits(['update:userInfo']);
|
||||
const handleChange = (val: string) => {
|
||||
value.value = val;
|
||||
const userInfoStr = data.value.find(option => option.value === val)?.label;
|
||||
let arr = userInfoStr.split('-')
|
||||
let userInfo = {
|
||||
userName: arr[0],
|
||||
gender: arr[1],
|
||||
phone: arr[2],
|
||||
}
|
||||
// value.value = val;
|
||||
const userInfo = data.value.find(option => option.value === val);
|
||||
queryUser(val, (d: any[]) => (data.value = d));
|
||||
emit('update:userInfo', userInfo);
|
||||
};
|
||||
|
||||
async function getUserInfo() {
|
||||
console.log(value.value, '=============value')
|
||||
const user = await (await findUserInfo(value.value)).user
|
||||
console.log(user, '=================ss')
|
||||
if(user){
|
||||
data.value=[{
|
||||
label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
|
||||
value: user.userId,
|
||||
userName: user.userName,
|
||||
gender: user.sex,
|
||||
phone: user.phonenumber,
|
||||
}]
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- v-model:value="value"-->
|
||||
<Select
|
||||
|
||||
v-model="value"
|
||||
show-search
|
||||
:placeholder="placeholder"
|
||||
style="width: 100%"
|
||||
|
@@ -2,6 +2,7 @@ import type {FormSchemaGetter} from '#/adapter/form';
|
||||
import type {VxeGridProps} from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {renderDict} from "#/utils/render";
|
||||
import {z} from "#/adapter/form";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -134,7 +135,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '联系电话',
|
||||
fieldName: 'phone',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }),
|
||||
},
|
||||
|
||||
{
|
||||
|
@@ -22,7 +22,7 @@ import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import resident_unitModal from './unit-modal.vue';
|
||||
import unitInfoModal from './unit-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {userStatusChange} from "#/api/system/user";
|
||||
import {resident_unitUpdate} from "#/api/property/resident/unit";
|
||||
import {TableSwitch} from "#/components/table";
|
||||
import {useAccess} from "@vben/access";
|
||||
|
||||
@@ -150,10 +150,11 @@ const { hasAccessByCodes } = useAccess();
|
||||
</template>
|
||||
<template #state="{ row }">
|
||||
<TableSwitch
|
||||
:checkedValue="1"
|
||||
:unCheckedValue="0"
|
||||
v-model:value="row.state"
|
||||
:api="() => userStatusChange(row)"
|
||||
:disabled=" !hasAccessByCodes(['property:unit:edit'])
|
||||
"
|
||||
:api="() => resident_unitUpdate(row)"
|
||||
:disabled=" !hasAccessByCodes(['property:unit:edit'])"
|
||||
@reload="() => tableApi.query()"
|
||||
/>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user