From 7c4a913ddbaed65c9aff0a5886d574add6666438 Mon Sep 17 00:00:00 2001 From: yejiaxing <591141169@qq.com> Date: Wed, 17 Jan 2024 17:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=B5=84=E4=BA=A7=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/fixedAssets/index.ts | 59 +++++ src/views/eam/fixedAssets/fixedAssets.data.ts | 120 +++++++++ src/views/eam/fixedAssets/index.vue | 244 ++++++++++++++++++ 3 files changed, 423 insertions(+) create mode 100644 src/api/eam/fixedAssets/index.ts create mode 100644 src/views/eam/fixedAssets/fixedAssets.data.ts create mode 100644 src/views/eam/fixedAssets/index.vue diff --git a/src/api/eam/fixedAssets/index.ts b/src/api/eam/fixedAssets/index.ts new file mode 100644 index 0000000..31c1c1b --- /dev/null +++ b/src/api/eam/fixedAssets/index.ts @@ -0,0 +1,59 @@ +import request from '@/config/axios' + +export interface FixedAssetsVO { + number: string + name: string + unit: string + specifications: string + locationNumber: string + purchaseDept: string + supplierNumber: string + productionDate: Date + purchasePrice: number + manageDept: string + qty: number + siteId: string + available: string + concurrencyStamp: number +} + +// 查询固定资产列表 +export const getFixedAssetsPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/fixed-assets/senior', data }) + } else { + return await request.get({ url: `/eam/fixed-assets/page`, params }) + } +} + +// 查询固定资产详情 +export const getFixedAssets = async (id: number) => { + return await request.get({ url: `/eam/fixed-assets/get?id=` + id }) +} + +// 新增固定资产 +export const createFixedAssets = async (data: FixedAssetsVO) => { + return await request.post({ url: `/eam/fixed-assets/create`, data }) +} + +// 修改固定资产 +export const updateFixedAssets = async (data: FixedAssetsVO) => { + return await request.put({ url: `/eam/fixed-assets/update`, data }) +} + +// 删除固定资产 +export const deleteFixedAssets = async (id: number) => { + return await request.delete({ url: `/eam/fixed-assets/delete?id=` + id }) +} + +// 导出固定资产 Excel +export const exportFixedAssets = async (params) => { + return await request.download({ url: `/eam/fixed-assets/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/fixed-assets/get-import-template' }) +} diff --git a/src/views/eam/fixedAssets/fixedAssets.data.ts b/src/views/eam/fixedAssets/fixedAssets.data.ts new file mode 100644 index 0000000..4a8993b --- /dev/null +++ b/src/views/eam/fixedAssets/fixedAssets.data.ts @@ -0,0 +1,120 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const FixedAssetsRules = reactive({ + number: [required], + name: [required], + locationNumber: [required], + supplierNumber: [required], + purchasePrice: [required], + qty: [required], + concurrencyStamp: [required], +}) + +export const FixedAssets = useCrudSchemas(reactive([ + { + label: '编号唯一标识', + field: 'number', + sort: 'custom', + isSearch: true, + }, + { + label: '资产名称', + field: 'name', + sort: 'custom', + isSearch: true, + }, + { + label: '会计单位', + field: 'unit', + sort: 'custom', + isSearch: true, + }, + { + label: '规格型号', + field: 'specifications', + sort: 'custom', + isSearch: true, + }, + { + label: '库位编号', + field: 'locationNumber', + sort: 'custom', + isSearch: true, + }, + { + label: '采购部门', + field: 'purchaseDept', + sort: 'custom', + isSearch: true, + }, + { + label: '供应商编号', + field: 'supplierNumber', + sort: 'custom', + isSearch: true, + }, + { + label: '出厂日期', + field: 'productionDate', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '购买价格', + field: 'purchasePrice', + sort: 'custom', + isSearch: true, + }, + { + label: '管理部门', + field: 'manageDept', + sort: 'custom', + isSearch: true, + }, + { + label: '数量', + field: 'qty', + sort: 'custom', + isSearch: true, + }, + { + label: '地点ID', + field: 'siteId', + sort: 'custom', + isSearch: true, + }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + isSearch: true, + }, + + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/fixedAssets/index.vue b/src/views/eam/fixedAssets/index.vue new file mode 100644 index 0000000..e79f16b --- /dev/null +++ b/src/views/eam/fixedAssets/index.vue @@ -0,0 +1,244 @@ + + +