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) => { 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' import request from '@/config/axios'
export interface deviceMaintainOrderMainVO { export interface DeviceMaintainOrderMainVO {
number: string number: string
name: string name: string
planNumber: string planNumber: string
@ -18,9 +18,8 @@ export interface deviceMaintainOrderMainVO {
available: string available: string
concurrencyStamp: number concurrencyStamp: number
} }
// 查询保养工单主列表 // 查询保养工单主列表
export const getdeviceMaintainOrderMainPage = async (params) => { export const getDeviceMaintainOrderMainPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} 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 }) 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 }) 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 }) 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 }) return await request.delete({ url: `/eam/device-maintain-order-main/delete?id=` + id })
} }
// 导出保养工单主 Excel // 导出保养工单主 Excel
export const exportdeviceMaintainOrderMain = async (params) => { export const exportDeviceMaintainOrderMain = async (params) => {
return await request.download({ url: `/eam/device-maintain-order-main/export-excel`, 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> <template>
<div> <div>
<el-drawer <el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading">
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header> <template #header>
<div class="font-size-18px"> <div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> {{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div> </div>
</template> </template>
<ContentWrap v-if="!isBasic"> <ContentWrap v-if="!isBasic">
<Descriptions <Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical"
:data="detailData" :column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" />
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap> </ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" /> <Tabs :tabsList="tabsList" :current="current" @change="change" />
@ -30,32 +16,15 @@
<!-- 详情 --> <!-- 详情 -->
<ContentWrap class="w-[100%]"> <ContentWrap class="w-[100%]">
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead v-if="!isBasic" :HeadButttondata="HeadButttondata" :number="masterParmas.maintenanceNumber"
v-if="!isBasic" @button-base-click="buttonBaseClick" :routeName="routeName" @searchFormClick="searchFormClick"
:HeadButttondata="HeadButttondata" :allSchemas="detailAllSchemas" />
:number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<!-- 默认单表展现 --> <!-- 默认单表展现 -->
<Descriptions <Descriptions v-if="isBasic && !tabsExtend" :data="detailData" :schema="allSchemas.detailSchema" :columns="2" />
v-if="isBasic && !tabsExtend"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<!-- 单表切换tabs 展现table --> <!-- 单表切换tabs 展现table -->
<Table <Table v-if="isBasic && tabsExtend" :columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList"
v-if="isBasic && tabsExtend" :loading="tableObjectRef.loading" :pagination="{ total: tableObjectRef.total }"
:columns="detailAllSchemasRef.tableColumns" v-model:pageSize="tableObjectRef.pageSize" v-model:currentPage="tableObjectRef.currentPage">
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<!-- <template #action="{ row }"> <!-- <template #action="{ row }">
<ButtonBase <ButtonBase
:Butttondata="buttondata" :Butttondata="buttondata"
@ -63,68 +32,34 @@
/> />
</template> --> </template> -->
</Table> </Table>
<Table <Table v-if="!isBasic && fromeWhere != 'countPlan'" :columns="detailAllSchemasRef.tableColumns"
v-if="!isBasic && fromeWhere != 'countPlan'" :data="tableObjectRef.tableList" :loading="tableObjectRef.loading"
:columns="detailAllSchemasRef.tableColumns" :pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize"
:data="tableObjectRef.tableList" v-model:currentPage="tableObjectRef.currentPage">
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<template #photos="{ row }"> <template #photos="{ row }">
<div <div v-for="(item, index) in row.photos.split(',')" :key="index" style="color: #409eff; cursor: pointer"
v-for="(item, index) in row.photos.split(',')" @click="openImage(item)">{{ item }}</div>
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
<DetailTable <DetailTable v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer" :columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList" :allList="allList"
:columns="detailAllSchemasRef.tableColumns" :countScopeType="countScopeType" :key="updateKey">
:data="tableObjectRef.tableList"
:allList="allList"
:countScopeType="countScopeType"
:key="updateKey"
>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</DetailTable> </DetailTable>
</ContentWrap> </ContentWrap>
</div> </div>
</el-drawer> </el-drawer>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="formRef" @success="submitForm" :rules="detailAllSchemasRules" :formAllSchemas="detailAllSchemas"
ref="formRef" :isBusiness="false" :apiUpdate="apiUpdate" :apiCreate="apiCreate" :fromeWhere="fromeWhere" :isDetail="true"
@success="submitForm" @searchTableSuccess="searchTableSuccess" :detailData="detailData" @submitForm="submitForm"
:rules="detailAllSchemasRules" @selectChangeDetail="selectChangeDetail" :formTypeDetail="formTypeDetail" :countPlanAllList="countPlanAllList"
:formAllSchemas="detailAllSchemas" :isSearchTableItem="isSearchTableItem" />
: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> </div>
</template> </template>
@ -271,6 +206,12 @@ const props = defineProps({
required: false, required: false,
default: false default: false
}, },
//
isShowAddBtn: {
type: Boolean,
required: false,
default: true
},
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
@ -342,11 +283,11 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
setBeiJian() setBeiJian()
let detailButtonAdd: any = [] let detailButtonAdd: any = []
detailButtonAdd = [ detailButtonAdd = props.isShowAddBtn ? [
defaultButtons.defaultAddBtn({ defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
}) })
] ] : []
HeadButttondata.value = [...detailButtonAdd] HeadButttondata.value = [...detailButtonAdd]
// //
if (!props.detailButtonIsShow) { if (!props.detailButtonIsShow) {
@ -433,10 +374,12 @@ const buttonBaseClick = (val, item) => {
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
console.log(val)
console.log(row)
if (val == 'edit') { if (val == 'edit') {
// //
openForm('update', row) openForm('update', row)
emit('detailOpenForm', row) // emit('detailOpenForm',val, row)
} else if (val == 'delete') { } else if (val == 'delete') {
// //
handleDelete(row.id) handleDelete(row.id)
@ -449,9 +392,14 @@ const formRef = ref()
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
if (row) { if (row) {
if (detailAllSchemasRef.value?.tableColumns?.length > 0) { if (detailAllSchemasRef.value?.tableColumns?.length > 0) {
//
let isTrue = false let isTrue = false
let isChargePeoples = false
let isItemNUmbersTrue = false let isItemNUmbersTrue = false
isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances') isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances')
isChargePeoples = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'chargePeoples'
)
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some( isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers' (item) => item.field == 'itemNumbers'
) )
@ -460,6 +408,11 @@ const openForm = async (type: string, row?: number) => {
row.maintenances = row.maintenances.split(',').map(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() await getList()
updateKey.value += 1 updateKey.value += 1
setBeiJian() setBeiJian()
} catch {} } catch { }
} }
// //
const searchFormClick = async (searchData) => { 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 { selecUserByType } from '@/api/system/dept'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore() const userStore = useUserStore()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
@ -263,7 +265,8 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'
} },
isDetail:false
} }
])) ]))
@ -285,17 +288,29 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
}, },
isSearch: false, isSearch: false,
isForm: false, isForm: false,
isTableForm: false,
}, },
{ {
label: '责任人', label: '责任人',
field: 'maintenance', field: 'chargePeoples',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150', width: '150',
}, },
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
},
api: () => dutyUserList, api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { 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: { form: {
component: 'Select', component: 'Select',
@ -306,7 +321,8 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
labelField: 'name', labelField: 'name',
valueField: 'id' valueField: 'id'
}, },
placeholder: "请选择责任人" placeholder: "请选择责任人",
multiple: true,
}, },
} }
}, },
@ -321,11 +337,7 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
isTable: true, isTable: true,
form: { form: {
component: 'DatePicker', component: 'Input',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}, },
}, },
{ {
@ -336,26 +348,26 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: '150', width: '150',
}, },
isSearch: false, isSearch: false,
isForm: true, form: {
component: 'InputNumber',
},
isTable: true, isTable: true,
tableForm: {
type: 'InputNumber',
},
}, },
{ {
label: '实际分钟', label: '实际分钟',
field: 'actualMinutes', field: 'actualMinutes',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
table: { table: {
width: '150', width: '150',
}, },
isSearch: false, isSearch: false,
isTable: true, isTable: true,
form: { form: {
component: 'DatePicker', component: 'Input',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}, },
}, },
@ -376,6 +388,10 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x' valueFormat: 'x'
} }
}, },
tableForm: {
type: 'FormDateTime',
valueFormat: 'x'
},
}, },
{ {
label: '工程师确认', label: '工程师确认',
@ -385,22 +401,9 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: '150', width: '150',
}, },
api: () => engineerList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return engineerList.find((account) => account.id == cellValue)?.name
},
form: { form: {
component: 'Select', component: 'Input',
api: () => engineerList, },
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择工程师"
},
}
}, },
{ {
label: '是否完成', label: '是否完成',
@ -419,6 +422,12 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
disabled: false, disabled: false,
} }
}, },
tableForm: {
type: 'Select',
componentProps: {
disabled: false,
}
},
}, },
{ {
label: '未完成原因', label: '未完成原因',
@ -431,7 +440,63 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
isForm: true, isForm: true,
isTable: 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: '操作', label: '操作',
field: 'action', field: 'action',
@ -439,6 +504,8 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'
} },
isDetail: false,
isTableForm: false,
} }
])) ]))

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

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

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

