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. 109
      src/views/eam/device/deviceMaintainPlan/deviceMaintainPlan.data.ts
  11. 7
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  12. 277
      src/views/eam/mold/moldInspectionMain/index.vue
  13. 463
      src/views/eam/mold/moldInspectionMain/moldInspectionMain.data.ts
  14. 403
      src/views/eam/mold/moldMaintainOrderMain/index.vue
  15. 441
      src/views/eam/mold/moldMaintainOrderMain/moldMaintainOrderMain.data.ts
  16. 109
      src/views/eam/mold/moldMaintainPlan/moldMaintainPlan.data.ts
  17. 388
      src/views/eam/mold/moldMaintenanceMain/index.vue
  18. 291
      src/views/eam/mold/moldMaintenanceMain/moldMaintenanceMain.data.ts
  19. 103
      src/views/eam/mold/moldRepair/index.vue
  20. 153
      src/views/eam/mold/moldRepair/moldRepair.data.ts

1
.gitignore

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

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

@ -63,3 +63,9 @@ export const importTemplate = () => {
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 })
}

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

@ -18,6 +18,7 @@ export interface DeviceMaintenanceMainVO {
// 查询维修工单主列表
export const getDeviceMaintenanceMainPage = async (params) => {
params.type = 'DEVICE'
if (params.isSearch) {
delete params.isSearch
const data = {...params}
@ -41,7 +42,6 @@ export const createDeviceMaintenanceMain = async (data: DeviceMaintenanceMainVO)
export const updateDeviceMaintenanceMain = async (data: DeviceMaintenanceMainVO) => {
return await request.put({ url: `/eam/device-maintenance-main/update`, data })
}
// 删除维修工单主
export const deleteDeviceMaintenanceMain = async (id: number) => {
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 = () => {
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
concurrencyStamp: number
}
// 查询保养工单主列表
export const getMoldMaintainOrderMainPage = async (params) => {
if (params.isSearch) {
@ -59,3 +58,14 @@ export const exportMoldMaintainOrderMain = async (params) => {
export const importTemplate = () => {
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'
export interface MoldMaintenanceMainVO {
id: number
number: string
requestNumber: string
describe: string
@ -17,6 +18,7 @@ export interface MoldMaintenanceMainVO {
// 查询维修工单主列表
export const getMoldMaintenanceMainPage = async (params) => {
params.type = 'MOLD'
if (params.isSearch) {
delete params.isSearch
const data = {...params}
@ -33,14 +35,13 @@ export const getMoldMaintenanceMain = async (id: number) => {
// 新增维修工单主
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) => {
return await request.put({ url: `/eam/device-maintenance-main/update`, data })
}
// 删除维修工单主
export const deleteMoldMaintenanceMain = async (id: number) => {
return await request.delete({ url: `/eam/device-maintenance-main/delete?id=` + id })
@ -55,3 +56,19 @@ export const exportMoldMaintenanceMain = async (params) => {
export const importTemplate = () => {
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.status = row.status
tableObjectRef.value.params = {
maintenanceNumber: row.number
number: row.number
}
await getList()
}

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

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

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

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

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

@ -23,28 +23,30 @@ export const DeviceMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
},
{
label: '保养类型',
field: 'maintenanceType',
sort: 'custom',
form: {
component: 'Select'
},
},
// {
// label: '保养类型',
// field: 'maintenanceType',
// sort: 'custom',
// form: {
// component: 'Select'
// },
// },
{
label: '设备执行周期、半年、年',
field: 'cycle',
sort: 'custom',
dictType: DICT_TYPE.MOLD_EXECUTION_CYCLE,
dictClass: 'string',
},
{
label: '次数',
field: 'times',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
// {
// label: '次数',
// field: 'times',
// sort: 'custom',
// form: {
// component: 'InputNumber',
// value: 0
// },
// },
{
label: '类型',
field: 'type',
@ -53,40 +55,43 @@ export const DeviceMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'Select'
},
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
},
{
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: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
// {
// 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: {
// 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',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isSearch: false,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
@ -147,6 +147,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
disabled: true,
}
},
search: {
value: 'DEVICE'
}
},
{
label: '班次',

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

@ -5,14 +5,9 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldInspectionMain.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="MoldInspectionMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
@ -27,13 +22,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -47,21 +42,49 @@
:apiUpdate="MoldInspectionMainApi.updateMoldInspectionMain"
:apiCreate="MoldInspectionMainApi.createMoldInspectionMain"
@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>
<script setup lang="ts">
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 MoldInspectionDetailApi from '@/api/eam/mold/moldInspectionDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -70,18 +93,34 @@ defineOptions({ name: 'MoldInspectionMain' })
const message = useMessage() //
const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
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(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
if (type == 'tableForm') {
//
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
row['itemNumbers1'] = str
row['itemNumbers'] = val
}
} else {
// const setV = {}
// setV[formField] = val[0][searchField]
// setV['supplierCode'] = val[0]['code']
// formRef.setValues(setV)
}
})
}
@ -99,12 +138,14 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldInspectionMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldInspectionMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldInspectionMain:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:moldInspectionMain:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:moldInspectionMain:import'}), //
// 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.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
@ -118,6 +159,8 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
MoldInspectionMain.allSchemas.formSchema[4].value = 'PROCCED';
MoldInspectionMain.allSchemas.formSchema[5].value = 'DEVICE';
openForm('create')
} else if (val == 'import') { //
handleImport()
@ -132,39 +175,47 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:moldInspectionMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldInspectionMain:delete'}), //
]
const butttondata = (row) => {
return [
// 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) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'maintenanceOrder') { //
handleMaintenanceOrder(row)
} else if (val == 'finishOrder') { //
handleFinishOrder(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
tableData.value = [] //
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =MoldInspectionMain.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = MoldInspectionMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.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 (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
await MoldInspectionMainApi.createMoldInspectionMain(data)
message.success(t('common.createSuccess'))
@ -192,7 +243,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
/** 导出按钮操作 */
@ -235,6 +286,156 @@ const searchFormClick = (searchData) => {
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 () => {
getList()

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

@ -1,103 +1,502 @@
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 { 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({
number: [required],
maintenanceNumber: [required],
deviceNumber: [required],
// maintenanceNumber: [required],
moldNumber: [required],
factoryAreaNumber: [required],
status: [required],
type: [required],
concurrencyStamp: [required],
faultType: [required],
})
export const MoldInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '检修编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
},
{
label: '维修工单号',
field: 'maintenanceNumber',
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: '设备模具',
field: 'deviceNumber',
label: '设备',
field: 'moldNumber',
sort: 'custom',
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',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
{
label: '描述',
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: '维修人',
field: 'maintenance',
sort: 'custom',
isSearch: false,
table: {
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: 'InputNumber',
value: 0
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择维修人"
},
{
label: '维修人联系电话',
field: 'maintenancePhone',
sort: 'custom',
}
},
// {
// label: '维修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{
label: '状态',
field: 'status',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
dictType: DICT_TYPE.JX_STATUS,
dictClass: 'string',
form: {
component: 'Radio'
component: 'Select',
componentProps: {
disabled: true,
placeholder: "请选择设备"
},
},
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
isSearch: false,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select'
component: 'Select',
componentProps: {
disabled: true,
placeholder: "请选择设备"
}
},
},
{
label: '创建时间',
field: 'createTime',
label: '故障类型',
field: 'faultType',
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,
table: {
width: 150,
fixed: 'right'
},
isDetail:false
}
]))
// 表单校验
export const MoldInspectionDetailRules = reactive({
number: [required],
estimatedMinutes: [required],
maintenance: [required],
})
export const MoldInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '地点ID',
field: 'siteId',
label: '检修编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: false,
isTableForm: false,
},
{
label: '是否可用',
field: 'available',
label: '责任人',
field: 'chargePeoples',
sort: 'custom',
table: {
width: '150',
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',
api: () => dutyUserList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择责任人",
multiple: true,
},
}
},
{
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'Input',
},
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
label: '人数',
field: 'peoples',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
form: {
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: '操作',
field: 'action',
@ -105,6 +504,8 @@ export const MoldInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150,
fixed: 'right'
}
},
isDetail: false,
isTableForm: false,
}
]))

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

@ -1,7 +1,11 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="MoldMaintainOrderMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="MoldMaintainOrderMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
@ -27,68 +31,143 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
ref="formRef"
:rules="MoldMaintainOrderMainRules"
:formAllSchemas="MoldMaintainOrderMain.allSchemas"
:tableAllSchemas="MoldMaintainOrderDetail.allSchemas"
:tableFormRules="MoldMaintainOrderDetailRules"
:tableData="tableData"
:apiUpdate="MoldMaintainOrderMainApi.updateMoldMaintainOrderMain"
:apiCreate="MoldMaintainOrderMainApi.createMoldMaintainOrderMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@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>
<script setup lang="ts">
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 MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'MoldMaintainOrderMain' })
const message = useMessage() //
const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
const formRef = ref()
routeName.value = route.name
const tableColumns = ref(MoldMaintainOrderMain.allSchemas.tableColumns)
const apiPage = ref(MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage)
const detailAllSchemas = ref(MoldMaintainOrderDetail.allSchemas)
const tableData = ref([])
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
//
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
row['itemNumbers1'] = str
row['itemNumbers'] = val
}
} else {
// const setV = {}
// setV[formField] = val[0][searchField]
// setV['supplierCode'] = val[0]['code']
// formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
setV['itemNumbers'] = val
setV['itemNumbers1'] = str
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage //
@ -99,87 +178,115 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldMaintainOrderMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldMaintainOrderMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldMaintainOrderMain:export'}), //
// defaultButtons.defaultAddBtn({
// hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
// }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
defaultButtons.defaultSetBtn(null) //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
MoldMaintainOrderMain.allSchemas.formSchema[3].value = 'MOLD'
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:moldMaintainOrderMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldMaintainOrderMain:delete'}), //
]
const butttondata = (row) => {
return [
// 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) => {
if (val == 'edit') { //
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
MoldMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
} else if (val == 'finishOrder') {
finishOrder(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =MoldMaintainOrderMain.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 MoldMaintainOrderMainApi.createMoldMaintainOrderMain(data)
message.success(t('common.createSuccess'))
} else {
await MoldMaintainOrderMainApi.updateMoldMaintainOrderMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
const openForm = (type: string, row?: any) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
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
const data = await MoldMaintainOrderMainApi.exportMoldMaintainOrderMain(tableObject.params)
download.excel(data, '保养工单主.xlsx')
download.excel(data, '维修工单主.xlsx')
} catch {
} finally {
exportLoading.value = false
@ -219,7 +326,7 @@ const handleImport = () => {
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '保养工单主导入模版.xlsx'
templateTitle: '维修工单主导入模版.xlsx'
})
//
const importSuccess = () => {
@ -235,10 +342,152 @@ const searchFormClick = (searchData) => {
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 () => {
getList()
importTemplateData.templateUrl = await MoldMaintainOrderMainApi.importTemplate()
})
</script>

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

@ -1,12 +1,26 @@
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 { 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({
number: [required],
name: [required],
planNumber: [required],
deviceNumber: [required],
moldNumber: [required],
factoryAreaNumber: [required],
status: [required],
type: [required],
@ -15,46 +29,111 @@ export const MoldMaintainOrderMainRules = reactive({
export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '保养单号',
field: 'number',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
// {
// label: '名称',
// field: 'name',
// sort: 'custom',
// isSearch: true,
// },
{
label: '保养计划单号',
field: 'planNumber',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
},
{
label: '设备/模具编号',
field: 'deviceNumber',
label: '设备/模具',
field: 'moldNumber',
sort: 'custom',
isSearch: true,
isSearch: false,
table: {
width: '150',
},
},
{
label: '厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: String) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
},
detail: {
}
},
{
label: '工程师id',
field: 'engineer',
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
form: {
component: 'InputNumber',
value: 0
component: 'Radio'
},
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: '接单时间',
field: 'receiveTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
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: '指派时间',
field: 'assignTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -77,19 +174,14 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '工程师id',
field: 'worker',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '完成时间',
field: 'finishedTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -103,6 +195,10 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '验证时间',
field: 'verifyTime',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
formatter: dateFormatter,
form: {
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: '状态',
field: 'status',
label: '操作',
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',
isSearch: true,
form: {
component: 'Radio'
component: 'Input',
componentProps: {
disabled: true,
}
},
},
{
label: '类型',
field: 'type',
label: '人数',
field: 'peoples',
sort: 'custom',
isSearch: true,
isSearch: false,
form: {
component: 'Select'
component: 'InputNumber',
},
isTable: true,
tableForm: {
type: 'InputNumber',
},
},
{
label: '创建时间',
field: 'createTime',
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
table: {
width: '150',
},
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: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择责任人",
multiple: true,
},
}
},
isForm: false,
{
label: '是否完成',
field: 'status',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isTable: true,
dictType: DICT_TYPE.JX_DETAILS_STATUS,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: false,
}
},
tableForm: {
type: 'Select',
componentProps: {
disabled: false,
}
},
},
{
label: '未完成原因',
field: 'uncompleted',
sort: 'custom',
isSearch: false,
isTable: true,
form: {
component: 'Input',
componentProps: {
type:'textarea'
}
}
},
{
label: '地点ID',
field: 'siteId',
label: '维修内容',
field: 'contents',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
disabled: true,
}
}
},
{
label: '是否可用',
field: 'available',
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: '并发乐观锁',
field: 'concurrencyStamp',
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: 'InputNumber',
value: 0
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '工程师确认',
field: 'engineer',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type:'TextArea'
}
}
},
{
label: '操作',
@ -172,6 +512,9 @@ export const MoldMaintainOrderMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150,
fixed: 'right'
}
},
isDetail: false,
isTableForm: false,
}
]))

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

