You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
761 lines
24 KiB
761 lines
24 KiB
<template>
|
|
<ContentWrap>
|
|
<!-- 搜索工作栏 -->
|
|
<Search
|
|
:schema="MoldMaintainOrderMain.allSchemas.searchSchema"
|
|
@search="setSearchParams"
|
|
@reset="setSearchParams"
|
|
/>
|
|
</ContentWrap>
|
|
|
|
<!-- 列表头部 -->
|
|
<TableHead
|
|
:HeadButttondata="HeadButttondata"
|
|
@button-base-click="buttonBaseClick"
|
|
:routeName="routeName"
|
|
@updataTableColumns="updataTableColumns"
|
|
@searchFormClick="searchFormClick"
|
|
:allSchemas="MoldMaintainOrderMain.allSchemas"
|
|
/>
|
|
|
|
<!-- 列表 -->
|
|
<ContentWrap>
|
|
<Table
|
|
:columns="tableColumns"
|
|
:data="tableObject.tableList"
|
|
:loading="tableObject.loading"
|
|
:pagination="{
|
|
total: tableObject.total
|
|
}"
|
|
v-model:pageSize="tableObject.pageSize"
|
|
v-model:currentPage="tableObject.currentPage"
|
|
v-model:sort="tableObject.sort"
|
|
>
|
|
<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(row)"
|
|
@button-base-click="buttonTableClick($event, row)"
|
|
/>
|
|
</template>
|
|
</Table>
|
|
</ContentWrap>
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
<BasicForm
|
|
ref="formRef"
|
|
:rules="MoldMaintainOrderMainRules"
|
|
:formAllSchemas="MoldMaintainOrderMain.allSchemas"
|
|
:tableAllSchemas="MoldMaintainOrderDetailFilter.allSchemas"
|
|
:tableFormRules="MoldMaintainOrderDetailRules"
|
|
:tableData="tableData"
|
|
:apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain"
|
|
:apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain"
|
|
:isBusiness="true"
|
|
@onChange="onChange"
|
|
@handleAddTable="handleAddTable"
|
|
@handleDeleteTable="handleDeleteTable"
|
|
@searchTableSuccess="searchTableSuccess"
|
|
@submitForm="submitForm"
|
|
:isSearchTableItem="true"
|
|
/>
|
|
|
|
<!-- 详情 -->
|
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintainOrderMain.allSchemas" /> -->
|
|
<Detail
|
|
ref="detailRef"
|
|
:isBasic="false"
|
|
:allSchemas="MoldMaintainOrderMain.allSchemas"
|
|
:detailAllSchemas="MoldMaintainOrderDetailFilter.allSchemas"
|
|
:detailAllSchemasRules="MoldMaintainOrderDetailRules"
|
|
:apiCreate="MoldMaintainOrderDetailApi.createMoldMaintainOrderDetail"
|
|
:apiUpdate="MoldMaintainOrderDetailApi.updateMoldMaintainOrderDetail"
|
|
:apiPage="MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage"
|
|
:apiDelete="MoldMaintainOrderDetailApi.deleteMoldMaintainOrderDetail"
|
|
:Echo="Echo"
|
|
:isShowAddBtn="false"
|
|
@searchTableSuccessDetail="searchTableSuccessDetail"
|
|
@detailOpenForm="detailOpenForm"
|
|
:detailValidate="detailValidate"
|
|
@detailSubmitForm="detailSubmitForm"
|
|
:isSearchTableItem="true"
|
|
:openFormCallBack="openFormCallBack"
|
|
:buttonControllFunction="buttonControllFunction"
|
|
@detailOnChange="detailOnChange"
|
|
/>
|
|
|
|
<!-- 导入 -->
|
|
<ImportForm
|
|
ref="importFormRef"
|
|
url="/eam/mold-maintenance-main/import"
|
|
:importTemplateData="importTemplateData"
|
|
@success="importSuccess"
|
|
/>
|
|
|
|
<Dialog
|
|
ref="updateDialog"
|
|
title="验证意见"
|
|
v-model="dialogVisible"
|
|
:width="600"
|
|
:maxHeight="700"
|
|
:style="{height:'450px'}"
|
|
:before-close="handleBeforeClose"
|
|
>
|
|
<el-form :model="updateFormValue" class="demo-form-inline">
|
|
<el-form-item label="验证意见">
|
|
<el-input
|
|
type="textarea"
|
|
v-model="updateFormValue.verifyContent"
|
|
placeholder="请填写验证意见"
|
|
clearable
|
|
:rows="12"
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<div style="text-align: center;">
|
|
<el-button type="primary" @click="onCancel">取消</el-button>
|
|
<el-button type="primary" @click="onSubmit">提交</el-button>
|
|
</div>
|
|
</template>
|
|
</Dialog>
|
|
|
|
|
|
<Dialog
|
|
title="照片上传"
|
|
v-model="dialogUploadVisible"
|
|
:width="600"
|
|
:maxHeight="900"
|
|
:style="{height:'600px'}"
|
|
:key="dialogFormKey"
|
|
>
|
|
<el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" >
|
|
<el-form-item label="">
|
|
<UploadImgs v-model="fileDialogUploadData.filePathList" :limit="20" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-button type="primary" @click="dialogUploadFile">提交</el-button>
|
|
</Dialog>
|
|
|
|
<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>
|
|
|
|
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import download from '@/utils/download'
|
|
import {
|
|
MoldMaintainOrderMain,
|
|
MoldMaintainOrderMainRules,
|
|
MoldMaintainOrderDetail,
|
|
MoldMaintainOrderDetailRules
|
|
} from './moldMaintainOrderMain.data'
|
|
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain'
|
|
import * as MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail'
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { selectAllFactoryArea } from '@/api/system/dept'
|
|
import * as UserApi from '@/api/system/user'
|
|
import { getAccessToken } from '@/utils/auth'
|
|
import * as uploadApi from '@/api/eam/upload'
|
|
import * as fileApi from '@/api/infra/file'
|
|
import { cloneDeep } from 'lodash-es'
|
|
|
|
defineOptions({ name: 'MoldMaintainOrderMain' })
|
|
const message = useMessage() // 消息弹窗
|
|
const { t } = useI18n() // 国际化
|
|
const userStore = useUserStore() // 用户信息
|
|
const route = useRoute() // 路由信息
|
|
const routeName = ref()
|
|
const formRef = ref()
|
|
routeName.value = route.name
|
|
const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns)
|
|
const apiPage = ref(MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage)
|
|
const detailAllSchemas = ref(MoldMaintainOrderDetail.allSchemas)
|
|
const tableData = ref([])
|
|
const updateFormValue = ref({
|
|
verifyContent:''
|
|
})
|
|
const dialogUploadVisible = ref(false)
|
|
const dialogVisible = ref(false)
|
|
const dialogRowData = ref()
|
|
const fileDialogUploadData = ref({
|
|
filePathList: []
|
|
})
|
|
const dialogUploadNumber = ref()
|
|
const dialogFormKey = ref(0)
|
|
const showView = ref(false)
|
|
const viewTitle = ref('图片预览')
|
|
const urls = ref([])
|
|
const viewKey = ref(0)
|
|
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL
|
|
const src = ref(BASE_URL + '/jmreport/view/940395429096013824?token=' + getAccessToken())
|
|
// 字段设置 更新主列表字段
|
|
const updataTableColumns = (val) => {
|
|
tableColumns.value = val
|
|
}
|
|
const MoldMaintainOrderDetailFilter = ref(cloneDeep(MoldMaintainOrderDetail))
|
|
// 查询页面返回
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
|
|
nextTick(() => {
|
|
if (type == 'tableForm') {
|
|
// 明细查询页赋值
|
|
if (formField == 'itemNumbers1') {
|
|
let str = ''
|
|
val.forEach((element) => {
|
|
str += element.name + ':' + element.qty + ','
|
|
})
|
|
str = str.substring(0, str.length - 1)
|
|
row['itemNumbers1'] = str
|
|
row['itemNumbers'] = val
|
|
}
|
|
} else {
|
|
// const setV = {}
|
|
// setV[formField] = val[0][searchField]
|
|
// setV['supplierCode'] = val[0]['code']
|
|
// formRef.setValues(setV)
|
|
}
|
|
})
|
|
}
|
|
|
|
// 查询页面返回——详情
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
|
|
nextTick(() => {
|
|
const setV = {}
|
|
setV[formField] = val[0][searchField]
|
|
if (formField == 'itemNumbers1') {
|
|
let str = ''
|
|
val.forEach((element) => {
|
|
str += element.name + ':' + element.qty + ','
|
|
})
|
|
str = str.substring(0, str.length - 1)
|
|
setV['itemNumbers'] = val
|
|
setV['itemNumbers1'] = str
|
|
}
|
|
formRef.setValues(setV)
|
|
})
|
|
}
|
|
|
|
// 子表新增的时候选择表格之后需要会显得字段
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
|
|
const Echo = []
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({
|
|
getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage // 分页接口
|
|
})
|
|
|
|
// 获得表格的各种操作
|
|
const { getList, setSearchParams } = tableMethods
|
|
|
|
// 列表头部按钮
|
|
const HeadButttondata = [
|
|
// defaultButtons.defaultAddBtn(null), // 新增
|
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:mold-maintain-job-main:import'}),
|
|
// defaultButtons.defaultExportBtn({hasPermi:'eam:mold-maintain-job-main:export'}),
|
|
defaultButtons.defaultFreshBtn(null), // 刷新
|
|
defaultButtons.defaultFilterBtn(null), // 筛选
|
|
defaultButtons.defaultSetBtn(null) // 设置
|
|
]
|
|
|
|
// 头部按钮事件
|
|
const buttonBaseClick = (val, item) => {
|
|
if (val == 'add') {
|
|
// 新增
|
|
openForm('create')
|
|
} else if (val == 'import') {
|
|
// 导入
|
|
handleImport()
|
|
} else if (val == 'export') {
|
|
// 导出
|
|
handleExport()
|
|
} else if (val == 'refresh') {
|
|
// 刷新
|
|
getList()
|
|
} else if (val == 'filtrate') {
|
|
// 筛选
|
|
} else {
|
|
// 其他按钮
|
|
console.log('其他按钮', item)
|
|
}
|
|
}
|
|
// 根据状态返回该按钮是否显示
|
|
const isShowMainButton = (row, val) => {
|
|
if (val.indexOf(row.status) > -1) {
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
}
|
|
// 列表-操作按钮
|
|
const butttondata = (row) => {
|
|
return [
|
|
// defaultButtons.mainListEditBtn(null), // 编辑
|
|
defaultButtons.acceptOrderBtn({
|
|
hasPermi:'eam:mold-maintain-job-main:orderClick',
|
|
hide: !(row.status == 'PENDING')
|
|
}), // 接单
|
|
defaultButtons.maintainBtn({
|
|
hasPermi:'eam:mold-maintain-job-main:maintain',
|
|
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
|
|
}),// 保养
|
|
defaultButtons.finishOrderBtn({
|
|
hasPermi:'eam:mold-maintain-job-main:orderClickFinish',
|
|
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
|
|
}), // 完成
|
|
defaultButtons.verifyOrderBtn({
|
|
hasPermi:'eam:mold-maintain-job-main:orderClickVerify',
|
|
hide: !(row.status == 'COMPLETED')
|
|
}), // 验证
|
|
defaultButtons.orderPrintBtn({
|
|
hasPermi:'eam:mold-maintain-job-main:print',
|
|
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) || !((row.status == 'COMPLETED' || row.status == 'PECEIVED'))
|
|
}), // 打印
|
|
defaultButtons.uploadImgsBtn({
|
|
hasPermi: 'eam:evice-maintain-job-main:upload',
|
|
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
|
|
}), // 上传
|
|
defaultButtons.pictureBtn({
|
|
hide: !(row.filePathList != null && row.filePathList.length > 0 && row.status != 'PECEIVED')
|
|
}) // 预览报修图片
|
|
]
|
|
}
|
|
const onChange = (field, cur, item) => {
|
|
if (field == 'moldNumber') {
|
|
// MoldMaintainOrderMain.allSchemas.formSchema[1].componentProps.disabled = true
|
|
// MoldMaintainOrderMain.allSchemas.formSchema[2].componentProps.disabled = true
|
|
formRef.value.formRef.formModel.factoryAreaNumber =String(item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber)
|
|
console.log(typeof formRef.value.formRef.formModel.factoryAreaNumber)
|
|
// console.log(item)
|
|
// console.log(item.componentProps.options)
|
|
formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
|
|
}
|
|
}
|
|
// 列表-操作按钮事件
|
|
const buttonTableClick = async (val, row) => {
|
|
if (val == 'edit') {
|
|
// 编辑
|
|
openForm('update', row)
|
|
} else if (val == 'delete') {
|
|
// 删除
|
|
handleDelete(row.id)
|
|
} else if (val == 'acceptOrder') {
|
|
acceptOrder(row)
|
|
} else if (val == 'turnOrder') {
|
|
openForm('turnOrder', row)
|
|
} else if (val == 'maintain') {
|
|
openDetail(row, '代码', row.number)
|
|
} else if (val == 'verifyOrder') {
|
|
openDialog(row)
|
|
} else if (val == 'finishOrder') {
|
|
finishOrder(row)
|
|
} else if (val == 'orderPrint') {
|
|
orderPrint(row)
|
|
}else if (val == 'uploadImgs') {
|
|
openDialogUpload(row)
|
|
} else if (val == 'picture') {
|
|
showView.value = true
|
|
urls.value = row.filePathList
|
|
viewKey.value += 1
|
|
}
|
|
}
|
|
|
|
/** 添加/修改操作 */
|
|
|
|
const openForm = (type: string, row?: any) => {
|
|
tableData.value = [] // 重置明细数据
|
|
formRef.value.open(type, row)
|
|
}
|
|
|
|
/** 详情操作 */
|
|
const detailRef = ref()
|
|
const openDetail = async (row: any, titleName: any, titleValue: any) => {
|
|
if(row.status == 'COMPLETED'){
|
|
MoldMaintainOrderDetailFilter.value.allSchemas.tableColumns = MoldMaintainOrderDetail.allSchemas.tableColumns.filter(item => item.field !== 'action');
|
|
}else{
|
|
MoldMaintainOrderDetailFilter.value.allSchemas.tableColumns = MoldMaintainOrderDetail.allSchemas.tableColumns;
|
|
}
|
|
const userListAll = await UserApi.getSimpleUserList()
|
|
row.maintenanceName = userListAll.find((account) => account.id == row.maintenance)?.nickname
|
|
const factoryList = await selectAllFactoryArea()
|
|
row.factoryAreaNumber1 = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
|
|
row.verifyerDetail = userListAll.find((account) => account.id == row.verifyer)?.nickname
|
|
detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintainOrderMain')
|
|
}
|
|
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (id: number) => {
|
|
try {
|
|
// 删除的二次确认
|
|
await message.delConfirm()
|
|
// 发起删除
|
|
await MoldMaintainOrderMainApi.deleteMoldMaintainOrderMain(id)
|
|
message.success(t('common.delSuccess'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch {}
|
|
}
|
|
|
|
/** 导出按钮操作 */
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
const handleExport = async () => {
|
|
try {
|
|
// 导出的二次确认
|
|
await message.exportConfirm()
|
|
// 发起导出
|
|
exportLoading.value = true
|
|
const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params)
|
|
download.excel(data, '维修工单主.xlsx')
|
|
} catch {
|
|
} finally {
|
|
exportLoading.value = false
|
|
}
|
|
}
|
|
|
|
/** 导入 */
|
|
const importFormRef = ref()
|
|
const handleImport = () => {
|
|
importFormRef.value.open()
|
|
}
|
|
// 导入附件弹窗所需的参数
|
|
const importTemplateData = reactive({
|
|
templateUrl: '',
|
|
templateTitle: '维修工单主导入模版.xlsx'
|
|
})
|
|
// 导入成功之后
|
|
const importSuccess = () => {
|
|
getList()
|
|
}
|
|
|
|
// 筛选提交
|
|
const searchFormClick = (searchData) => {
|
|
tableObject.params = {
|
|
isSearch: true,
|
|
filters: searchData.filters
|
|
}
|
|
getList() // 刷新当前列表
|
|
}
|
|
|
|
// 接单
|
|
function acceptOrder(row) {
|
|
MoldMaintainOrderMainApi.orderClick(row.id).then(() => {
|
|
message.success('接单成功')
|
|
getList();
|
|
});
|
|
}
|
|
// 转办
|
|
function turnOrder() {}
|
|
// 完成
|
|
function finishOrder(row) {
|
|
// MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage({
|
|
// masterId: row.id,
|
|
// isSearch: false,
|
|
// status: 0,
|
|
// }).then(( res) => {
|
|
// if (res.data.length === 0) {
|
|
// message.warning('请先完成保养明细')
|
|
// return
|
|
// }
|
|
// })
|
|
|
|
MoldMaintainOrderMainApi.orderClickFinish(row.id).then(() => {
|
|
message.success('完成保养')
|
|
getList();
|
|
});
|
|
}
|
|
// 验证
|
|
function verifyOrder() {}
|
|
// 维修
|
|
function repair() {}
|
|
|
|
// 详情
|
|
function mainListDetail() {}
|
|
/**
|
|
* tableForm方法
|
|
*/
|
|
const tableFormKeys = {}
|
|
MoldMaintainOrderDetail.allSchemas.tableFormColumns.forEach((item) => {
|
|
tableFormKeys[item.field] = item.default ? item.default : ''
|
|
})
|
|
|
|
// 添加明细
|
|
const handleAddTable = () => {
|
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
|
|
}
|
|
// 删除明细
|
|
const handleDeleteTable = (item, index) => {
|
|
tableData.value.splice(index, 1)
|
|
}
|
|
|
|
// 主子数据 提交
|
|
const submitForm = async (formType, data) => {
|
|
data.subList = tableData.value.map((item) => {
|
|
return {
|
|
describes: item.describes,
|
|
describes1: item.describes1,
|
|
itemNumbers: item.itemNumbers1,
|
|
maintenances: item.maintenances?.join(','),
|
|
workOut: item.workOut,
|
|
}
|
|
}) // 拼接子表数据参数
|
|
console.log(data.subList)
|
|
try {
|
|
if (formType === 'create') {
|
|
await MoldMaintainOrderMainApi.createMoldMaintainOrderMain(data)
|
|
message.success(t('common.createSuccess'))
|
|
} else {
|
|
await MoldMaintainOrderMainApi.updateMoldMaintainOrderMain(data)
|
|
message.success(t('common.updateSuccess'))
|
|
}
|
|
formRef.value.dialogVisible = false
|
|
// 刷新当前列表
|
|
getList()
|
|
} finally {
|
|
formRef.value.formLoading = false
|
|
}
|
|
}
|
|
const detailOpenForm = (type, row) =>{
|
|
console.log("type",type);
|
|
console.log("row",row);
|
|
MoldMaintainOrderDetail.allSchemas.tableFormColumns.map((item) => {
|
|
// if(purchaseReceiptRecordNumberRef.value == ''){
|
|
// if (item.field == 'itemCode') {
|
|
// item.form.componentProps.disabled = true
|
|
// item.form.componentProps.isSearchList = true
|
|
// }
|
|
// if(item.field == 'poLine'){
|
|
// item.form.componentProps.disabled = true
|
|
// item.form.componentProps.isSearchList = false
|
|
// }
|
|
// }else{
|
|
// if (item.field == 'itemCode') {
|
|
// item.form.componentProps.disabled = true
|
|
// item.form.componentProps.isSearchList = false
|
|
// }
|
|
// if(item.field == 'poLine'){
|
|
// item.form.componentProps.disabled = true
|
|
// item.form.componentProps.isSearchList = true
|
|
// }
|
|
// }
|
|
})
|
|
}
|
|
// 子表新增/编辑校验
|
|
const detailValidate = (data) => {
|
|
return true;
|
|
let tag = false;
|
|
if(data.qty <= 0){
|
|
message.warning('数量必须大于0')
|
|
tag = false;
|
|
return tag;
|
|
}else {
|
|
tag = true;
|
|
return tag;
|
|
}
|
|
}
|
|
// 子表提交
|
|
const detailSubmitForm= async (formType,data,formRef,tableList) => {
|
|
try {
|
|
let data1 = {
|
|
id:data.id,
|
|
number:data.number,
|
|
describes:data.describes,
|
|
describes1: data.describes1,
|
|
peoples: data.peoples,
|
|
status: data.status,
|
|
itemNumbers: data.itemNumbers,
|
|
estimatedMinutes: data.estimatedMinutes,
|
|
actualMinutes: data.actualMinutes,
|
|
chargePeoples:data.chargePeoples?.join(','),
|
|
workOut: data.workOut,
|
|
engineer: data.engineer,
|
|
completionTime: data.completionTime,
|
|
uncompleted: data.uncompleted,
|
|
}
|
|
console.log(data1)
|
|
if (formType === 'create') {
|
|
await MoldMaintainOrderDetailApi.createMoldMaintainOrderDetail(data1)
|
|
message.success(t('common.createSuccess'))
|
|
} else {
|
|
await MoldMaintainOrderDetailApi.updateMoldMaintainOrderDetail(data1)
|
|
message.success(t('common.updateSuccess'))
|
|
}
|
|
formRef.dialogVisible = false
|
|
// 刷新当前列表
|
|
await detailRef.value.getList()
|
|
detailRef.value.tableObject.tableList.forEach(item=>{
|
|
if (item.itemNumbers?.length>0) {
|
|
let str = ''
|
|
item.itemNumbers.forEach(element => {
|
|
str += element.name + ':' + element.qty + ','
|
|
})
|
|
item.itemNumbers1 = str.substring(0, str.length - 1)
|
|
}
|
|
|
|
})
|
|
} finally {
|
|
formRef.formLoading = false
|
|
}
|
|
}
|
|
|
|
function buttonControllFunction(row, val) {
|
|
if (val == 'delete') {
|
|
return false
|
|
} else if (val == 'edit') {
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance) ) {
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
} else if(val == 'add') {
|
|
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' || !isReceiver(row.maintenance)) {
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
} else {
|
|
return true
|
|
}
|
|
}
|
|
|
|
function detailOnChange(field, cur, item,formRef) {
|
|
if (field == 'status') {
|
|
if (cur == '1') {
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true
|
|
formRef.setValues({completionTime:''})
|
|
MoldMaintainOrderDetailRules.uncompleted = [{ required: true, message: '该项为必填项' }]
|
|
MoldMaintainOrderDetailRules.completionTime = [{ required: false }]
|
|
} else {
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false
|
|
MoldMaintainOrderDetailRules.uncompleted = [{ required: false }]
|
|
formRef.setValues({uncompleted:''})
|
|
MoldMaintainOrderDetailRules.completionTime = [{ required: true , message: '该项为必填项'}]
|
|
}
|
|
}
|
|
}
|
|
|
|
const openFormCallBack = (type, row, masterParmas, callback) => {
|
|
if (row == undefined || row == null) {
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false
|
|
MoldMaintainOrderDetailRules.uncompleted = [{ required: false }]
|
|
MoldMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}]
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0'
|
|
} else {
|
|
if (row.status == '1') {
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true
|
|
MoldMaintainOrderDetailRules.uncompleted = [{ required: true,message: '该项为必填项' }]
|
|
MoldMaintainOrderDetailRules.completionTime = [{ required: false }]
|
|
} else {
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true
|
|
MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false
|
|
MoldMaintainOrderDetailRules.uncompleted = [{ required: false }]
|
|
MoldMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}]
|
|
}
|
|
}
|
|
callback()
|
|
}
|
|
|
|
|
|
function isReceiver(orderPerson) {
|
|
if (orderPerson == userStore?.getUser?.id) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
|
|
const openDialog = (row) => {
|
|
dialogRowData.value = row
|
|
updateFormValue.value.verifyContent = ''
|
|
dialogVisible.value = true
|
|
}
|
|
|
|
const onCancel = () => {
|
|
dialogVisible.value = false
|
|
}
|
|
|
|
const onSubmit = (val) => {
|
|
MoldMaintainOrderMainApi.orderClickApprove(dialogRowData.value.id,'VERIFIED',updateFormValue.value.verifyContent).then(res => {
|
|
message.success(t('common.verifySuccess'))
|
|
dialogVisible.value = false
|
|
getList()
|
|
})
|
|
}
|
|
|
|
const orderPrint = (row) => {
|
|
window.open(src.value + "&id=" + row.id)
|
|
}
|
|
|
|
|
|
|
|
const openDialogUpload = (row) => {
|
|
dialogUploadNumber.value = row.number
|
|
uploadApi.getImage({
|
|
number: row.number,
|
|
funcCode: "maintenance"
|
|
})
|
|
.then((res) => {
|
|
fileApi.selectList().then(response=>{
|
|
fileDialogUploadData.value.filePathList = res.map(item=>{
|
|
response.forEach(element=>{
|
|
if(item.url == element.url){
|
|
item.name = element.name
|
|
}
|
|
})
|
|
return item
|
|
})
|
|
dialogUploadVisible.value = true
|
|
dialogFormKey.value += 1
|
|
|
|
})
|
|
|
|
})
|
|
}
|
|
|
|
function dialogUploadFile() {
|
|
let data = {
|
|
number: dialogUploadNumber.value,
|
|
fileInfoList: fileDialogUploadData.value.filePathList?fileDialogUploadData.value.filePathList:[],
|
|
funcCode: "maintenance",
|
|
}
|
|
uploadApi.uploadImage(data).then((res) => {
|
|
message.success(t('common.submitSuccess'))
|
|
})
|
|
}
|
|
|
|
const getImage = () => {
|
|
uploadApi.getImage({
|
|
number: dialogUploadNumber.value,
|
|
funcCode: "maintenance",
|
|
})
|
|
.then((res) => {
|
|
nextTick(() => {
|
|
fileDialogUploadData.value.filePathList = res
|
|
dialogFormKey.value += 1
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
onMounted(async () => {
|
|
getList()
|
|
importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate()
|
|
})
|
|
</script>
|
|
|