Browse Source

EAM ——> 维修工单 主子联动 前后端

master_hella_20240701
gaojs 5 months ago
parent
commit
5596ee712d
  1. 59
      src/api/eam/equipmentRepairJobDetail/index.ts
  2. 93
      src/api/eam/equipmentRepairJobMain/index.ts
  3. 6
      src/utils/dict.ts
  4. 2
      src/views/eam/basicFaultCause/basicFaultCause.data.ts
  5. 2
      src/views/eam/basicFaultType/basicFaultType.data.ts
  6. 2
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  7. 35
      src/views/eam/equipmentMaintenanceMain/index.vue
  8. 145
      src/views/eam/equipmentRepairJobDetail/equipmentRepairJobDetail.data.ts
  9. 244
      src/views/eam/equipmentRepairJobDetail/index.vue
  10. 1086
      src/views/eam/equipmentRepairJobMain/EquipmentRepairJobDetail.vue
  11. 668
      src/views/eam/equipmentRepairJobMain/equipmentRepairJobMain.data.ts
  12. 320
      src/views/eam/equipmentRepairJobMain/index.vue
  13. 2
      src/views/eam/equipmentReportRepairRequest/equipmentReportRepairRequest.data.ts
  14. 3
      src/views/eam/equipmentReportRepairRequest/index.vue

59
src/api/eam/equipmentRepairJobDetail/index.ts

