Browse Source

EAM ——> 报修图片上传 图片预览 前后端

master_hella_20240701
gaojs 6 months ago
parent
commit
a4f2a1a25d
  1. 1
      src/api/eam/equipmentRepairJobMain/index.ts
  2. 5
      src/api/eam/equipmentReportRepairRequest/index.ts
  3. 12
      src/utils/disposition/defaultButtons.ts
  4. 67
      src/views/eam/equipmentRepairJobMain/equipmentRepairJobMain.data.ts
  5. 4
      src/views/eam/equipmentRepairJobMain/finishForm1.vue
  6. 76
      src/views/eam/equipmentRepairJobMain/index.vue
  7. 2
      src/views/eam/equipmentRepairRecordMain/equipmentRepairRecordMain.data.ts
  8. 13
      src/views/eam/equipmentReportRepairRequest/equipmentReportRepairRequest.data.ts
  9. 80
      src/views/eam/equipmentReportRepairRequest/index.vue

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

@ -79,6 +79,7 @@ export const updateEquipmentRepairMain = async (data: EquipmentRepairJobMainVO)
return await request.post({ url: `/eam/equipment-repair-job-main/updateRepair`, data })
}
// 完成维修工单主
export const executeEquipmentRepairJobMain = async (data: EquipmentRepairJobMainVO) => {
return await request.post({ url: `/eam/equipment-repair-job-main/execute`, data })

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

@ -81,3 +81,8 @@ export const updateEquipmentReportRepairOrder = async (data: EquipmentReportRepa
export const createEquipmentWeixiuOrder = async (data: EquipmentReportRepairRequestVO) => {
return await request.post({ url: `/eam/equipment-report-repair-request/updateCreateOrder`, data })
}
// 查询报修工单文件附件
export const getEquipmentReportFileInfo = async (data) => {
return await request.post({ url: `/eam/equipment-report-repair-request/fileListInfo`, data })
}

12
src/utils/disposition/defaultButtons.ts

@ -440,6 +440,18 @@ export function mainListValidateRepairBtn(option:any) {
hasPermi: ''
})
}
// 主列表-预览按钮
export function viewBtn(option:any) {
return __defaultBtnOption(option,{
label: '预览',
name: 'view',
hide: false,
type: 'success',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-审核按钮
export function mainListAuditingBtn(option:any) {

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

@ -4,7 +4,6 @@ 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 {getBasicFaultCausePage} from "@/api/eam/basicFaultCause";
// 表单校验
export const EquipmentRepairJobMainRules = reactive({
@ -14,9 +13,9 @@ export const EquipmentRepairJobMainRules = reactive({
urgency: [required],
level: [required],
equipmentCode: [required],
totalMinutes: [required],
faultType: [required],
status: [required],
shutDown:[required],
})
export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -34,6 +33,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'number',
sort: 'custom',
isSearch: true,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '设备类别',
@ -48,20 +50,30 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'repairNumber',
sort: 'custom',
isSearch: true,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '来源字典',
label: '来源',
field: 'sources',
sort: 'custom',
dictType: DICT_TYPE.EAM_MAINTENANCE_SOURCES,
dictClass: 'string',
isSearch: false,
isForm: true,
form:{
value:'1'
}
},
{
label: '维修描述',
field: 'maintenanceDesc',
sort: 'custom',
isSearch: false,
isSearch: true,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '紧急程度',
@ -121,6 +133,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -143,6 +158,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -164,18 +182,27 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'totalMinutes',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '维修验证人',
field: 'verifyerRepair',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '维修验证内容',
field: 'verifyContentRepair',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '维修验证时间',
@ -183,6 +210,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -204,12 +234,18 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'verifyerReport',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '报修验证内容',
field: 'verifyContentReport',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '报修验证时间',
@ -217,6 +253,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -238,12 +277,18 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'maintenancer',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '维修人联系电话',
field: 'maintenancePhone',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '结果',
@ -251,7 +296,10 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.EAM_COMPLETE_RESULT,
dictClass: 'string',
isSearch: true,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '完成时间',
@ -259,6 +307,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -306,6 +357,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
search: {
component: 'DatePicker',
componentProps: {
@ -327,6 +381,9 @@ export const EquipmentRepairJobMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'repairer',
sort: 'custom',
isSearch: false,
isTable: true,
isForm: false,
isDetail:true,
},
{
label: '故障类型',

4
src/views/eam/equipmentRepairJobMain/finishForm1.vue

@ -63,6 +63,7 @@ const InputRef = ref<InstanceType<typeof ElInput>>()
const formData = ref({
id:'',
number:'',
sources:'',
verifyerRepair: '',
verifyContentRepair: '',
verifyTimeRepair: '',
@ -158,6 +159,7 @@ const open = async (type: string, row?: object) => {
//
formData.value.id = row.id
formData.value.number = row.number
formData.value.sources = row.sources
}
defineExpose({ open }) // open
@ -172,7 +174,7 @@ const submitForm = async (val) => {
//
await EquipmentRepairJobMainApi.updateEquipmentRepairJobMain(formData.value)
//success
emit('success',formData.value.id)
emit('success',formData.value.id,formData.value.sources)
dialogVisible.value = false
}

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

@ -48,6 +48,7 @@
:apiCreate="EquipmentRepairJobMainApi.createEquipmentRepairJobMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<FinishForm1 ref="finishForm1Ref" @success="getData1" @close="getClosed1"/>
@ -88,6 +89,10 @@ 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 {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";
defineOptions({ name: 'EquipmentRepairJobMain' })
@ -163,6 +168,15 @@ const isShowStatusButton = (row,val) => {
}
}
//true
const isShowBaoXiuButton = (row) => {
if(row.sources =='0' && row.status == '7'){
return false
}else{
return true
}
}
// -
const butttondata = (row) => {
@ -172,7 +186,7 @@ const butttondata = (row) => {
defaultButtons.mainListExecuteBtn({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: isShowStatusButton(row,['7']),hasPermi:'eam:equipmentRepairJobMain:update'}), //
defaultButtons.mainListValidateReportBtn({hide: isShowBaoXiuButton(row),hasPermi:'eam:equipmentRepairJobMain:update'}), //
]
}
@ -200,6 +214,27 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type == "create"){
EquipmentRepairJobMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'sources'){
item.value = '1'
item.componentProps.disabled = true
}
if(item.field == 'status'){
item.value = '3'
item.componentProps.disabled = true
}
})
}else{
EquipmentRepairJobMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'sources'){
item.componentProps.disabled = true
}
if(item.field == 'status'){
item.componentProps.disabled = true
}
})
}
basicFormRef.value.open(type, row)
}
@ -384,16 +419,20 @@ const getClosed1=(val)=> {
}
//finishForm1
const getData1=(val)=> {
const getData1=(val1,val2)=> {
nextTick?.(async () => {
console.log(val)
try {
const params = ref({
id: '',
status:'',
})
params.value.id = val
params.value.status = '7'
params.value.id = val1
if(val2 == '1'){
params.value.status = '8'
}
if(val2 == '0'){
params.value.status = '7'
}
await EquipmentRepairJobMainApi.updateEquipmentRepairOrder(params.value)
message.success(t('工单已流转'))
//
@ -461,6 +500,33 @@ const getData3=(val)=> {
)
}
const onChange = (field, item) => {
//
if(field == 'type' && item == 'DEVICE'){
EquipmentRepairJobMain.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({
equipmentCode:''
})
items.componentProps.searchAllSchemas = EquipmentAccounts.allSchemas
items.componentProps.searchPage = EquipmentItemApi.getEquipmentAccountsPage
}
})
}
//
if(field == 'type' && item == 'EQUIPMENT'){
EquipmentRepairJobMain.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({
equipmentCode:''
})
items.componentProps.searchAllSchemas = ToolAccounts.allSchemas
items.componentProps.searchPage = ToolItemApi.getToolAccountsPage
}
})
}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {

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

@ -42,7 +42,7 @@ export const EquipmentRepairRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
dictType: DICT_TYPE.EAM_MAINTENANCE_SOURCES,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: false
isSearch: false,
},
{
label: '维修描述',

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

@ -98,6 +98,19 @@ export const EquipmentReportRepairRequest = useCrudSchemas(reactive<CrudSchema[]
field: 'images',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
isDetail: false,
form: {
component: 'UploadImgs',
componentProps: {
limit:3,
upData:{
tableId:'1',
tableName:'request_equipment_report_repair'
}
}
}
},
// {
// label: '所属厂区编号',

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

@ -35,6 +35,9 @@
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
<template #images="{ row }">
<ButtonBase v-if="row.images === 'TRUE' ":Butttondata="butttondataView(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -54,6 +57,16 @@
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentReportRepairRequest.allSchemas" />
<Dialog
ref="basicFormViewRef"
v-model="showView"
:key="viewKey"
:closeOnClickModal="true"
:title="viewTitle"
>
<el-image v-for="url in urls" :key="url" :src="url" lazy />
</Dialog>
<!-- 审核页面 -->
<AudiForm ref="audiFormRef" @success="getData" @close="getClosed"/>
@ -61,6 +74,7 @@
<ImportForm ref="importFormRef" url="/eam/equipment-report-repair-request/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentReportRepairRequest,EquipmentReportRepairRequestRules } from './equipmentReportRepairRequest.data'
@ -74,7 +88,7 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts";
import {createEquipmentWeixiuOrder} from "@/api/eam/equipmentReportRepairRequest";
import * as EquipmentReportRepairApi from "@/api/eam/equipmentReportRepairRequest";
defineOptions({ name: 'EquipmentReportRepairRequest' })
@ -84,6 +98,10 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const showView = ref(false)
const urls = ref([])
const viewKey = ref(0)
const viewTitle = ref('图片预览')
const tableColumns = ref(EquipmentReportRepairRequest.allSchemas.tableColumns)
//
@ -125,6 +143,13 @@ const HeadButttondata = [
// },
]
// -
const butttondataView = (row) => {
return [
defaultButtons.viewBtn(null),
]
}
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
@ -153,7 +178,7 @@ const isShowStatusButton = (row,val) => {
// -
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hide: isShowStatusButton(row, ['0']),hasPermi: 'eam:equipmentReportRepairRequest:update'}), //
//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'}), //
@ -176,24 +201,43 @@ const buttonTableClick = async (val, row) => {
handleAudited(row)
} else if (val == 'finish') { //
handleFinish(row.id)
} else if (val == 'view') { //
openForm('view', row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type == "create"){
//
const basicFormViewRef = ref()
const openForm = async (type: string, row?: any) => {
if (type == "create") {
EquipmentReportRepairRequest.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
if (item.field == 'status') {
}
})
}else{
} else {
EquipmentReportRepairRequest.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
if (item.field == 'status') {
}
})
}
basicFormRef.value.open(type, row)
if (type == 'view') {
const formData = ref({
number: row.number,
funcCode: 'equipment_report',
fileBusiType: 'EAM',
})
urls.value = []
let newVar = await EquipmentReportRepairApi.getEquipmentReportFileInfo(formData.value);
newVar.forEach((item: any) => {
urls.value.push(item.url);
})
showView.value = true
viewKey.value += 1
} else {
basicFormRef.value.open(type, row)
}
}
// form
@ -209,6 +253,18 @@ const formsSuccess = async (formType,data) => {
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
const tags=ref([])
if (data.images != null && data.images != "") {
data.images.forEach((item: any) => {
const newItem = {};
newItem['name'] = item.name;
newItem['size'] = item.size;
newItem['uid'] = item.uid;
newItem['url'] = item.url;
tags.value.push(newItem);
})
}
data.fileInfoList = tags.value
if (formType === 'create') {
await EquipmentReportRepairRequestApi.createEquipmentReportRepairRequest(data)
message.success(t('common.createSuccess'))
@ -397,6 +453,14 @@ const onChange = (field, item) => {
}
})
}
//
if(field == 'images'){
EquipmentReportRepairRequest.allSchemas.formSchema.forEach((items) => {
if (items.field == 'images') {
console.log(items.value);
}
})
}
}
//

Loading…
Cancel
Save