Browse Source

EAM ——> 定时任务生成保养工单 主子明细

master_hella_20240701
gaojs 6 months ago
parent
commit
6b366d0e50
  1. 64
      src/api/eam/equipmentMaintenanceDetail/index.ts
  2. 6
      src/api/eam/equipmentMaintenanceMain/index.ts
  3. 3
      src/utils/dict.ts
  4. 2
      src/views/eam/basicMaintenanceOption/basicMaintenanceOption.data.ts
  5. 295
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  6. 116
      src/views/eam/equipmentMaintenanceMain/index.vue
  7. 2
      src/views/eam/maintenance/index.vue
  8. 65
      src/views/eam/maintenance/maintenance.data.ts

64
src/api/eam/equipmentMaintenanceDetail/index.ts

@ -0,0 +1,64 @@
import request from '@/config/axios'
export interface EquipmentMaintenanceDetailVO {
id: number
number: string
masterId: number
peoples: number
estimatedMinutes: number
actualMinutes: number
chargePeoples: string
completionTime: Date
uncompletedCause: string
result: string
contents: string
equipmentParts: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询设备保养工单子列表
export const getEquipmentMaintenanceDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/equipment-maintenance-detail/senior', data })
} else {
return await request.get({ url: `/eam/equipment-maintenance-detail/page`, params })
}
}
// 查询设备保养工单子详情
export const getEquipmentMaintenanceDetail = async (id: number) => {
return await request.get({ url: `/eam/equipment-maintenance-detail/get?id=` + id })
}
// 新增设备保养工单子
export const createEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.post({ url: `/eam/equipment-maintenance-detail/create`, data })
}
// 修改设备保养工单子
export const updateEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.put({ url: `/eam/equipment-maintenance-detail/update`, data })
}
// 删除设备保养工单子
export const deleteEquipmentMaintenanceDetail = async (id: number) => {
return await request.delete({ url: `/eam/equipment-maintenance-detail/delete?id=` + id })
}
// 导出设备保养工单子 Excel
export const exportEquipmentMaintenanceDetail = async (params) => {
return await request.download({ url: `/eam/equipment-maintenance-detail/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/equipment-maintenance-detail/get-import-template' })
}

6
src/api/eam/equipmentMaintenanceMain/index.ts

@ -1,4 +1,5 @@
import request from '@/config/axios'
import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart";
export interface EquipmentMaintenanceMainVO {
id: number
@ -72,3 +73,8 @@ export const exportEquipmentMaintenanceMain = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/eam/equipment-maintenance-main/get-import-template' })
}
// 启用 / 禁用
export const updateEnableCode = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/ables` , data })
}

3
src/utils/dict.ts

@ -348,5 +348,6 @@ export enum DICT_TYPE {
SUBJECT = 'subject', //科目
REGION = 'region', //区域
PART_CLASS = 'part_class', //备件分类
MAINTENANCE_CYCLE ='maintenance_cycle' // 保养周期
MAINTENANCE_CYCLE ='maintenance_cycle', // 保养周期
EAM_ORDER_STATUS = 'eam_order_status'
}

2
src/views/eam/basicMaintenanceOption/basicMaintenanceOption.data.ts