@ -1,8 +1,22 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' 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 { 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], number: [required],
name: [required], name: [required],
planNumber: [required], planNumber: [required],
@ -13,39 +27,73 @@ export const deviceMaintainOrderMainRules = reactive({
concurrencyStamp: [required], concurrencyStamp: [required],
}) })
export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '保养单号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
{ // {
label: '名称', // label: '名称',
field: 'name', // field: 'name',
sort: 'custom', // sort: 'custom',
isSearch: true, // isSearch: true,
}, // },
{ {
label: '保养计划单号', label: '保养计划单号',
field: 'planNumber', field: 'planNumber',
sort: 'custom', sort: 'custom',
isSearch: true,
}, },
{ {
label: '设备/模具编号', label: '设备/模具',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
}, },
{ {
label: '厂区编号', label: '厂区编号',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', 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', field: 'engineer',
sort: 'custom', sort: 'custom',
isSearch: false,
form: { form: {
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
@ -55,6 +103,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '接单时间', label: '接单时间',
field: 'receiveTime', field: 'receiveTime',
sort: 'custom', sort: 'custom',
isSearch: false,
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -68,6 +117,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '指派时间', label: '指派时间',
field: 'assignTime', field: 'assignTime',
sort: 'custom', sort: 'custom',
isSearch: false,
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -77,19 +127,11 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '工程师id',
field: 'worker',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{ {
label: '完成时间', label: '完成时间',
field: 'finishedTime', field: 'finishedTime',
sort: 'custom', sort: 'custom',
isSearch: false,
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -103,6 +145,7 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '验证时间', label: '验证时间',
field: 'verifyTime', field: 'verifyTime',
sort: 'custom', sort: 'custom',
isSearch: false,
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -126,44 +169,304 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: { form: {
component: 'Select' 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: '创建时间', label: '保养工单号',
field: 'createTime', field: 'number',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
search: { form: {
component: 'DatePicker', component: 'Input',
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss', disabled: true,
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isForm: false,
}, },
{ {
label: '地点ID', label: '人数',
field: 'siteId', field: 'peoples',
sort: 'custom', sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
},
isTable: true,
tableForm: {
type: 'InputNumber',
},
}, },
{ {
label: '是否可用', label: '预计分钟',
field: 'available', field: 'estimatedMinutes',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
}, },
{ {
label: '并发乐观锁', label: '实际分钟',
field: 'concurrencyStamp', field: 'actualMinutes',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: { form: {
component: 'InputNumber', component: 'Input',
value: 0 },
},
{
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: '操作', label: '操作',
@ -172,6 +475,9 @@ export const deviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'
} },
isDetail: false,
isTableForm: false,
} }
])) ]))

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

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="deviceMaintainOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="DeviceMaintainOrderMain.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="deviceMaintainOrderMain.allSchemas" :allSchemas="DeviceMaintainOrderMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,71 +31,146 @@
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="DeviceMaintainOrderMainRules"
:rules="deviceMaintainOrderMainRules" :formAllSchemas="DeviceMaintainOrderMain.allSchemas"
:formAllSchemas="deviceMaintainOrderMain.allSchemas" :tableAllSchemas="DeviceMaintainOrderDetail.allSchemas"
:apiUpdate="deviceMaintainOrderMainApi.updatedeviceMaintainOrderMain" :tableFormRules="DeviceMaintainOrderDetailRules"
:apiCreate="deviceMaintainOrderMainApi.createdeviceMaintainOrderMain" :tableData="tableData"
:apiUpdate="DeviceMaintainOrderMainApi.updateDeviceMaintainOrderMain"
:apiCreate="DeviceMaintainOrderMainApi.createDeviceMaintainOrderMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @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> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { deviceMaintainOrderMain,deviceMaintainOrderMainRules } from './deviceMaintainOrderMain.data' import {
import * as deviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain' 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 * 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: 'deviceMaintainOrderMain' })
defineOptions({ name: 'DeviceMaintainOrderMain' })
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(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(() => { 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: deviceMaintainOrderMainApi.getdeviceMaintainOrderMainPage // getListApi: DeviceMaintainOrderMainApi.getDeviceMaintainOrderMainPage //
}) })
// //
@ -99,87 +178,111 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintainOrderMain:create'}), // // defaultButtons.defaultAddBtn({
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintainOrderMain:import'}), // // hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMaintainOrderMain: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') {
//
DeviceMaintainOrderMain.allSchemas.formSchema[3].value = 'DEVICE'
DeviceMaintainOrderMain.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:deviceMaintainOrderMain:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintainOrderMain:delete'}), // // 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) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // DeviceMaintainOrderMain.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)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) tableData.value = [] //
} formRef.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()
} }
/** 详情操作 */ /** 详情操作 */
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, 'basicdeviceMaintainOrderMain') detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintainOrderMain')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -188,7 +291,7 @@ const handleDelete = async (id: number) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await deviceMaintainOrderMainApi.deletedeviceMaintainOrderMain(id) await DeviceMaintainOrderMainApi.deleteDeviceMaintainOrderMain(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
@ -203,8 +306,8 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await deviceMaintainOrderMainApi.exportdeviceMaintainOrderMain(tableObject.params) const data = await DeviceMaintainOrderMainApi.exportDeviceMaintainOrderMain(tableObject.params)
download.excel(data, '保养工单主.xlsx') download.excel(data, '维修工单主.xlsx')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@ -219,7 +322,7 @@ const handleImport = () => {
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '保养工单主导入模版.xlsx' templateTitle: '维修工单主导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
@ -235,10 +338,144 @@ const searchFormClick = (searchData) => {
getList() // 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 () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await deviceMaintainOrderMainApi.importTemplate() importTemplateData.templateUrl = await DeviceMaintainOrderMainApi.importTemplate()
}) })
</script> </script>

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

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

Loading…
Cancel
Save