Browse Source

模具保养项 巡检点检

master
songguoqiang 7 months ago
parent
commit
69d55ede23
  1. 34
      src/api/eam/basic/inspection/index.ts
  2. 63
      src/api/eam/basic/moldInspection/index.ts
  3. 57
      src/api/eam/mold/moldSpotInspectionRecordMain/index.ts
  4. 224
      src/views/eam/basic/moldInspection/index.vue
  5. 166
      src/views/eam/basic/moldInspection/moldInspection.data.ts
  6. 2
      src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts
  7. 111
      src/views/eam/device/deviceSpotInspectionRecordMain/index.vue
  8. 549
      src/views/eam/mold/moldSpotInspectionRecordMain/index.vue
  9. 263
      src/views/eam/mold/moldSpotInspectionRecordMain/moldSpotInspectionRecordMain.data.ts

34
src/api/eam/basic/inspection/index.ts

@ -3,14 +3,14 @@ import request from '@/config/axios'
export interface DeviceMoldItemsVO { export interface DeviceMoldItemsVO {
name: string name: string
deviceNumber: string deviceNumber: string
type: "DEVICE" type: string
status: string status: string
siteId: string siteId: string
available: string available: string
concurrencyStamp: number concurrencyStamp: number
} }
// 查询项记录表(设备 模具 保养 维修 巡检点检)列表 // 查询设备项记录表(设备 模具 保养 维修 巡检点检)列表
export const getDeviceMoldItemsPage = async (params) => { export const getDeviceMoldItemsPage = async (params) => {
params.type="DEVICE" params.type="DEVICE"
params.status="INSPECTION" params.status="INSPECTION"
@ -23,6 +23,19 @@ export const getDeviceMoldItemsPage = async (params) => {
} }
} }
// 查询模具项记录表(设备 模具 保养 维修 巡检点检)列表
export const getMoldItemsPage = async (params) => {
params.type="MOLD"
params.status="INSPECTION"
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/device-mold-items/senior', data })
} else {
return await request.get({ url: `/eam/device-mold-items/page`, params })
}
}
// 查询项记录表(设备 模具 保养 维修 巡检点检)详情 // 查询项记录表(设备 模具 保养 维修 巡检点检)详情
export const getDeviceMoldItems = async (id: number) => { export const getDeviceMoldItems = async (id: number) => {
@ -34,12 +47,19 @@ export const getNumber = async (params) => {
return await request.get({ url: `/eam/device-mold-items/getNumber`, params}) return await request.get({ url: `/eam/device-mold-items/getNumber`, params})
} }
// 新增项记录表(设备 模具 保养 维修 巡检点检) // 新增设备项记录表(设备 模具 保养 维修 巡检点检)
export const createDeviceMoldItems = async (data: DeviceMoldItemsVO) => { export const createDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
data.type="DEVICE" data.type="DEVICE"
data.status="INSPECTION" data.status="INSPECTION"
return await request.post({ url: `/eam/device-mold-items/create`, data }) return await request.post({ url: `/eam/device-mold-items/create`, data })
} }
//新增模具
export const creatMoldItems = async (data: DeviceMoldItemsVO) => {
debugger
data.type="MOLD"
data.status="INSPECTION"
return await request.post({ url: `/eam/device-mold-items/create`, data })
}
// 修改项记录表(设备 模具 保养 维修 巡检点检) // 修改项记录表(设备 模具 保养 维修 巡检点检)
export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => { export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
@ -48,6 +68,14 @@ export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
return await request.put({ url: `/eam/device-mold-items/update`, data }) return await request.put({ url: `/eam/device-mold-items/update`, data })
} }
// 修改模具项记录表(设备 模具 保养 维修 巡检点检)
export const updateMoldItems = async (data: DeviceMoldItemsVO) => {
debugger
data.type="MOLD"
data.status="INSPECTION"
return await request.put({ url: `/eam/device-mold-items/update`, data })
}
// 删除项记录表(设备 模具 保养 维修 巡检点检) // 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => { export const deleteDeviceMoldItems = async (id: number) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id }) return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id })

63
src/api/eam/basic/moldInspection/index.ts

