Browse Source

EAM ——> 报修工单更新流程按钮 维修工单主子代码生成

master_hella_20240701
gaojs 5 months ago
parent
commit
ae78b5a3c4
  1. 10
      src/api/eam/equipmentReportRepairRequest/index.ts
  2. 26
      src/utils/disposition/defaultButtons.ts
  3. 141
      src/views/eam/equipmentReportRepairRequest/audiForm.vue
  4. 70
      src/views/eam/equipmentReportRepairRequest/equipmentReportRepairRequest.data.ts
  5. 143
      src/views/eam/equipmentReportRepairRequest/index.vue

10
src/api/eam/equipmentReportRepairRequest/index.ts

@ -71,3 +71,13 @@ export const exportEquipmentReportRepairRequest = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/eam/equipment-report-repair-request/get-import-template' })
}
// 修改报修工单状态
export const updateEquipmentReportRepairOrder = async (data: EquipmentReportRepairRequestVO) => {
return await request.post({ url: `/eam/equipment-report-repair-request/updateOrder`, data })
}
// 完成并创建维修工单
export const createEquipmentWeixiuOrder = async (data: EquipmentReportRepairRequestVO) => {
return await request.post({ url: `/eam/equipment-report-repair-request/updateCreateOrder`, data })
}

26
src/utils/disposition/defaultButtons.ts