@ -4,7 +4,7 @@ import {
BasicMaintenanceItemSelectSet
} from "@/views/eam/maintenanceItemSelectSet/maintenanceItemSelectSet.data";
import * as ItemApi from "@/api/eam/maintenanceItemSelectSet";
import {getBasicMaintenanceItemSelectSetPage} from "@/api/eam/maintenanceItemSelectSet";
// 表单校验
export const BasicMaintenanceOptionRules = reactive({

295
src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts

@ -1,5 +1,9 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop";
// 表单校验
export const EquipmentMaintenanceMainRules = reactive({
@ -8,7 +12,6 @@ export const EquipmentMaintenanceMainRules = reactive({
planNumber: [required],
status: [required],
factoryAreaCode: [required],
concurrencyStamp: [required],
})
export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -25,6 +28,7 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '保养工单编号',
field: 'number',
sort: 'custom',
isForm: false,
isSearch: true,
},
{
@ -34,16 +38,37 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
},
{
label: '设备编号',
field: 'equipmentCode',
label: '设备类别',
field: 'type',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: true,
},
{
label: '设备分类',
field: 'type',
label: '设备编号',
field: 'equipmentCode',
sort: 'custom',
isSearch: true,
isForm: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchTitle: '设备信息', // 查询弹窗标题
searchListPlaceholder: '请选择 设备编号', // 输入框占位文本
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: EquipmentItemApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
multiple:true,
searchCondition: [{
key: 'status',
value: 'NORMAL',
action: '==',
isSearch: true,
isMainValue: false
}]
}
}
},
{
label: '班次枚举',
@ -74,29 +99,22 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'times',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '验证人',
field: 'verifyer',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '验证内容',
field: 'verifyContent',
sort: 'custom',
isSearch: true,
form: {
component: 'Editor',
componentProps: {
valueHtml: '',
height: 200
}
},
},
{
label: '验证时间',
@ -125,10 +143,6 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'maintenancer',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '保养人联系电话',
@ -187,25 +201,44 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
},
{
label: '流程状态枚举',
label: '流程状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
dictType: DICT_TYPE.EAM_ORDER_STATUS,
dictClass: 'string',
},
{
label: '所属厂区编号',
field: 'factoryAreaCode',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '车间', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '工段编号',
@ -253,6 +286,218 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isForm: false,
isDetail:false,
},
{
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
},
{
label: '删除时间',
field: 'deletionTime',
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '删除人id',
field: 'deleterId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const EquipmentMaintenanceDetailRules = reactive({
number: [required],
contents: [required],
})
export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '保养工单号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '主表id',
field: 'masterId',
sort: 'custom',
isSearch: true,
},
{
label: '人数',
field: 'peoples',
sort: 'custom',
isSearch: true,
},
{
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '责任人多选',
field: 'chargePeoples',
sort: 'custom',
isSearch: true,
},
{
label: '完成时间',
field: 'completionTime',
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: 'uncompletedCause',
sort: 'custom',
isSearch: true,
},
{
label: '结果枚举0完成 1未完成',
field: 'result',
sort: 'custom',
isSearch: true,
},
{
label: '保养内容',
field: 'contents',
sort: 'custom',
isSearch: true,
},
{
label: '保养部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: true,
},
{
label: '创建时间',
field: 'createTime',
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')]
}
},
isForm: false,
},
{
label: '部门id',
field: 'departmentCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '是否可用默认TRUE',
field: 'available',

116
src/views/eam/equipmentMaintenanceMain/index.vue

@ -27,13 +27,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
@ -48,10 +48,18 @@
:apiCreate="EquipmentMaintenanceMainApi.createEquipmentMaintenanceMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentMaintenanceMain.allSchemas" />
<Detail ref="detailRef"
:isBasic="false"
:allSchemas="EquipmentMaintenanceMain.allSchemas"
:detailAllSchemas="EquipmentMaintenanceDetail.allSchemas"
:apiPage="EquipmentMaintenanceDetailApi.getEquipmentMaintenanceDetailPage"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-maintenance-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -59,12 +67,18 @@
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentMaintenanceMain,EquipmentMaintenanceMainRules } from './equipmentMaintenanceMain.data'
import { EquipmentMaintenanceMain,EquipmentMaintenanceMainRules,EquipmentMaintenanceDetail } from './equipmentMaintenanceMain.data'
import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain'
import * as EquipmentMaintenanceDetailApi from '@/api/eam/equipmentMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import {Maintenance} from "@/views/eam/maintenance/maintenance.data";
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts";
defineOptions({ name: 'EquipmentMaintenanceMain' })
@ -131,11 +145,23 @@ const buttonBaseClick = (val, item) => {
}
}
const isShowMainButton = (row,val) => {
if (val.indexOf(row.available) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = [
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain:delete'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain:delete'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}),
]
}
// -
const buttonTableClick = async (val, row) => {
@ -149,6 +175,20 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type == "create"){
EquipmentMaintenanceMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.value = '0';
item.componentProps.disabled = true
}
})
}else{
EquipmentMaintenanceMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.componentProps.disabled = true
}
})
}
basicFormRef.value.open(type, row)
}
@ -195,6 +235,66 @@ const handleDelete = async (id: number) => {
} catch {}
}
/** 启用 */
const handleEnable = async (id: number) => {
try {
const params = ref({
id: '',
available:'',
})
params.value.id = id
params.value.available = 'TRUE'
await EquipmentMaintenanceMainApi.updateEnableCode(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 禁用 */
const handleDisable = async (id: number) => {
try {
const params = ref({
id: '',
available:'',
})
params.value.id = id
params.value.available = 'FALSE'
await EquipmentMaintenanceMainApi.updateEnableCode(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
const onChange = (field, item) => {
console.log(field)
console.log(item)
//
if(field == 'type' && item == 'DEVICE'){
Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({
equipmentCode:''
})
items.componentProps.searchAllSchemas = EquipmentAccounts.allSchemas
items.componentProps.searchPage = EquipmentItemApi.getEquipmentAccountsPage
}
})
}
//
if(field == 'type' && item == 'EQUIPMENT'){
Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({
equipmentCode:''
})
items.componentProps.searchAllSchemas = ToolAccounts.allSchemas
items.componentProps.searchPage = ToolItemApi.getToolAccountsPage
}
})
}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {

2
src/views/eam/maintenance/index.vue

@ -248,8 +248,6 @@ const handleDisable = async (id: number) => {
}
const onChange = (field, item) => {
console.log(field)
console.log(item)
//
if(field == 'type' && item == 'DEVICE'){
Maintenance.allSchemas.formSchema.forEach((items) => {

65
src/views/eam/maintenance/maintenance.data.ts

@ -2,10 +2,13 @@ import type {CrudSchema} from '@/hooks/web/useCrudSchemas'
import {dateFormatter} from '@/utils/formatTime'
import { EquipmentAccounts } from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import { BasicMaintenanceOption } from "@/views/eam/basicMaintenanceOption/basicMaintenanceOption.data";
import * as MaintenanceOptionApi from "@/api/eam/basicMaintenanceOption";
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
// 表单校验
export const MaintenanceRules = reactive({
number: [required],
name: [required],
equipmentCode: [required],
optionCode: [required],
@ -29,6 +32,8 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
isDetail:true,
},
{
label: '计划名称',
@ -74,6 +79,25 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'optionCode',
sort: 'custom',
isSearch: true,
isForm: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchTitle: '保养方案信息', // 查询弹窗标题
searchListPlaceholder: '请选择保养方案', // 输入框占位文本
searchAllSchemas: BasicMaintenanceOption.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: MaintenanceOptionApi.getBasicMaintenanceOptionPage, // 查询弹窗所需分页方法
multiple:true,
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}]
}
}
},
{
label: '周期',
@ -145,13 +169,6 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'approveContent',
sort: 'custom',
isSearch: true,
form: {
component: 'Editor',
componentProps: {
valueHtml: '',
height: 200
}
},
},
{
label: '审核时间',
@ -179,13 +196,19 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '自动审核',
field: 'autoExamine',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '自动通过',
field: 'autoAgree',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '直接生成记录',
@ -197,13 +220,33 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '所属厂区编号',
field: 'factoryAreaCode',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '车间', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '工段编号',

Loading…
Cancel
Save