@ -0,0 +1,63 @@
import request from '@/config/axios'
export interface DeviceMoldItemsVO {
name: string
deviceNumber: string
type: string
status: string
siteId: string
available: string
concurrencyStamp: number
}
// 查询模具项记录表(设备 模具 保养 维修 巡检点检)列表
export const getMoldItemsPage = async (params) => {
params.type="MOLD"
params.status="INSPECTION"
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/device-mold-items/senior', data })
} else {
return await request.get({ url: `/eam/device-mold-items/page`, params })
}
}
// 查询项记录表(设备 模具 保养 维修 巡检点检)详情
export const getDeviceMoldItems = async (id: number) => {
return await request.get({ url: `/eam/device-mold-items/get?id=` + id })
}
// 查询供应商发票申请主详情
export const getNumber = async (params) => {
return await request.get({ url: `/eam/device-mold-items/getNumber`, params})
}
//新增模具
export const creatMoldItems = async (data: DeviceMoldItemsVO) => {
data.type="MOLD"
data.status="INSPECTION"
return await request.post({ url: `/eam/device-mold-items/create`, data })
}
// 修改模具项记录表(设备 模具 保养 维修 巡检点检)
export const updateMoldItems = async (data: DeviceMoldItemsVO) => {
data.type="MOLD"
data.status="INSPECTION"
return await request.put({ url: `/eam/device-mold-items/update`, data })
}
// 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id })
}
// 导出项记录表(设备 模具 保养 维修 巡检点检) Excel
export const exportDeviceMoldItems = async (params) => {
return await request.download({ url: `/eam/device-mold-items/export-excel`, params })
}

57
src/api/eam/mold/moldSpotInspectionRecordMain/index.ts

