Browse Source

检修保养工单代码

master
ljlong_2630 10 months ago
parent
commit
5e2666ac2e
  1. 2
      src/api/eam/device/deviceInspectionMain/index.ts
  2. 15
      src/api/eam/device/deviceMaintainOrderMain/index.ts
  3. 143
      src/components/Detail/src/Detail.vue
  4. 133
      src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts
  5. 111
      src/views/eam/device/deviceInspectionMain/index.vue
  6. 390
      src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts
  7. 433
      src/views/eam/device/deviceMaintainOrderMain/index.vue
  8. 3
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

2
src/api/eam/device/deviceInspectionMain/index.ts

@ -33,7 +33,7 @@ export const getDeviceInspectionMain = async (id: number) => {
// 新增检修工单主
export const createDeviceInspectionMain = async (data: DeviceInspectionMainVO) => {
return await request.post({ url: `/eam/device-inspection-main/create`, data })
return await request.post({ url: `/eam/device-inspection-main/createPC`, data })
}
// 修改检修工单主

15
src/api/eam/device/deviceMaintainOrderMain/index.ts

@ -1,6 +1,6 @@
import request from '@/config/axios'
export interface deviceMaintainOrderMainVO {
export interface DeviceMaintainOrderMainVO {
number: string
name: string
planNumber: string
@ -18,9 +18,8 @@ export interface deviceMaintainOrderMainVO {
available: string
concurrencyStamp: number
}
// 查询保养工单主列表
export const getdeviceMaintainOrderMainPage = async (params) => {
export const getDeviceMaintainOrderMainPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
@ -31,27 +30,27 @@ export const getdeviceMaintainOrderMainPage = async (params) => {
}
// 查询保养工单主详情
export const getdeviceMaintainOrderMain = async (id: number) => {
export const getDeviceMaintainOrderMain = async (id: number) => {
return await request.get({ url: `/eam/device-maintain-order-main/get?id=` + id })
}
// 新增保养工单主
export const createdeviceMaintainOrderMain = async (data: deviceMaintainOrderMainVO) => {
export const createDeviceMaintainOrderMain = async (data: DeviceMaintainOrderMainVO) => {
return await request.post({ url: `/eam/device-maintain-order-main/create`, data })
}
// 修改保养工单主
export const updatedeviceMaintainOrderMain = async (data: deviceMaintainOrderMainVO) => {
export const updateDeviceMaintainOrderMain = async (data: DeviceMaintainOrderMainVO) => {
return await request.put({ url: `/eam/device-maintain-order-main/update`, data })
}
// 删除保养工单主
export const deletedeviceMaintainOrderMain = async (id: number) => {
export const deleteDeviceMaintainOrderMain = async (id: number) => {
return await request.delete({ url: `/eam/device-maintain-order-main/delete?id=` + id })
}
// 导出保养工单主 Excel
export const exportdeviceMaintainOrderMain = async (params) => {
export const exportDeviceMaintainOrderMain = async (params) => {
return await request.download({ url: `/eam/device-maintain-order-main/export-excel`, params })
}

143
src/components/Detail/src/Detail.vue

@ -1,28 +1,14 @@
<template>
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading">
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical"
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" />
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
@ -30,32 +16,15 @@
<!-- 详情 -->
<ContentWrap class="w-[100%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<TableHead v-if="!isBasic" :HeadButttondata="HeadButttondata" :number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick" :routeName="routeName" @searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas" />
<!-- 默认单表展现 -->
<Descriptions
v-if="isBasic && !tabsExtend"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<Descriptions v-if="isBasic && !tabsExtend" :data="detailData" :schema="allSchemas.detailSchema" :columns="2" />
<!-- 单表切换tabs 展现table -->
<Table
v-if="isBasic && tabsExtend"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<Table v-if="isBasic && tabsExtend" :columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList"
:loading="tableObjectRef.loading" :pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize" v-model:currentPage="tableObjectRef.currentPage">
<!-- <template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@ -63,68 +32,34 @@
/>
</template> -->
</Table>
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<Table v-if="!isBasic && fromeWhere != 'countPlan'" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage">
<template #photos="{ row }">
<div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
<div v-for="(item, index) in row.photos.split(',')" :key="index" style="color: #409eff; cursor: pointer"
@click="openImage(item)">{{ item }}</div>
</template>
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
<DetailTable
v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:allList="allList"
:countScopeType="countScopeType"
:key="updateKey"
>
<DetailTable v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList" :allList="allList"
:countScopeType="countScopeType" :key="updateKey">
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</DetailTable>
</ContentWrap>
</div>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
:fromeWhere="fromeWhere"
:isDetail="true"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
@selectChangeDetail="selectChangeDetail"
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
:isSearchTableItem="isSearchTableItem"
/>
<BasicForm ref="formRef" @success="submitForm" :rules="detailAllSchemasRules" :formAllSchemas="detailAllSchemas"
:isBusiness="false" :apiUpdate="apiUpdate" :apiCreate="apiCreate" :fromeWhere="fromeWhere" :isDetail="true"
@searchTableSuccess="searchTableSuccess" :detailData="detailData" @submitForm="submitForm"
@selectChangeDetail="selectChangeDetail" :formTypeDetail="formTypeDetail" :countPlanAllList="countPlanAllList"
:isSearchTableItem="isSearchTableItem" />
</div>
</template>
@ -271,6 +206,12 @@ const props = defineProps({
required: false,
default: false
},
//
isShowAddBtn: {
type: Boolean,
required: false,
default: true
},
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
@ -342,11 +283,11 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
setBeiJian()
let detailButtonAdd: any = []
detailButtonAdd = [
detailButtonAdd = props.isShowAddBtn ? [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
})
]
] : []
HeadButttondata.value = [...detailButtonAdd]
//
if (!props.detailButtonIsShow) {
@ -433,10 +374,12 @@ const buttonBaseClick = (val, item) => {
// -
const buttonTableClick = async (val, row) => {
console.log(val)
console.log(row)
if (val == 'edit') {
//
openForm('update', row)
emit('detailOpenForm', row)
// emit('detailOpenForm',val, row)
} else if (val == 'delete') {
//
handleDelete(row.id)
@ -449,9 +392,14 @@ const formRef = ref()
const openForm = async (type: string, row?: number) => {
if (row) {
if (detailAllSchemasRef.value?.tableColumns?.length > 0) {
//
let isTrue = false
let isChargePeoples = false
let isItemNUmbersTrue = false
isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances')
isChargePeoples = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'chargePeoples'
)
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers'
)
@ -460,6 +408,11 @@ const openForm = async (type: string, row?: number) => {
row.maintenances = row.maintenances.split(',').map(Number)
}
}
if (isChargePeoples) {
if (row.chargePeoples && isString(row.chargePeoples)) {
row.chargePeoples = row.chargePeoples.split(',').map(Number)
}
}
}
}
@ -500,7 +453,7 @@ const handleDelete = async (id: number) => {
await getList()
updateKey.value += 1
setBeiJian()
} catch {}
} catch { }
}
//
const searchFormClick = async (searchData) => {

133
src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts

@ -5,6 +5,8 @@ import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import { dateFormatter } from '@/utils/formatTime'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
@ -263,7 +265,8 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150,
fixed: 'right'
}
},
isDetail:false
}
]))
@ -285,17 +288,29 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
},
isSearch: false,
isForm: false,
isTableForm: false,
},
{
label: '责任人',
field: 'maintenance',
field: 'chargePeoples',
sort: 'custom',
table: {
width: '150',
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return dutyUserList.find((account) => account.id == cellValue)?.name
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',
@ -306,7 +321,8 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择责任人"
placeholder: "请选择责任人",
multiple: true,
},
}
},
@ -321,11 +337,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
component: 'Input',
},
},
{
@ -336,26 +348,26 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
isSearch: false,
isForm: true,
form: {
component: 'InputNumber',
},
isTable: true,
tableForm: {
type: 'InputNumber',
},
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
component: 'Input',
},
},
@ -376,6 +388,10 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x'
}
},
tableForm: {
type: 'FormDateTime',
valueFormat: 'x'
},
},
{
label: '工程师确认',
@ -385,22 +401,9 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
api: () => engineerList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return engineerList.find((account) => account.id == cellValue)?.name
},
form: {
component: 'Select',
api: () => engineerList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择工程师"
},
}
component: 'Input',
},
},
{
label: '是否完成',
@ -419,6 +422,12 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
disabled: false,
}
},
tableForm: {
type: 'Select',
componentProps: {
disabled: false,
}
},
},
{
label: '未完成原因',
@ -431,7 +440,63 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
isForm: true,
isTable: true,
},
{
label: '备件',
field: 'itemNumbers1',
sort: 'custom',
table: {
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
searchField: 'itemNumbers1',
searchTitle: '备件',
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas,
searchPage: ItemApi.getItemList,
tableSelectionChange: (value) => {
console.log('value', value)
// tableData.value.itemNumbers1 = value.map(item => item.itemNumber)
},
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
}
},
isSearch: false,
},
{
label: '备件1',
field: 'itemNumbers',
sort: 'custom',
table: {
},
isForm:false,
isDetail:false,
isTable:false,
isSearch: false,
isTableForm: false,
},
{
label: '操作',
field: 'action',
@ -439,6 +504,8 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150,
fixed: 'right'
}
},
isDetail: false,
isTableForm: false,
}
]))

