Browse Source

模具除台账外代码

master
ljlong_2630 9 months ago
parent
commit
e2703668fc
  1. 1
      .gitignore
  2. 6
      src/api/eam/device/deviceMaintainOrderMain/index.ts
  3. 2
      src/api/eam/device/deviceMaintenanceMain/index.ts
  4. 5
      src/api/eam/mold/moldAccounts/index.ts
  5. 12
      src/api/eam/mold/moldMaintainOrderMain/index.ts
  6. 21
      src/api/eam/mold/moldMaintenanceMain/index.ts
  7. 2
      src/components/Detail/src/Detail.vue
  8. 82
      src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts
  9. 9
      src/views/eam/device/deviceMaintainOrderMain/index.vue
  10. 111
      src/views/eam/device/deviceMaintainPlan/deviceMaintainPlan.data.ts
  11. 7
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  12. 279
      src/views/eam/mold/moldInspectionMain/index.vue
  13. 473
      src/views/eam/mold/moldInspectionMain/moldInspectionMain.data.ts
  14. 421
      src/views/eam/mold/moldMaintainOrderMain/index.vue
  15. 447
      src/views/eam/mold/moldMaintainOrderMain/moldMaintainOrderMain.data.ts
  16. 111
      src/views/eam/mold/moldMaintainPlan/moldMaintainPlan.data.ts
  17. 406
      src/views/eam/mold/moldMaintenanceMain/index.vue
  18. 301
      src/views/eam/mold/moldMaintenanceMain/moldMaintenanceMain.data.ts
  19. 107
      src/views/eam/mold/moldRepair/index.vue
  20. 167
      src/views/eam/mold/moldRepair/moldRepair.data.ts

1
.gitignore

@ -12,3 +12,4 @@ auto-*.d.ts
/eam/ /eam/
/eam /eam
eam eam
.vscode/

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

