268 lines
5.4 KiB
TypeScript
268 lines
5.4 KiB
TypeScript
import type { FormSchemaGetter } from '#/adapter/form';
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
import { getDictOptions } from '#/utils/dict';
|
|
import { renderDict } from '#/utils/render';
|
|
import { suppliersList } from '#/api/property/assetManage/suppliers';
|
|
import { depotList } from '#/api/property/assetManage/depot';
|
|
// import { useUserStore } from '@vben/stores';
|
|
|
|
// const userStore = useUserStore();
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
// {
|
|
// component: 'Input',
|
|
// fieldName: 'title',
|
|
// label: '标题',
|
|
// },
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'applicat',
|
|
label: '申请人',
|
|
},
|
|
// {
|
|
// component: 'Input',
|
|
// fieldName: 'phone',
|
|
// label: '申请人手机号',
|
|
// },
|
|
// {
|
|
// component: 'ApiSelect',
|
|
// fieldName: 'supplier',
|
|
// label: '供应商',
|
|
// componentProps: {
|
|
// api: suppliersList({ pageNum: 1, pageSize: 1000 }),
|
|
// resultField: 'rows',
|
|
// labelField: 'assetTypeName',
|
|
// valueField: 'id',
|
|
// },
|
|
// },
|
|
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('wy_zccgfs'),
|
|
},
|
|
fieldName: 'buyType',
|
|
label: '采购方式',
|
|
},
|
|
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
|
|
options: getDictOptions('wy_zcsqshzt'),
|
|
},
|
|
fieldName: 'state',
|
|
label: '状态',
|
|
},
|
|
];
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{ type: 'checkbox', width: 60 },
|
|
{
|
|
title: '序号',
|
|
field: 'id',
|
|
slots: {
|
|
default: ({ rowIndex }) => {
|
|
return (rowIndex + 1).toString();
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: '标题',
|
|
field: 'title',
|
|
width: 'auto',
|
|
},
|
|
{
|
|
title: '申请人id',
|
|
field: 'applicat',
|
|
},
|
|
{
|
|
title: '申请人手机号',
|
|
field: 'phone',
|
|
},
|
|
{
|
|
title: '供应商id',
|
|
field: 'supplier',
|
|
},
|
|
{
|
|
title: '采购方式',
|
|
field: 'buyType',
|
|
slots: {
|
|
default: ({ row }) => {
|
|
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
|
|
return renderDict(row.buyType, 'wy_zccgfs');
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: '状态',
|
|
field: 'state',
|
|
slots: {
|
|
default: ({ row }) => {
|
|
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
|
|
return renderDict(row.state, 'wy_zcsqshzt');
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: '备注',
|
|
field: 'remark',
|
|
},
|
|
{
|
|
field: 'action',
|
|
fixed: 'right',
|
|
slots: { default: 'action' },
|
|
title: '操作',
|
|
width: 280,
|
|
},
|
|
];
|
|
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
{
|
|
label: '',
|
|
fieldName: 'id',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: () => false,
|
|
triggerFields: [''],
|
|
},
|
|
},
|
|
{
|
|
label: '标题',
|
|
fieldName: 'title',
|
|
component: 'Input',
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '存放仓库',
|
|
fieldName: 'depotId',
|
|
component: 'ApiSelect',
|
|
rules: 'required',
|
|
componentProps: {
|
|
api: async () => {
|
|
const res = await depotList({ pageNum: 1, pageSize: 1000 });
|
|
return res;
|
|
},
|
|
resultField: 'rows',
|
|
labelField: 'depotName',
|
|
valueField: 'id',
|
|
},
|
|
},
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'applicatDisplay', // 显示用
|
|
label: '申请人',
|
|
rules: 'required',
|
|
disabled: true,
|
|
},
|
|
{
|
|
component: 'Input',
|
|
rules: 'required',
|
|
fieldName: 'applicat', // 实际存储ID
|
|
dependencies: {
|
|
show: () => false,
|
|
triggerFields: [''],
|
|
},
|
|
},
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'phone',
|
|
rules: 'required',
|
|
label: '申请人手机号',
|
|
},
|
|
{
|
|
component: 'ApiSelect',
|
|
rules: 'required',
|
|
fieldName: 'supplier',
|
|
label: '供应商',
|
|
componentProps: {
|
|
api: async () => {
|
|
const res = await suppliersList({ pageNum: 1, pageSize: 1000 });
|
|
return res;
|
|
},
|
|
resultField: 'rows',
|
|
labelField: 'suppliersName',
|
|
valueField: 'id',
|
|
},
|
|
},
|
|
{
|
|
rules: 'required',
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('wy_zccgfs'),
|
|
},
|
|
fieldName: 'buyType',
|
|
label: '采购方式',
|
|
},
|
|
// {
|
|
// label: '采购单价',
|
|
// fieldName: 'buyUnitPrice',
|
|
// component: 'Input',
|
|
// },
|
|
// {
|
|
// label: '采购金额',
|
|
// fieldName: 'buyAmount',
|
|
// component: 'Input',
|
|
// },
|
|
// {
|
|
// label: '状态',
|
|
// fieldName: 'state',
|
|
// component: 'Select',
|
|
// componentProps: {
|
|
// // 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
|
|
// options: getDictOptions('wy_zcsqshzt'),
|
|
// },
|
|
// },
|
|
{
|
|
label: '备注',
|
|
fieldName: 'remark',
|
|
component: 'Input',
|
|
},
|
|
];
|
|
|
|
export const detailColumns: VxeGridProps['columns'] = [
|
|
{
|
|
title: '序号',
|
|
field: 'id',
|
|
width: 80,
|
|
slots: {
|
|
default: ({ rowIndex }) => {
|
|
return (rowIndex + 1).toString();
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: '资产名称',
|
|
field: 'capitalName',
|
|
width: 150,
|
|
},
|
|
{
|
|
title: '规格',
|
|
field: 'spec',
|
|
width: 120,
|
|
},
|
|
{
|
|
title: '购买数量',
|
|
field: 'buyQuantity',
|
|
width: 120,
|
|
},
|
|
{
|
|
title: '采购单价',
|
|
field: 'buyUnitPrice',
|
|
width: 120,
|
|
},
|
|
{
|
|
title: '金额小计',
|
|
field: 'buyAmount',
|
|
width: 120,
|
|
},
|
|
{
|
|
title: '备注',
|
|
field: 'remark',
|
|
width: 150,
|
|
},
|
|
];
|