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

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

View File

@ -7,7 +7,7 @@ VITE_COMPRESS=gzip
VITE_PWA=false VITE_PWA=false
# vue-router 的模式 # vue-router 的模式
VITE_ROUTER_HISTORY=history VITE_ROUTER_HISTORY=hash
# 是否注入全局loading # 是否注入全局loading
VITE_INJECT_APP_LOADING=true VITE_INJECT_APP_LOADING=true

View File

@ -10,7 +10,7 @@ VITE_COMPRESS=gzip
VITE_PWA=false VITE_PWA=false
# vue-router 的模式 # vue-router 的模式
VITE_ROUTER_HISTORY=history VITE_ROUTER_HISTORY=hash
# 是否注入全局loading # 是否注入全局loading
VITE_INJECT_APP_LOADING=true VITE_INJECT_APP_LOADING=true

View File

@ -15,6 +15,10 @@ export function assetTypeList(params?: AssetTypeQuery) {
return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params }); return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params });
} }
export function assetTypeselect() {
return requestClient.get<AssetTypeVO[]>('/property/assetType/list');
}
/** /**
* *
* @param params * @param params

View File

@ -5,11 +5,16 @@ import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; 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 { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; 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: [] }>(); 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({ const [BasicModal, modalApi] = useVbenModal({
// //
class: 'w-[550px]', class: 'w-[550px]',
@ -62,7 +164,7 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
await setupPackageSelect();
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },
}); });

View File

@ -112,46 +112,46 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '资产id', label: '资产id',
fieldName: 'assetId', fieldName: 'assetId',
component: 'Input', component: 'Select',
}, },
{ {
label: '领用人id', label: '领用人id',
fieldName: 'userId', fieldName: 'userId',
component: 'Input', component: 'Select',
}, },
{ {
label: '数量', label: '数量',
fieldName: 'number', fieldName: 'number',
component: 'Input', component: 'Input',
}, },
{ // {
label: '状态', // label: '状态',
fieldName: 'state', // fieldName: 'state',
component: 'Input', // component: 'Input',
}, // },
{ // {
label: '审批人id', // label: '审批人id',
fieldName: 'acceptanceUserId', // fieldName: 'acceptanceUserId',
component: 'Input', // component: 'Input',
}, // },
{ // {
label: '审批时间', // label: '审批时间',
fieldName: 'acceptanceTime', // fieldName: 'acceptanceTime',
component: 'DatePicker', // component: 'DatePicker',
componentProps: { // componentProps: {
showTime: true, // showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', // format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, // },
}, // },
{ // {
label: '申请时间', // label: '申请时间',
fieldName: 'applicationTime', // fieldName: 'applicationTime',
component: 'DatePicker', // component: 'DatePicker',
componentProps: { // componentProps: {
showTime: true, // showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', // format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, // },
}, // },
]; ];

View File

@ -10,6 +10,10 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
import { packageSelectList } from "#/api/system/tenant-package";
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@ -41,6 +45,55 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
}, },
); );
async function setupPackageSelect() {
const tenantPackageList = await assetTypeselect();
const depot = await depotList();
const suppliers =await suppliersList();
const options = tenantPackageList.rows.map((item) => ({
label: item.assetTypeName,
value: item.id,
}));
const depotoptions = depot.rows.map((item) => ({
label: item.depotName,
value: item.id,
}));
const supplieroptions = suppliers.rows.map((item) => ({
label: item.suppliersName,
value: item.id,
}));
formApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'model',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: depotoptions,
showSearch: true,
},
fieldName: 'depotId',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: supplieroptions,
showSearch: true,
},
fieldName: 'suppliersId',
},
]);
}
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// //
class: 'w-[550px]', class: 'w-[550px]',
@ -52,6 +105,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
@ -62,7 +116,7 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
await setupPackageSelect();
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },
}); });

View File

@ -1,6 +1,9 @@
import type {FormSchemaGetter} from '#/adapter/form'; import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table'; import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict"; import {getDictOptions} from "#/utils/dict";
import { renderDict } from "#/utils/render";
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
@ -44,7 +47,7 @@ export const columns: VxeGridProps['columns'] = [
}, },
{ {
title: '资产类型', title: '资产类型',
field: 'model', field: 'modelName',
}, },
{ {
title: '规格', title: '规格',
@ -63,16 +66,16 @@ export const columns: VxeGridProps['columns'] = [
field: 'unit', field: 'unit',
}, },
{ {
title: '仓库id', title: '仓库',
field: 'depotId', field: 'depotName',
}, },
{ {
title: '描述信息', title: '描述信息',
field: 'msg', field: 'msg',
}, },
{ {
title: '供应商id', title: '供应商',
field: 'suppliersId', field: 'suppliersName',
}, },
{ {
title: '入库时间', title: '入库时间',
@ -81,6 +84,11 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '固定资产', title: '固定资产',
field: 'type', field: 'type',
slots: {
default: ({ row }) => {
return renderDict(row.type, DictEnum.WY_SF);
},
},
}, },
{ {
title: '创建时间', title: '创建时间',
@ -113,7 +121,7 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '类型', label: '类型',
fieldName: 'model', fieldName: 'model',
component: 'Textarea', component: 'Select',
}, },
{ {
label: '规格', label: '规格',
@ -136,9 +144,9 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input', component: 'Input',
}, },
{ {
label: '仓库id', label: '仓库',
fieldName: 'depotId', fieldName: 'depotId',
component: 'Input', component: 'Select',
}, },
{ {
label: '描述信息', label: '描述信息',
@ -148,7 +156,7 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '供应商id', label: '供应商id',
fieldName: 'suppliersId', fieldName: 'suppliersId',
component: 'Input', component: 'Select',
}, },
{ {
label: '入库时间', label: '入库时间',
@ -164,6 +172,8 @@ export const modalSchema: FormSchemaGetter = () => [
label: '固定资产类型', label: '固定资产类型',
fieldName: 'type', fieldName: 'type',
component: 'Select', component: 'Select',
componentProps: {}, componentProps: {
options: getDictOptions('wy_sf'),
},
}, },
]; ];

View File

@ -1,14 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,

View File

@ -27,7 +27,8 @@ export default defineConfig(async () => {
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址 // mock代理目标地址
target: 'http://47.109.37.87:3010/', // target: 'http://by.missmoc.top:3010/',
target: 'http://127.0.0.1:8080/',
ws: true, ws: true,
}, },
}, },

View File

@ -13,6 +13,7 @@ export const DictEnum = {
WF_BUSINESS_STATUS: 'wf_business_status', // 业务状态 WF_BUSINESS_STATUS: 'wf_business_status', // 业务状态
WF_FORM_TYPE: 'wf_form_type', // 表单类型 WF_FORM_TYPE: 'wf_form_type', // 表单类型
WF_TASK_STATUS: 'wf_task_status', // 任务状态 WF_TASK_STATUS: 'wf_task_status', // 任务状态
WY_SF: 'wy_sf',
} as const; } as const;
export type DictEnumKey = keyof typeof DictEnum; export type DictEnumKey = keyof typeof DictEnum;