@ -23,28 +23,30 @@ export const MoldMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
},
{
label: '保养类型',
field: 'maintenanceType',
sort: 'custom',
form: {
component: 'Select'
},
},
// {
// label: '保养类型',
// field: 'maintenanceType',
// sort: 'custom',
// form: {
// component: 'Select'
// },
// },
{
label: '设备执行周期、半年、年',
field: 'cycle',
sort: 'custom',
dictType: DICT_TYPE.MOLD_EXECUTION_CYCLE,
dictClass: 'string',
},
{
label: '次数',
field: 'times',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
// {
// label: '次数',
// field: 'times',
// sort: 'custom',
// form: {
// component: 'InputNumber',
// value: 0
// },
// },
{
label: '类型',
field: 'type',
@ -53,40 +55,43 @@ export const MoldMaintainPlan = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'Select'
},
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
},
{
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: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
// {
// 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: {
// component: 'InputNumber',
// value: 0
// },
// },
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// },
// isTable: false
// }
]))

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

@ -1,7 +1,11 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="MoldMaintenanceMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="MoldMaintenanceMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
@ -27,68 +31,144 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
ref="formRef"
:rules="MoldMaintenanceMainRules"
:formAllSchemas="MoldMaintenanceMain.allSchemas"
:tableAllSchemas="MoldMaintenanceDetail.allSchemas"
:tableFormRules="MoldMaintenanceDetailRules"
:tableData="tableData"
:apiUpdate="MoldMaintenanceMainApi.updateMoldMaintenanceMain"
:apiCreate="MoldMaintenanceMainApi.createMoldMaintenanceMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@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>
<script setup lang="ts">
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 MoldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'MoldMaintenanceMain' })
const message = useMessage() //
const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
const formRef = ref()
routeName.value = route.name
const tableColumns = ref(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(() => {
const setV = {}
setV[formField] = val[0][searchField]
if (formField == 'itemNumbers1') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
setV['itemNumbers'] = val
setV['itemNumbers1'] = str
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: MoldMaintenanceMainApi.getMoldMaintenanceMainPage //
@ -99,87 +179,111 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldMaintenanceMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldMaintenanceMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldMaintenanceMain:export'}), //
defaultButtons.defaultAddBtn({
hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
defaultButtons.defaultSetBtn(null) //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
MoldMaintenanceMain.allSchemas.formSchema[3].value = 'MOLD'
MoldMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:moldMaintenanceMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldMaintenanceMain:delete'}), //
]
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn(null), //
defaultButtons.acceptOrderBtn({
hide: !(
row.status == 'PENDING' &&
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
)
}), //
defaultButtons.turnOrderBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}), //
defaultButtons.repairBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}), //
defaultButtons.verifyOrderBtn({
hide: !(
row.status == 'COMPLETED' &&
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')
)
}), //
defaultButtons.finishOrderBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}) //
]
}
const onChange = (field, cur, item) => {
if (field == 'deviceNumber') {
// 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) => {
if (val == 'edit') { //
MoldMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
MoldMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =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 openForm = (type: string, row?: any) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
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() //
}
//
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 () => {
getList()
importTemplateData.templateUrl = await MoldMaintenanceMainApi.importTemplate()
})
</script>

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

@ -1,6 +1,14 @@
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({
number: [required],
@ -8,104 +16,321 @@ export const MoldMaintenanceMainRules = reactive({
deviceNumber: [required],
factoryAreaNumber: [required],
maintenance: [required],
status: [required],
type: [required],
siteId: [required],
concurrencyStamp: [required],
classes: [required],
faultType: [required],
describes : [required],
})
export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '维修工单编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
},
{
label: '报修工单申请号',
label: '报修工单号',
field: 'requestNumber',
sort: 'custom',
table: {
width: '150',
},
{
label: '描述',
field: 'describe',
sort: 'custom',
isForm: false,
isSearch: true,
isTable: true,
},
{
label: '设备模具编号',
field: 'deviceNumber',
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: '厂区编号',
field: 'factoryAreaNumber',
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: '维修人',
field: 'maintenance',
sort: 'custom',
table: {
width: '150',
},
form: {
component: 'InputNumber',
value: 0
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择模具"
},
}
},
{
label: '报修人联系电话',
field: 'maintenancePhone',
label: '类型',
field: 'type',
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: '状态',
field: 'status',
label: '班次',
field: 'classes',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
dictType: DICT_TYPE.MAINTENANCE_SHIFT,
dictClass: 'number',
form: {
component: 'Radio'
component: 'Select'
},
},
{
label: '类型设备',
field: 'type',
label: '故障类型',
field: 'faultType',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
label: '描述',
field: 'describes',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
form: {
component: 'Input',
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 300,
fixed: 'right'
},
isDetail:false
}
]))
export const MoldMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '故障描述',
field: 'describes',
sort: 'custom',
table: {
},
isSearch: false,
},
{
label: '地点ID',
field: 'siteId',
label: '故障真因',
field: 'describes1',
sort: 'custom',
table: {
},
isSearch: false,
},
{
label: '是否可用',
field: 'available',
label: '解决措施',
field: 'workOut',
sort: 'custom',
table: {
},
isSearch: false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
label: '维修人',
field: 'maintenances',
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: '备件',
field: 'itemNumbers1',
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: {
component: 'InputNumber',
value: 0
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
}
},
isSearch: false,
},
{
label: '备件1',
field: 'itemNumbers',
sort: 'custom',
table: {
},
isForm:false,
isDetail:false,
isTable:false,
isSearch: false,
isTableForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
width: 300,
fixed: 'right'
}
},
isDetail: false,
isTableForm: false,
}
]))
// 表单校验
export const MoldMaintenanceDetailRules = reactive({
describes: [required],
describes1: [required],
workOut: [required],
maintenance: [required],
itemNumbers: [required],
})

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