@ -0,0 +1,59 @@
import request from '@/config/axios'
export interface EquipmentRepairJobDetailVO {
id: number
number: string
masterId: number
describing: string
faultCause: string
workOut: string
maintenances: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询维修工单子列表
export const getEquipmentRepairJobDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/equipment-repair-job-detail/senior', data })
} else {
return await request.get({ url: `/eam/equipment-repair-job-detail/page`, params })
}
}
// 查询维修工单子详情
export const getEquipmentRepairJobDetail = async (id: number) => {
return await request.get({ url: `/eam/equipment-repair-job-detail/get?id=` + id })
}
// 新增维修工单子
export const createEquipmentRepairJobDetail = async (data: EquipmentRepairJobDetailVO) => {
return await request.post({ url: `/eam/equipment-repair-job-detail/create`, data })
}
// 修改维修工单子
export const updateEquipmentRepairJobDetail = async (data: EquipmentRepairJobDetailVO) => {
return await request.put({ url: `/eam/equipment-repair-job-detail/update`, data })
}
// 删除维修工单子
export const deleteEquipmentRepairJobDetail = async (id: number) => {
return await request.delete({ url: `/eam/equipment-repair-job-detail/delete?id=` + id })
}
// 导出维修工单子 Excel
export const exportEquipmentRepairJobDetail = async (params) => {
return await request.download({ url: `/eam/equipment-repair-job-detail/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/equipment-repair-job-detail/get-import-template' })
}

93
src/api/eam/equipmentRepairJobMain/index.ts

@ -0,0 +1,93 @@
import request from '@/config/axios'
import {EquipmentReportRepairRequestVO} from "@/api/eam/equipmentReportRepairRequest";
export interface EquipmentRepairJobMainVO {
id: number
number: string
type: string
repairNumber: string
sources: string
maintenanceDesc: string
urgency: string
level: string
equipmentCode: string
shutDown: boolean
startTime: Date
endTime: Date
totalMinutes: number
verifyer: number
verifyContent: string
verifyTime: Date
maintenancer: number
maintenancePhone: string
completeResult: string
completionTime: Date
maintenanceTime: Date
repairTime: Date
repairer: number
faultType: string
status: string
autoOrder: string
autoPerform: string
autoVerify: string
directCreateRecord: string
classType: string
factoryAreaCode: string
workshopCode: string
lineCode: string
processCode: string
workstationCode: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询维修工单主列表
export const getEquipmentRepairJobMainPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/equipment-repair-job-main/senior', data })
} else {
return await request.get({ url: `/eam/equipment-repair-job-main/page`, params })
}
}
// 查询维修工单主详情
export const getEquipmentRepairJobMain = async (id: number) => {
return await request.get({ url: `/eam/equipment-repair-job-main/get?id=` + id })
}
// 新增维修工单主
export const createEquipmentRepairJobMain = async (data: EquipmentRepairJobMainVO) => {
return await request.post({ url: `/eam/equipment-repair-job-main/create`, data })
}
// 修改维修工单主
export const updateEquipmentRepairJobMain = async (data: EquipmentRepairJobMainVO) => {
return await request.put({ url: `/eam/equipment-repair-job-main/update`, data })
}
// 删除维修工单主
export const deleteEquipmentRepairJobMain = async (id: number) => {
return await request.delete({ url: `/eam/equipment-repair-job-main/delete?id=` + id })
}
// 导出维修工单主 Excel
export const exportEquipmentRepairJobMain = async (params) => {
return await request.download({ url: `/eam/equipment-repair-job-main/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/equipment-repair-job-main/get-import-template' })
}
// 修改维修工单状态
export const updateEquipmentRepairOrder = async (data: EquipmentRepairJobMainVO) => {
return await request.post({ url: `/eam/equipment-repair-job-main/updateOrder`, data })
}

6
src/utils/dict.ts

@ -356,6 +356,10 @@ export enum DICT_TYPE {
MAINTENANCE_CYCLE ='maintenance_cycle', // 保养周期 MAINTENANCE_CYCLE ='maintenance_cycle', // 保养周期
EAM_ORDER_STATUS = 'eam_order_status',// 保养工单状态 EAM_ORDER_STATUS = 'eam_order_status',// 保养工单状态
EAM_PLAN_STATUS = 'eam_plan_status', // 保养计划状态 EAM_PLAN_STATUS = 'eam_plan_status', // 保养计划状态
EAM_REPAIR_STATUS = 'eam_repair_status', // 报修状态 EAM_REPAIR_REPORT_STATUS = 'eam_repair_report_status', // 报修状态
EAM_MAINTENANCE_SOURCES = 'eam_maintenance_sources', // 维保数据来源
EAM_MAINTENANCE_URGENCY = 'eam_maintenance_urgency', // 维保紧急程度
EAM_MAINTENANCE_LEVEL = 'eam_maintenance_level', // 维保维修级别
EAM_REPAIR_STATUS = 'eam_repair_status', // 维修状态
OFF_BACK_STATUS = 'off_back_status' OFF_BACK_STATUS = 'off_back_status'
} }

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

@ -31,7 +31,7 @@ export const BasicFaultCause = useCrudSchemas(reactive<CrudSchema[]>([
}, },
}, },
{ {
label: '设备编码', label: '编码',
field: 'code', field: 'code',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,

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

@ -18,7 +18,7 @@ export const BasicFaultType = useCrudSchemas(reactive<CrudSchema[]>([
isDetail:false, isDetail:false,
}, },
{ {
label: '设备编码', label: '编码',
field: 'code', field: 'code',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,

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

@ -89,6 +89,8 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '故障类型枚举', label: '故障类型枚举',
field: 'faultType', field: 'faultType',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.FAILURE_REASON,
dictClass: 'string',
isSearch: true, isSearch: true,
isSearch: false, isSearch: false,
}, },

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

@ -353,39 +353,6 @@ const handleFinish = async (row) => {
// //
finishForm2Ref.value.open('update', row); finishForm2Ref.value.open('update', row);
//let res = await EquipmentMaintenanceMainApi.getMaintenanceOrderConfig();
//
// if(res.remark === 'TRUE'){
// try {
//
//
// // //
// // await message.delConfirm('');
// // const params = ref({
// // id: '',
// // status:'',
// // })
// // params.value.id = row.id
// // params.value.status = '5'
// // //
// // await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
// // message.success(t(''))
// // //
// // await getList()
// } catch {}
// }
// //
// if(res.remark === 'FALSE'){
// try {
// //
// await message.delConfirm('');
//
// //
// finishForm2Ref.value.open('update', row);
//
// } catch {}
// }
} }
/** 验证按钮操作 */ /** 验证按钮操作 */
@ -406,8 +373,6 @@ const handleValidate = async (row) => {
await getList() await getList()
}) })
} }
/** 启用 */ /** 启用 */