111
src/views/eam/device/deviceInspectionMain/index.vue

@ -34,21 +34,39 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules"
:formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @onChange="onChange" />
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceInspectionMainRules"
:formAllSchemas="DeviceInspectionMain.allSchemas"
:apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="true"
@onChange="onChange"
:tableAllSchemas="DeviceInspectionDetail.allSchemas"
:tableFormRules="DeviceInspectionDetailRules"
:tableData="tableData"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@submitForm="submitForm"
:isSearchTableItem="true"
/>
<!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionDetail.allSchemas" /> -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="DeviceInspectionMain.allSchemas"
:detailAllSchemas="DeviceInspectionDetail.allSchemas" :detailAllSchemasRules="DeviceInspectionDetailRules"
:detailAllSchemas="DeviceInspectionDetail.allSchemas"
:detailAllSchemasRules="DeviceInspectionDetailRules"
:apiCreate="DeviceInspectionDetailApi.createDeviceInspectionDetail"
:apiUpdate="DeviceInspectionDetailApi.updateDeviceInspectionDetail"
:apiPage="DeviceInspectionDetailApi.getDeviceInspectionDetailPage"
:apiDelete="DeviceInspectionDetailApi.deleteDeviceInspectionDetail" :Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" @detailOpenForm="detailOpenForm" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" :isSearchTableItem="true" />
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData"
@ -77,12 +95,28 @@ const routeName = ref()
routeName.value = route.name
const tableColumns = ref(DeviceInspectionMain.allSchemas.tableColumns)
const Echo = []
const tableData = ref([])
const formRef = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
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)
}
})
}
@ -161,6 +195,7 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
tableData.value = [] //
basicFormRef.value.open(type, row)
}
@ -273,6 +308,7 @@ const onChange = (field, cur, item) => {
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
debugger
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -312,23 +348,24 @@ const detailValidate = (data) => {
}
//
const detailSubmitForm = async (formType, data, getList, formRef, tableList) => {
console.log('data',data)
try {
let data1 = {
id: data.id,
number: data.number,
number: data.maintenanceNumber,
siteId: data.siteId,
available: data.available,
concurrencyStamp: data.concurrencyStamp,
name: data.name,
peoples: data.peoples.join(','),
peoples: data.peoples,
estimatedMinutes: data.estimatedMinutes,
actualMinutes: data.actualMinutes,
chargePeoples: data.chargePeoples.join(','),
completionTime: data.completionTime,
engineer: data.engineer.join(','),
engineer: data.engineer,
uncompleted: data.uncompleted
}
console.log(data1)
console.log('data1',data1)
if (formType === 'create') {
await DeviceInspectionDetailApi.createDeviceInspectionDetail(data1)
message.success(t('common.createSuccess'))
@ -354,6 +391,50 @@ const detailSubmitForm = async (formType, data, getList, formRef, tableList) =>
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
DeviceInspectionDetail.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) => {
debugger
data.subList = tableData.value.map((item) => {
item.chargePeoples = item.chargePeoples.join(',');
return item;
}) //
console.log(data.subList)
debugger
try {
if (formType === 'create') {
await DeviceInspectionMainApi.createDeviceInspectionMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceInspectionMainApi.updateDeviceInspectionMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 初始化 **/
onMounted(async () => {
getList()

390
src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts

@ -1,8 +1,22 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import { dateFormatter } from '@/utils/formatTime'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined })
const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 2})
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
// 表单校验
export const deviceMaintainOrderMainRules = reactive({
export const DeviceMaintainOrderMainRules = reactive({
number: [required],
name: [required],
planNumber: [required],
@ -13,39 +27,73 @@ export const deviceMaintainOrderMainRules = reactive({
concurrencyStamp: [required],
})
export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '保养单号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
// {
// label: '名称',
// field: 'name',
// sort: 'custom',
// isSearch: true,
// },
{
label: '保养计划单号',
field: 'planNumber',
sort: 'custom',
isSearch: true,
},
{
label: '设备/模具编号',
label: '设备/模具',
field: 'deviceNumber',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
label: '厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: String) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
},
detail: {
}
},
{
label: '工程师id',
label: '工程师',
field: 'engineer',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
@ -55,6 +103,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '接单时间',
field: 'receiveTime',
sort: 'custom',
isSearch: false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -68,6 +117,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '指派时间',
field: 'assignTime',
sort: 'custom',
isSearch: false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -77,19 +127,11 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '工程师id',
field: 'worker',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '完成时间',
field: 'finishedTime',
sort: 'custom',
isSearch: false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -103,6 +145,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '验证时间',
field: 'verifyTime',
sort: 'custom',
isSearch: false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -126,44 +169,304 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
},
form: {
component: 'Select'
},
},
// {
// label: '创建时间',
// field: 'createTime',
// 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')]
// }
// },
// isForm: false,
// },
// {
// label: '地点ID',
// field: 'siteId',
// sort: 'custom',
// isSearch: false,
// },
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// isSearch: false,
// },
// {
// label: '并发乐观锁',
// field: 'concurrencyStamp',
// sort: 'custom',
// form: {
// component: 'InputNumber',
// value: 0
// },
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const DeviceMaintainOrderDetailRules = reactive({
concurrencyStamp: [required],
name: [required],
number: [required],
peoples: [required],
estimatedMinutes: [required],
actualMinutes: [required],
chargePeoples: [required],
completionTime: [required],
engineer: [required]
})
export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '创建时间',
field: 'createTime',
label: '保养工单号',
field: 'number',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
form: {
component: 'Input',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
disabled: true,
}
},
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
label: '人数',
field: 'peoples',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
},
isTable: true,
tableForm: {
type: 'InputNumber',
},
},
{
label: '是否可用',
field: 'available',
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'InputNumber',
value: 0
component: 'Input',
},
},
{
label: '责任人多选',
field: 'chargePeoples',
sort: 'custom',
table: {
width: '150',
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',
api: () => dutyUserList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择责任人",
multiple: true,
},
}
},
{
label: '是否完成',
field: 'status',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
dictType: DICT_TYPE.JX_DETAILS_STATUS,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: false,
}
},
tableForm: {
type: 'Select',
componentProps: {
disabled: false,
}
},
},
{
label: '未完成原因',
field: 'uncompleted',
sort: 'custom',
isSearch: false,
isTable: true,
form: {
component: 'Input',
componentProps: {
type:'textarea'
}
}
},
{
label: '维修内容',
field: 'contents',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
disabled: true,
}
}
},
{
label: '备件',
field: 'itemNumbers1',
sort: 'custom',
table: {
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
searchField: 'itemNumbers1',
searchTitle: '备件',
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas,
searchPage: ItemApi.getItemList,
tableSelectionChange: (value) => {
console.log('value', value)
// tableData.value.itemNumbers1 = value.map(item => item.itemNumber)
},
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
}
},
isSearch: false,
},
{
label: '备件1',
field: 'itemNumbers',
sort: 'custom',
table: {
},
isForm:false,
isDetail:false,
isTable:false,
isSearch: false,
isTableForm: false,
},
{
label: '完成时间',
field: 'completionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
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: 'engineer',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type:'TextArea'
}
}
},
{
label: '操作',
@ -172,6 +475,9 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150,
fixed: 'right'
}
},
isDetail: false,
isTableForm: false,
}
]))

