Browse Source

EAM ——> 基础数据 备件管理更新

master_hella_20240701
gaojs 6 months ago
parent
commit
68afbb4aa6
  1. 34
      src/api/eam/sparePart/index.ts
  2. 4
      src/views/eam/sparePart/index.vue
  3. 220
      src/views/eam/sparePart/sparePart.data.ts

34
src/api/eam/sparePart/index.ts

@ -7,23 +7,19 @@ export interface SparePartVO {
brand: string
specifications: string
isOverall: string
isConstant: string
subject: string
subjectCode: string
category: string
type: string
images: string
region: string
classification: string
uom: string
singlePrice: number
stockAge: number
reprocurement: number
safetyStock: number
cost: string
purchaser: string
financer: string
purchaseTime: Date
isFramework: string
isRadeIn: string
manufacturer: string
minInventory: number
maxInventory: number
replacementCycle: number
storageLocation: string
departmentCode: string
remark: string
siteId: string
@ -38,38 +34,38 @@ export const getSparePartPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/sparepart/spare-part/senior', data })
return await request.post({ url: '/eam/basic/spare-part/senior', data })
} else {
return await request.get({ url: `/eam/sparepart/spare-part/page`, params })
return await request.get({ url: `/eam/basic/spare-part/page`, params })
}
}
// 查询备件基础详情
export const getSparePart = async (id: number) => {
return await request.get({ url: `/eam/sparepart/spare-part/get?id=` + id })
return await request.get({ url: `/eam/basic/spare-part/get?id=` + id })
}
// 新增备件基础
export const createSparePart = async (data: SparePartVO) => {
return await request.post({ url: `/eam/sparepart/spare-part/create`, data })
return await request.post({ url: `/eam/basic/spare-part/create`, data })
}
// 修改备件基础
export const updateSparePart = async (data: SparePartVO) => {
return await request.put({ url: `/eam/sparepart/spare-part/update`, data })
return await request.put({ url: `/eam/basic/spare-part/update`, data })
}
// 删除备件基础
export const deleteSparePart = async (id: number) => {
return await request.delete({ url: `/eam/sparepart/spare-part/delete?id=` + id })
return await request.delete({ url: `/eam/basic/spare-part/delete?id=` + id })
}
// 导出备件基础 Excel
export const exportSparePart = async (params) => {
return await request.download({ url: `/eam/sparepart/spare-part/export-excel`, params })
return await request.download({ url: `/eam/basic/spare-part/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/sparepart/spare-part/get-import-template' })
return request.download({ url: '/eam/basic/spare-part/get-import-template' })
}

4
src/views/eam/sparePart/index.vue

@ -54,7 +54,7 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="SparePart.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/sparepart/spare-part/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm ref="importFormRef" url="/eam/spare-part/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
@ -134,7 +134,7 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:spare-part:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:spare-part:delete'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:sparePart:delete'}), //
]
// -

220
src/views/eam/sparePart/sparePart.data.ts

@ -1,27 +1,30 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ConfigApi from '@/api/infra/config'
const autoCodeSwitch = await ConfigApi.getConfigKey('sparePartCodeAutoSwitch')
const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
}
// 表单校验
export const SparePartRules = reactive({
code: [required],
name: [required],
isOverall: [required],
images: [required],
uom: [required],
concurrencyStamp: [required]
})
export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备件编号',
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '编号',
field: 'code',
sort: 'custom',
isForm: !autoSwitch.value,
isForm: true,
isSearch: true,
fixed: 'left'
},
@ -29,19 +32,19 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
isSearch: true,
},
{
label: '品牌',
field: 'brand',
sort: 'custom',
isSearch: false
isSearch: true,
},
{
label: '规格型号',
field: 'specifications',
sort: 'custom',
isSearch: false
isSearch: true,
},
{
label: '是否全局',
@ -59,22 +62,6 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '是否存储',
field: 'isConstant',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '科目',
field: 'subject',
@ -90,13 +77,19 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
label: '科目代码',
field: 'subjectCode',
sort: 'custom',
isSearch: false
isSearch: true,
},
{
label: '类别',
field: 'category',
field: 'type',
sort: 'custom',
isSearch: true,
},
{
label: '图片',
field: 'images',
sort: 'custom',
isSearch: false
isSearch: false,
},
{
label: '区域',
@ -104,7 +97,7 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.REGION,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: false,
isSearch: true,
form: {
component: 'Select'
}
@ -121,71 +114,126 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '单位',
label: '计量单位字典',
field: 'uom',
sort: 'custom',
isSearch: false
dictType: DICT_TYPE.UOM,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
isSearch: false
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '库龄',
field: 'stockAge',
label: '生产厂家字符',
field: 'manufacturer',
sort: 'custom',
isSearch: false,
isSearch: true,
},
{
label: '库存下限',
field: 'minInventory',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
},
{
label: '重采购点',
field: 'reprocurement',
label: '库存上限',
field: 'maxInventory',
sort: 'custom',
isSearch: false,
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
},
{
label: '安全库存',
field: 'safetyStock',
label: '更换周期',
field: 'replacementCycle',
sort: 'custom',
isSearch: false,
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '存放位置描述',
field: 'storageLocation',
sort: 'custom',
isSearch: false,
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
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')]
}
},
isForm: false,
},
{
label: '成本中心',
field: 'cost',
label: '部门id',
field: 'departmentCode',
sort: 'custom',
isSearch: false
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '采购员',
field: 'purchaser',
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false
isSearch: false,
},
{
label: '财务',
field: 'financer',
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '采购时间',
field: 'purchaseTime',
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '删除时间',
field: 'deletionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
search: {
component: 'DatePicker',
componentProps: {
@ -200,57 +248,29 @@ export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '是否框架协议',
field: 'isFramework',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '是否以旧换新',
field: 'isRadeIn',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '备注',
field: 'remark',
label: '删除人id',
field: 'deleterId',
sort: 'custom',
isSearch: true
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '是否可用',
field: 'available',
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isForm: false,
isSearch: false,
isTableForm: false,
isTable: false,
isForm: false,
isDetail:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',

Loading…
Cancel
Save