Browse Source

EAM ——> 保养工单 子保养项新增 修改。主工单保养状态流转

master_hella_20240701
gaojs 6 months ago
parent
commit
8560ad639f
  1. 7
      src/api/eam/equipmentMaintenanceDetail/index.ts
  2. 7
      src/api/eam/equipmentMaintenanceMain/index.ts
  3. 8
      src/hooks/web/useMessage.ts
  4. 26
      src/utils/disposition/defaultButtons.ts
  5. 322
      src/views/eam/equipmentMaintenanceMain/DetailEam.vue
  6. 121
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  7. 136
      src/views/eam/equipmentMaintenanceMain/index.vue

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

@ -43,6 +43,11 @@ export const createEquipmentMaintenanceDetail = async (data: EquipmentMaintenanc
return await request.post({ url: `/eam/equipment-maintenance-detail/create`, data }) return await request.post({ url: `/eam/equipment-maintenance-detail/create`, data })
} }
// 新增设备保养工单 通过主表添加
export const createItemEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.post({ url: `/eam/equipment-maintenance-detail/createItem`, data })
}
// 修改设备保养工单子 // 修改设备保养工单子
export const updateEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => { export const updateEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.put({ url: `/eam/equipment-maintenance-detail/update`, data }) return await request.put({ url: `/eam/equipment-maintenance-detail/update`, data })
@ -61,4 +66,4 @@ export const exportEquipmentMaintenanceDetail = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/equipment-maintenance-detail/get-import-template' }) return request.download({ url: '/eam/equipment-maintenance-detail/get-import-template' })
} }

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

