Browse Source

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

master_hella_20240701
gaojs 6 months ago
parent
commit
8560ad639f
  1. 5
      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. 274
      src/views/eam/equipmentMaintenanceMain/DetailEam.vue
  6. 121
      src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts
  7. 136
      src/views/eam/equipmentMaintenanceMain/index.vue

5
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 })
}
// 新增设备保养工单 通过主表添加
export const createItemEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.post({ url: `/eam/equipment-maintenance-detail/createItem`, data })
}
// 修改设备保养工单子
export const updateEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => {
return await request.put({ url: `/eam/equipment-maintenance-detail/update`, data })

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 })
}
// 执行保养工单
// 修改保养工单状态
export const updateMaintenanceOrder = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-maintenance-main/updateOrder`, data })
}
//执行保养工单
export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => {
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'
})
},
// 确认窗体
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) {
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) {
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) {
return __defaultBtnOption(option,{

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

@ -2,17 +2,18 @@
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
:title="t(`ts.详情`).replace('ts.','')"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<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>
</template>
<ContentWrap v-if="!isBasic">
<Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<ContentWrap v-if="!isBasic" v-show="tabsList[current].label=='主数据'">
<Descriptions
:data="detailData"
labelClassName="label-class-name"
@ -24,11 +25,9 @@
width="200px"
/>
</ContentWrap>
<Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<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
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
@ -54,6 +53,7 @@
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
>
<!-- <template #action="{ row }">
<ButtonBase
@ -70,6 +70,7 @@
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
>
<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>
@ -96,24 +97,69 @@
</template>
</DetailTable>
</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'}">
<Annex v-show="tabsList[current].label=='附件'"
<Annex
:annexData="annexData"
:showDownload = "annexAlias.showDownload"
:hiddenDelete = "annexAlias.hiddenDelete"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
: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"
class="mt-20px"
@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>
</ContentWrap>
</div>
@ -121,7 +167,7 @@
<!-- 表格弹窗 -->
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" />
<!-- 表单弹窗添加/修改 -->
<BasicFormQmsNumber
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
@ -140,7 +186,6 @@
@onChange="detailBasicFormOnChange"
@onBlur="onBlur"
@formFormDateChange="formFormDateChange"
:myFuncTypeSign="myFuncTypeSign"
/>
</div>
</template>
@ -154,12 +199,15 @@ import Tabs from '@/components/Tabs/src/Tabs.vue'
import * as RemarkApi from '@/api/wms/remark'
import * as FileApi from '@/api/wms/file'
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 DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { SearchTable } from '@/components/SearchTable'
import {
EquipmentMaintenanceDetail, EquipmentMaintenanceDetailRules,
} from "@/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data";
defineOptions({ name: 'DetailQmsNumber' })
defineOptions({ name: 'Detail' })
const message = useMessage() //
const { t } = useI18n() //
@ -177,6 +225,24 @@ const props = defineProps({
required: true,
default: null
},
//tab
annexTable: {
type: Array,
required: false,
default: ()=>[]
},
//tab
annexAlias: {
type: Object,
required: false,
default: ()=>({
label: '附件',
showDownload:false,
showPreview:false,
hiddenDelete:false
})
},
//
isBasic: {
type: Boolean,
@ -311,16 +377,15 @@ const props = defineProps({
required: false,
default: false
},
//
myFuncTypeSign:{
type: String,
//
otherHeadButttonData:{
type:Array,
required: false,
default: null
},
default: () => []
}
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const myFuncTypeSign = props.myFuncTypeSign
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (props.isBasic == true) {
@ -342,8 +407,16 @@ 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]
if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) {
@ -352,6 +425,13 @@ if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.leng
prop: 'Detail'
})
}
if(!props.isBasic){
tabsList.value.unshift({
label: '主数据',
prop: 'Descriptions'
})
}
// Tabs
const tabRef = ref()
@ -372,6 +452,8 @@ const remarkHeight = computed(() => {
const annexData = reactive({
annexList: []
})
// //
const annexTableData = ref<Array<any>>([])
//
const remarksData = reactive({
@ -393,6 +475,48 @@ const getFileList = async () => {
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 = () => {
getFileList()
@ -403,6 +527,11 @@ const deleteAnnexSuccess = async () => {
getFileList()
getChangeRecordList()
}
/** 追加的附件 */
const updateAnnexTableHandle = () => {
getAnnexFileList(detailData.value)
getChangeRecordList()
}
// Tabs
const current = ref(0)
@ -420,7 +549,7 @@ const change = (item, index) => {
const masterParmas = ref({
masterId: '', //id
number: '', //
status: '', //
status: '' //
})
//
@ -455,17 +584,23 @@ const searchTableFormType = ref('') // 表单的类型:create - 新增;updat
const formRef = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const count =ref(0)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
remarksData.data = {
tableId: row.masterId||row.id,
tableName: tableName
}
count.value++
//
if (!props.isBasic) {
// id
masterParmas.value.masterId = row.id
masterParmas.value.masterId = row.masterId||row.id
masterParmas.value.number = row.number
masterParmas.value.status = row.status
tableObjectRef.value.params = {
masterId: row.id
masterId: row.masterId||row.id
}
await getList()
}
@ -474,9 +609,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
detailLoading.value = true
try {
detailData.value = row
// getRemarkList()
// getFileList()
// getChangeRecordList()
getRemarkList()
getFileList()
getAnnexFileList(row)
getChangeRecordList()
//
let detailButtonFilter: any = []
let detailButtonAdd: any = []
@ -502,7 +638,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
defaultButtons.defaultFilterBtn(null) //
]
}
HeadButttondata.value = [...HeadButttondata.value,...props.otherHeadButttonData]
let detailButtonEdit: any = []
let detailButtonDelete: any = []
if (props.detailButtonIsShowEdit) {
@ -564,11 +700,6 @@ detailAllSchemasRef.value = props.detailAllSchemas
//
const isShowMainButton = (row, val) => {
// if (val.indexOf(row.status) > -1) {
// return false
// } else {
// return true
// }
return false
}
@ -613,6 +744,7 @@ const buttonBaseClick = (val, item) => {
} else {
//
console.log('其他按钮', item)
emit('buttonBaseClick',val, item)
}
}
@ -643,8 +775,6 @@ const opensearchTable = (
}
}
}
console.log(searchCondition)
console.log(_searchCondition)
searchTableRef.value.open(
searchTitle,
searchAllSchemas,
@ -694,8 +824,69 @@ const buttonTableClick = async (val, row) => {
}
/** 添加/修改操作 */
const openForm = async (type: string, row?: number) => {
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
const submitForm = async (formType, data) => {
@ -710,6 +901,7 @@ const submitForm = async (formType, data) => {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
emit('handleMainFefresh')
formRef.value.dialogVisible = false
//
await getList()
@ -740,7 +932,8 @@ const emit = defineEmits([
'openImage',
'onBlur',
'detailBasicFormOnChange',
'formFormDateChange'
'formFormDateChange',
'buttonBaseClick'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
@ -752,6 +945,7 @@ const handleDelete = async (id: number) => {
await props.apiDelete(id)
tableObject.loading = false
message.success(t('common.delSuccess'))
emit('handleMainFefresh')
//
await getList()
updateKey.value += 1
@ -796,7 +990,7 @@ const openImage=(item)=>{
* @param field 当前操作字段
* @param cur 改变后值
*/
const detailBasicFormOnChange = (field, cur) => {
const detailBasicFormOnChange = (field, cur) => {
emit('detailBasicFormOnChange', field, cur)
}
@ -805,7 +999,7 @@ const openImage=(item)=>{
* @param field 当前操作字段
* @param e
*/
const onBlur = (field, e) => {
const 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 {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
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({
@ -355,7 +358,55 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
export const EquipmentMaintenanceDetailRules = reactive({
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[]>([
@ -373,38 +424,41 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
field: 'number',
sort: 'custom',
isSearch: true,
form:{
componentProps: {
disabled: true
}
}
},
{
label: '主表id',
field: 'masterId',
sort: 'custom',
isSearch: true,
form:{
componentProps: {
disabled: true
}
}
},
{
label: '人数',
field: 'peoples',
sort: 'custom',
isSearch: true,
isForm: 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: '责任人多选',
@ -445,25 +499,43 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
field: 'result',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.IS_COMPLETED,
dictClass: 'string',
},
{
label: '保养名称',
label: '保养名称',
field: 'name',
sort: 'custom',
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: '保养内容',
field: 'content',
sort: 'custom',
isSearch: true,
},
{
label: '保养部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: true,
},
// {
// label: '保养内容',
// field: 'content',
// sort: 'custom',
// isSearch: true,
// },
// {
// label: '保养部位',
// field: 'equipmentParts',
// sort: 'custom',
// isSearch: true,
// },
{
label: '创建时间',
field: 'createTime',
@ -508,7 +580,10 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>(
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
},

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

@ -55,10 +55,19 @@
<Detail ref="detailRef"
:isBasic="false"
:allSchemas="EquipmentMaintenanceMain.allSchemas"
:detailAllSchemasRules="EquipmentMaintenanceDetailRules"
:detailAllSchemas="EquipmentMaintenanceDetail.allSchemas"
:apiPage="EquipmentMaintenanceDetailApi.getEquipmentMaintenanceDetailPage"
:apiCreate="EquipmentMaintenanceDetailApi.createItemEquipmentMaintenanceDetail"
:apiUpdate="EquipmentMaintenanceDetailApi.updateEquipmentMaintenanceDetail"
:apiDelete="EquipmentMaintenanceDetailApi.deleteEquipmentMaintenanceDetail"
:detailButtonIsShowAdd=statusBtn
:detailButtonIsShowEdit=statusBtn
:detailButtonIsShowDelete=statusBtn
@handleMainFefresh="handleMainFefresh"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailBasicFormOnChange="detailBasicFormOnChange"
:key="count"
/>
<!-- 导入 -->
@ -67,30 +76,28 @@
<script setup lang="ts">
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 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 Detail from '@/views/eam/equipmentMaintenanceMain/DetailEam.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";
import * as ReworkBatchApi from "@/api/mes/reworkBatch";
import {mainListExecuteBtn} from "@/utils/disposition/defaultButtons";
defineOptions({ name: 'EquipmentMaintenanceMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentMaintenanceMain.allSchemas.tableColumns)
const statusBtn = ref(false);
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -167,9 +174,10 @@ const isShowStatusButton = (row,val) => {
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceMain:update'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceMain:delete'}), //
defaultButtons.mainListReceiveBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:maintenance:update'}), //
defaultButtons.mainListReceiveOrderBtn({hide: isShowStatusButton(row,['3']),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.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenance:update'}),
]
@ -181,13 +189,23 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'receive') { //
} else if (val == 'receive') { //
handleReceive(row.id)
} else if (val == 'execute') { //
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 openForm = (type: string, row?: any) => {
@ -232,9 +250,30 @@ const formsSuccess = async (formType,data) => {
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 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')
}
@ -255,7 +294,7 @@ const handleDelete = async (id: number) => {
const handleReceive = async (id: number) => {
try {
//
await message.delConfirm('是否领取所选中任务?');
await message.delConfirm('是否接单?');
const params = ref({
id: '',
status:'',
@ -263,8 +302,8 @@ const handleReceive = async (id: number) => {
params.value.id = id
params.value.status = '4'
//
await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value)
message.success(t('领取成功'))
await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value)
message.success(t('接单成功'))
//
await getList()
} catch {}
@ -289,6 +328,53 @@ const handleExecute = async (id: number) => {
} 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) => {
try {
@ -320,13 +406,34 @@ const handleDisable = async (id: number) => {
} 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) => {
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:''
})
@ -339,6 +446,7 @@ const onChange = (field, item) => {
if(field == 'type' && item == 'EQUIPMENT'){
Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') {
console.log(basicFormRef.value.formRef)
basicFormRef.value.formRef.setValues({
equipmentCode:''
})

Loading…
Cancel
Save