@ -390,6 +390,32 @@ export function mainListAuditingBtn(option:any) {
})
}
// 主列表-审核完成按钮
export function mainListAuditedBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.审核完成`).replace('ts.', ''),
name: 'audited',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-撤回按钮
export function mainListRevokeBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.撤回`).replace('ts.', ''),
name: 'revoke',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-绑定
export function mainListBindBtn(option:any) {
return __defaultBtnOption(option,{

141
src/views/eam/equipmentReportRepairRequest/audiForm.vue

@ -0,0 +1,141 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false">
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="审核人" prop="approver">
<el-input v-model="formData.approver" placeholder="请输入审核人" :disabled="isDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核内容" prop="approveContent">
<el-input v-model="formData.approveContent" placeholder="请输入审核内容" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="审核时间" prop="approveTime">
<el-date-picker
v-model="formData.approveTime"
type="datetime"
value-format="x"
placeholder="选择审核时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')"> </el-button>
<el-button @click="handleClose('close')"> </el-button>
</template>
</Dialog>
<!--添加巡检项弹窗-->
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script lang="ts" setup>
import { SearchTable } from '@/components/SearchTable'
import {ElInput} from "element-plus";
import * as EquipmentReportRepairRequestApi from "@/api/eam/equipmentReportRepairRequest";
defineOptions({ name: 'TeamForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const tags=ref([])
const inputValue = ref('')
const inputVisible = ref(false)
const isDisabled = ref(false)
const InputRef = ref<InstanceType<typeof ElInput>>()
const formData = ref({
id:'',
number:'',
approver: '',
approveContent: '',
approveTime: '',
})
const formRules = reactive({
approver: [
{ required: true, message: '审核人不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
approveContent: [
{ required: true, message: '审核内容不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
approveTime: [
{ required: true, message: '审核时间不能为空', trigger: 'blur' },
],
})
const basicFormRef = ref() // Ref
/** 初始化弹窗 */
const open = async (type: string, row?: object) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
//
formData.value.id = row.id
formData.value.number = row.number
}
defineExpose({ open }) // open
/** 提交表单 */
const submitForm = async (val) => {
//success
emit('success',formData.value.id)
//
if (!basicFormRef) return
const valid = await basicFormRef.value.validate()
if (!valid) return
//
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairRequest(formData.value)
dialogVisible.value = false
}
const handleClose=(val)=>{
dialogVisible.value = false
emit('close',val)
}
//
const emit = defineEmits(['close','success'])
</script>
<style scoped>
.tag-container {
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */
border: 1px solid #ccc; /* 添加边框样式 */
padding: 10px; /* 可根据需要调整容器内边距 */
width: 950px; /* 设置固定宽度为 950px */
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */
overflow-wrap: break-word; /* 兼容性更好的写法 */
flex-wrap: wrap;
}
.input-with-button {
display: flex;
align-items: center;
width: 100%;
}
.input-with-button > .el-input {
flex: 1;
/*margin-right: 10px;*/
}
</style>

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

@ -1,9 +1,9 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop";
import {dateFormatter} from '@/utils/formatTime'
// 表单校验
export const EquipmentReportRepairRequestRules = reactive({
@ -149,40 +149,40 @@ export const EquipmentReportRepairRequest = useCrudSchemas(reactive<CrudSchema[]
isSearch: false,
isForm: false,
},
// {
// label: '审核人',
// field: 'approver',
// sort: 'custom',
// isSearch: false,
// },
// {
// label: '审核内容',
// field: 'approveContent',
// sort: 'custom',
// isSearch: false,
// },
// {
// label: '审核时间',
// field: 'approveTime',
// 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: 'approver',
sort: 'custom',
isSearch: false,
},
{
label: '审核内容',
field: 'approveContent',
sort: 'custom',
isSearch: false,
},
{
label: '审核时间',
field: 'approveTime',
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: 'autoExamine',

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

@ -27,13 +27,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
@ -54,6 +54,9 @@
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentReportRepairRequest.allSchemas" />
<!-- 审核页面 -->
<AudiForm ref="audiFormRef" @success="getData" @close="getClosed"/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-report-repair-request/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
@ -66,7 +69,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import {Maintenance} from "@/views/eam/maintenance/maintenance.data";
import AudiForm from '@/views/eam/equipmentReportRepairRequest/audiForm.vue'
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
@ -137,11 +140,26 @@ const buttonBaseClick = (val, item) => {
}
}
const isShowStatusButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentReportRepairRequest:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentReportRepairRequest:delete'}), //
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hide: isShowStatusButton(row, ['0']),hasPermi: 'eam:equipmentReportRepairRequest:update'}), //
defaultButtons.mainListAuditingBtn({hide: isShowStatusButton(row, ['0']), hasPermi: 'eam:equipmentReportRepairRequest:update'}), //
defaultButtons.mainListAuditedBtn({hide: isShowStatusButton(row, ['2']), hasPermi: 'eam:equipmentReportRepairRequest:update'}), //
defaultButtons.mainListRevokeBtn({hide: isShowStatusButton(row, ['0']), hasPermi: 'eam:equipmentReportRepairRequest:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['3']),hasPermi:'eam:equipmentReportRepairRequest:update'}),
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentReportRepairRequest:update'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
@ -149,6 +167,14 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'auditing') { //
handleAuditing(row.id)
} else if (val == 'revoke') { //
handleRevoke(row.id)
} else if (val == 'audited') { //
handleAudited(row)
} else if (val == 'finish') { //
handleFinish(row.id)
}
}
@ -199,6 +225,79 @@ const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentReportRepairRequest')
}
//
const handleFinish = async (id: number) => {
await message.delConfirm('是否完成,并创建维修工单?');
try {
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '5'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
//
const handleAudited = async (row) => {
message.confirmAudi(t('')).then(async () => {
//
audiFormRef.value.open('update', row);
}).catch(async (action: Action) => {
if(action === 'cancel'){
const params = ref({
id: '',
status:'',
})
params.value.id = row.id
params.value.status = '4'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
}
})
}
//
const audiFormRef = ref()
const handleAuditing = async (id: number) => {
await message.delConfirm('是否审核所选中工单?');
try {
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '2'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 撤回按钮操作 */
const handleRevoke = async (id: number) => {
await message.delConfirm('是否撤回所选中工单?');
try {
const params = ref({
id: '',
status:'',
})
params.value.id = id
params.value.status = '1'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
@ -243,6 +342,34 @@ const importSuccess = () => {
getList()
}
//audiForm
const getClosed=(val)=> {
nextTick?.(() => {
getList()
})
}
//audiForm
const getData=(val)=> {
nextTick?.(async () => {
try {
const params = ref({
id: '',
status:'',
})
params.value.id = val
params.value.status = '3'
await EquipmentReportRepairRequestApi.updateEquipmentReportRepairOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
} catch {}
}
)
}
const onChange = (field, item) => {
//

Loading…
Cancel
Save