433
src/views/eam/device/deviceMaintainOrderMain/index.vue

@ -1,18 +1,22 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="deviceMaintainOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="DeviceMaintainOrderMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="deviceMaintainOrderMain.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMaintainOrderMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
@ -27,71 +31,146 @@
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>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="deviceMaintainOrderMainRules"
:formAllSchemas="deviceMaintainOrderMain.allSchemas"
:apiUpdate="deviceMaintainOrderMainApi.updatedeviceMaintainOrderMain"
:apiCreate="deviceMaintainOrderMainApi.createdeviceMaintainOrderMain"
ref="formRef"
:rules="DeviceMaintainOrderMainRules"
:formAllSchemas="DeviceMaintainOrderMain.allSchemas"
:tableAllSchemas="DeviceMaintainOrderDetail.allSchemas"
:tableFormRules="DeviceMaintainOrderDetailRules"
:tableData="tableData"
:apiUpdate="DeviceMaintainOrderMainApi.updateDeviceMaintainOrderMain"
:apiCreate="DeviceMaintainOrderMainApi.createDeviceMaintainOrderMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@submitForm="submitForm"
:isSearchTableItem="true"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="deviceMaintainOrderMain.allSchemas" />
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintainOrderMain.allSchemas" /> -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="DeviceMaintainOrderMain.allSchemas"
:detailAllSchemas="DeviceMaintainOrderDetail.allSchemas"
:detailAllSchemasRules="DeviceMaintainOrderDetailRules"
:apiCreate="DeviceMaintainOrderDetailApi.createDeviceMaintainOrderDetail"
:apiUpdate="DeviceMaintainOrderDetailApi.updateDeviceMaintainOrderDetail"
:apiPage="DeviceMaintainOrderDetailApi.getDeviceMaintainOrderDetailPage"
:apiDelete="DeviceMaintainOrderDetailApi.deleteDeviceMaintainOrderDetail"
:Echo="Echo"
:isShowAddBtn="false"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-maintain-order-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/eam/device-maintenance-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { deviceMaintainOrderMain,deviceMaintainOrderMainRules } from './deviceMaintainOrderMain.data'
import * as deviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain'
import {
DeviceMaintainOrderMain,
DeviceMaintainOrderMainRules,
DeviceMaintainOrderDetail,
DeviceMaintainOrderDetailRules
} from './deviceMaintainOrderMain.data'
import * as DeviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain'
import * as DeviceMaintainOrderDetailApi from '@/api/eam/device/deviceMaintainOrderDetail'
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'
defineOptions({ name: 'deviceMaintainOrderMain' })
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'DeviceMaintainOrderMain' })
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(deviceMaintainOrderMain.allSchemas.tableColumns)
const tableColumns = ref(DeviceMaintainOrderMain.allSchemas.tableColumns)
const apiPage = ref(DeviceMaintainOrderDetailApi.getDeviceMaintainOrderDetailPage)
const detailAllSchemas = ref(DeviceMaintainOrderDetail.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(() => {
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 updataTableColumns = (val) => {
tableColumns.value = val
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: deviceMaintainOrderMainApi.getdeviceMaintainOrderMainPage //
getListApi: DeviceMaintainOrderMainApi.getDeviceMaintainOrderMainPage //
})
//
@ -99,87 +178,111 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintainOrderMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintainOrderMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMaintainOrderMain:export'}), //
// defaultButtons.defaultAddBtn({
// hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
// }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
defaultButtons.defaultSetBtn(null) //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
DeviceMaintainOrderMain.allSchemas.formSchema[3].value = 'DEVICE'
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} 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 = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMaintainOrderMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintainOrderMain:delete'}), //
]
const butttondata = (row) => {
return [
// defaultButtons.mainListEditBtn(null), //
defaultButtons.acceptOrderBtn({
hide: !(
row.status == 'PENDING' &&
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 == 'deviceNumber') {
// DeviceMaintainOrderMain.allSchemas.formSchema[1].componentProps.disabled = true
// DeviceMaintainOrderMain.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') { //
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =deviceMaintainOrderMain.allSchemas.formSchema.some(function (item) {
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 deviceMaintainOrderMainApi.createdeviceMaintainOrderMain(data)
message.success(t('common.createSuccess'))
} else {
await deviceMaintainOrderMainApi.updatedeviceMaintainOrderMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicdeviceMaintainOrderMain')
detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintainOrderMain')
}
/** 删除按钮操作 */
@ -188,7 +291,7 @@ const handleDelete = async (id: number) => {
//
await message.delConfirm()
//
await deviceMaintainOrderMainApi.deletedeviceMaintainOrderMain(id)
await DeviceMaintainOrderMainApi.deleteDeviceMaintainOrderMain(id)
message.success(t('common.delSuccess'))
//
await getList()
@ -203,8 +306,8 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await deviceMaintainOrderMainApi.exportdeviceMaintainOrderMain(tableObject.params)
download.excel(data, '保养工单主.xlsx')
const data = await DeviceMaintainOrderMainApi.exportDeviceMaintainOrderMain(tableObject.params)
download.excel(data, '维修工单主.xlsx')
} catch {
} finally {
exportLoading.value = false
@ -219,7 +322,7 @@ const handleImport = () => {
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '保养工单主导入模版.xlsx'
templateTitle: '维修工单主导入模版.xlsx'
})
//
const importSuccess = () => {
@ -235,10 +338,144 @@ const searchFormClick = (searchData) => {
getList() //
}
//
function acceptOrder(row) {
DeviceMaintainOrderMainApi.orderStepChange(row)
}
//
function turnOrder() {}
//
function finishOrder() {}
//
function verifyOrder() {}
//
function repair() {}
//
function mainListDetail() {}
/**
* tableForm方法
*/
const tableFormKeys = {}
DeviceMaintainOrderDetail.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 DeviceMaintainOrderMainApi.createDeviceMaintainOrderMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintainOrderMainApi.updateDeviceMaintainOrderMain(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);
DeviceMaintainOrderDetail.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 DeviceMaintainOrderDetailApi.createDeviceMaintainOrderDetail(data1)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintainOrderDetailApi.updateDeviceMaintainOrderDetail(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 () => {
getList()
importTemplateData.templateUrl = await deviceMaintainOrderMainApi.importTemplate()
importTemplateData.templateUrl = await DeviceMaintainOrderMainApi.importTemplate()
})
</script>

3
src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

@ -319,7 +319,8 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: 300,
fixed: 'right'
},
isDetail:false
isDetail: false,
isTableForm: false,
}
]))
// 表单校验

Loading…
Cancel
Save