asset
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m18s

This commit is contained in:
2025-06-25 09:27:33 +08:00
parent a62d5530b9
commit ec2f257a87
10 changed files with 224 additions and 59 deletions

View File

@@ -5,11 +5,16 @@ import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";
import { assetList } from "#/api/property/assetManage/asset";
import { userList } from "#/api/system/user";
const emit = defineEmits<{ reload: [] }>();
@@ -41,6 +46,103 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
},
);
formApi.getValues().then(setupPackageSelect);
async function upSelectUser(nickName: string){
const list=await userList({
nickName:nickName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.userName;
item.value=item.id;
})
fromApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'userId',
},
]);
}
async function upSelectAssets(assetsName: string){
const list=await assetList({
assetsName:assetsName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.assetsName;
item.value=item.id;
})
fromApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'assetsId',
},
]);
}
async function setupPackageSelect() {
const users = await userList({
pageNum: 1,
pageSize: 10,
});
const assets = await assetList({
pageNum: 1,
pageSize: 10,
});
const options = users.rows.map((item) => ({
label: item.nickName,
value: item.userId,
}));
const assetOptions = assets.rows.map((item) => ({
label: item.name,
value: item.id,
}));
formApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
async select(userId) {
await upSelectUser(userId);
userId=""
},
fieldName: 'userId',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: assetOptions,
showSearch: true,
},
async select(assetsId) {
await upSelectAssets(assetsId);
assetsId=""
},
fieldName: 'assetId',
},
]);
}
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
@@ -62,7 +164,7 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues(record);
}
await markInitialized();
await setupPackageSelect();
modalApi.modalLoading(false);
},
});