@ -5,63 +5,46 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldRepair.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="MoldRepair.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
}" 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)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="MoldRepairRules"
:formAllSchemas="MoldRepair.allSchemas"
:apiUpdate="MoldRepairApi.updateMoldRepair"
:apiCreate="MoldRepairApi.createMoldRepair"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="MoldRepairRules"
:formAllSchemas="MoldRepair.allSchemas" :apiUpdate="MoldRepairApi.updateMoldRepair"
:apiCreate="MoldRepairApi.createMoldRepair" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<!-- 详情 -->
<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>
<script setup lang="ts">
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 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 ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -73,6 +56,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const factoryAreaList = ref([])
routeName.value = route.name
const tableColumns = ref(MoldRepair.allSchemas.tableColumns)
@ -99,9 +83,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:moldRepair:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:moldRepair:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:moldRepair:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:moldRepair:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:moldRepair:import'}), //
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:moldRepair:export' }), //
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -132,10 +119,13 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:moldRepair:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:moldRepair:delete'}), //
]
const butttondata = (row) => {
return [
// defaultButtons.mainListEditBtn({hasPermi:'eam:moldRepair:update'}), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:moldRepair:delete' }), //
defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), //
]
}
// -
const buttonTableClick = async (val, row) => {
@ -143,6 +133,8 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'backout') { //
handleBackout(row)
}
}
@ -153,18 +145,20 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =MoldRepair.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = MoldRepair.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.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 (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
data.type = 'DEVICE';
data.result = 'PENDING';
if (formType === 'create') {
await MoldRepairApi.createMoldRepair(data)
message.success(t('common.createSuccess'))
@ -192,7 +186,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
/** 导出按钮操作 */
@ -235,6 +229,23 @@ const searchFormClick = (searchData) => {
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 () => {
getList()

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

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

Loading…
Cancel
Save