admin-vben5/apps/web-antd/src/views/property/assetManage/asset/data.ts
dev_ljl 87331ab607
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
1、资产管理
2025-06-25 09:42:38 +08:00

205 lines
3.7 KiB
TypeScript

import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {assetTypeList} from "#/api/property/assetManage/assetType";
import type {AssetTypeVO} from "#/api/property/assetManage/assetType/model";
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'name',
label: '资产名称',
},
{
component: 'Select',
fieldName: 'model',
label: '资产类型',
componentProps: {
showSearch:true,
placeholder:'根据类型名称搜索...',
onSearch:handleSearch,
onChange:handleChange,
options:typeData
},
},
{
component: 'Select',
componentProps: {
options: getDictOptions('wy_sf'),
},
fieldName: 'type',
label: '固定资产',
},
];
export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60},
{
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '资产名称',
field: 'name',
},
{
title: '资产类型',
field: 'model',
},
{
title: '规格',
field: 'specs',
},
{
title: '价格',
field: 'price',
},
{
title: '库存',
field: 'stock',
},
{
title: '计量单位',
field: 'unit',
},
{
title: '仓库id',
field: 'depotId',
},
{
title: '描述信息',
field: 'msg',
},
{
title: '供应商id',
field: 'suppliersId',
},
{
title: '入库时间',
field: 'storageTime',
},
{
title: '固定资产',
field: 'type',
},
{
title: '创建时间',
field: 'createTime',
},
{
field: 'action',
fixed: 'right',
slots: {default: 'action'},
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '资产名称',
fieldName: 'name',
component: 'Input',
},
{
label: '类型',
fieldName: 'model',
component: 'Textarea',
},
{
label: '规格',
fieldName: 'specs',
component: 'Textarea',
},
{
label: '价格',
fieldName: 'price',
component: 'Input',
},
{
label: '库存',
fieldName: 'stock',
component: 'Input',
},
{
label: '计量单位',
fieldName: 'unit',
component: 'Input',
},
{
label: '仓库id',
fieldName: 'depotId',
component: 'Input',
},
{
label: '描述信息',
fieldName: 'msg',
component: 'Textarea',
},
{
label: '供应商id',
fieldName: 'suppliersId',
component: 'Input',
},
{
label: '入库时间',
fieldName: 'storageTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '固定资产类型',
fieldName: 'type',
component: 'Select',
componentProps: {},
},
];
let typeData:AssetTypeVO[]=[]
const handleSearch = (val: string) => {
queryAssetsType(val, (d: any[]) => (typeData = d));
};
const handleChange = (val: string) => {
queryAssetsType(val, (d: any[]) => (typeData = d));
};
function queryAssetsType(value: string, callback: any) {
let queryParam={
pageNum:100,
pageSize:1,
assetTypeName:value
}
assetTypeList(queryParam).then(res=>{
const data: any[] = [];
res.rows.forEach((r: any) => {
data.push({
value: r.assetTypeName,
label: r.id,
});
});
callback(data);
})
}