Browse Source

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

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

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

@ -7,23 +7,19 @@ export interface SparePartVO {
brand: string brand: string
specifications: string specifications: string
isOverall: string isOverall: string
isConstant: string
subject: string subject: string
subjectCode: string subjectCode: string
category: string type: string
images: string
region: string region: string
classification: string classification: string
uom: string uom: string
singlePrice: number singlePrice: number
stockAge: number manufacturer: string
reprocurement: number minInventory: number
safetyStock: number maxInventory: number
cost: string replacementCycle: number
purchaser: string storageLocation: string
financer: string
purchaseTime: Date
isFramework: string
isRadeIn: string
departmentCode: string departmentCode: string
remark: string remark: string
siteId: string siteId: string
@ -38,38 +34,38 @@ export const getSparePartPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} 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 { } 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) => { 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) => { 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) => { 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) => { 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 // 导出备件基础 Excel
export const exportSparePart = async (params) => { 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 = () => { 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" /> <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> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -134,7 +134,7 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:spare-part:update'}), // defaultButtons.mainListEditBtn({hasPermi:'eam:spare-part:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:spare-part:delete'}), // //defaultButtons.mainListDeleteBtn({hasPermi:'eam:sparePart:delete'}), //
] ]
// - // -

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

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

Loading…
Cancel
Save