|
@ -1,18 +1,22 @@ |
|
|
<template> |
|
|
<template> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<!-- 搜索工作栏 --> |
|
|
<!-- 搜索工作栏 --> |
|
|
<Search :schema="MoldMaintainOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
<Search |
|
|
|
|
|
:schema="MoldMaintainOrderMain.allSchemas.searchSchema" |
|
|
|
|
|
@search="setSearchParams" |
|
|
|
|
|
@reset="setSearchParams" |
|
|
|
|
|
/> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
<!-- 列表头部 --> |
|
|
<TableHead |
|
|
<TableHead |
|
|
:HeadButttondata="HeadButttondata" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
@button-base-click="buttonBaseClick" |
|
|
@button-base-click="buttonBaseClick" |
|
|
:routeName="routeName" |
|
|
:routeName="routeName" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@searchFormClick="searchFormClick" |
|
|
@searchFormClick="searchFormClick" |
|
|
:allSchemas="MoldMaintainOrderMain.allSchemas" |
|
|
:allSchemas="MoldMaintainOrderMain.allSchemas" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
<!-- 列表 --> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
@ -27,68 +31,143 @@ |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:sort="tableObject.sort" |
|
|
v-model:sort="tableObject.sort" |
|
|
> |
|
|
> |
|
|
<template #code="{row}"> |
|
|
<template #number="{ row }"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
|
|
<span>{{ row.code }}</span> |
|
|
<span>{{ row.number }}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row }"> |
|
|
<template #action="{ row }"> |
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
<ButtonBase |
|
|
|
|
|
:Butttondata="butttondata(row)" |
|
|
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
</Table> |
|
|
</Table> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<BasicForm |
|
|
<BasicForm |
|
|
ref="basicFormRef" |
|
|
ref="formRef" |
|
|
@success="formsSuccess" |
|
|
|
|
|
:rules="MoldMaintainOrderMainRules" |
|
|
:rules="MoldMaintainOrderMainRules" |
|
|
:formAllSchemas="MoldMaintainOrderMain.allSchemas" |
|
|
:formAllSchemas="MoldMaintainOrderMain.allSchemas" |
|
|
|
|
|
:tableAllSchemas="MoldMaintainOrderDetail.allSchemas" |
|
|
|
|
|
:tableFormRules="MoldMaintainOrderDetailRules" |
|
|
|
|
|
:tableData="tableData" |
|
|
:apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain" |
|
|
:apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain" |
|
|
:apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain" |
|
|
:apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain" |
|
|
|
|
|
:isBusiness="true" |
|
|
|
|
|
@onChange="onChange" |
|
|
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
:isBusiness="false" |
|
|
@submitForm="submitForm" |
|
|
|
|
|
:isSearchTableItem="true" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintainOrderMain.allSchemas" /> |
|
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintainOrderMain.allSchemas" /> --> |
|
|
|
|
|
<Detail |
|
|
|
|
|
ref="detailRef" |
|
|
|
|
|
:isBasic="false" |
|
|
|
|
|
:allSchemas="MoldMaintainOrderMain.allSchemas" |
|
|
|
|
|
:detailAllSchemas="MoldMaintainOrderDetail.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" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
<!-- 导入 --> |
|
|
<ImportForm ref="importFormRef" url="/eam/mold-maintain-order-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
<ImportForm |
|
|
|
|
|
ref="importFormRef" |
|
|
|
|
|
url="/eam/mold-maintenance-main/import" |
|
|
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
|
|
@success="importSuccess" |
|
|
|
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { MoldMaintainOrderMain,MoldMaintainOrderMainRules } from './moldMaintainOrderMain.data' |
|
|
import { |
|
|
|
|
|
MoldMaintainOrderMain, |
|
|
|
|
|
MoldMaintainOrderMainRules, |
|
|
|
|
|
MoldMaintainOrderDetail, |
|
|
|
|
|
MoldMaintainOrderDetailRules |
|
|
|
|
|
} from './moldMaintainOrderMain.data' |
|
|
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain' |
|
|
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain' |
|
|
|
|
|
import * as MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
|
|
// import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'MoldMaintainOrderMain' }) |
|
|
defineOptions({ name: 'MoldMaintainOrderMain' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
const userStore = useUserStore() // 用户信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
|
|
|
const formRef = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns) |
|
|
const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns) |
|
|
|
|
|
const apiPage = ref(MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage) |
|
|
|
|
|
const detailAllSchemas = ref(MoldMaintainOrderDetail.allSchemas) |
|
|
|
|
|
const tableData = ref([]) |
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
tableColumns.value = val |
|
|
|
|
|
} |
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
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(() => { |
|
|
nextTick(() => { |
|
|
const setV = {} |
|
|
const setV = {} |
|
|
setV[formField] = val[0][searchField] |
|
|
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) |
|
|
formRef.setValues(setV) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
// 子表新增的时候选择表格之后需要会显得字段 |
|
|
const updataTableColumns = (val) => { |
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] |
|
|
tableColumns.value = val |
|
|
const Echo = [] |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage // 分页接口 |
|
|
getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage // 分页接口 |
|
@ -99,87 +178,115 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
defaultButtons.defaultAddBtn({hasPermi:'eam:moldMaintainOrderMain:create'}), // 新增 |
|
|
// defaultButtons.defaultAddBtn({ |
|
|
defaultButtons.defaultImportBtn({hasPermi:'eam:moldMaintainOrderMain:import'}), // 导入 |
|
|
// hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') |
|
|
defaultButtons.defaultExportBtn({hasPermi:'eam:moldMaintainOrderMain:export'}), // 导出 |
|
|
// }), // 新增 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
// { |
|
|
|
|
|
// label: '自定义扩展按钮', |
|
|
|
|
|
// name: 'zdy', |
|
|
|
|
|
// hide: false, |
|
|
|
|
|
// type: 'primary', |
|
|
|
|
|
// icon: 'Select', |
|
|
|
|
|
// color: '' |
|
|
|
|
|
// }, |
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
|
const buttonBaseClick = (val, item) => { |
|
|
const buttonBaseClick = (val, item) => { |
|
|
if (val == 'add') { // 新增 |
|
|
if (val == 'add') { |
|
|
|
|
|
// 新增 |
|
|
|
|
|
MoldMaintainOrderMain.allSchemas.formSchema[3].value = 'MOLD' |
|
|
|
|
|
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false |
|
|
openForm('create') |
|
|
openForm('create') |
|
|
} else if (val == 'import') { // 导入 |
|
|
} else if (val == 'import') { |
|
|
|
|
|
// 导入 |
|
|
handleImport() |
|
|
handleImport() |
|
|
} else if (val == 'export') { // 导出 |
|
|
} else if (val == 'export') { |
|
|
|
|
|
// 导出 |
|
|
handleExport() |
|
|
handleExport() |
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
} else if (val == 'refresh') { |
|
|
|
|
|
// 刷新 |
|
|
getList() |
|
|
getList() |
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
} else if (val == 'filtrate') { |
|
|
} else { // 其他按钮 |
|
|
// 筛选 |
|
|
|
|
|
} else { |
|
|
|
|
|
// 其他按钮 |
|
|
console.log('其他按钮', item) |
|
|
console.log('其他按钮', item) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
|
|
const isShowMainButton = (row, val) => { |
|
|
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
|
|
return false |
|
|
|
|
|
} else { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = [ |
|
|
const butttondata = (row) => { |
|
|
defaultButtons.mainListEditBtn({hasPermi:'eam:moldMaintainOrderMain:update'}), // 编辑 |
|
|
return [ |
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldMaintainOrderMain:delete'}), // 删除 |
|
|
// defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
] |
|
|
defaultButtons.acceptOrderBtn({ |
|
|
|
|
|
|
|
|
|
|
|
hide: !( |
|
|
|
|
|
row.status == 'PENDING' && |
|
|
|
|
|
(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') || |
|
|
|
|
|
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) |
|
|
|
|
|
) |
|
|
|
|
|
}), // 接单 |
|
|
|
|
|
// defaultButtons.turnOrderBtn({ |
|
|
|
|
|
// hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) |
|
|
|
|
|
// }), // 转办 |
|
|
|
|
|
// defaultButtons.repairBtn({ |
|
|
|
|
|
// hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) |
|
|
|
|
|
// }), // 维修 |
|
|
|
|
|
// defaultButtons.verifyOrderBtn({ |
|
|
|
|
|
// hide: !( |
|
|
|
|
|
// row.status == 'COMPLETED' && |
|
|
|
|
|
// userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') |
|
|
|
|
|
// ) |
|
|
|
|
|
// }), // 验证 |
|
|
|
|
|
defaultButtons.finishOrderBtn({ |
|
|
|
|
|
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) |
|
|
|
|
|
}) // 完成 |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
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) => { |
|
|
const buttonTableClick = async (val, row) => { |
|
|
if (val == 'edit') { // 编辑 |
|
|
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false |
|
|
|
|
|
if (val == 'edit') { |
|
|
|
|
|
// 编辑 |
|
|
openForm('update', row) |
|
|
openForm('update', row) |
|
|
} else if (val == 'delete') { // 删除 |
|
|
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true |
|
|
|
|
|
} else if (val == 'delete') { |
|
|
|
|
|
// 删除 |
|
|
handleDelete(row.id) |
|
|
handleDelete(row.id) |
|
|
} |
|
|
} else if (val == 'acceptOrder') { |
|
|
|
|
|
acceptOrder(row) |
|
|
|
|
|
} else if (val == 'turnOrder') { |
|
|
|
|
|
openForm('turnOrder', row) |
|
|
|
|
|
} else if (val == 'finishOrder') { |
|
|
|
|
|
finishOrder(row) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
/** 添加/修改操作 */ |
|
|
const basicFormRef = ref() |
|
|
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
const openForm = (type: string, row?: any) => { |
|
|
const formsSuccess = async (formType,data) => { |
|
|
tableData.value = [] // 重置明细数据 |
|
|
var isHave =MoldMaintainOrderMain.allSchemas.formSchema.some(function (item) { |
|
|
formRef.value.open(type, row) |
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
|
|
}); |
|
|
|
|
|
if(isHave){ |
|
|
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
await MoldMaintainOrderMainApi.createMoldMaintainOrderMain(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await MoldMaintainOrderMainApi.updateMoldMaintainOrderMain(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
const detailRef = ref() |
|
|
const detailRef = ref() |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicMoldMaintainOrderMain') |
|
|
detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintainOrderMain') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
@ -204,7 +311,7 @@ const handleExport = async () => { |
|
|
// 发起导出 |
|
|
// 发起导出 |
|
|
exportLoading.value = true |
|
|
exportLoading.value = true |
|
|
const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params) |
|
|
const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params) |
|
|
download.excel(data, '保养工单主.xlsx') |
|
|
download.excel(data, '维修工单主.xlsx') |
|
|
} catch { |
|
|
} catch { |
|
|
} finally { |
|
|
} finally { |
|
|
exportLoading.value = false |
|
|
exportLoading.value = false |
|
@ -219,7 +326,7 @@ const handleImport = () => { |
|
|
// 导入附件弹窗所需的参数 |
|
|
// 导入附件弹窗所需的参数 |
|
|
const importTemplateData = reactive({ |
|
|
const importTemplateData = reactive({ |
|
|
templateUrl: '', |
|
|
templateUrl: '', |
|
|
templateTitle: '保养工单主导入模版.xlsx' |
|
|
templateTitle: '维修工单主导入模版.xlsx' |
|
|
}) |
|
|
}) |
|
|
// 导入成功之后 |
|
|
// 导入成功之后 |
|
|
const importSuccess = () => { |
|
|
const importSuccess = () => { |
|
@ -235,10 +342,152 @@ const searchFormClick = (searchData) => { |
|
|
getList() // 刷新当前列表 |
|
|
getList() // 刷新当前列表 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 接单 |
|
|
|
|
|
function acceptOrder(row) { |
|
|
|
|
|
MoldMaintainOrderMainApi.orderClick(row.id).then(() => { |
|
|
|
|
|
message.success('接单成功') |
|
|
|
|
|
getList(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 转办 |
|
|
|
|
|
function turnOrder() {} |
|
|
|
|
|
// 完成 |
|
|
|
|
|
function finishOrder(row) { |
|
|
|
|
|
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,getList,formRef,tableList) => { |
|
|
|
|
|
try { |
|
|
|
|
|
let data1 = { |
|
|
|
|
|
id:data.id, |
|
|
|
|
|
maintenanceNumber:data.maintenanceNumber, |
|
|
|
|
|
describes:data.describes, |
|
|
|
|
|
describes1:data.describes1, |
|
|
|
|
|
itemNumbers:data.itemNumbers, |
|
|
|
|
|
maintenances:data.maintenances.join(','), |
|
|
|
|
|
workOut:data.workOut, |
|
|
|
|
|
} |
|
|
|
|
|
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 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 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
/** 初始化 **/ |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
getList() |
|
|
getList() |
|
|
importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate() |
|
|
importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|