@ -63,3 +63,9 @@ export const importTemplate = () => {
export const orderClick = (id: number) => { export const orderClick = (id: number) => {
return request.get({ url: '/eam/device-maintain-order-main/orderClick?id=' + id }) return request.get({ url: '/eam/device-maintain-order-main/orderClick?id=' + id })
} }
// 保养完成
export const orderClickFinish = (id: number) => {
return request.get({ url: '/eam/device-maintain-order-main/orderClickFinish?id=' + id })
}

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

@ -18,6 +18,7 @@ export interface DeviceMaintenanceMainVO {
// 查询维修工单主列表 // 查询维修工单主列表
export const getDeviceMaintenanceMainPage = async (params) => { export const getDeviceMaintenanceMainPage = async (params) => {
params.type = 'DEVICE'
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
@ -41,7 +42,6 @@ export const createDeviceMaintenanceMain = async (data: DeviceMaintenanceMainVO)
export const updateDeviceMaintenanceMain = async (data: DeviceMaintenanceMainVO) => { export const updateDeviceMaintenanceMain = async (data: DeviceMaintenanceMainVO) => {
return await request.put({ url: `/eam/device-maintenance-main/update`, data }) return await request.put({ url: `/eam/device-maintenance-main/update`, data })
} }
// 删除维修工单主 // 删除维修工单主
export const deleteDeviceMaintenanceMain = async (id: number) => { export const deleteDeviceMaintenanceMain = async (id: number) => {
return await request.delete({ url: `/eam/device-maintenance-main/delete?id=` + id }) return await request.delete({ url: `/eam/device-maintenance-main/delete?id=` + id })

5
src/api/eam/mold/moldAccounts/index.ts

@ -60,3 +60,8 @@ export const exportMoldAccounts = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/mold-accounts/get-import-template' }) return request.download({ url: '/eam/mold-accounts/get-import-template' })
} }
// 查询模型台账列表
export const getMoldAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/mold-accounts/selectData`, params })
}

12
src/api/eam/mold/moldMaintainOrderMain/index.ts

@ -18,7 +18,6 @@ export interface MoldMaintainOrderMainVO {
available: string available: string
concurrencyStamp: number concurrencyStamp: number
} }
// 查询保养工单主列表 // 查询保养工单主列表
export const getMoldMaintainOrderMainPage = async (params) => { export const getMoldMaintainOrderMainPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
@ -59,3 +58,14 @@ export const exportMoldMaintainOrderMain = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/device-maintain-order-main/get-import-template' }) return request.download({ url: '/eam/device-maintain-order-main/get-import-template' })
} }
// 保养接单
export const orderClick = (id: number) => {
return request.get({ url: '/eam/device-maintain-order-main/orderClick?id=' + id })
}
// 保养完成
export const orderClickFinish = (id: number) => {
return request.get({ url: '/eam/device-maintain-order-main/orderClickFinish?id=' + id })
}

21
src/api/eam/mold/moldMaintenanceMain/index.ts

@ -1,6 +1,7 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface MoldMaintenanceMainVO { export interface MoldMaintenanceMainVO {
id: number
number: string number: string
requestNumber: string requestNumber: string
describe: string describe: string
@ -17,6 +18,7 @@ export interface MoldMaintenanceMainVO {
// 查询维修工单主列表 // 查询维修工单主列表
export const getMoldMaintenanceMainPage = async (params) => { export const getMoldMaintenanceMainPage = async (params) => {
params.type = 'MOLD'
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
@ -33,14 +35,13 @@ export const getMoldMaintenanceMain = async (id: number) => {
// 新增维修工单主 // 新增维修工单主
export const createMoldMaintenanceMain = async (data: MoldMaintenanceMainVO) => { export const createMoldMaintenanceMain = async (data: MoldMaintenanceMainVO) => {
return await request.post({ url: `/eam/device-maintenance-main/create`, data }) return await request.post({ url: `/eam/device-maintenance-main/createPC`, data })
} }
// 修改维修工单主 // 修改维修工单主
export const updateMoldMaintenanceMain = async (data: MoldMaintenanceMainVO) => { export const updateMoldMaintenanceMain = async (data: MoldMaintenanceMainVO) => {
return await request.put({ url: `/eam/device-maintenance-main/update`, data }) return await request.put({ url: `/eam/device-maintenance-main/update`, data })
} }
// 删除维修工单主 // 删除维修工单主
export const deleteMoldMaintenanceMain = async (id: number) => { export const deleteMoldMaintenanceMain = async (id: number) => {
return await request.delete({ url: `/eam/device-maintenance-main/delete?id=` + id }) return await request.delete({ url: `/eam/device-maintenance-main/delete?id=` + id })
@ -55,3 +56,19 @@ export const exportMoldMaintenanceMain = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/device-maintenance-main/get-import-template' }) return request.download({ url: '/eam/device-maintenance-main/get-import-template' })
} }
// 修改维修工单主
export const orderStepChange = async (data: MoldMaintenanceMainVO) => {
return await request.get({ url: `/eam/device-maintenance-main/orderClick?number=`+data.number+`&status=`+data.status+`&id=`+data.id+`&requestNumber=`+data.requestNumber })
}
// 修改维修工单主
export const orderTurnTo = async (data: MoldMaintenanceMainVO) => {
return await request.get({ url: `/eam/device-maintenance-main/turnTo?deviceNumber=`+data.deviceNumber +`&id=`+data.id + `&receiverType=`+ data.type +`&receiverUserId=` + data.maintenance })
}
// 查询维修工单主列表不分页
export const getMoldMainTempList = async (type: String) => {
return await request.get({ url: `/eam/device-maintenance-main/getList?type=` + type })
}

2
src/components/Detail/src/Detail.vue

@ -336,7 +336,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
// masterParmas.value.number = row.number // masterParmas.value.number = row.number
// masterParmas.value.status = row.status // masterParmas.value.status = row.status
tableObjectRef.value.params = { tableObjectRef.value.params = {
maintenanceNumber: row.number number: row.number
} }
await getList() await getList()
} }

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

@ -33,6 +33,9 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: '150',
},
}, },
// { // {
// label: '名称', // label: '名称',
@ -45,12 +48,18 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'planNumber', field: 'planNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: '150',
},
}, },
{ {
label: '设备/模具', label: '设备/模具',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: {
width: '150',
},
}, },
{ {
label: '厂区编号', label: '厂区编号',
@ -90,20 +99,41 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '工程师', label: '状态',
field: 'engineer', field: 'status',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: true,
table: {
width: '150',
},
form: { form: {
component: 'InputNumber', component: 'Radio'
value: 0 },
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
table: {
width: '150',
}, },
form: {
component: 'Select'
},
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
}, },
{ {
label: '接单时间', label: '接单时间',
field: 'receiveTime', field: 'receiveTime',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -113,11 +143,28 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '工程师',
field: 'engineer',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
form: {
component: 'InputNumber',
value: 0
},
},
{ {
label: '指派时间', label: '指派时间',
field: 'assignTime', field: 'assignTime',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -132,6 +179,9 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'finishedTime', field: 'finishedTime',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -146,6 +196,9 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'verifyTime', field: 'verifyTime',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -155,24 +208,7 @@ export const DeviceMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
},
},
// { // {
// label: '创建时间', // label: '创建时间',
// field: 'createTime', // field: 'createTime',

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

@ -271,6 +271,8 @@ const buttonTableClick = async (val, row) => {
acceptOrder(row) acceptOrder(row)
} else if (val == 'turnOrder') { } else if (val == 'turnOrder') {
openForm('turnOrder', row) openForm('turnOrder', row)
} else if (val == 'finishOrder') {
finishOrder(row)
} }
} }
@ -350,7 +352,12 @@ function acceptOrder(row) {
// //
function turnOrder() {} function turnOrder() {}
// //
function finishOrder() {} function finishOrder(row) {
DeviceMaintainOrderMainApi.orderClickFinish(row.id).then(() => {
message.success('完成保养')
getList();
});
}
// //
function verifyOrder() {} function verifyOrder() {}
// //

111
src/views/eam/device/deviceMaintainPlan/deviceMaintainPlan.data.ts

@ -23,70 +23,75 @@ export const DeviceMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
{ // {
label: '保养类型', // label: '保养类型',
field: 'maintenanceType', // field: 'maintenanceType',
sort: 'custom', // sort: 'custom',
form: { // form: {
component: 'Select' // component: 'Select'
}, // },
}, // },
{ {
label: '设备执行周期、半年、年', label: '设备执行周期、半年、年',
field: 'cycle', field: 'cycle',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.MOLD_EXECUTION_CYCLE,
dictClass: 'string',
}, },
{ // {
label: '次数', // label: '次数',
field: 'times', // field: 'times',
sort: 'custom', // sort: 'custom',
form: { // form: {
component: 'InputNumber', // component: 'InputNumber',
value: 0 // value: 0
}, // },
}, // },
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: { form: {
component: 'InputNumber', component: 'Select'
value: 0
}, },
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
}, },
{ // {
label: '操作', // label: '创建时间',
field: 'action', // field: 'createTime',
isForm: false, // sort: 'custom',
table: { // formatter: dateFormatter,
width: 150, // isForm: false,
fixed: 'right' // },
} // {
} // label: '地点ID',
// field: 'siteId',
// sort: 'custom',
// },
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// },
// {
// label: '并发乐观锁',
// field: 'concurrencyStamp',
// sort: 'custom',
// form: {
// component: 'InputNumber',
// value: 0
// },
// },
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// },
// isTable: false
// }
])) ]))

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

@ -131,13 +131,13 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '类型设备', label: '类型',
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150', width: '150',
}, },
isSearch: true, isSearch: false,
isForm: true, isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE, dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string', dictClass: 'string',
@ -147,6 +147,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
disabled: true, disabled: true,
} }
}, },
search: {
value: 'DEVICE'
}
}, },
{ {
label: '班次', label: '班次',

279
src/views/eam/mold/moldInspectionMain/index.vue

@ -4,15 +4,10 @@
<Search :schema="MoldInspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="MoldInspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
@button-base-click="buttonBaseClick" :allSchemas="MoldInspectionMain.allSchemas" />
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldInspectionMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,13 +22,13 @@
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>
@ -47,21 +42,49 @@
:apiUpdate="MoldInspectionMainApi.updateMoldInspectionMain" :apiUpdate="MoldInspectionMainApi.updateMoldInspectionMain"
:apiCreate="MoldInspectionMainApi.createMoldInspectionMain" :apiCreate="MoldInspectionMainApi.createMoldInspectionMain"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" :isBusiness="true"
@onChange="onChange"
:tableAllSchemas="MoldInspectionDetail.allSchemas"
:tableFormRules="MoldInspectionDetailRules"
:tableData="tableData"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@submitForm="submitForm"
:isSearchTableItem="true"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldInspectionMain.allSchemas" /> <!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldInspectionDetail.allSchemas" /> -->
<Detail ref="detailRef"
:isBasic="false"
:allSchemas="MoldInspectionMain.allSchemas"
:detailAllSchemas="MoldInspectionDetail.allSchemas"
:detailAllSchemasRules="MoldInspectionDetailRules"
:apiCreate="MoldInspectionDetailApi.createMoldInspectionDetail"
:apiUpdate="MoldInspectionDetailApi.updateMoldInspectionDetail"
:apiPage="MoldInspectionDetailApi.getMoldInspectionDetailPage"
:apiDelete="MoldInspectionDetailApi.deleteMoldInspectionDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/mold-inspection-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/eam/mold-inspection-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 { MoldInspectionMain,MoldInspectionMainRules } from './moldInspectionMain.data' import { MoldInspectionDetail, MoldInspectionDetailRules, MoldInspectionMain, MoldInspectionMainRules } from './moldInspectionMain.data'
import * as MoldInspectionMainApi from '@/api/eam/mold/moldInspectionMain' import * as MoldInspectionMainApi from '@/api/eam/mold/moldInspectionMain'
import * as MoldInspectionDetailApi from '@/api/eam/mold/moldInspectionDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
// import TableHead from '@/components/TableHead/src/TableHead.vue' // import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue' // import Detail from '@/components/Detail/src/Detail.vue'
@ -70,18 +93,34 @@ defineOptions({ name: 'MoldInspectionMain' })
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()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(MoldInspectionMain.allSchemas.tableColumns) const tableColumns = ref(MoldInspectionMain.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(() => { 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)
}
}) })
} }
@ -99,12 +138,14 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldInspectionMain:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'eam:moldInspectionMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldInspectionMain:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'eam:moldInspectionMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldInspectionMain:export'}), // // defaultButtons.defaultExportBtn({ hasPermi: 'eam:moldInspectionMain:export' }), //
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') || userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -118,6 +159,8 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
MoldInspectionMain.allSchemas.formSchema[4].value = 'PROCCED';
MoldInspectionMain.allSchemas.formSchema[5].value = 'DEVICE';
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') { //
handleImport() handleImport()
@ -132,39 +175,47 @@ const buttonBaseClick = (val, item) => {
} }
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'eam:moldInspectionMain:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldInspectionMain:delete'}), // // defaultButtons.mainListEditBtn({hasPermi:'eam:moldInspectionMain:update'}), //
] // defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldInspectionMain:delete'}), //
defaultButtons.mainListEditBtn(null), //
defaultButtons.maintenanceOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //
]
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'maintenanceOrder') { //
handleDelete(row.id) handleMaintenanceOrder(row)
} else if (val == 'finishOrder') { //
handleFinishOrder(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)
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =MoldInspectionMain.allSchemas.formSchema.some(function (item) { var isHave = MoldInspectionMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return;
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
await MoldInspectionMainApi.createMoldInspectionMain(data) await MoldInspectionMainApi.createMoldInspectionMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -192,7 +243,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -235,6 +286,156 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
function handleMaintenanceOrder(row) {
}
function handleFinishOrder(row) {
}
const onChange = (field, cur, item) => {
//
if (field == 'moldNumber') {
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
basicFormRef.value.formRef.formModel.maintenanceNumber = ''
} else if (field == 'maintenanceNumber') {
basicFormRef.value.formRef.formModel.moldNumber = item.componentProps.options.find(element => element.number == cur).moldNumber
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(element => element.number == cur).factoryAreaNumber)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
}
}
//
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 detailOpenForm = (type, row) => {
console.log("type", type);
console.log("row", row);
MoldInspectionDetail.allSchemas.tableFormColumns.map((item) => {
})
}
// /
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) => {
console.log('data',data)
try {
let data1 = {
id: data.id,
number: data.maintenanceNumber,
siteId: data.siteId,
available: data.available,
concurrencyStamp: data.concurrencyStamp,
name: data.name,
peoples: data.peoples,
estimatedMinutes: data.estimatedMinutes,
actualMinutes: data.actualMinutes,
chargePeoples: data.chargePeoples.join(','),
completionTime: data.completionTime,
engineer: data.engineer,
uncompleted: data.uncompleted
}
console.log('data1',data1)
if (formType === 'create') {
await MoldInspectionDetailApi.createMoldInspectionDetail(data1)
message.success(t('common.createSuccess'))
} else {
await MoldInspectionDetailApi.updateMoldInspectionDetail(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
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
MoldInspectionDetail.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) => {
item.chargePeoples = item.chargePeoples.join(',');
return item;
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await MoldInspectionMainApi.createMoldInspectionMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldInspectionMainApi.updateMoldInspectionMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

473
src/views/eam/mold/moldInspectionMain/moldInspectionMain.data.ts

@ -1,103 +1,502 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
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 moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: undefined })
const engineerList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: '', flag: 2})
const repairList = await MoldMaintenanceMainApi.getMoldMainTempList('MOLD')
// 表单校验 // 表单校验
export const MoldInspectionMainRules = reactive({ export const MoldInspectionMainRules = reactive({
number: [required], number: [required],
maintenanceNumber: [required], // maintenanceNumber: [required],
deviceNumber: [required], moldNumber: [required],
factoryAreaNumber: [required], factoryAreaNumber: [required],
status: [required], status: [required],
type: [required], type: [required],
concurrencyStamp: [required], concurrencyStamp: [required],
faultType: [required],
}) })
export const MoldInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([ export const MoldInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '检修编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false,
}, },
{ {
label: '维修工单号', label: '维修工单号',
field: 'maintenanceNumber', field: 'maintenanceNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => repairList,
// formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
// return repairList.find((account) => account.number == cellValue)?.name
// },
search: {
show: true,
component: 'Select',
api: () => repairList,
componentProps: {
optionsAlias: {
labelField: 'number',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => repairList,
componentProps: {
optionsAlias: {
labelField: 'number',
valueField: 'number'
},
},
}
}, },
{ {
label: '设备模具', label: '设备',
field: 'deviceNumber', field: 'moldNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: '150',
},
api: () => moldList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldList.find((account) => account.number == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
}, },
{ {
label: '厂区编号', label: '厂区',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
}, isSearch: false,
{ table: {
label: '描述', width: '150',
field: 'describe', },
sort: 'custom', api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
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: "请选择设备"
},
}
}, },
{ {
label: '维修人', label: '维修人',
field: 'maintenance', field: 'maintenance',
sort: 'custom', sort: 'custom',
form: { isSearch: false,
component: 'InputNumber', table: {
value: 0 width: '150',
}, },
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => userList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
form: {
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择维修人"
},
}
}, },
{ // {
label: '维修人联系电话', // label: '维修人联系电话',
field: 'maintenancePhone', // field: 'maintenancePhone',
sort: 'custom', // sort: 'custom',
}, // },
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
dictType: DICT_TYPE.JX_STATUS,
dictClass: 'string',
form: { form: {
component: 'Radio' component: 'Select',
componentProps: {
disabled: true,
placeholder: "请选择设备"
},
}, },
}, },
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
form: { width: '150',
component: 'Select' },
}, isSearch: false,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: true,
placeholder: "请选择设备"
}
},
}, },
{ {
label: '创建时间', label: '故障类型',
field: 'createTime', field: 'faultType',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, table: {
width: '150',
},
// isSearch: false,
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
form: {
value: 'PM',
component: 'Select',
componentProps: {
// disabled: true,
placeholder: "请选择故障类型"
}
},
},
// {
// label: '创建时间',
// field: 'createTime',
// sort: 'custom',
// formatter: dateFormatter,
// isForm: false,
// },
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: false,
table: {
width: '230',
},
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
},
{
label: '操作',
field: 'action',
isForm: false, isForm: false,
table: {
width: 150,
fixed: 'right'
},
isDetail:false
}
]))
// 表单校验
export const MoldInspectionDetailRules = reactive({
number: [required],
estimatedMinutes: [required],
maintenance: [required],
})
export const MoldInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '检修编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: false,
isTableForm: false,
}, },
{ {
label: '地点ID', label: '责任人',
field: 'siteId', field: 'chargePeoples',
sort: 'custom', 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: '是否可用', label: '预计分钟',
field: 'available', field: 'estimatedMinutes',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
}, },
{ {
label: '并发乐观锁', label: '人数',
field: 'concurrencyStamp', field: 'peoples',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false,
form: { form: {
component: 'InputNumber', component: 'InputNumber',
value: 0 },
isTable: true,
tableForm: {
type: 'InputNumber',
},
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
},
{
label: '完成时间',
field: 'completionTime',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
tableForm: {
type: 'FormDateTime',
valueFormat: 'x'
}, },
}, },
{
label: '工程师确认',
field: 'engineer',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
form: {
component: 'Input',
},
},
{
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',
table: {
width: '150',
},
isSearch: false,
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: 'moldNumber',
value: 'moldNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'moldNumber',
value: 'moldNumber',
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',
@ -105,6 +504,8 @@ export const MoldInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'
} },
isDetail: false,
isTableForm: false,
} }
])) ]))

421
src/views/eam/mold/moldMaintainOrderMain/index.vue

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="MoldMaintainOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="MoldMaintainOrderMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="MoldMaintainOrderMain.allSchemas" :allSchemas="MoldMaintainOrderMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,68 +31,143 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #code="{row}"> <template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.code }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="formRef"
@success="formsSuccess"
:rules="MoldMaintainOrderMainRules" :rules="MoldMaintainOrderMainRules"
:formAllSchemas="MoldMaintainOrderMain.allSchemas" :formAllSchemas="MoldMaintainOrderMain.allSchemas"
:tableAllSchemas="MoldMaintainOrderDetail.allSchemas"
:tableFormRules="MoldMaintainOrderDetailRules"
:tableData="tableData"
:apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain" :apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain"
:apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain" :apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @submitForm="submitForm"
:isSearchTableItem="true"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintainOrderMain.allSchemas" /> <!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintainOrderMain.allSchemas" /> -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="MoldMaintainOrderMain.allSchemas"
:detailAllSchemas="MoldMaintainOrderDetail.allSchemas"
:detailAllSchemasRules="MoldMaintainOrderDetailRules"
:apiCreate="MoldMaintainOrderDetailApi.createMoldMaintainOrderDetail"
:apiUpdate="MoldMaintainOrderDetailApi.updateMoldMaintainOrderDetail"
:apiPage="MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage"
:apiDelete="MoldMaintainOrderDetailApi.deleteMoldMaintainOrderDetail"
:Echo="Echo"
:isShowAddBtn="false"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/mold-maintain-order-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm
ref="importFormRef"
url="/eam/mold-maintenance-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { MoldMaintainOrderMain,MoldMaintainOrderMainRules } from './moldMaintainOrderMain.data' import {
MoldMaintainOrderMain,
MoldMaintainOrderMainRules,
MoldMaintainOrderDetail,
MoldMaintainOrderDetailRules
} from './moldMaintainOrderMain.data'
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain' import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain'
import * as MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue' import { useUserStore } from '@/store/modules/user'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'MoldMaintainOrderMain' }) defineOptions({ name: 'MoldMaintainOrderMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const formRef = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns) const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns)
const apiPage = ref(MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage)
const detailAllSchemas = ref(MoldMaintainOrderDetail.allSchemas)
const tableData = ref([])
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
//
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
row['itemNumbers1'] = str
row['itemNumbers'] = val
}
} else {
// const setV = {}
// setV[formField] = val[0][searchField]
// setV['supplierCode'] = val[0]['code']
// formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
setV['itemNumbers'] = val
setV['itemNumbers1'] = str
}
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
// //
const updataTableColumns = (val) => { // const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
tableColumns.value = val const Echo = []
}
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage // getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage //
@ -99,87 +178,115 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldMaintainOrderMain:create'}), // // defaultButtons.defaultAddBtn({
defaultButtons.defaultImportBtn({hasPermi:'eam:moldMaintainOrderMain:import'}), // // hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
defaultButtons.defaultExportBtn({hasPermi:'eam:moldMaintainOrderMain:export'}), // // }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
MoldMaintainOrderMain.allSchemas.formSchema[3].value = 'MOLD'
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'eam:moldMaintainOrderMain:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldMaintainOrderMain:delete'}), // // defaultButtons.mainListEditBtn(null), //
] defaultButtons.acceptOrderBtn({
hide: !(
row.status == 'PENDING' &&
(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') ||
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker'))
)
}), //
// defaultButtons.turnOrderBtn({
// hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
// }), //
// defaultButtons.repairBtn({
// hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
// }), //
// defaultButtons.verifyOrderBtn({
// hide: !(
// row.status == 'COMPLETED' &&
// userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')
// )
// }), //
defaultButtons.finishOrderBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}) //
]
}
const onChange = (field, cur, item) => {
if (field == 'moldNumber') {
// MoldMaintainOrderMain.allSchemas.formSchema[1].componentProps.disabled = true
// MoldMaintainOrderMain.allSchemas.formSchema[2].componentProps.disabled = true
formRef.value.formRef.formModel.factoryAreaNumber =String(item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber)
console.log(typeof formRef.value.formRef.formModel.factoryAreaNumber)
// console.log(item)
// console.log(item.componentProps.options)
formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
}
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
} else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
} else if (val == 'finishOrder') {
finishOrder(row)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form const openForm = (type: string, row?: any) => {
const formsSuccess = async (formType,data) => { tableData.value = [] //
var isHave =MoldMaintainOrderMain.allSchemas.formSchema.some(function (item) { formRef.value.open(type, row)
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await MoldMaintainOrderMainApi.createMoldMaintainOrderMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldMaintainOrderMainApi.updateMoldMaintainOrderMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
} }
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicMoldMaintainOrderMain') detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintainOrderMain')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -204,7 +311,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params) const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params)
download.excel(data, '保养工单主.xlsx') download.excel(data, '维修工单主.xlsx')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@ -219,7 +326,7 @@ const handleImport = () => {
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '保养工单主导入模版.xlsx' templateTitle: '维修工单主导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
@ -235,10 +342,152 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
//
function acceptOrder(row) {
MoldMaintainOrderMainApi.orderClick(row.id).then(() => {
message.success('接单成功')
getList();
});
}
//
function turnOrder() {}
//
function finishOrder(row) {
MoldMaintainOrderMainApi.orderClickFinish(row.id).then(() => {
message.success('完成保养')
getList();
});
}
//
function verifyOrder() {}
//
function repair() {}
//
function mainListDetail() {}
/**
* tableForm方法
*/
const tableFormKeys = {}
MoldMaintainOrderDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value.map((item) => {
return {
describes: item.describes,
describes1: item.describes1,
itemNumbers: item.itemNumbers1,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
}
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await MoldMaintainOrderMainApi.createMoldMaintainOrderMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldMaintainOrderMainApi.updateMoldMaintainOrderMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
const detailOpenForm = (type, row) =>{
console.log("type",type);
console.log("row",row);
MoldMaintainOrderDetail.allSchemas.tableFormColumns.map((item) => {
// if(purchaseReceiptRecordNumberRef.value == ''){
// if (item.field == 'itemCode') {
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = true
// }
// if(item.field == 'poLine'){
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = false
// }
// }else{
// if (item.field == 'itemCode') {
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = false
// }
// if(item.field == 'poLine'){
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = true
// }
// }
})
}
// /
const detailValidate = (data) => {
return true;
let tag = false;
if(data.qty <= 0){
message.warning('数量必须大于0')
tag = false;
return tag;
}else {
tag = true;
return tag;
}
}
//
const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
try {
let data1 = {
id:data.id,
maintenanceNumber:data.maintenanceNumber,
describes:data.describes,
describes1:data.describes1,
itemNumbers:data.itemNumbers,
maintenances:data.maintenances.join(','),
workOut:data.workOut,
}
console.log(data1)
if (formType === 'create') {
await MoldMaintainOrderDetailApi.createMoldMaintainOrderDetail(data1)
message.success(t('common.createSuccess'))
} else {
await MoldMaintainOrderDetailApi.updateMoldMaintainOrderDetail(data1)
message.success(t('common.updateSuccess'))
}
formRef.dialogVisible = false
//
await getList()
detailRef.value.tableObject.tableList.forEach(item=>{
if (item.itemNumbers?.length>0) {
let str = ''
item.itemNumbers.forEach(element => {
str += element.name + ':' + element.qty + ','
})
item.itemNumbers1 = str.substring(0, str.length - 1)
}
})
} finally {
formRef.formLoading = false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate() importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate()
}) })
</script> </script>

447
src/views/eam/mold/moldMaintainOrderMain/moldMaintainOrderMain.data.ts

@ -1,12 +1,26 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
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 moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: undefined, flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: undefined, flag: undefined })
const engineerList = await selecUserByType({ classType: 'MOLD', factoryAreaNumber: undefined, flag: 2})
const repairList = await MoldMaintenanceMainApi.getMoldMainTempList('MOLD')
// 表单校验 // 表单校验
export const MoldMaintainOrderMainRules = reactive({ export const MoldMaintainOrderMainRules = reactive({
number: [required], number: [required],
name: [required], name: [required],
planNumber: [required], planNumber: [required],
deviceNumber: [required], moldNumber: [required],
factoryAreaNumber: [required], factoryAreaNumber: [required],
status: [required], status: [required],
type: [required], type: [required],
@ -15,46 +29,111 @@ export const MoldMaintainOrderMainRules = reactive({
export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '保养单号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: '150',
},
}, },
{ // {
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,
table: {
width: '150',
},
}, },
{ {
label: '设备/模具编号', label: '设备/模具',
field: 'deviceNumber', field: 'moldNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
table: {
width: '150',
},
}, },
{ {
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: 'status',
sort: 'custom', sort: 'custom',
isSearch: true,
table: {
width: '150',
},
form: { form: {
component: 'InputNumber', component: 'Radio'
value: 0 },
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
table: {
width: '150',
}, },
form: {
component: 'Select'
},
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
}, },
{ {
label: '接单时间', label: '接单时间',
field: 'receiveTime', field: 'receiveTime',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -64,10 +143,28 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '工程师',
field: 'engineer',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
form: {
component: 'InputNumber',
value: 0
},
},
{ {
label: '指派时间', label: '指派时间',
field: 'assignTime', field: 'assignTime',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -77,19 +174,14 @@ export const MoldMaintainOrderMain = 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,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -103,6 +195,10 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '验证时间', label: '验证时间',
field: 'verifyTime', field: 'verifyTime',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter, formatter: dateFormatter,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
@ -112,58 +208,302 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
// {
// 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: '状态', label: '操作',
field: 'status', field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const MoldMaintainOrderDetailRules = reactive({
concurrencyStamp: [required],
name: [required],
number: [required],
peoples: [required],
estimatedMinutes: [required],
actualMinutes: [required],
chargePeoples: [required],
completionTime: [required],
engineer: [required]
})
export const MoldMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '保养工单号',
field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: { form: {
component: 'Radio' component: 'Input',
componentProps: {
disabled: true,
}
}, },
}, },
{ {
label: '类型', label: '人数',
field: 'type', field: 'peoples',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
form: { form: {
component: 'Select' component: 'InputNumber',
}, },
isTable: true,
tableForm: {
type: 'InputNumber',
},
}, },
{ {
label: '创建时间', label: '预计分钟',
field: 'createTime', field: 'estimatedMinutes',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, table: {
isSearch: true, width: '150',
search: { },
component: 'DatePicker', isSearch: false,
isTable: true,
form: {
component: 'Input',
},
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
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: { componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss', disabled: false,
type: 'daterange', optionsAlias: {
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] 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,
} }
}, },
isForm: false,
}, },
{ {
label: '地点ID', label: '未完成原因',
field: 'siteId', field: 'uncompleted',
sort: 'custom', sort: 'custom',
isSearch: false,
isTable: true,
form: {
component: 'Input',
componentProps: {
type:'textarea'
}
}
}, },
{ {
label: '是否可用', label: '维修内容',
field: 'available', field: 'contents',
sort: 'custom', sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
disabled: true,
}
}
}, },
{ {
label: '并发乐观锁', label: '备件',
field: 'concurrencyStamp', field: 'itemNumbers1',
sort: 'custom', 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: 'moldNumber',
value: 'moldNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: { form: {
component: 'InputNumber', // labelMessage: '信息提示说明!!!',
value: 0 componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'moldNumber',
value: 'moldNumber',
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 +512,9 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'
} },
isDetail: false,
isTableForm: false,
} }
])) ]))

111
src/views/eam/mold/moldMaintainPlan/moldMaintainPlan.data.ts

@ -23,70 +23,75 @@ export const MoldMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
{ // {
label: '保养类型', // label: '保养类型',
field: 'maintenanceType', // field: 'maintenanceType',
sort: 'custom', // sort: 'custom',
form: { // form: {
component: 'Select' // component: 'Select'
}, // },
}, // },
{ {
label: '设备执行周期、半年、年', label: '设备执行周期、半年、年',
field: 'cycle', field: 'cycle',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.MOLD_EXECUTION_CYCLE,
dictClass: 'string',
}, },
{ // {
label: '次数', // label: '次数',
field: 'times', // field: 'times',
sort: 'custom', // sort: 'custom',
form: { // form: {
component: 'InputNumber', // component: 'InputNumber',
value: 0 // value: 0
}, // },
}, // },
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: { form: {
component: 'InputNumber', component: 'Select'
value: 0
}, },
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
}, },
{ // {
label: '操作', // label: '创建时间',
field: 'action', // field: 'createTime',
isForm: false, // sort: 'custom',
table: { // formatter: dateFormatter,
width: 150, // isForm: false,
fixed: 'right' // },
} // {
} // label: '地点ID',
// field: 'siteId',
// sort: 'custom',
// },
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// },
// {
// label: '并发乐观锁',
// field: 'concurrencyStamp',
// sort: 'custom',
// form: {
// component: 'InputNumber',
// value: 0
// },
// },
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// },
// isTable: false
// }
])) ]))

406
src/views/eam/mold/moldMaintenanceMain/index.vue

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="MoldMaintenanceMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="MoldMaintenanceMain.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="MoldMaintenanceMain.allSchemas" :allSchemas="MoldMaintenanceMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,68 +31,144 @@
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="MoldMaintenanceMainRules" :rules="MoldMaintenanceMainRules"
:formAllSchemas="MoldMaintenanceMain.allSchemas" :formAllSchemas="MoldMaintenanceMain.allSchemas"
:tableAllSchemas="MoldMaintenanceDetail.allSchemas"
:tableFormRules="MoldMaintenanceDetailRules"
:tableData="tableData"
:apiUpdate="MoldMaintenanceMainApi.updateMoldMaintenanceMain" :apiUpdate="MoldMaintenanceMainApi.updateMoldMaintenanceMain"
:apiCreate="MoldMaintenanceMainApi.createMoldMaintenanceMain" :apiCreate="MoldMaintenanceMainApi.createMoldMaintenanceMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @submitForm="submitForm"
:isSearchTableItem="true"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenanceMain.allSchemas" /> <!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenanceMain.allSchemas" /> -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="MoldMaintenanceMain.allSchemas"
:detailAllSchemas="MoldMaintenanceDetail.allSchemas"
:detailAllSchemasRules="MoldMaintenanceDetailRules"
:apiCreate="MoldMaintenanceDetailApi.createMoldMaintenanceDetail"
:apiUpdate="MoldMaintenanceDetailApi.updateMoldMaintenanceDetail"
:apiPage="MoldMaintenanceDetailApi.getMoldMaintenanceDetailPage"
:apiDelete="MoldMaintenanceDetailApi.deleteMoldMaintenanceDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/mold-maintenance-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm
ref="importFormRef"
url="/eam/mold-maintenance-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { MoldMaintenanceMain,MoldMaintenanceMainRules } from './moldMaintenanceMain.data' import {
MoldMaintenanceMain,
MoldMaintenanceMainRules,
MoldMaintenanceDetail,
MoldMaintenanceDetailRules
} from './moldMaintenanceMain.data'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain' import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
import * as MoldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
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: 'MoldMaintenanceMain' }) defineOptions({ name: 'MoldMaintenanceMain' })
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(MoldMaintenanceMain.allSchemas.tableColumns) const tableColumns = ref(MoldMaintenanceMain.allSchemas.tableColumns)
const apiPage = ref(MoldMaintenanceDetailApi.getMoldMaintenanceDetailPage)
const detailAllSchemas = ref(MoldMaintenanceDetail.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
console.log(row)
}
} 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: MoldMaintenanceMainApi.getMoldMaintenanceMainPage // getListApi: MoldMaintenanceMainApi.getMoldMaintenanceMainPage //
@ -99,87 +179,111 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldMaintenanceMain:create'}), // defaultButtons.defaultAddBtn({
defaultButtons.defaultImportBtn({hasPermi:'eam:moldMaintenanceMain:import'}), // hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
defaultButtons.defaultExportBtn({hasPermi:'eam:moldMaintenanceMain: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') {
//
MoldMaintenanceMain.allSchemas.formSchema[3].value = 'MOLD'
MoldMaintenanceMain.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:moldMaintenanceMain:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldMaintenanceMain: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') {
// MoldMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true
// MoldMaintenanceMain.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') { // MoldMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // MoldMaintenanceMain.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 =MoldMaintenanceMain.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 MoldMaintenanceMainApi.createMoldMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldMaintenanceMainApi.updateMoldMaintenanceMain(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, 'basicMoldMaintenanceMain') detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintenanceMain')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -235,10 +339,144 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
//
function acceptOrder(row) {
MoldMaintenanceMainApi.orderStepChange(row)
}
//
function turnOrder() {}
//
function finishOrder() {}
//
function verifyOrder() {}
//
function repair() {}
//
function mainListDetail() {}
/**
* tableForm方法
*/
const tableFormKeys = {}
MoldMaintenanceDetail.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.itemNumbers,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
}
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await MoldMaintenanceMainApi.createMoldMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldMaintenanceMainApi.updateMoldMaintenanceMain(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);
MoldMaintenanceDetail.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 MoldMaintenanceDetailApi.createMoldMaintenanceDetail(data1)
message.success(t('common.createSuccess'))
} else {
await MoldMaintenanceDetailApi.updateMoldMaintenanceDetail(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 MoldMaintenanceMainApi.importTemplate() importTemplateData.templateUrl = await MoldMaintenanceMainApi.importTemplate()
}) })
</script> </script>

301
src/views/eam/mold/moldMaintenanceMain/moldMaintenanceMain.data.ts

@ -1,6 +1,14 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const moldList = await MoldAccountsApi.getMoldAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
// 表单校验 // 表单校验
export const MoldMaintenanceMainRules = reactive({ export const MoldMaintenanceMainRules = reactive({
number: [required], number: [required],
@ -8,104 +16,321 @@ export const MoldMaintenanceMainRules = reactive({
deviceNumber: [required], deviceNumber: [required],
factoryAreaNumber: [required], factoryAreaNumber: [required],
maintenance: [required], maintenance: [required],
status: [required],
type: [required], type: [required],
siteId: [required], classes: [required],
concurrencyStamp: [required], faultType: [required],
describes : [required],
}) })
export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '维修工单编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false,
}, },
{ {
label: '报修工单申请号', label: '报修工单号',
field: 'requestNumber', field: 'requestNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isForm: false,
isSearch: true,
isTable: true,
}, },
{
label: '描述',
field: 'describe',
sort: 'custom',
},
{ {
label: '设备模具编号', label: '设备模具编号',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => moldList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldList.find((account) => account.number == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => moldList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
}, },
{ {
label: '厂区编号', label: '厂区编号',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
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: "请先选择模具"
},
}
}, },
{ {
label: '维修人', label: '维修人',
field: 'maintenance', field: 'maintenance',
sort: 'custom', sort: 'custom',
form: { table: {
component: 'InputNumber', width: '150',
value: 0
}, },
form: {
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择模具"
},
}
}, },
{ {
label: '报修人联系电话', label: '类型',
field: 'maintenancePhone', field: 'type',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: true,
}
},
search: {
value: 'MOLD'
}
}, },
{ {
label: '状态', label: '班次',
field: 'status', field: 'classes',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
dictType: DICT_TYPE.MAINTENANCE_SHIFT,
dictClass: 'number',
form: { form: {
component: 'Radio' component: 'Select'
}, },
}, },
{ {
label: '类型设备', label: '故障类型',
field: 'type', field: 'faultType',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
form: { dictType: DICT_TYPE.FAULT_TYPE,
component: 'Select' dictClass: 'string',
}, form: {
component: 'Select'
},
}, },
{ {
label: '创建时间', label: '描述',
field: 'createTime', field: 'describes',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, table: {
width: '150',
},
form: {
component: 'Input',
},
},
{
label: '操作',
field: 'action',
isForm: false, isForm: false,
table: {
width: 300,
fixed: 'right'
},
isDetail:false
}
]))
export const MoldMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '故障描述',
field: 'describes',
sort: 'custom',
table: {
},
isSearch: false,
},
{
label: '故障真因',
field: 'describes1',
sort: 'custom',
table: {
},
isSearch: false,
}, },
{ {
label: '地点ID', label: '解决措施',
field: 'siteId', field: 'workOut',
sort: 'custom', sort: 'custom',
table: {
},
isSearch: false,
}, },
{ {
label: '是否可用', label: '维修人',
field: 'available', field: 'maintenances',
sort: 'custom', sort: 'custom',
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
},
form:{
component: 'Select',
api: () => userList,
componentProps: {
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}
}, },
{ {
label: '并发乐观锁', label: '备件',
field: 'concurrencyStamp', field: 'itemNumbers1',
sort: 'custom', sort: 'custom',
table: {
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
searchField: 'itemNumbers1',
searchTitle: '备件',
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas,
searchPage: ItemApi.getItemList,
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
form: { form: {
component: 'InputNumber', // labelMessage: '信息提示说明!!!',
value: 0 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',
isForm: false, isForm: false,
table: { table: {
width: 150, width: 300,
fixed: 'right' fixed: 'right'
} },
isDetail: false,
isTableForm: false,
} }
])) ]))
// 表单校验
export const MoldMaintenanceDetailRules = reactive({
describes: [required],
describes1: [required],
workOut: [required],
maintenance: [required],
itemNumbers: [required],
})

107
src/views/eam/mold/moldRepair/index.vue

@ -4,64 +4,47 @@
<Search :schema="MoldRepair.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="MoldRepair.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="MoldRepair.allSchemas" />
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldRepair.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns" total: tableObject.total
:data="tableObject.tableList" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
:loading="tableObject.loading" v-model:sort="tableObject.sort">
:pagination="{ <template #code="{ row }">
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</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" @success="formsSuccess" :rules="MoldRepairRules"
ref="basicFormRef" :formAllSchemas="MoldRepair.allSchemas" :apiUpdate="MoldRepairApi.updateMoldRepair"
@success="formsSuccess" :apiCreate="MoldRepairApi.createMoldRepair" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
:rules="MoldRepairRules"
:formAllSchemas="MoldRepair.allSchemas"
:apiUpdate="MoldRepairApi.updateMoldRepair"
:apiCreate="MoldRepairApi.createMoldRepair"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldRepair.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldRepair.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/mold-repair/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/eam/mold-repair/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 { MoldRepair,MoldRepairRules } from './moldRepair.data' import { MoldRepair, MoldRepairRules } from './moldRepair.data'
import * as MoldRepairApi from '@/api/eam/mold/moldRepair' import * as MoldRepairApi from '@/api/eam/mold/moldRepair'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { selectAllFactoryArea } from '@/api/system/dept'
import { getRowIdentity } from 'element-plus/es/components/table/src/util'
// import TableHead from '@/components/TableHead/src/TableHead.vue' // import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue' // import Detail from '@/components/Detail/src/Detail.vue'
@ -73,6 +56,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const factoryAreaList = ref([])
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(MoldRepair.allSchemas.tableColumns) const tableColumns = ref(MoldRepair.allSchemas.tableColumns)
@ -99,9 +83,12 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldRepair:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'eam:moldRepair:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldRepair:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'eam:moldRepair:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldRepair:export'}), // // defaultButtons.defaultExportBtn({ hasPermi: 'eam:moldRepair:export' }), //
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -132,10 +119,13 @@ const buttonBaseClick = (val, item) => {
} }
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'eam:moldRepair:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldRepair:delete'}), // // defaultButtons.mainListEditBtn({hasPermi:'eam:moldRepair:update'}), //
] // defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:moldRepair:delete' }), //
defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), //
]
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
@ -143,6 +133,8 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'backout') { //
handleBackout(row)
} }
} }
@ -153,18 +145,20 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =MoldRepair.allSchemas.formSchema.some(function (item) { var isHave = MoldRepair.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return;
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
data.type = 'DEVICE';
data.result = 'PENDING';
if (formType === 'create') { if (formType === 'create') {
await MoldRepairApi.createMoldRepair(data) await MoldRepairApi.createMoldRepair(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -192,7 +186,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -235,6 +229,23 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
// function getAllFactoryAreaList() {
// selectAllFactoryArea().then(res => {
// factoryAreaList.value = res.data
// })
// }
function handleBackout(row) {
if (row.result != 'PENDING') {
message.error('该报修单正在处理中,不能撤销!')
}
MoldRepairApi.rejected(row.id).then(res => {
console.log("撤销成功!")
getList() //
})
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

167
src/views/eam/mold/moldRepair/moldRepair.data.ts

@ -1,96 +1,175 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
// 邮箱账号的列表
const factoryList = await selectAllFactoryArea()
const moldList = ref([]);
// 表单校验 // 表单校验
export const MoldRepairRules = reactive({ export const MoldRepairRules = reactive({
number: [required], number: [required],
deviceNumber: [required], moldNumber: [required],
factoryAreaNumber: [required], factoryAreaNumber: [required],
declarer: [required], declarer: [required],
faultType: [required], faultType: [required],
type: [required], type: [required],
available: [required], available: [required],
concurrencyStamp: [required], concurrencyStamp: [required],
// result: [required],
}) })
export const MoldRepair = useCrudSchemas(reactive<CrudSchema[]>([ export const MoldRepair = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: 'id',
field: 'number', field: 'id',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: false,
isTable: false
}, },
{ {
label: '设备模具编号', label: '报修工单编号',
field: 'deviceNumber', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false
}, },
{ {
label: '厂区编号', label: '厂区',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
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: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
onChange: (val) => {
MoldAccountsApi.getMoldAccountsPage({
isSearch: false,
factoryAreaNumber: val
}).then((res) => {
moldList.value = res?.list
}).catch((e) => {
console.log(e)
})
}
},
}
}, },
{ {
label: '报修人', label: '模具',
field: 'declarer', field: 'moldNumber',
sort: 'custom', sort: 'custom',
form: { table: {
component: 'InputNumber', width: '150',
value: 0
}, },
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: moldList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
}, },
{ {
label: '报修人联系电话', label: '报修人电话',
field: 'declarerPhone', field: 'declarerPhone',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
}, },
{ {
label: '故障类型枚举EM、CM、 PM', label: '故障类型',
field: 'faultType', field: 'faultType',
sort: 'custom', sort: 'custom',
form: { table: {
component: 'Select' width: '150',
}, },
}, dictType: DICT_TYPE.FAULT_TYPE,
{ dictClass: 'string',
label: '类型', form: {
field: 'type', component: 'Select'
sort: 'custom', },
isSearch: true,
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
}, },
{ {
label: '地点ID', label: '描述',
field: 'siteId', field: 'describe',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
}, },
{ {
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
}, },
{ {
label: '并发乐观锁', label: '维修状态',
field: 'concurrencyStamp', field: 'result',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
form: { form: {
component: 'InputNumber', component: 'Select',
value: 0
}, },
}, },
{ {

Loading…
Cancel
Save