提交 48512367 authored 作者: leon's avatar leon

用户管理fix

上级 8d6fce93
...@@ -13,7 +13,7 @@ VITE_PUBLIC_PATH=/ ...@@ -13,7 +13,7 @@ VITE_PUBLIC_PATH=/
VITE_DROP_CONSOLE=false VITE_DROP_CONSOLE=false
# Basic interface address SPA # Basic interface address SPA
VITE_GLOB_API_URL=http://101.34.156.75:8101 VITE_GLOB_API_URL=http://192.168.101.69:8087
# File upload address, optional # File upload address, optional
VITE_GLOB_UPLOAD_URL=http://192.168.101.69:8087/v1/sys/upload VITE_GLOB_UPLOAD_URL=http://192.168.101.69:8087/v1/sys/upload
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import * as DistributorApi from '/@/api/system/distributorApi'; import * as DistributorApi from '/@/api/system/distributorApi';
import get from 'lodash.get'; import get from 'lodash.get';
import * as HospitalApi from '/@/api/system/hospitalApi'; import * as HospitalApi from '/@/api/system/hospitalApi';
import * as DoctorApi from '/@/api/system/doctorApi';
export const getDistributorText = (text) => { export const getDistributorText = (text) => {
if (text === 0) { if (text === 0) {
...@@ -76,4 +77,35 @@ const getHospitalId = ({ colProps }) => { ...@@ -76,4 +77,35 @@ const getHospitalId = ({ colProps }) => {
}; };
}; };
export { getDistributorId, getHospitalId }; const getDoctorId = ({ colProps }) => {
return {
field: 'doctorId',
label: '医生',
defaultValue: undefined,
form: {
itemProps: {
validateTrigger: 'blur',
},
componentProps: {
labelInValue: true,
api: DoctorApi.all,
params: {},
resultField: 'records',
labelField: 'name',
valueField: 'id',
allowClear: false,
placeholder: '医生',
optionFilterProp: 'label',
showSearch: true,
},
colProps,
component: 'ApiSelect',
rules: [{ required: true, type: 'object', message: '请选择医生!' }],
},
table: {
customRender: ({ record }) => get(record, 'hospital.name') || '(已删除/不存在)',
},
};
};
export { getDistributorId, getHospitalId, getDoctorId };
...@@ -203,9 +203,6 @@ ...@@ -203,9 +203,6 @@
(schemas) => { (schemas) => {
resetSchema(schemas ?? []); resetSchema(schemas ?? []);
}, },
{
deep: true,
},
); );
watch( watch(
......
<template> <template>
<BasicDrawer v-bind="$attrs" @register="registerDrawer" showFooter :confirmDisabled="getConfirmDisabled" :title="getTitle" width="600px" @ok="handleSubmit"> <BasicDrawer
v-bind="$attrs"
@register="registerDrawer"
showFooter
:confirmDisabled="getConfirmDisabled"
:title="getTitle"
width="1000px"
@ok="handleSubmit"
>
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
</a-spin> </a-spin>
...@@ -31,13 +39,13 @@ ...@@ -31,13 +39,13 @@
isLoading, isLoading,
execute, execute,
} = useAsyncState( } = useAsyncState(
() => { () => {
return OperationOrderApi.getById(entityId.value).then((res: OperationOrder) => res); return OperationOrderApi.getById(entityId.value).then((res: OperationOrder) => res);
}, },
null, null,
{ {
immediate: false, immediate: false,
}, },
); );
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
...@@ -51,8 +59,8 @@ ...@@ -51,8 +59,8 @@
if (detail.value) { if (detail.value) {
const formData: any = { const formData: any = {
...detail.value, ...detail.value,
hospitalId: { label: detail.value.hospital?.name || '(已删除/不存在)', value: detail.value.hospitalId }, hospitalId: { label: detail.value.hospital?.name || '(已删除/不存在)', value: detail.value.hospitalId },
}; };
await setFieldsValue(formData); await setFieldsValue(formData);
} }
} }
...@@ -65,17 +73,13 @@ ...@@ -65,17 +73,13 @@
return false; return false;
} }
}); });
const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
async function handleSubmit() { async function handleSubmit() {
try { try {
const values = await validate(); const values = await validate();
setDrawerProps({ confirmLoading: true }); setDrawerProps({ confirmLoading: true });
const { const { hospitalId, ...rest } = values;
hospitalId,
...rest
} = values;
const action = !unref(isUpdate) ? OperationOrderApi.add : OperationOrderApi.update; const action = !unref(isUpdate) ? OperationOrderApi.add : OperationOrderApi.update;
const data = !unref(isUpdate) const data = !unref(isUpdate)
? { ? {
...@@ -83,14 +87,15 @@ ...@@ -83,14 +87,15 @@
hospitalId: hospitalId.value, hospitalId: hospitalId.value,
hospitalName: hospitalId.label, hospitalName: hospitalId.label,
} }
: Object.assign({}, : Object.assign(
{ {},
...rest, {
id: unref(entityId), ...rest,
hospitalId: hospitalId.value, id: unref(entityId),
hospitalName: hospitalId.label, hospitalId: hospitalId.value,
}, hospitalName: hospitalId.label,
); },
);
await action(data); await action(data);
closeDrawer(); closeDrawer();
emit('success'); emit('success');
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
ifShow: hasPermission('AUTH_ORDER_OPERATION_ORDER:EDIT'), ifShow: hasPermission('AUTH_ORDER_OPERATION_ORDER:EDIT'),
}, },
{ {
tooltip: '详情', tooltip: '详情',
icon: 'ant-design:eye-outlined', icon: 'ant-design:eye-outlined',
onClick: handleView.bind(null, record), onClick: handleView.bind(null, record),
...@@ -76,23 +76,19 @@ ...@@ -76,23 +76,19 @@
import componentSetting from '/@/settings/componentSetting'; import componentSetting from '/@/settings/componentSetting';
import OperationOrderDrawer from './drawer.vue'; import OperationOrderDrawer from './drawer.vue';
import { columns, searchFormSchema } from './schema'; import { columns, searchFormSchema } from './schema';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const { hasPermission } = usePermission(); const { hasPermission } = usePermission();
const go = useGo(); const go = useGo();
const { const { formConfig, showTableSetting, bordered, showIndexColumn } = componentSetting.table;
formConfig,
showTableSetting,
bordered,
showIndexColumn,
} = componentSetting.table;
const checkedKeys = ref<Array<string | number>>([]); const checkedKeys = ref<Array<string | number>>([]);
const onSelectChange = (selectedRowKeys: (string | number)[]) => { const onSelectChange = (selectedRowKeys: (string | number)[]) => {
checkedKeys.value = selectedRowKeys; checkedKeys.value = selectedRowKeys;
} };
const [registerDrawer, { openDrawer }] = useDrawer(); const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload ,setLoading}] = useTable({ const [registerTable, { reload, setLoading }] = useTable({
title: '手术订单管理', title: '手术订单管理',
api: (params) => OperationOrderApi.search(handleParams(params)), api: (params) => OperationOrderApi.search(handleParams(params)),
columns, columns,
...@@ -142,6 +138,10 @@ ...@@ -142,6 +138,10 @@
} }
} }
}); });
// 如果是经销商,只能看到自己的数据
if (userStore.getIsDistributor) {
handledParams.distributorId = userStore.getDistributorId;
}
return handledParams; return handledParams;
}; };
...@@ -160,20 +160,24 @@ ...@@ -160,20 +160,24 @@
const handleDelete = (record: Recordable) => { const handleDelete = (record: Recordable) => {
setLoading(true); setLoading(true);
OperationOrderApi.remove(record.id).then((_) => { OperationOrderApi.remove(record.id)
reload(); .then((_) => {
}).catch(() => { reload();
setLoading(false); })
}); .catch(() => {
setLoading(false);
});
}; };
const handleBatchDelete = () => { const handleBatchDelete = () => {
setLoading(true); setLoading(true);
OperationOrderApi.batchRemove(checkedKeys.value).then((_) => { OperationOrderApi.batchRemove(checkedKeys.value)
reload(); .then((_) => {
}).catch(() => { reload();
setLoading(false); })
}); .catch(() => {
setLoading(false);
});
}; };
const handleSuccess = () => { const handleSuccess = () => {
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import get from 'lodash.get'; import { useUserStore } from '/@/store/modules/user';
import * as HospitalApi from '/@/api/system/hospitalApi'; import { getDistributorId, getDoctorId, getHospitalId } from '/@/commonSchemaProperty';
export enum YesNoEnum { export enum YesNoEnum {
YES = '是', YES = '是',
...@@ -37,7 +37,7 @@ for (const key in StatusEnum) { ...@@ -37,7 +37,7 @@ for (const key in StatusEnum) {
} }
const colProps = { xs: { span: 24 }, sm: { span: 24 }, lg: { span: 8 } }; const colProps = { xs: { span: 24 }, sm: { span: 24 }, lg: { span: 8 } };
const colPropsInDrawer = { span: 24 }; const colPropsInDrawer = { span: 12 };
export const schema = { export const schema = {
model: 'OperationOrder', model: 'OperationOrder',
...@@ -45,36 +45,20 @@ export const schema = { ...@@ -45,36 +45,20 @@ export const schema = {
properties: [ properties: [
{ {
field: 'id', field: 'id',
label: 'ID系统自动生成', label: 'ID',
defaultValue: undefined, defaultValue: undefined,
form: { form: {
componentProps: { componentProps: {
allowClear: false, allowClear: false,
placeholder: 'ID系统自动生成', placeholder: 'ID',
}, },
colProps, colProps,
component: 'InputNumber', component: 'InputNumber',
rules: [{ required: true, message: '请输入ID系统自动生成!' }], rules: [{ required: true, message: '请输入ID!' }],
},
table: {
},
},
{
field: 'distributorId',
label: '经销商id',
defaultValue: undefined,
form: {
componentProps: {
allowClear: false,
placeholder: '经销商id',
},
colProps,
component: 'InputNumber',
rules: [{ required: true, message: '请输入经销商id!' }],
},
table: {
}, },
table: {},
}, },
getDistributorId({ colProps }),
{ {
field: 'orderSn', field: 'orderSn',
label: '订单编号', label: '订单编号',
...@@ -88,8 +72,7 @@ export const schema = { ...@@ -88,8 +72,7 @@ export const schema = {
component: 'Input', component: 'Input',
rules: [{ required: true, message: '请输入订单编号!' }], rules: [{ required: true, message: '请输入订单编号!' }],
}, },
table: { table: {},
},
}, },
{ {
field: 'productLineName', field: 'productLineName',
...@@ -103,31 +86,9 @@ export const schema = { ...@@ -103,31 +86,9 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
},
{
field: 'hospitalId',
label: '医院id',
defaultValue: undefined,
form: {
componentProps: {
labelInValue: true,
api: HospitalApi.all,
params: {},
resultField: 'records',
labelField: 'id',
valueField: 'id',
allowClear: true,
placeholder: '医院id',
},
colProps,
component: 'ApiSelect',
},
table: {
customRender: ({ text, record }) => get(record, 'hospital.name') || text,
},
}, },
getHospitalId({ colProps }),
{ {
field: 'saleUserId', field: 'saleUserId',
label: '业务员id', label: '业务员id',
...@@ -140,8 +101,7 @@ export const schema = { ...@@ -140,8 +101,7 @@ export const schema = {
colProps, colProps,
component: 'InputNumber', component: 'InputNumber',
}, },
table: { table: {},
},
}, },
{ {
field: 'saleUserName', field: 'saleUserName',
...@@ -155,24 +115,9 @@ export const schema = { ...@@ -155,24 +115,9 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
},
{
field: 'doctorId',
label: '医生id',
defaultValue: undefined,
form: {
componentProps: {
allowClear: true,
placeholder: '医生id',
},
colProps,
component: 'InputNumber',
},
table: {
},
}, },
getDoctorId({ colProps }),
{ {
field: 'doctorName', field: 'doctorName',
label: '医生名称', label: '医生名称',
...@@ -185,8 +130,7 @@ export const schema = { ...@@ -185,8 +130,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'surgicalName', field: 'surgicalName',
...@@ -200,8 +144,7 @@ export const schema = { ...@@ -200,8 +144,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'surgicalTime', field: 'surgicalTime',
...@@ -217,8 +160,7 @@ export const schema = { ...@@ -217,8 +160,7 @@ export const schema = {
showTime: true, showTime: true,
}, },
}, },
table: { table: {},
},
}, },
{ {
field: 'deliveryTime', field: 'deliveryTime',
...@@ -234,8 +176,7 @@ export const schema = { ...@@ -234,8 +176,7 @@ export const schema = {
showTime: true, showTime: true,
}, },
}, },
table: { table: {},
},
}, },
{ {
field: 'needTool', field: 'needTool',
...@@ -252,7 +193,7 @@ export const schema = { ...@@ -252,7 +193,7 @@ export const schema = {
}, },
table: { table: {
customRender: ({ text }) => { customRender: ({ text }) => {
const option = YesNoEnumOptions.find((item) => item.value === text) const option = YesNoEnumOptions.find((item) => item.value === text);
return option ? option.label : text; return option ? option.label : text;
}, },
}, },
...@@ -269,8 +210,7 @@ export const schema = { ...@@ -269,8 +210,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'receiveName', field: 'receiveName',
...@@ -284,8 +224,7 @@ export const schema = { ...@@ -284,8 +224,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'receivePhone', field: 'receivePhone',
...@@ -299,8 +238,7 @@ export const schema = { ...@@ -299,8 +238,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'address', field: 'address',
...@@ -314,8 +252,7 @@ export const schema = { ...@@ -314,8 +252,7 @@ export const schema = {
component: 'InputTextArea', component: 'InputTextArea',
colProps: { span: 24 }, colProps: { span: 24 },
}, },
table: { table: {},
},
}, },
{ {
field: 'status', field: 'status',
...@@ -333,7 +270,7 @@ export const schema = { ...@@ -333,7 +270,7 @@ export const schema = {
}, },
table: { table: {
customRender: ({ text }) => { customRender: ({ text }) => {
const option = StatusEnumOptions.find((item) => item.value === text) const option = StatusEnumOptions.find((item) => item.value === text);
return option ? option.label : text; return option ? option.label : text;
}, },
}, },
...@@ -354,7 +291,7 @@ export const schema = { ...@@ -354,7 +291,7 @@ export const schema = {
}, },
table: { table: {
customRender: ({ text }) => { customRender: ({ text }) => {
const option = YesNoEnumOptions.find((item) => item.value === text) const option = YesNoEnumOptions.find((item) => item.value === text);
return option ? option.label : text; return option ? option.label : text;
}, },
}, },
...@@ -371,8 +308,7 @@ export const schema = { ...@@ -371,8 +308,7 @@ export const schema = {
colProps, colProps,
component: 'Input', component: 'Input',
}, },
table: { table: {},
},
}, },
{ {
field: 'deleteStatus', field: 'deleteStatus',
...@@ -389,7 +325,7 @@ export const schema = { ...@@ -389,7 +325,7 @@ export const schema = {
}, },
table: { table: {
customRender: ({ text }) => { customRender: ({ text }) => {
const option = YesNoEnumOptions.find((item) => item.value === text) const option = YesNoEnumOptions.find((item) => item.value === text);
return option ? option.label : text; return option ? option.label : text;
}, },
}, },
...@@ -407,8 +343,7 @@ export const schema = { ...@@ -407,8 +343,7 @@ export const schema = {
component: 'InputNumber', component: 'InputNumber',
rules: [{ required: true, message: '请输入操作人ID!' }], rules: [{ required: true, message: '请输入操作人ID!' }],
}, },
table: { table: {},
},
}, },
{ {
field: 'editorName', field: 'editorName',
...@@ -423,8 +358,7 @@ export const schema = { ...@@ -423,8 +358,7 @@ export const schema = {
component: 'Input', component: 'Input',
rules: [{ required: true, message: '请输入操作人!' }], rules: [{ required: true, message: '请输入操作人!' }],
}, },
table: { table: {},
},
}, },
{ {
field: 'createTime', field: 'createTime',
...@@ -441,8 +375,7 @@ export const schema = { ...@@ -441,8 +375,7 @@ export const schema = {
component: 'RangePicker', component: 'RangePicker',
rules: [{ required: true, message: '请输入CreateTime!' }], rules: [{ required: true, message: '请输入CreateTime!' }],
}, },
table: { table: {},
},
}, },
{ {
field: 'updateTime', field: 'updateTime',
...@@ -459,18 +392,123 @@ export const schema = { ...@@ -459,18 +392,123 @@ export const schema = {
component: 'RangePicker', component: 'RangePicker',
rules: [{ required: true, message: '请输入UpdateTime!' }], rules: [{ required: true, message: '请输入UpdateTime!' }],
}, },
table: { table: {},
},
}, },
], ],
}; };
const queryFields = ['id','distributorId','orderSn','productLineName','hospitalId','saleUserId','saleUserName','doctorId','doctorName','surgicalName','surgicalTime','deliveryTime','needTool','logisticsMode','receiveName','receivePhone','status','type','remark','deleteStatus','editorId','editorName','createTime','updateTime']; const queryFields = [
const editFields = ['distributorId','orderSn','productLineName','hospitalId','saleUserId','saleUserName','doctorId','doctorName','surgicalName','surgicalTime','deliveryTime','needTool','logisticsMode','receiveName','receivePhone','address','status','type','remark','deleteStatus']; // 'id',
const tableFields = ['id','distributorId','orderSn','productLineName','hospitalId','saleUserId','saleUserName','doctorId','doctorName','surgicalName','surgicalTime','deliveryTime','needTool','logisticsMode','receiveName','receivePhone','address','status','type','remark','deleteStatus','editorId','editorName','createTime','updateTime']; 'distributorId',
const descriptionFields = ['id','distributorId','orderSn','productLineName','hospitalId','saleUserId','saleUserName','doctorId','doctorName','surgicalName','surgicalTime','deliveryTime','needTool','logisticsMode','receiveName','receivePhone','address','status','type','remark','deleteStatus','editorId','editorName','createTime','updateTime']; 'orderSn',
'productLineName',
export const searchFormSchema: FormSchema[] = schema.properties.filter(item => queryFields.includes(item.field)) 'hospitalId',
'saleUserId',
'saleUserName',
'doctorId',
'doctorName',
'surgicalName',
'surgicalTime',
'deliveryTime',
'needTool',
'logisticsMode',
'receiveName',
'receivePhone',
'status',
'type',
'remark',
'deleteStatus',
'editorId',
'editorName',
'createTime',
'updateTime',
];
const editFields = [
'distributorId',
'orderSn',
'productLineName',
'hospitalId',
'saleUserId',
'saleUserName',
'doctorId',
'doctorName',
'surgicalName',
'surgicalTime',
'deliveryTime',
'needTool',
'logisticsMode',
'receiveName',
'receivePhone',
'address',
'status',
'type',
'remark',
'deleteStatus',
];
const tableFields = [
'id',
'distributorId',
'orderSn',
'productLineName',
'hospitalId',
'saleUserId',
'saleUserName',
'doctorId',
'doctorName',
'surgicalName',
'surgicalTime',
'deliveryTime',
'needTool',
'logisticsMode',
'receiveName',
'receivePhone',
'address',
'status',
'type',
'remark',
'deleteStatus',
'editorId',
'editorName',
'createTime',
'updateTime',
];
const descriptionFields = [
'id',
'distributorId',
'orderSn',
'productLineName',
'hospitalId',
'saleUserId',
'saleUserName',
'doctorId',
'doctorName',
'surgicalName',
'surgicalTime',
'deliveryTime',
'needTool',
'logisticsMode',
'receiveName',
'receivePhone',
'address',
'status',
'type',
'remark',
'deleteStatus',
'editorId',
'editorName',
'createTime',
'updateTime',
];
const userStore = useUserStore();
export const searchFormSchema: FormSchema[] = schema.properties
.filter((item) => queryFields.includes(item.field))
.filter((item) => {
if (item.field === 'distributorId') {
return queryFields.includes(item.field) && userStore.getDistributorId === 0;
} else {
return queryFields.includes(item.field);
}
})
.map( .map(
({ field, label, form: { rules = [], ...formProps } }) => ({ field, label, form: { rules = [], ...formProps } }) =>
({ ({
...@@ -482,7 +520,8 @@ export const searchFormSchema: FormSchema[] = schema.properties.filter(item => q ...@@ -482,7 +520,8 @@ export const searchFormSchema: FormSchema[] = schema.properties.filter(item => q
} as FormSchema), } as FormSchema),
); );
export const formSchema: FormSchema[] = schema.properties.filter(item => editFields.includes(item.field)) export const formSchema: FormSchema[] = schema.properties
.filter((item) => editFields.includes(item.field))
.map( .map(
({ field, label, defaultValue, form }) => ({ field, label, defaultValue, form }) =>
({ ({
...@@ -494,17 +533,19 @@ export const formSchema: FormSchema[] = schema.properties.filter(item => editFie ...@@ -494,17 +533,19 @@ export const formSchema: FormSchema[] = schema.properties.filter(item => editFie
} as FormSchema), } as FormSchema),
); );
export const columns: BasicColumn[] = schema.properties.filter(item => tableFields.includes(item.field)) export const columns: BasicColumn[] = schema.properties
.filter((item) => tableFields.includes(item.field))
.map( .map(
({ field, label, table }) => ({ field, label, table }) =>
({ ({
dataIndex: field, dataIndex: field,
title: label, title: label,
...table, ...table,
} as BasicColumn) } as BasicColumn),
); );
export const descriptionColumns: BasicColumn[] = schema.properties.filter(item => descriptionFields.includes(item.field)) export const descriptionColumns: BasicColumn[] = schema.properties
.filter((item) => descriptionFields.includes(item.field))
.map( .map(
({ field, label, table }) => ({ field, label, table }) =>
({ ({
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
const userStore = useUserStore(); const userStore = useUserStore();
const [registerDrawer, { openDrawer }] = useDrawer(); const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload, setLoading, getLoading }] = useTable({ const [registerTable, { reload, setLoading }] = useTable({
title: '医生管理', title: '医生管理',
api: (params) => DoctorApi.search(handleParams(params)), api: (params) => DoctorApi.search(handleParams(params)),
columns, columns,
......
...@@ -33,18 +33,7 @@ ...@@ -33,18 +33,7 @@
showActionButtonGroup: false, showActionButtonGroup: false,
}); });
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm(useFormProps.value); const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm(useFormProps.value);
/**
* @description: 编辑时候影藏密码表单项 , 创建时候显示
*/
const handlePwdFiled = () => {
useFormProps.value.schemas?.forEach((item: any) => {
if (item.field === PASSWORD) {
item.show = !unref(isUpdate);
}
});
};
// id 查询 // id 查询
const { const {
...@@ -68,9 +57,12 @@ ...@@ -68,9 +57,12 @@
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
entityId.value = data?.record?.id; entityId.value = data?.record?.id;
handlePwdFiled();
if (unref(isUpdate)) { if (unref(isUpdate)) {
// 更新时,不显示密码
await updateSchema({
field: PASSWORD,
show: false,
});
await execute(); await execute();
if (detail.value) { if (detail.value) {
const formData: any = { ...detail.value }; const formData: any = { ...detail.value };
...@@ -90,6 +82,12 @@ ...@@ -90,6 +82,12 @@
formData.roleList = roleObj; formData.roleList = roleObj;
await setFieldsValue(formData); await setFieldsValue(formData);
} }
} else {
// 新增时,显示密码
await updateSchema({
field: PASSWORD,
show: true,
});
} }
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论