@ -0,0 +1,57 @@
import request from '@/config/axios'
export interface DeviceSpotInspectionRecordMainVO {
number: string
deviceNumber: string
describe: string
maintenance: number
maintenancePhone: string
status: string
type: string
siteId: string
available: string
approveOpinion?: string
concurrencyStamp: number
}
// 查询检修工单主列表
export const getDeviceSpotInspectionRecordMainPage = async (params) => {
params.type = 'MOLD'
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/device-spot-inspection-record-main/senior', data })
} else {
return await request.get({ url: `/eam/device-spot-inspection-record-main/page`, params })
}
}
// 查询检修工单主详情
export const getDeviceSpotInspectionRecordMain = async (id: number) => {
return await request.get({ url: `/eam/device-spot-inspection-record-main/get?id=` + id })
}
// 新增检修工单主
export const createDeviceSpotInspectionRecordMain = async (data: DeviceSpotInspectionRecordMainVO) => {
return await request.post({ url: `/eam/device-spot-inspection-record-main/create`, data })
}
// 修改检修工单主
export const updateDeviceSpotInspectionRecordMain = async (data: DeviceSpotInspectionRecordMainVO) => {
return await request.put({ url: `/eam/device-spot-inspection-record-main/update`, data })
}
// 删除检修工单主
export const deleteDeviceSpotInspectionRecordMain = async (id: number) => {
return await request.delete({ url: `/eam/device-spot-inspection-record-main/delete?id=` + id })
}
// 导出检修工单主 Excel
export const exportDeviceSpotInspectionRecordMain = async (params) => {
return await request.download({ url: `/eam/device-spot-inspection-record-main/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/device-spot-inspection-record-main/get-import-template' })
}

224
src/views/eam/basic/moldInspection/index.vue

@ -0,0 +1,224 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DeviceMoldItems.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMoldItems.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<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}">
<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)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceMoldItemsRules"
:formAllSchemas="DeviceMoldItems.allSchemas"
:apiUpdate="DeviceMoldItemsApi.updateMoldItems"
:apiCreate="DeviceMoldItemsApi.creatMoldItems"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMoldItems.allSchemas" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DeviceMoldItems,DeviceMoldItemsRules } from './moldInspection.data'
import * as DeviceMoldItemsApi from '@/api/eam/basic/moldInspection'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'MoldInspection' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMoldItems.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: DeviceMoldItemsApi.getMoldItemsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceMoldItems.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 DeviceMoldItemsApi.creatMoldItems(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMoldItemsApi.updateMoldItems(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceMoldItems')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DeviceMoldItemsApi.deleteDeviceMoldItems(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
tableObject.params.type="MOLD"
tableObject.params.status="INSPECTION"
const data = await DeviceMoldItemsApi.exportDeviceMoldItems(tableObject.params)
download.excel(data, '项记录表(设备 模具 保养 维修 巡检点检).xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>

166
src/views/eam/basic/moldInspection/moldInspection.data.ts

@ -0,0 +1,166 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as DeviceMoldItemsApi from '@/api/eam/basic/deviceMaintenance'
// 表单校验
export const DeviceMoldItemsRules = reactive({
name: [required],
deviceNumber: [required],
type: [required],
status: [required],
concurrencyStamp: [required],
})
export const DeviceMOLD = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号',
field: 'number',
sort: 'custom',
isForm: false,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '名称',
field: 'name',
sort: 'custom',
},
{
label: '规格型号',
field: 'specification',
sort: 'custom',
},
]))
export const DeviceMoldItems = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '巡检点检项',
field: 'name',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
type: 'textarea',
}
}
},
{
label: '类型',
field: 'type',
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: false,
form: {
value: 'MOLD',
componentProps: {
disabled: true,
}
}
},
{
label: '模具编号',
field: 'deviceNumber',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择单号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '单号信息', // 查询弹窗标题
searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类
searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: "TRUE",
isMainValue: false
}, {
key: 'type',
value: 'type',
isMainValue: true
}
]
}
}
},
{
label: '模具名称',
field: 'deviceName',
sort: 'custom',
isSearch: false,
isForm: false,
},
{
label: '项类型',
field: 'status',
dictType: DICT_TYPE.DEVICEMOLDITEMS_STATUS,
dictClass: 'string',
sort: 'custom',
isSearch: false,
form: {
component: 'Select',
value: 'INSPECTION',
componentProps: {
disabled: true
}
},
},
{
label: '模具部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: true,
},
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: false,
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// tableForm: {
// type: 'Select',
// inactiveValue: 'FALSE',
// disabled: true
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
table: {
width: 170
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

2
src/views/eam/device/deviceSpotInspectionRecordMain/deviceSpotInspectionRecordMain.data.ts

@ -182,7 +182,7 @@ export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema
label: '操作', label: '操作',
field: 'action', field: 'action',
isForm: false, isForm: false,
isTable: false, isTable: true,
isDetail:false, isDetail:false,
table: { table: {
width: 150, width: 150,

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

@ -85,6 +85,35 @@
:buttonControllFunction="buttonControllFunction" :buttonControllFunction="buttonControllFunction"
/> />
<Dialog
ref="updateDialog"
title="审批意见"
v-model="dialogVisible"
:width="600"
:maxHeight="700"
:style="{height:'450px'}"
:before-close="handleBeforeClose"
>
<el-form :model="updateFormValue" class="demo-form-inline">
<el-form-item label="审批意见">
<el-input
type="textarea"
v-model="updateFormValue.approveOpinion"
placeholder="请对审批添加意见"
clearable
:rows="12"
/>
</el-form-item>
</el-form>
<template #footer>
<div style="text-align: center;">
<el-button type="success" @click="onSubmit('APPROVEPASS')">通过</el-button>
<el-button type="danger" @click="onSubmit('APPROVEREJECTED')">不通过</el-button>
</div>
</template>
</Dialog>
<!-- 导入 --> <!-- 导入 -->
<ImportForm <ImportForm
ref="importFormRef" ref="importFormRef"
@ -104,6 +133,7 @@ import {
} from './deviceSpotInspectionRecordMain.data' } from './deviceSpotInspectionRecordMain.data'
import * as DeviceSpotInspectionRecordMainApi from '@/api/eam/device/deviceSpotInspectionRecordMain' import * as DeviceSpotInspectionRecordMainApi from '@/api/eam/device/deviceSpotInspectionRecordMain'
import * as DeviceSpotInspectionRecordDetailApi from '@/api/eam/device/deviceSpotInspectionRecordDetail' import * as DeviceSpotInspectionRecordDetailApi from '@/api/eam/device/deviceSpotInspectionRecordDetail'
import { DeviceSpotInspectionRecordMainVO } from '@/api/eam/device/deviceSpotInspectionRecordMain'
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'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
@ -121,6 +151,12 @@ const tableColumns = ref(DeviceSpotInspectionRecordMain.allSchemas.tableColumns)
const apiPage = ref(DeviceSpotInspectionRecordDetailApi.getDeviceSpotInspectionRecordDetailPage) const apiPage = ref(DeviceSpotInspectionRecordDetailApi.getDeviceSpotInspectionRecordDetailPage)
const detailAllSchemas = ref(DeviceSpotInspectionRecordDetail.allSchemas) const detailAllSchemas = ref(DeviceSpotInspectionRecordDetail.allSchemas)
const tableData = ref([]) const tableData = ref([])
const dialogVisible = ref(false)
const updateFormValue = ref({//
approveOpinion:'',
id:null,
status:null
})
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
@ -224,28 +260,7 @@ const isShowMainButton = (row, val) => {
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListEditBtn({ hide: !(row.status != 'COMPLETED' && row.status != 'VERIFIED' && row.status != 'REJECTED')}), // defaultButtons.approveBtn({ hide: !(row.status == 'COMPLETED' && judgeIfDeviceRole())}), //
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) => { const onChange = (field, cur, item) => {
@ -259,22 +274,9 @@ const onChange = (field, cur, item) => {
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => { if (val == 'approve') {//
return item.field == 'type' dialogVisible.value = true;
}).value = 'DEVICE' updateFormValue.value.id = row.id
if (val == 'edit') {
//
openForm('update', row)
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'number'
}).componentProps.disabled = true
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
openForm('turnOrder', row)
} }
} }
@ -504,6 +506,39 @@ function buttonControllFunction(row, val) {
return true return true
} }
} }
const handleBeforeClose = async(done)=>{
done()
}
const onSubmit = async (status: string) => {
try {
const data: DeviceSpotInspectionRecordMainVO = {
approveOpinion: updateFormValue.value.approveOpinion,
status: status,
id:updateFormValue.value.id
};
await DeviceSpotInspectionRecordMainApi.updateDeviceSpotInspectionRecordMain(data);
message.success(t('common.updateSuccess'));
dialogVisible.value = false;
// Refresh the current list
getList();
} finally {
formRef.value.formLoading = false;
}
}
/**
* 判断是否为模具工程师
*/
const judgeIfDeviceRole = () => {
const rolesOk = userStore.roles.find(item => {
return item == 'device_class_Engineer_role'
})
if (rolesOk != undefined && rolesOk != null) {
return true
} else {
return false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {

549
src/views/eam/mold/moldSpotInspectionRecordMain/index.vue

@ -0,0 +1,549 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="DeviceSpotInspectionRecordMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceSpotInspectionRecordMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<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 #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(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
:rules="DeviceSpotInspectionRecordMainRules"
:formAllSchemas="DeviceSpotInspectionRecordMain.allSchemas"
:tableAllSchemas="DeviceSpotInspectionRecordDetail.allSchemas"
:tableFormRules="DeviceSpotInspectionRecordDetailRules"
:tableData="tableData"
:apiUpdate="DeviceSpotInspectionRecordMainApi.updateDeviceSpotInspectionRecordMain"
:apiCreate="DeviceSpotInspectionRecordMainApi.createDeviceSpotInspectionRecordMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isSearchTableItem="true"
/>
<!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceSpotInspectionRecordMain.allSchemas" /> -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="DeviceSpotInspectionRecordMain.allSchemas"
:detailAllSchemas="DeviceSpotInspectionRecordDetail.allSchemas"
:detailAllSchemasRules="DeviceSpotInspectionRecordDetailRules"
:apiCreate="DeviceSpotInspectionRecordDetailApi.createDeviceSpotInspectionRecordDetail"
:apiUpdate="DeviceSpotInspectionRecordDetailApi.updateDeviceSpotInspectionRecordDetail"
:apiPage="DeviceSpotInspectionRecordDetailApi.getDeviceSpotInspectionRecordDetailPage"
:apiDelete="DeviceSpotInspectionRecordDetailApi.deleteDeviceSpotInspectionRecordDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
:buttonControllFunction="buttonControllFunction"
/>
<Dialog
ref="updateDialog"
title="审批意见"
v-model="dialogVisible"
:width="600"
:maxHeight="700"
:style="{height:'450px'}"
:before-close="handleBeforeClose"
>
<el-form :model="updateFormValue" class="demo-form-inline">
<el-form-item label="审批意见">
<el-input
type="textarea"
v-model="updateFormValue.approveOpinion"
placeholder="请对审批添加意见"
clearable
:rows="12"
/>
</el-form-item>
</el-form>
<template #footer>
<div style="text-align: center;">
<el-button type="success" @click="onSubmit('APPROVEPASS')">通过</el-button>
<el-button type="danger" @click="onSubmit('APPROVEREJECTED')">不通过</el-button>
</div>
</template>
</Dialog>
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/eam/device-maintenance-job-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import {
DeviceSpotInspectionRecordMain,
DeviceSpotInspectionRecordMainRules,
DeviceSpotInspectionRecordDetail,
DeviceSpotInspectionRecordDetailRules
} from './moldSpotInspectionRecordMain.data'
import * as DeviceSpotInspectionRecordMainApi from '@/api/eam/mold/moldSpotInspectionRecordMain'
import { DeviceSpotInspectionRecordMainVO } from '@/api/eam/mold/moldSpotInspectionRecordMain'
import * as DeviceSpotInspectionRecordDetailApi from '@/api/eam/device/deviceSpotInspectionRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'MoldSpotInspectionRecordMain' })
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(DeviceSpotInspectionRecordMain.allSchemas.tableColumns)
const apiPage = ref(DeviceSpotInspectionRecordDetailApi.getDeviceSpotInspectionRecordDetailPage)
const detailAllSchemas = ref(DeviceSpotInspectionRecordDetail.allSchemas)
const tableData = ref([])
const dialogVisible = ref(false)
const updateFormValue = ref({//
approveOpinion:'',
id:null,
status:null
})
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
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(() => {
setV[formField] = val[0][searchField]
const setV = {}
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 Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: DeviceSpotInspectionRecordMainApi.getDeviceSpotInspectionRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'type'
}).value = 'DEVICE'
DeviceSpotInspectionRecordMain.allSchemas.formSchema.find(item => {
return item.field == 'deviceNumber'
}).componentProps.disabled = false
openForm('create')
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') {
//
getList()
} 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 = (row) => {
return [
defaultButtons.approveBtn({ hide: !(row.status == 'COMPLETED' && judgeIfMoldRole())}), //
]
}
const onChange = (field, cur, item) => {
if (field == 'deviceNumber') {
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 == 'approve') {//
dialogVisible.value = true;
updateFormValue.value.id = row.id
}
}
/** 添加/修改操作 */
const openForm = (type: string, row?: any) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail =async (row: any, titleName: any, titleValue: any) => {
const userListAll = await UserApi.getSimpleUserList()
row.maintenanceName = userListAll.find((account) => account.id == row.maintenance)?.nickname
detailRef.value.openDetail(row, titleName, titleValue,'DeviceSpotInspectionRecordMain')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DeviceSpotInspectionRecordMainApi.deleteDeviceSpotInspectionRecordMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DeviceSpotInspectionRecordMainApi.exportDeviceSpotInspectionRecordMain(tableObject.params)
download.excel(data, '维修工单主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '维修工单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
//
function acceptOrder(row) {
DeviceSpotInspectionRecordMainApi.orderStepChange(row)
}
//
function turnOrder() {}
//
function finishOrder() {}
//
function verifyOrder() {}
//
function repair() {}
//
function mainListDetail() {}
/**
* tableForm方法
*/
const tableFormKeys = {}
DeviceSpotInspectionRecordDetail.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 DeviceSpotInspectionRecordMainApi.createDeviceSpotInspectionRecordMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceSpotInspectionRecordMainApi.updateDeviceSpotInspectionRecordMain(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);
DeviceSpotInspectionRecordDetail.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 DeviceSpotInspectionRecordDetailApi.createDeviceSpotInspectionRecordDetail(data1)
message.success(t('common.createSuccess'))
} else {
await DeviceSpotInspectionRecordDetailApi.updateDeviceSpotInspectionRecordDetail(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
}
}
function buttonControllFunction(row, val) {
if (val == 'delete') {
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' ) {
return false
} else {
return true
}
} else if (val == 'edit') {
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED' ) {
return false
} else {
return true
}
} else if(val == 'add') {
if (row.status == 'COMPLETED' || row.status == 'VERIFIED' || row.status == 'REJECTED') {
return false
} else {
return true
}
} else {
return true
}
}
/**
* 判断是否为模具工程师
*/
const judgeIfMoldRole = () => {
const rolesOk = userStore.roles.find(item => {
return item == 'mold_class_Engineer_role'
})
if (rolesOk != undefined && rolesOk != null) {
return true
} else {
return false
}
}
const handleBeforeClose = async(done)=>{
done()
}
const onSubmit = async (status: string) => {
try {
const data: DeviceSpotInspectionRecordMainVO = {
approveOpinion: updateFormValue.value.approveOpinion,
status: status,
id:updateFormValue.value.id
};
await DeviceSpotInspectionRecordMainApi.updateDeviceSpotInspectionRecordMain(data);
message.success(t('common.updateSuccess'));
dialogVisible.value = false;
// Refresh the current list
getList();
} finally {
formRef.value.formLoading = false;
}
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await DeviceSpotInspectionRecordMainApi.importTemplate()
})
</script>

263
src/views/eam/mold/moldSpotInspectionRecordMain/moldSpotInspectionRecordMain.data.ts

@ -0,0 +1,263 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as UserApi from '@/api/system/user'
import { fa } from 'element-plus/es/locale'
// 邮箱账号的列表
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const userListAll = await UserApi.getSimpleUserList()
const deviceListNoPage = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'DEVICE')
const deviceDeviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const isConformList = [{
label:'是',
value:'TRUE'
},{
label:'否',
value:'FALSE'
}]
// 表单校验
export const DeviceSpotInspectionRecordMainRules = reactive({
deviceNumber: [required],
status: [required],
type: [required],
concurrencyStamp: [required],
})
export const DeviceSpotInspectionRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '巡检点检编号',
field: 'number',
sort: 'custom',
isSearch: true,
table: {
width: '150',
fixed: 'left',
},
isForm: false,
},
{
label: '设备模具',
field: 'deviceNumber',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
api: () => DeviceAccountsApi.getDeviceAccountsNoPage({
isSearch: false
}),
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceListNoPage.find((account) => account.number == cellValue)?.name
},
search:{
component: 'Select',
componentProps: {
options: deviceListNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
},
},
form: {
component: 'Select',
componentProps: {
options: deviceList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
},
}
},
{
label: '维修人',
field: 'maintenance',
sort: 'custom',
table: {
width: '150',
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
},
isDetail:false,
form: {
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
},
}
},
{
label: '维修人',
field: 'maintenanceName',
sort: 'custom',
table: {
width: '150',
},
isForm:false,
isDetail:true,
isSearch:false,
isTable:false
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
table: {
width: 'c',
},
form: {
component: 'Select'
},
},
{
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: 'getDeviceSpotInspectionRecordMainSenior',
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceDeviceTypeList.find((account) => account.value == cellValue)?.label
},
isSearch: false,
isTable: false,
search: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
filterable: true,
},
},
form: {
component: 'Select',
componentProps: {
options: deviceTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
filterable: true,
placeholder: "请选择设备"
}
},
detail:{
dictType:DICT_TYPE.APP_DEVICE_MOLD_TYPE
}
},
{
label: '描述',
field: 'describes',
sort: 'custom',
table: {
width: '300',
},
},
{
label: '审批意见',
field: 'approveOpinion',
sort: 'custom',
table: {
width: '300',
},
},
{
label: '操作',
field: 'action',
isForm: false,
isTable: true,
isDetail:false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const DeviceSpotInspectionRecordDetailRules = reactive({
number: [required],
concurrencyStamp: [required],
name: [required],
equipmentPosition: [required]
})
export const DeviceSpotInspectionRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '检修工单号',
field: 'number',
sort: 'custom',
isSearch: true,
table: {
width: '300',
},
},
{
label: '是否符合',
field: 'isConform',
sort: 'custom',
isSearch: true,
table: {
width: 'auto',
},
formatter: (_: Recordable, __: TableColumn, cellValue: String) => {
return isConformList.find((account) => account.value == cellValue)?.label
},
},
{
label: '检查内容',
field: 'name',
sort: 'custom',
table: {
width: '300',
},
isSearch: true
},
{
label: '设备部位名称',
field: 'equipmentPosition',
sort: 'custom',
table: {
width: '300',
},
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
isTable: true,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save