Browse Source

合并冲突

master
ljlong_2630 1 year ago
parent
commit
e1c347c5c1
  1. 2
      .env.development
  2. 58
      src/api/eam/device/deviceInspectionDetail/index.ts
  3. 2
      src/utils/dict.ts
  4. 181
      src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts
  5. 122
      src/views/eam/device/deviceInspectionMain/index.vue

2
.env.development

@ -4,8 +4,8 @@ NODE_ENV=development
VITE_DEV=false VITE_DEV=false
# 请求路径 # 请求路径
# VITE_BASE_URL='http://localhost:12080'
VITE_BASE_URL='http://localhost:12080' VITE_BASE_URL='http://localhost:12080'
# VITE_BASE_URL='http://192.168.0.165:12080'
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload' VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload'

58
src/api/eam/device/deviceInspectionDetail/index.ts

@ -0,0 +1,58 @@
import request from '@/config/axios'
export interface DeviceInspectionDetailVO {
id: number
number: string
siteId: string
available: string
concurrencyStamp: number
name: string
peoples: string
estimatedMinutes: number
actualMinutes: number
chargePeoples: string
completionTime: Date
engineer: string
uncompleted: string
}
// 查询检修工单子列表
export const getDeviceInspectionDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/device-inspection-detail/senior', data })
} else {
return await request.get({ url: `/eam/device-inspection-detail/page`, params })
}
}
// 查询检修工单子详情
export const getDeviceInspectionDetail = async (id: number) => {
return await request.get({ url: `/eam/device-inspection-detail/get?id=` + id })
}
// 新增检修工单子
export const createDeviceInspectionDetail = async (data: DeviceInspectionDetailVO) => {
return await request.post({ url: `/eam/device-inspection-detail/create`, data })
}
// 修改检修工单子
export const updateDeviceInspectionDetail = async (data: DeviceInspectionDetailVO) => {
return await request.put({ url: `/eam/device-inspection-detail/update`, data })
}
// 删除检修工单子
export const deleteDeviceInspectionDetail = async (id: number) => {
return await request.delete({ url: `/eam/device-inspection-detail/delete?id=` + id })
}
// 导出检修工单子 Excel
export const exportDeviceInspectionDetail = async (params) => {
return await request.download({ url: `/eam/device-inspection-detail/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/device-inspection-detail/get-import-template' })
}

2
src/utils/dict.ts

@ -290,7 +290,7 @@ export enum DICT_TYPE {
GET_ORDER_STATUS = 'get_order_status', //模具保养周期 GET_ORDER_STATUS = 'get_order_status', //模具保养周期
IS_OPEN = 'is_open', //是否打开 IS_OPEN = 'is_open', //是否打开
ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态 ITEM_APPLY_STATUS = 'item_apply_status',//备件申领状态
JX_DETAILS_STATUS = 'jx_details_status', //检修明细状态
} }

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

@ -4,10 +4,13 @@ import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept' import { selecUserByType } from '@/api/system/dept'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import { dateFormatter } from '@/utils/formatTime'
const userStore = useUserStore() const userStore = useUserStore()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 }) const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined })
const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 2})
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE') const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
// 表单校验 // 表单校验
export const DeviceInspectionMainRules = reactive({ export const DeviceInspectionMainRules = reactive({
@ -167,7 +170,7 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
labelField: 'name', labelField: 'name',
valueField: 'id' valueField: 'id'
}, },
placeholder: "请选择设备" placeholder: "请选择维修人"
}, },
} }
}, },
@ -263,3 +266,179 @@ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
])) ]))
// 表单校验
export const DeviceInspectionDetailRules = reactive({
number: [required],
estimatedMinutes: [required],
maintenance: [required],
})
export const DeviceInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '检修编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: false,
},
{
label: '责任人',
field: 'maintenance',
sort: 'custom',
table: {
width: '150',
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return dutyUserList.find((account) => account.id == cellValue)?.name
},
form: {
component: 'Select',
api: () => dutyUserList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择责任人"
},
}
},
{
label: '预计分钟',
field: 'estimatedMinutes',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '人数',
field: 'peoples',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: true,
isTable: true,
},
{
label: '实际分钟',
field: 'actualMinutes',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '完成时间',
field: 'completionTime',
sort: 'custom',
formatter: dateFormatter,
table: {
width: '150',
},
isSearch: false,
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '工程师确认',
field: 'engineer',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
api: () => engineerList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return engineerList.find((account) => account.id == cellValue)?.name
},
form: {
component: 'Select',
api: () => engineerList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请选择工程师"
},
}
},
{
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,
}
},
},
{
label: '未完成原因',
field: 'uncompleted',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: true,
isTable: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

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

@ -11,13 +11,20 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }"
v-model:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
<template #code="{ row }"> v-model:currentPage="tableObject.currentPage"
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> v-model:sort="tableObject.sort"
<span>{{ row.code }}</span> >
<template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
@ -30,10 +37,18 @@
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules" <BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules"
:formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain" :formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess" :apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @onChange="onChange"/> :isBusiness="false" @onChange="onChange" />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionMain.allSchemas" /> <!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionDetail.allSchemas" /> -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="DeviceInspectionMain.allSchemas"
:detailAllSchemas="DeviceInspectionDetail.allSchemas" :detailAllSchemasRules="DeviceInspectionDetailRules"
:apiCreate="DeviceInspectionDetailApi.createDeviceInspectionDetail"
:apiUpdate="DeviceInspectionDetailApi.updateDeviceInspectionDetail"
:apiPage="DeviceInspectionDetailApi.getDeviceInspectionDetailPage"
:apiDelete="DeviceInspectionDetailApi.deleteDeviceInspectionDetail" :Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" @detailOpenForm="detailOpenForm" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" :isSearchTableItem="true" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData" <ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData"
@ -42,8 +57,9 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data' import { DeviceInspectionDetail, DeviceInspectionDetailRules, DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data'
import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain' import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain'
import * as DeviceInspectionDetailApi from '@/api/eam/device/deviceInspectionDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
@ -60,7 +76,7 @@ const route = useRoute() // 路由信息
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceInspectionMain.allSchemas.tableColumns) const tableColumns = ref(DeviceInspectionMain.allSchemas.tableColumns)
const Echo = []
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
@ -252,6 +268,92 @@ const onChange = (field, cur, item) => {
} }
} }
//
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);
DeviceInspectionDetail.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) => {
try {
let data1 = {
id: data.id,
number: data.number,
siteId: data.siteId,
available: data.available,
concurrencyStamp: data.concurrencyStamp,
name: data.name,
peoples: data.peoples.join(','),
estimatedMinutes: data.estimatedMinutes,
actualMinutes: data.actualMinutes,
chargePeoples: data.chargePeoples.join(','),
completionTime: data.completionTime,
engineer: data.engineer.join(','),
uncompleted: data.uncompleted
}
console.log(data1)
if (formType === 'create') {
await DeviceInspectionDetailApi.createDeviceInspectionDetail(data1)
message.success(t('common.createSuccess'))
} else {
await DeviceInspectionDetailApi.updateDeviceInspectionDetail(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()

Loading…
Cancel
Save