@ -79,7 +79,12 @@ export const updateEnableCode = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/ables` , data }) return await request.post({ url: `/eam/equipment-maintenance-main/ables` , data })
} }
// 执行保养工单 // 修改保养工单状态
export const updateMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/updateOrder`, data })
}
//执行保养工单
export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => { export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/execute`, data }) return await request.post({ url: `/eam/equipment-maintenance-main/execute`, data })
} }

8
src/hooks/web/useMessage.ts

@ -59,6 +59,14 @@ export const useMessage = () => {
type: 'warning' type: 'warning'
}) })
}, },
// 确认窗体
confirmPassword(content: string, tip?: string) {
return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
confirmButtonText: t('通过'),
cancelButtonText: t('不通过'),
type: 'warning'
})
},
// 删除窗体 // 删除窗体
delConfirm(content?: string, tip?: string) { delConfirm(content?: string, tip?: string) {
return ElMessageBox.confirm( return ElMessageBox.confirm(

26
src/utils/disposition/defaultButtons.ts

@ -325,6 +325,19 @@ export function mainListReceiveBtn(option:any) {
}) })
} }
// 主列表-接单按钮
export function mainListReceiveOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.接单`).replace('ts.', ''),
name: 'receive',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-执行按钮 // 主列表-执行按钮
export function mainListExecuteBtn(option:any) { export function mainListExecuteBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{
@ -351,6 +364,19 @@ export function mainListFinishBtn(option:any) {
}) })
} }
// 主列表-验证按钮
export function mainListValidateBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.验证`).replace('ts.', ''),
name: 'validate',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-绑定 // 主列表-绑定
export function mainListBindBtn(option:any) { export function mainListBindBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{

322
src/components/Detail/src/DetailQmsNumber.vue → src/views/eam/equipmentMaintenanceMain/DetailEam.vue

@ -2,17 +2,18 @@
<div> <div>
<el-drawer <el-drawer
v-model="isShowDrawer" v-model="isShowDrawer"
title="详情" :title="t(`ts.详情`).replace('ts.','')"
direction="rtl" direction="rtl"
size="80%" size="80%"
v-loading="detailLoading" v-loading="detailLoading"
> >
<template #header> <template #header>
<div class="font-size-18px"> <div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> {{ titleValueRef }} <span class="ml-20px font-size-16px">{{ t(`ts.${titleNameRef}`).replace('ts.','') }}</span>
</div> </div>
</template> </template>
<ContentWrap v-if="!isBasic"> <Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<ContentWrap v-if="!isBasic" v-show="tabsList[current].label=='主数据'">
<Descriptions <Descriptions
:data="detailData" :data="detailData"
labelClassName="label-class-name" labelClassName="label-class-name"
@ -24,11 +25,9 @@
width="200px" width="200px"
/> />
</ContentWrap> </ContentWrap>
<Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<div class="flex"> <div class="flex">
<!-- 详情 --> <!-- 详情 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label!='附件'&&tabsList[current].label!='备注'&&tabsList[current].label!='变更记录'"> <!-- 列表头部 --> <ContentWrap class="w-[100%]" v-show="tabsList[current].label!=annexAlias.label&&tabsList[current].label!='备注'&&tabsList[current].label!='变更记录'&&tabsList[current].label!='主数据'&&!annexTableData.some(item=>item.label==tabsList[current].label)"> <!-- 列表头部 -->
<TableHead <TableHead
v-if="!isBasic" v-if="!isBasic"
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@ -54,6 +53,7 @@
:pagination="{ total: tableObjectRef.total }" :pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
> >
<!-- <template #action="{ row }"> <!-- <template #action="{ row }">
<ButtonBase <ButtonBase
@ -70,9 +70,10 @@
:pagination="{ total: tableObjectRef.total }" :pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
> >
<template #photos="{ row }"> <template #photos="{ row }">
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> </template> <div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase
:Butttondata="buttondata" :Butttondata="buttondata"
@ -96,32 +97,77 @@
</template> </template>
</DetailTable> </DetailTable>
</ContentWrap> </ContentWrap>
<!-- other附件组件:如质检明细 -->
<div v-for="(annexItem ,index) in annexTableData" :key="index" v-show="annexItem.label==tabsList[current].label" class="w-[100%]" :style="{height:annexItem.hasSubDetail?'100%':remarkHeight+'px'}">
<ContentWrap class="w-[100%]">
<ElScrollbar ref="scrollbar" :style="{height:annexItem.hasSubDetail?'100%':(remarkHeight-40)+'px'}">
<Annex v-show="tabsList[current].label==annexItem.label"
:annexData="annexItem"
:fileType="annexItem.fileType"
:showPreview="annexItem.showPreview"
:showDownload = "annexItem.showDownload"
:hiddenDelete = "annexItem.hiddenDelete"
@handleAnnexSuccess="updateAnnexTableHandle"
@deleteAnnexSuccess="updateAnnexTableHandle"
:upData="{...remarksData.data,tableName:annexItem.tableName}"
/>
</ElScrollbar>
</ContentWrap>
<ContentWrap class="w-[100%]" v-if="annexItem.subDetailTableData">
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
:align="annexItem.align?annexItem.align:'center'"
:columns="annexItem.subDetailTableData.tableColumns"
:data="annexItem.subDetailTableData.tableList"
:loading="annexItem.subDetailTableData.loading"
:pagination="{ total: annexItem.subDetailTableData.tableList.length }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
/>
</ContentWrap>
</div>
<!-- 附件/备注/变更记录 --> <!-- 附件/备注/变更记录 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='附件'||tabsList[current].label=='备注'||tabsList[current].label=='变更记录'" :style="{height:remarkHeight+'px'}"> <ContentWrap class="w-[100%]" v-show="tabsList[current].label==annexAlias.label" :style="{height:remarkHeight+'px'}">
<!-- 附件组件 --> <!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}"> <ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<Annex v-show="tabsList[current].label=='附件'" <Annex
:annexData="annexData" :annexData="annexData"
:showDownload = "annexAlias.showDownload"
:hiddenDelete = "annexAlias.hiddenDelete"
@handleAnnexSuccess="handleAnnexSuccess" @handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess" @deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data" :upData="remarksData.data"
:key="count"
/> />
</ElScrollbar>
</ContentWrap>
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='备注'" :style="{height:remarkHeight+'px'}">
<!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<!-- 备注组件 --> <!-- 备注组件 -->
<Remarks v-show="tabsList[current].label=='备注'" <Remarks
:remarksData="remarksData" :remarksData="remarksData"
class="mt-20px" class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess" @remarksSubmitScuess="remarksSubmitScuess"
:key="count"
/> />
</ElScrollbar>
</ContentWrap>
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='变更记录'" :style="{height:remarkHeight+'px'}">
<!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<!-- 变更记录组件 --> <!-- 变更记录组件 -->
<ChangeRecord v-show="tabsList[current].label=='变更记录'" :changeRecordData="changeRecordData" class="mt-20px" /> <ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" :key="count"/>
</ElScrollbar> </ElScrollbar>
</ContentWrap> </ContentWrap>
</div> </div>
</el-drawer> </el-drawer>
<!-- 表格弹窗 --> <!-- 表格弹窗 -->
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" /> <SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" />
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicFormQmsNumber <BasicForm
ref="formRef" ref="formRef"
@success="submitForm" @success="submitForm"
:rules="detailAllSchemasRules" :rules="detailAllSchemasRules"
@ -140,7 +186,6 @@
@onChange="detailBasicFormOnChange" @onChange="detailBasicFormOnChange"
@onBlur="onBlur" @onBlur="onBlur"
@formFormDateChange="formFormDateChange" @formFormDateChange="formFormDateChange"
:myFuncTypeSign="myFuncTypeSign"
/> />
</div> </div>
</template> </template>
@ -154,12 +199,15 @@ import Tabs from '@/components/Tabs/src/Tabs.vue'
import * as RemarkApi from '@/api/wms/remark' import * as RemarkApi from '@/api/wms/remark'
import * as FileApi from '@/api/wms/file' import * as FileApi from '@/api/wms/file'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicFormQmsNumber from '@/components/BasicForm/src/BasicFormQmsNumber.vue' import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import {
EquipmentMaintenanceDetail, EquipmentMaintenanceDetailRules,
} from "@/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data";
defineOptions({ name: 'DetailQmsNumber' }) defineOptions({ name: 'Detail' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -177,6 +225,24 @@ const props = defineProps({
required: true, required: true,
default: null default: null
}, },
//tab
annexTable: {
type: Array,
required: false,
default: ()=>[]
},
//tab
annexAlias: {
type: Object,
required: false,
default: ()=>({
label: '附件',
showDownload:false,
showPreview:false,
hiddenDelete:false
})
},
// //
isBasic: { isBasic: {
type: Boolean, type: Boolean,
@ -311,16 +377,15 @@ const props = defineProps({
required: false, required: false,
default: false default: false
}, },
// //
myFuncTypeSign:{ otherHeadButttonData:{
type: String, type:Array,
required: false, required: false,
default: null default: () => []
}, }
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
const myFuncTypeSign = props.myFuncTypeSign
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (props.isBasic == true) { if (props.isBasic == true) {
@ -342,23 +407,38 @@ if (props.isBasic == true) {
} }
} }
const otherList = [] const otherList = [...props.annexTable,{
label:props.annexAlias.label,
prop:'Annex'
},{
label:'备注',
prop:'Remarks'
},{
label:'变更记录',
prop:'ChangeRecord'
}]
tabsList.value = [...tabsList?.value,...otherList] tabsList.value = [...tabsList?.value,...otherList]
if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) { if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) {
tabsList.value.unshift({ tabsList.value.unshift({
label: '明细', label: '明细',
prop: 'Detail' prop: 'Detail'
})
}
if(!props.isBasic){
tabsList.value.unshift({
label: '主数据',
prop: 'Descriptions'
}) })
} }
// Tabs
// Tabs
const tabRef = ref() const tabRef = ref()
// //
const scrollbar = ref() const scrollbar = ref()
// //
const remarkHeight = computed(() => { const remarkHeight = computed(() => {
const tab = unref(tabRef) const tab = unref(tabRef)
const tabTop = tab?.$el.getBoundingClientRect().top const tabTop = tab?.$el.getBoundingClientRect().top
const tabHeight = tab?.$el.getBoundingClientRect().height const tabHeight = tab?.$el.getBoundingClientRect().height
@ -372,6 +452,8 @@ const remarkHeight = computed(() => {
const annexData = reactive({ const annexData = reactive({
annexList: [] annexList: []
}) })
// //
const annexTableData = ref<Array<any>>([])
// //
const remarksData = reactive({ const remarksData = reactive({
@ -393,6 +475,48 @@ const getFileList = async () => {
detailLoading.value = false detailLoading.value = false
} }
} }
//
const getAnnexFileList = async (row) => {
props.annexTable?.forEach(async (item) => {
let requstData = {...remarksData.data,tableName: item?.tableName}
if(item?.queryParams){
item?.queryParams?.forEach(queryItem => {
requstData[queryItem.queryField] = row[queryItem.rowField]
});
}
const annexList = await FileApi.getFileList(requstData)
const annexData = annexTableData.value.find(annex=>annex.label === item.label)
if(annexData){
annexData.annexList = annexList
}else{
annexTableData.value.push({
align:item.align,
label: item.label,
tableName: item?.tableName || '',
annexList,
hasSubDetail:item.hasSubDetail||false,
subDetailTableData:item.subDetailTableData,
fileType:item.fileType||['apk','doc', 'xls', 'ppt', 'txt', 'pdf','png', 'jpg', 'jpeg'],
showPreview:item.showPreview||false, //
showDownload:item.showDownload||false, //
hiddenDelete:item.hiddenDelete || false, //
})
if(item?.subDetailTableData){
const { tableObject:subTableObject, tableMethods:subTableMethods } = useTable({
getListApi: item.subDetailTableData.getSubList //
})
const {getList:getSubList} = subTableMethods
subTableObject.params= {}
item.subDetailTableData.queryParams.forEach(queryItem => {
subTableObject.params[queryItem.queryField] = row[queryItem.rowField]
});
await getSubList()
item.subDetailTableData.tableList = subTableObject.tableList
console.log('subTableObject',annexTableData.value)
}
}
})
}
/** 添加附件 */ /** 添加附件 */
const handleAnnexSuccess = () => { const handleAnnexSuccess = () => {
getFileList() getFileList()
@ -403,6 +527,11 @@ const deleteAnnexSuccess = async () => {
getFileList() getFileList()
getChangeRecordList() getChangeRecordList()
} }
/** 追加的附件 */
const updateAnnexTableHandle = () => {
getAnnexFileList(detailData.value)
getChangeRecordList()
}
// Tabs // Tabs
const current = ref(0) const current = ref(0)
@ -413,14 +542,14 @@ const change = (item, index) => {
// // -- // // --
scrollbar.value.scrollTo({ top: 0}); scrollbar.value.scrollTo({ top: 0});
} }
} }
// //
const masterParmas = ref({ const masterParmas = ref({
masterId: '', //id masterId: '', //id
number: '', // number: '', //
status: '', // status: '' //
}) })
// //
@ -455,17 +584,23 @@ const searchTableFormType = ref('') // 表单的类型:create - 新增;updat
const formRef = ref() const formRef = ref()
const titleNameRef = ref() const titleNameRef = ref()
const titleValueRef = ref() const titleValueRef = ref()
const count =ref(0)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName titleNameRef.value = titleName
titleValueRef.value = titleValue titleValueRef.value = titleValue
remarksData.data = {
tableId: row.masterId||row.id,
tableName: tableName
}
count.value++
// //
if (!props.isBasic) { if (!props.isBasic) {
// id // id
masterParmas.value.masterId = row.id masterParmas.value.masterId = row.masterId||row.id
masterParmas.value.number = row.number masterParmas.value.number = row.number
masterParmas.value.status = row.status masterParmas.value.status = row.status
tableObjectRef.value.params = { tableObjectRef.value.params = {
masterId: row.id masterId: row.masterId||row.id
} }
await getList() await getList()
} }
@ -474,9 +609,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
detailLoading.value = true detailLoading.value = true
try { try {
detailData.value = row detailData.value = row
// getRemarkList() getRemarkList()
// getFileList() getFileList()
// getChangeRecordList() getAnnexFileList(row)
getChangeRecordList()
// //
let detailButtonFilter: any = [] let detailButtonFilter: any = []
let detailButtonAdd: any = [] let detailButtonAdd: any = []
@ -502,7 +638,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
defaultButtons.defaultFilterBtn(null) // defaultButtons.defaultFilterBtn(null) //
] ]
} }
HeadButttondata.value = [...HeadButttondata.value,...props.otherHeadButttonData]
let detailButtonEdit: any = [] let detailButtonEdit: any = []
let detailButtonDelete: any = [] let detailButtonDelete: any = []
if (props.detailButtonIsShowEdit) { if (props.detailButtonIsShowEdit) {
@ -564,11 +700,6 @@ detailAllSchemasRef.value = props.detailAllSchemas
// //
const isShowMainButton = (row, val) => { const isShowMainButton = (row, val) => {
// if (val.indexOf(row.status) > -1) {
// return false
// } else {
// return true
// }
return false return false
} }
@ -588,13 +719,13 @@ const buttonBaseClick = (val, item) => {
}) })
const item = props.detailAllSchemas.formSchema[0] const item = props.detailAllSchemas.formSchema[0]
opensearchTable( opensearchTable(
item.field, item?.componentProps?.searchField, item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle, item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas, item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage, item?.componentProps?.searchPage,
item?.componentProps?.searchCondition, item?.componentProps?.searchCondition,
item?.componentProps?.multiple, item?.componentProps?.multiple,
undefined,undefined undefined,undefined
) )
}else{ }else{
openForm('create') openForm('create')
@ -613,6 +744,7 @@ const buttonBaseClick = (val, item) => {
} else { } else {
// //
console.log('其他按钮', item) console.log('其他按钮', item)
emit('buttonBaseClick',val, item)
} }
} }
@ -643,8 +775,6 @@ const opensearchTable = (
} }
} }
} }
console.log(searchCondition)
console.log(_searchCondition)
searchTableRef.value.open( searchTableRef.value.open(
searchTitle, searchTitle,
searchAllSchemas, searchAllSchemas,
@ -674,13 +804,13 @@ const buttonTableClick = async (val, row) => {
} }
const item = props.detailAllSchemas.formSchema[0] const item = props.detailAllSchemas.formSchema[0]
opensearchTable( opensearchTable(
item.field, item?.componentProps?.searchField, item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle, item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas, item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage, item?.componentProps?.searchPage,
item?.componentProps?.searchCondition, item?.componentProps?.searchCondition,
item?.componentProps?.multiple, item?.componentProps?.multiple,
undefined,undefined undefined,undefined
) )
}else{ }else{
openForm('update', row) openForm('update', row)
@ -694,8 +824,69 @@ const buttonTableClick = async (val, row) => {
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value) formRef.value.open(type, row, masterParmas.value)
emit('detailOpenForm', type, row, masterParmas.value) emit('detailOpenForm', type, row)
if(type == "create"){
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if(item.field == 'peoples'){
item.componentProps.disabled = true
EquipmentMaintenanceDetailRules.peoples[0].required = false
}
if(item.field == 'estimatedMinutes'){
EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = true
}
if(item.field == 'actualMinutes'){
item.componentProps.disabled = true
EquipmentMaintenanceDetailRules.actualMinutes[0].required = false
}
if(item.field == 'completionTime'){
item.componentProps.disabled = true
EquipmentMaintenanceDetailRules.completionTime[0].required = false
}
if(item.field == 'result'){
item.componentProps.disabled = true
EquipmentMaintenanceDetailRules.result[0].required = false
}
if(item.field == 'uncompletedCause'){
item.componentProps.disabled = true
EquipmentMaintenanceDetailRules.uncompletedCause[0].required = false
}
if(item.field == 'name'){
EquipmentMaintenanceDetailRules.name[0].required = true
}
})
}else{
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => {
if(item.field == 'peoples'){
item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.peoples[0].required = true
}
if(item.field == 'estimatedMinutes'){
EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = false
}
if(item.field == 'actualMinutes'){
item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.actualMinutes[0].required = true
}
if(item.field == 'completionTime'){
item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.completionTime[0].required = true
}
if(item.field == 'result'){
item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.result[0].required = true
}
if(item.field == 'uncompletedCause'){
item.componentProps.disabled = false
EquipmentMaintenanceDetailRules.uncompletedCause[0].required = false
}
if(item.field == 'name'){
EquipmentMaintenanceDetailRules.name[0].required = true
}
})
}
} }
// form // form
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
@ -710,6 +901,7 @@ const submitForm = async (formType, data) => {
await props.apiUpdate(data) await props.apiUpdate(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
emit('handleMainFefresh')
formRef.value.dialogVisible = false formRef.value.dialogVisible = false
// //
await getList() await getList()
@ -740,7 +932,8 @@ const emit = defineEmits([
'openImage', 'openImage',
'onBlur', 'onBlur',
'detailBasicFormOnChange', 'detailBasicFormOnChange',
'formFormDateChange' 'formFormDateChange',
'buttonBaseClick'
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -752,6 +945,7 @@ const handleDelete = async (id: number) => {
await props.apiDelete(id) await props.apiDelete(id)
tableObject.loading = false tableObject.loading = false
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
emit('handleMainFefresh')
// //
await getList() await getList()
updateKey.value += 1 updateKey.value += 1
@ -796,16 +990,16 @@ const openImage=(item)=>{
* @param field 当前操作字段 * @param field 当前操作字段
* @param cur 改变后值 * @param cur 改变后值
*/ */
const detailBasicFormOnChange = (field, cur) => { const detailBasicFormOnChange = (field, cur) => {
emit('detailBasicFormOnChange', field, cur) emit('detailBasicFormOnChange', field, cur)
} }
/** /**
* 监听失焦事件 * 监听失焦事件
* @param field 当前操作字段 * @param field 当前操作字段
* @param e * @param e
*/ */
const onBlur = (field, e) => { const onBlur = (field, e) => {
emit('onBlur', field, e) emit('onBlur', field, e)
} }

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

@ -4,6 +4,9 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop"; import * as WorkshopApi from "@/api/wms/workshop";
import {MaintenanceItem} from "@/views/eam/maintenanceItem/maintenanceItem.data";
import * as ItemApi from "@/api/eam/maintenanceItem";
import {validateInteger, validateroundNumber} from "@/utils/validator";
// 表单校验 // 表单校验
export const EquipmentMaintenanceMainRules = reactive({ export const EquipmentMaintenanceMainRules = reactive({
@ -355,7 +358,55 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
export const EquipmentMaintenanceDetailRules = reactive({ export const EquipmentMaintenanceDetailRules = reactive({
number: [required], number: [required],
contents: [required], masterId: [required],
peoples: [
{
required:false ,
message:'该项为必填项',
tagger:['blur']
},
{
validator:validateroundNumber,
message: '请输入正确的正整数',
trigger: 'blur'}],
estimatedMinutes: [
{
required:false ,
message:'该项为必填项',
tagger:['blur']
},
{
validator:validateroundNumber,
message: '请输入正确的正整数',
trigger: 'blur'}],
actualMinutes: [
{
required:false ,
message:'该项为必填项',
tagger:['blur']
},
{
validator:validateroundNumber,
message: '请输入正确的正整数',
trigger: 'blur'}],
completionTime: [
{
required:false ,
message:'该项为必填项',
tagger:['blur']
}],
result: [
{
required:false ,
message:'该项为必填项',
tagger:['blur']
}],
name: [required],
uncompletedCause:[{
required:false ,
message:'该项为必填项',
tagger:['blur','change']
}]
}) })
export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
@ -373,38 +424,41 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form:{
componentProps: {
disabled: true
}
}
}, },
{ {
label: '主表id', label: '主表id',
field: 'masterId', field: 'masterId',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form:{
componentProps: {
disabled: true
}
}
}, },
{ {
label: '人数', label: '人数',
field: 'peoples', field: 'peoples',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: true,
}, },
{ {
label: '预计分钟', label: '预计分钟',
field: 'estimatedMinutes', field: 'estimatedMinutes',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
}, },
{ {
label: '实际分钟', label: '实际分钟',
field: 'actualMinutes', field: 'actualMinutes',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
}, },
{ {
label: '责任人多选', label: '责任人多选',
@ -445,25 +499,43 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
field: 'result', field: 'result',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
dictType: DICT_TYPE.IS_COMPLETED,
dictClass: 'string',
}, },
{ {
label: '保养名称', label: '保养名称',
field: 'name', field: 'name',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择 类别编码',
searchTitle: '保养项信息', // 查询弹窗标题
searchAllSchemas: MaintenanceItem.allSchemas, // 查询弹窗所需类
searchField: 'name', // 查询弹窗赋值字段
searchPage: ItemApi.getMaintenanceItemPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '=='
}]
}
}
}, },
{ // {
label: '保养内容', // label: '保养内容',
field: 'content', // field: 'content',
sort: 'custom', // sort: 'custom',
isSearch: true, // isSearch: true,
}, // },
{ // {
label: '保养部位', // label: '保养部位',
field: 'equipmentParts', // field: 'equipmentParts',
sort: 'custom', // sort: 'custom',
isSearch: true, // isSearch: true,
}, // },
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',
@ -508,7 +580,10 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑 dictClass: 'string', // 默认都是字符串类型其他暂不考虑
}, },

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

@ -55,10 +55,19 @@
<Detail ref="detailRef" <Detail ref="detailRef"
:isBasic="false" :isBasic="false"
:allSchemas="EquipmentMaintenanceMain.allSchemas" :allSchemas="EquipmentMaintenanceMain.allSchemas"
:detailAllSchemasRules="EquipmentMaintenanceDetailRules"
:detailAllSchemas="EquipmentMaintenanceDetail.allSchemas" :detailAllSchemas="EquipmentMaintenanceDetail.allSchemas"
:apiPage="EquipmentMaintenanceDetailApi.getEquipmentMaintenanceDetailPage" :apiPage="EquipmentMaintenanceDetailApi.getEquipmentMaintenanceDetailPage"
:apiCreate="EquipmentMaintenanceDetailApi.createItemEquipmentMaintenanceDetail"
:apiUpdate="EquipmentMaintenanceDetailApi.updateEquipmentMaintenanceDetail"
:apiDelete="EquipmentMaintenanceDetailApi.deleteEquipmentMaintenanceDetail"
:detailButtonIsShowAdd=statusBtn
:detailButtonIsShowEdit=statusBtn
:detailButtonIsShowDelete=statusBtn
@handleMainFefresh="handleMainFefresh"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@detailBasicFormOnChange="detailBasicFormOnChange"
:key="count"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -67,30 +76,28 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { EquipmentMaintenanceMain,EquipmentMaintenanceMainRules,EquipmentMaintenanceDetail } from './equipmentMaintenanceMain.data' import { EquipmentMaintenanceMain,EquipmentMaintenanceMainRules,EquipmentMaintenanceDetail,EquipmentMaintenanceDetailRules } from './equipmentMaintenanceMain.data'
import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain' import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain'
import * as EquipmentMaintenanceDetailApi from '@/api/eam/equipmentMaintenanceDetail' import * as EquipmentMaintenanceDetailApi from '@/api/eam/equipmentMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/views/eam/equipmentMaintenanceMain/DetailEam.vue'
import {Maintenance} from "@/views/eam/maintenance/maintenance.data"; import {Maintenance} from "@/views/eam/maintenance/maintenance.data";
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
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 * as ReworkBatchApi from "@/api/mes/reworkBatch";
import {mainListExecuteBtn} from "@/utils/disposition/defaultButtons";
defineOptions({ name: 'EquipmentMaintenanceMain' }) defineOptions({ name: 'EquipmentMaintenanceMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(EquipmentMaintenanceMain.allSchemas.tableColumns) const tableColumns = ref(EquipmentMaintenanceMain.allSchemas.tableColumns)
const statusBtn = ref(false);
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -167,9 +174,10 @@ const isShowStatusButton = (row,val) => {
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), // defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain:delete'}), // defaultButtons.mainListReceiveOrderBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListReceiveBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:maintenance:update'}), // defaultButtons.mainListExecuteBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['5']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListValidateBtn({hide: isShowStatusButton(row,['6']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}), defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenance:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}), defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}),
] ]
@ -181,13 +189,23 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'receive') { // } else if (val == 'receive') { //
handleReceive(row.id) handleReceive(row.id)
} else if (val == 'execute') { // } else if (val == 'execute') { //
handleExecute(row.id) handleExecute(row.id)
} else if (val == 'finish') { //
handleFinish(row.id)
} else if (val == 'validate') { //
handleValidate(row.id)
} }
} }
let count = ref(0)
const handleMainFefresh = async()=>{
count.value++
getList()
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
@ -232,9 +250,30 @@ const formsSuccess = async (formType,data) => {
getList() getList()
} }
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
let result = '';
for (var i = 0; i < val.length; i++) {
result += val[i].name + ',';
}
if(result.endsWith(',')){
result = result.substring(0,result.length -1)
}
setV[formField] = result;
formRef.setValues(setV)
})
}
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { 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, 'basicEquipmentMaintenanceMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentMaintenanceMain')
} }
@ -255,7 +294,7 @@ const handleDelete = async (id: number) => {
const handleReceive = async (id: number) => { const handleReceive = async (id: number) => {
try { try {
// //
await message.delConfirm('是否领取所选中任务?'); await message.delConfirm('是否接单?');
const params = ref({ const params = ref({
id: '', id: '',
status:'', status:'',
@ -263,8 +302,8 @@ const handleReceive = async (id: number) => {
params.value.id = id params.value.id = id
params.value.status = '4' params.value.status = '4'
// //
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('领取成功')) message.success(t('接单成功'))
// //
await getList() await getList()
} catch {} } catch {}
@ -289,6 +328,53 @@ const handleExecute = async (id: number) => {
} catch {} } catch {}
} }
/** 完成按钮操作 */
const handleFinish = async (id: number) => {
try {
//
await message.delConfirm('是否完成所选中工单?');
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '5'
//
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('工单已完成'))
//
await getList()
} catch {}
}
/** 验证按钮操作 */
const handleValidate = async (id: number) => {
try {
const params = ref({
id: '',
status:'',
})
//
message.confirmPassword(t('')).then(async () => {
params.value.id = id
params.value.status = '7'
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
}).catch (async () => {
params.value.id = id
params.value.status = '5'
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
})
} catch {}
}
/** 启用 */ /** 启用 */
const handleEnable = async (id: number) => { const handleEnable = async (id: number) => {
try { try {
@ -320,13 +406,34 @@ const handleDisable = async (id: number) => {
} catch {} } catch {}
} }
const detailBasicFormOnChange = (field, item) => {
//
if(field == 'result' && item == '1'){
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((items) => {
if (items.field == 'uncompletedCause') {
EquipmentMaintenanceDetailRules.uncompletedCause[0].required = true
}
})
}
//
if(field == 'result' && item == '0'){
EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((items) => {
if (items.field == 'uncompletedCause') {
EquipmentMaintenanceDetailRules.uncompletedCause[0].required = false
detailRef.value.formRef.formRef.setValues({
uncompletedCause:''
})
}
})
}
}
const onChange = (field, item) => { const onChange = (field, item) => {
console.log(field)
console.log(item)
// //
if(field == 'type' && item == 'DEVICE'){ if(field == 'type' && item == 'DEVICE'){
Maintenance.allSchemas.formSchema.forEach((items) => { Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') { if (items.field == 'equipmentCode') {
//
basicFormRef.value.formRef.setValues({ basicFormRef.value.formRef.setValues({
equipmentCode:'' equipmentCode:''
}) })
@ -339,6 +446,7 @@ const onChange = (field, item) => {
if(field == 'type' && item == 'EQUIPMENT'){ if(field == 'type' && item == 'EQUIPMENT'){
Maintenance.allSchemas.formSchema.forEach((items) => { Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') { if (items.field == 'equipmentCode') {
console.log(basicFormRef.value.formRef)
basicFormRef.value.formRef.setValues({ basicFormRef.value.formRef.setValues({
equipmentCode:'' equipmentCode:''
}) })

Loading…
Cancel
Save