145
src/views/eam/equipmentRepairJobDetail/equipmentRepairJobDetail.data.ts

@ -0,0 +1,145 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const EquipmentRepairJobDetailRules = reactive({
number: [required],
masterId: [required],
concurrencyStamp: [required],
})
export const EquipmentRepairJobDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
},
{
label: '维修工单号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '主表id',
field: 'masterId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '故障描述',
field: 'describing',
sort: 'custom',
isSearch: true,
},
{
label: '故障原因关联基础数据',
field: 'faultCause',
sort: 'custom',
isSearch: true,
},
{
label: '解决措施',
field: 'workOut',
sort: 'custom',
isSearch: true,
},
{
label: '维修人员字符串多个',
field: 'maintenances',
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: true,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true,
},
{
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isSearch: true,
},
{
label: '删除时间',
field: 'deletionTime',
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: '删除人id',
field: 'deleterId',
sort: 'custom',
isSearch: true,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/equipmentRepairJobDetail/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="EquipmentRepairJobDetail.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="EquipmentRepairJobDetail.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
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>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="EquipmentRepairJobDetailRules"
:formAllSchemas="EquipmentRepairJobDetail.allSchemas"
:apiUpdate="EquipmentRepairJobDetailApi.updateEquipmentRepairJobDetail"
:apiCreate="EquipmentRepairJobDetailApi.createEquipmentRepairJobDetail"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentRepairJobDetail.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-repair-job-detail/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentRepairJobDetail,EquipmentRepairJobDetailRules } from './equipmentRepairJobDetail.data'
import * as EquipmentRepairJobDetailApi from '@/api/eam/equipmentRepairJobDetail'
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'
defineOptions({ name: 'EquipmentRepairJobDetail' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentRepairJobDetail.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: EquipmentRepairJobDetailApi.getEquipmentRepairJobDetailPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:equipmentRepairJobDetail:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:equipmentRepairJobDetail:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:equipmentRepairJobDetail:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:equipmentRepairJobDetail:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:equipmentRepairJobDetail:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =EquipmentRepairJobDetail.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await EquipmentRepairJobDetailApi.createEquipmentRepairJobDetail(data)
message.success(t('common.createSuccess'))
} else {
await EquipmentRepairJobDetailApi.updateEquipmentRepairJobDetail(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentRepairJobDetail')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EquipmentRepairJobDetailApi.deleteEquipmentRepairJobDetail(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await EquipmentRepairJobDetailApi.exportEquipmentRepairJobDetail(tableObject.params)
download.excel(data, '维修工单子.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '维修工单子导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await EquipmentRepairJobDetailApi.importTemplate()
})
</script>

1086
src/views/eam/equipmentRepairJobMain/EquipmentRepairJobDetail.vue

File diff suppressed because it is too large

668
src/views/eam/equipmentRepairJobMain/equipmentRepairJobMain.data.ts

@ -0,0 +1,668 @@
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 {BasicFaultCause} from "@/views/eam/basicFaultCause/basicFaultCause.data";
import * as ItemApi from "@/api/eam/basicFaultCause";
import {getBasicFaultCausePage} from "@/api/eam/basicFaultCause";
// 表单校验
export const EquipmentRepairJobMainRules = reactive({
number: [required],
type: [required],
sources: [required],
urgency: [required],
level: [required],
equipmentCode: [required],
totalMinutes: [required],
faultType: [required],
status: [required],
})
export const EquipmentRepairJobMain = 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: '设备类别',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string',
isSearch: true,
},
{
label: '报修工单号',
field: 'repairNumber',
sort: 'custom',
isSearch: true,
},
{
label: '来源字典',
field: 'sources',
sort: 'custom',
dictType: DICT_TYPE.EAM_MAINTENANCE_SOURCES,
dictClass: 'string',
isSearch: false,
},
{
label: '维修描述',
field: 'maintenanceDesc',
sort: 'custom',
isSearch: false,
},
{
label: '紧急程度',
field: 'urgency',
sort: 'custom',
dictType: DICT_TYPE.EAM_MAINTENANCE_URGENCY,
dictClass: 'string',
isSearch: true,
},
{
label: '维修级别',
field: 'level',
sort: 'custom',
dictType: DICT_TYPE.EAM_MAINTENANCE_LEVEL,
dictClass: 'string',
isSearch: true,
},
{
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: '是否停机',
field: 'shutDown',
sort: 'custom',
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
dictClass: 'string',
isSearch: true,
form: {
component: 'Radio'
}
},
{
label: '维修开始时间',
field: 'startTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '维修结束时间',
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '维修时长',
field: 'totalMinutes',
sort: 'custom',
isSearch: false,
},
{
label: '验证人',
field: 'verifyer',
sort: 'custom',
isSearch: false,
},
{
label: '验证内容',
field: 'verifyContent',
sort: 'custom',
isSearch: false,
},
{
label: '验证时间',
field: 'verifyTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '执行人',
field: 'maintenancer',
sort: 'custom',
isSearch: false,
},
{
label: '维修人联系电话',
field: 'maintenancePhone',
sort: 'custom',
isSearch: false,
},
{
label: '结果',
field: 'completeResult',
sort: 'custom',
isSearch: true,
},
{
label: '完成时间',
field: 'completionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '执行时间',
field: 'maintenanceTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '报修时间',
field: 'repairTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '报修人',
field: 'repairer',
sort: 'custom',
isSearch: false,
},
{
label: '故障类型',
field: 'faultType',
dictType: DICT_TYPE.FAILURE_REASON,
dictClass: 'string',
sort: 'custom',
isSearch: true,
},
{
label: '流程状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.EAM_REPAIR_STATUS,
dictClass: 'string',
isSearch: true,
},
// {
// label: '自动接单',
// field: 'autoOrder',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '自动执行',
// field: 'autoPerform',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '自动验证',
// field: 'autoVerify',
// sort: 'custom',
// isSearch: true,
// },
{
label: '直接生成记录',
field: 'directCreateRecord',
sort: 'custom',
isSearch: false,
},
{
label: '班组类型',
field: 'classType',
sort: 'custom',
isSearch: false,
},
// {
// label: '所属厂区编号',
// field: 'factoryAreaCode',
// sort: 'custom',
// isSearch: true,
// },
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: false,
},
// {
// label: '产线编号',
// field: 'lineCode',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// },
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
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')]
}
},
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '部门id',
field: 'departmentCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
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: {
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 EquipmentRepairJobDetailRules = reactive({
number: [required],
masterId: [required],
concurrencyStamp: [required],
})
export const EquipmentRepairJobDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '维修工单号',
field: 'number',
sort: 'custom',
isSearch: true,
form:{
componentProps: {
disabled: true
}
}
},
{
label: '主表id',
field: 'masterId',
sort: 'custom',
isSearch: true,
form:{
componentProps: {
disabled: true
}
},
},
{
label: '故障描述',
field: 'describing',
sort: 'custom',
isSearch: true,
},
{
label: '故障原因',
field: 'faultCause',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择 故障原因',
searchTitle: '故障原因', // 查询弹窗标题
searchAllSchemas: BasicFaultCause.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: ItemApi.getBasicFaultCausePage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}]
}
},
},
{
label: '解决措施',
field: 'workOut',
sort: 'custom',
isSearch: true,
},
{
label: '维修人员字符串多个',
field: 'maintenances',
sort: 'custom',
isSearch: true,
},
{
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: '部门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',
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: {
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'
}
}
]))

