Browse Source

EAM ——> 维修工单转办

master_hella_20240701
gaojs 5 months ago
parent
commit
7eb3166fef
  1. 13
      src/utils/disposition/defaultButtons.ts
  2. 38
      src/views/eam/equipmentRepairJobMain/equipmentRepairJobMain.data.ts
  3. 43
      src/views/eam/equipmentRepairJobMain/index.vue
  4. 344
      src/views/eam/equipmentRepairJobMain/transferForm.vue

13
src/utils/disposition/defaultButtons.ts

@ -389,6 +389,19 @@ export function mainListExecuteBtn(option:any) {
})
}
// 主列表-转办按钮
export function mainListTransferBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.转办`).replace('ts.', ''),
name: 'transfer',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-完成按钮
export function mainListFinishBtn(option:any) {
return __defaultBtnOption(option,{

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

@ -4,6 +4,10 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {BasicFaultCause} from "@/views/eam/basicFaultCause/basicFaultCause.data";
import * as ItemApi from "@/api/eam/basicFaultCause";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop";
import {BasicFaultType} from "@/views/eam/basicFaultType/basicFaultType.data";
import * as BasicFaultTypeApi from "@/api/eam/basicFaultType";
// 表单校验
export const EquipmentRepairJobMainRules = reactive({
@ -388,10 +392,23 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '故障类型',
field: 'faultType',
dictType: DICT_TYPE.FAILURE_REASON,
dictClass: 'string',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择故障类型', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: BasicFaultType.allSchemas, // 查询弹窗所需类
searchPage: BasicFaultTypeApi.getBasicFaultTypePage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '流程状态',
@ -442,6 +459,23 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'workshopCode',
sort: 'custom',
isSearch: false,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
// {
// label: '产线编号',

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

@ -54,6 +54,7 @@
<FinishForm1 ref="finishForm1Ref" @success="getData1" @close="getClosed1"/>
<FinishForm2 ref="finishForm2Ref" @success="getData2" @close="getClosed2"/>
<FinishForm3 ref="finishForm3Ref" @success="getData3" @close="getClosed3"/>
<TransferForm ref="transferForm" @success="getData4" @close="getClosed4"/>
<!-- 详情 -->
<Detail ref="detailRef"
@ -89,6 +90,7 @@ import Detail from '@/views/eam/equipmentRepairJobMain/EquipmentRepairJobDetail.
import FinishForm1 from '@/views/eam/equipmentRepairJobMain/finishForm1.vue'
import FinishForm2 from '@/views/eam/equipmentRepairJobMain/finishForm2.vue'
import FinishForm3 from '@/views/eam/equipmentRepairJobMain/finishForm3.vue'
import TransferForm from '@/views/eam/equipmentRepairJobMain/transferForm.vue'
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
@ -184,6 +186,7 @@ const butttondata = (row) => {
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.mainListTransferBtn({hide: isShowStatusButton(row,['4']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListFinishBtn({hide: isShowStatusButton(row,['5']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListValidateRepairBtn({hide: isShowStatusButton(row,['6']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListValidateReportBtn({hide: isShowBaoXiuButton(row),hasPermi:'eam:equipmentRepairJobMain:update'}), //
@ -206,6 +209,8 @@ const buttonTableClick = async (val, row) => {
handleValidateRepair(row)
} else if (val == 'validate_report') { //
handleValidateReport(row)
} else if (val == 'transfer') { //
handleTransferReport(row)
}
@ -296,6 +301,14 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
})
}
/** 转办按钮操作 */
const transferForm = ref()
const handleTransferReport = async (row) => {
await message.delConfirm('是否转办所选中工单?');
transferForm.value.open('update', row);
}
/** 报修验证按钮操作 */
const finishForm3Ref = ref()
@ -500,6 +513,36 @@ const getData3=(val)=> {
)
}
//finishForm4
const getClosed4=(val)=> {
nextTick?.(() => {
console.log(val)
getList()
})
}
//finishForm4
const getData4=(val)=> {
nextTick?.(async () => {
console.log(val)
try {
const params = ref({
id: '',
status:'',
})
params.value.id = val
params.value.status = '3'
await EquipmentRepairJobMainApi.updateEquipmentRepairOrder(params.value)
message.success(t('工单已流转'))
//
await getList()
} catch {}
}
)
}
const onChange = (field, item) => {
//
if(field == 'type' && item == 'DEVICE'){

344
src/views/eam/equipmentRepairJobMain/transferForm.vue

@ -0,0 +1,344 @@
<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="transferType">
<el-select v-model="formData.transferType" placeholder="请选择转办类型" style="width: 150px" @change="onChangeSec">
<el-option label="人员转办" value="0"></el-option>
<el-option label="类型转办" value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="故障类型" prop="faultType">
<el-input v-model="formData.faultType" style="width: 150px" disabled></el-input>
<el-button :icon="Search" @click="chooseFaultType" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备类别" prop="type" >
<el-select v-model="formData.type" placeholder="请选择设备类别" style="width: 150px" :disabled = "isDisabled1" @change="onChangeType">
<el-option label="设备" value="DEVICE"></el-option>
<el-option label="工装" value="EQUIPMENT"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编号" prop="equipmentCode" >
<el-input v-model="formData.equipmentCode" style="width: 150px" disabled></el-input>
<el-button :icon="Search" @click="chooseEquipmentCode" :disabled = "isDisabled1"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="车间" prop="workshopCode">
<el-input v-model="formData.workshopCode" style="width: 150px" disabled></el-input>
<el-button :icon="Search" @click="chooseWorkshopCode" :disabled = "isDisabled2"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修人" prop="maintenancer">
<el-input v-model="formData.maintenancer" style="width: 150px" :disabled = "isDisabled2"></el-input>
<!-- <el-button :icon="Search" @click="chooseWorkshopCode" />-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="班组" prop="classType">
<el-select v-model="formData.classType" placeholder="请选择班组类别" style="width: 150px">
<el-option label="白班" value="0"></el-option>
<el-option label="夜班" value="1"></el-option>
</el-select>
</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 { Search } from '@element-plus/icons-vue'
import * as EquipmentRepairJobMainApi from "@/api/eam/equipmentRepairJobMain";
import * as WorkshopApi from "@/api/wms/workshop";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.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 {BasicFaultType} from "@/views/eam/basicFaultType/basicFaultType.data";
import * as BasicFaultTypeApi from "@/api/eam/basicFaultType";
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 typeValue = ref('')
const inputVisible = ref(false)
const isDisabled1 = ref(false)
const isDisabled2 = ref(false)
const InputRef = ref<InstanceType<typeof ElInput>>()
const formData = ref({
id:'',
number:'',
transferType:'',
faultType:'',
type:'',
equipmentCode:'',
workshopCode:'',
maintenancer: '',
classType: '',
})
const formRules = reactive({
transferType: [
{ required: true, message: '转办类型不能为空', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'change' }
],
faultType: [
{ required: true, message: '故障类型不能为空', trigger: 'change' },
],
classType: [
{ required: true, message: '班次不能为空', trigger: 'change' },
],
workshopCode: [
{ required: false, message: '车间不能为空', trigger: 'change' },
],
maintenancer: [
{ required: false, message: '维修人不能为空', trigger: 'change' },
],
type: [
{ required: false, message: '设备类别不能为空', trigger: 'change' },
],
equipmentCode: [
{ required: false, message: '设备编号不能为空', trigger: 'change' },
],
})
const basicFormRef = ref() // Ref
// /** */
const searchTableRef = ref();
const _searchTableTitle = ref();
const _searchTableAllSchemas = ref();
const _searchTablePage = ref();
const _searchField = ref();
const _formField = ref();
const _multiple = ref();
const _searchCondition = ref({})
/** 选择故障类型弹窗 */
const chooseFaultType = (field) => {
_searchCondition.value = {}
const filters: any[] = []
filters.push({
key: 'available',
value: 'TRUE',
isMainValue: false
})
//
_searchCondition.value.isSearch = true
_searchCondition.value.filters = filters
_searchTableTitle.value = '选择故障类型'
_searchField.value = "faultType"
_formField.value = 'faultType'
_searchTablePage.value = BasicFaultTypeApi.getBasicFaultTypePage,
_searchTableAllSchemas.value = BasicFaultType.allSchemas,
openCommon()
}
/** 选择设备编码弹窗 */
const chooseEquipmentCode = (field) => {
_searchCondition.value = {}
const filters: any[] = []
filters.push({
key: 'status',
value: 'NORMAL',
action: '==',
isSearch: true,
isMainValue: false
})
//
_searchCondition.value.isSearch = true
_searchCondition.value.filters = filters
_searchField.value = "equipmentCode"
_formField.value = 'equipmentCode'
if(typeValue.value == 'DEVICE'){
_searchTableTitle.value = '选择设备编号'
_searchTablePage.value = EquipmentItemApi.getEquipmentAccountsPage,
_searchTableAllSchemas.value = EquipmentAccounts.allSchemas
}else{
_searchTableTitle.value = '选择工装编号'
_searchTablePage.value = ToolItemApi.getToolAccountsPage,
_searchTableAllSchemas.value = ToolAccounts.allSchemas
}
openCommon()
}
/** 选择车间弹窗 */
const chooseWorkshopCode = (field) => {
_searchCondition.value = {}
const filters: any[] = []
filters.push({
key: 'available',
value: 'TRUE',
isMainValue: false
})
//
_searchCondition.value.isSearch = true
_searchCondition.value.filters = filters
_searchTableTitle.value = '选择车间'
_searchField.value = "workshopCode"
_formField.value = 'workshopCode'
_searchTablePage.value = WorkshopApi.getWorkshopPage,
_searchTableAllSchemas.value = Workshop.allSchemas,
openCommon()
}
/*打开弹窗*/
const openCommon = () => {
searchTableRef.value.open(
_searchTableTitle.value,
_searchTableAllSchemas.value,
_searchTablePage.value,
_searchField.value,
_searchCondition.value
)
}
/** 弹窗选择之后 回调函数 */
const searchTableSuccess = (formField, searchField, val) => {
nextTick?.(() => {
console.log(formField)
if (formField === 'workshopCode') {
formData.value.workshopCode = val[0].code
}
if (formField === 'equipmentCode') {
formData.value.equipmentCode = val[0].code
}
if (formField === 'faultType') {
formData.value.faultType = val[0].code
}
})
}
/** 初始化弹窗 */
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 onChangeType = (field) => {
typeValue.value = ''
if(field == 'DEVICE'){
typeValue.value = 'DEVICE'
formData.value.equipmentCode = null
}else if(field == 'EQUIPMENT'){
typeValue.value = 'EQUIPMENT'
formData.value.equipmentCode = null
}
}
const onChangeSec = (field) => {
//
if(field == '0'){
formData.value.equipmentCode = null
formData.value.type = null
isDisabled1.value = true
isDisabled2.value = false
formRules.workshopCode[0].required = true
formRules.maintenancer[0].required = true
formRules.type[0].required = false
formRules.equipmentCode[0].required = false
}else{
//
formData.value.workshopCode = null
formData.value.maintenancer = null
isDisabled1.value = false
isDisabled2.value = true
formRules.workshopCode[0].required = false
formRules.maintenancer[0].required = false
formRules.type[0].required = true
formRules.equipmentCode[0].required = true
}
}
/** 提交表单 */
const submitForm = async (val) => {
//
if (!basicFormRef) return
const valid = await basicFormRef.value.validate()
if (!valid) return
await message.delConfirm('是否提交数据?');
//
await EquipmentRepairJobMainApi.updateEquipmentRepairJobMain(formData.value)
//success
emit('success',formData.value.id)
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>
Loading…
Cancel
Save