320
src/views/eam/equipmentRepairJobMain/index.vue

@ -0,0 +1,320 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="EquipmentRepairJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="EquipmentRepairJobMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<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(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="EquipmentRepairJobMainRules"
:formAllSchemas="EquipmentRepairJobMain.allSchemas"
:apiUpdate="EquipmentRepairJobMainApi.updateEquipmentRepairJobMain"
:apiCreate="EquipmentRepairJobMainApi.createEquipmentRepairJobMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef"
:isBasic="false"
:allSchemas="EquipmentRepairJobMain.allSchemas"
:detailAllSchemas="EquipmentRepairJobDetail.allSchemas"
:detailAllSchemasRules="EquipmentRepairJobDetailRules"
:apiPage="EquipmentRepairJobDetailApi.getEquipmentRepairJobDetailPage"
:apiCreate="EquipmentRepairJobDetailApi.createEquipmentRepairJobDetail"
:apiUpdate="EquipmentRepairJobDetailApi.updateEquipmentRepairJobDetail"
:apiDelete="EquipmentRepairJobDetailApi.deleteEquipmentRepairJobDetail"
:detailButtonIsShowAdd=statusBtn
:detailButtonIsShowEdit=statusBtn
:detailButtonIsShowDelete=statusBtn
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-repair-job-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentRepairJobMain,EquipmentRepairJobMainRules,EquipmentRepairJobDetail,EquipmentRepairJobDetailRules } from './equipmentRepairJobMain.data'
import * as EquipmentRepairJobMainApi from '@/api/eam/equipmentRepairJobMain'
import * as EquipmentRepairJobDetailApi from '@/api/eam/equipmentRepairJobDetail'
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 '@/views/eam/equipmentRepairJobMain/EquipmentRepairJobDetail.vue'
defineOptions({ name: 'EquipmentRepairJobMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentRepairJobMain.allSchemas.tableColumns)
const statusBtn = ref(false);
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: EquipmentRepairJobMainApi.getEquipmentRepairJobMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentRepairJobMain:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'eam:equipmentRepairJobMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:equipmentRepairJobMain:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
const isShowStatusButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return[
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListReceiveOrderBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['5']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'receive') { //
handleReceive(row.id)
} else if (val == 'execute') { //
handleExecute(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =EquipmentRepairJobMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await EquipmentRepairJobMainApi.createEquipmentRepairJobMain(data)
message.success(t('common.createSuccess'))
} else {
await EquipmentRepairJobMainApi.updateEquipmentRepairJobMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
if('5' === row.status){
statusBtn.value=true
}else {
statusBtn.value=false
}
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentRepairJobMain')
}
/** 接单按钮操作 */
const handleReceive = async (id: number) => {
try {
//
await message.delConfirm('是否接单?');
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '4'
//
await EquipmentRepairJobMainApi.updateEquipmentRepairOrder(params.value)
message.success(t('接单成功'))
//
await getList()
} catch {}
}
/** 执行按钮操作 */
const handleExecute = async (id: number) => {
try {
//
await message.delConfirm('是否执行所选中任务?');
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '5'
//
await EquipmentRepairJobMainApi.updateEquipmentRepairOrder(params.value)
message.success(t('执行成功'))
//
await getList()
} catch {}
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EquipmentRepairJobMainApi.deleteEquipmentRepairJobMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await EquipmentRepairJobMainApi.exportEquipmentRepairJobMain(tableObject.params)
download.excel(data, '维修工单主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '维修工单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await EquipmentRepairJobMainApi.importTemplate()
})
</script>

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

@ -144,7 +144,7 @@ export const EquipmentReportRepairRequest = useCrudSchemas(reactive<CrudSchema[]
label: '报修状态', label: '报修状态',
field: 'status', field: 'status',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.EAM_REPAIR_STATUS, dictType: DICT_TYPE.EAM_REPAIR_REPORT_STATUS,
dictClass: 'string', dictClass: 'string',
isSearch: false, isSearch: false,
isForm: false, isForm: false,

3
src/views/eam/equipmentReportRepairRequest/index.vue

@ -74,6 +74,7 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data"; import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts"; import * as ToolItemApi from "@/api/eam/toolAccounts";
import {createEquipmentWeixiuOrder} from "@/api/eam/equipmentReportRepairRequest";
defineOptions({ name: 'EquipmentReportRepairRequest' }) defineOptions({ name: 'EquipmentReportRepairRequest' })
@ -235,7 +236,7 @@ const handleFinish = async (id: number) => {
}) })
params.value.id = id params.value.id = id
params.value.status = '5' params.value.status = '5'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value) await EquipmentReportRepairRequestApi.createEquipmentWeixiuOrder(params.value)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
// //
await getList() await getList()

Loading…
Cancel
Save