Browse Source

保养项历史记录功能

master
ljlong_2630 7 months ago
parent
commit
981294241d
  1. 4
      src/api/eam/basic/deviceMaintenance/index.ts
  2. 60
      src/api/eam/basic/deviceMoldItemsHistory/index.ts
  3. 4
      src/api/eam/basic/inspection/index.ts
  4. 4
      src/api/eam/basic/moldMaintenance/index.ts
  5. 111
      src/views/eam/basic/deviceMaintenance/index.vue
  6. 158
      src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts
  7. 244
      src/views/eam/basic/deviceMoldItemsHistory/index.vue
  8. 3
      src/views/eam/basic/fixedAssets/fixedAssets.data.ts
  9. 104
      src/views/eam/basic/inspection/index.vue
  10. 100
      src/views/eam/basic/moldMaintenance/index.vue
  11. 22
      src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts
  12. 4
      src/views/eam/device/devicemaintainjob/index.vue

4
src/api/eam/basic/deviceMaintenance/index.ts

@ -49,8 +49,8 @@ export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
} }
// 删除项记录表(设备 模具 保养 维修 巡检点检) // 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => { export const deleteDeviceMoldItems = async (id: number,remark: string) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id }) return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id + `&remark=` + remark })
} }
// 导出项记录表(设备 模具 保养 维修 巡检点检) Excel // 导出项记录表(设备 模具 保养 维修 巡检点检) Excel

60
src/api/eam/basic/deviceMoldItemsHistory/index.ts

@ -0,0 +1,60 @@
import request from '@/config/axios'
export interface DeviceMoldItemsHistoryVO {
id: number
name: string
deviceNumber: string
executionCycle: string
equipmentParts: string
type: string
status: string
peoples: number
estimatedMinutes: number
remark: string
siteId: string
available: string
concurrencyStamp: number
peopleNum: number
maintenanceTime: number
}
// 查询项记录历史表(设备 模具 保养 维修 巡检点检)列表
export const getDeviceMoldItemsHistoryPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/record/device-mold-items-history/senior', data })
} else {
return await request.get({ url: `/record/device-mold-items-history/page`, params })
}
}
// 查询项记录历史表(设备 模具 保养 维修 巡检点检)详情
export const getDeviceMoldItemsHistory = async (id: number) => {
return await request.get({ url: `/record/device-mold-items-history/get?id=` + id })
}
// 新增项记录历史表(设备 模具 保养 维修 巡检点检)
export const createDeviceMoldItemsHistory = async (data: DeviceMoldItemsHistoryVO) => {
return await request.post({ url: `/record/device-mold-items-history/create`, data })
}
// 修改项记录历史表(设备 模具 保养 维修 巡检点检)
export const updateDeviceMoldItemsHistory = async (data: DeviceMoldItemsHistoryVO) => {
return await request.put({ url: `/record/device-mold-items-history/update`, data })
}
// 删除项记录历史表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItemsHistory = async (id: number) => {
return await request.delete({ url: `/record/device-mold-items-history/delete?id=` + id })
}
// 导出项记录历史表(设备 模具 保养 维修 巡检点检) Excel
export const exportDeviceMoldItemsHistory = async (params) => {
return await request.download({ url: `/record/device-mold-items-history/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/record/device-mold-items-history/get-import-template' })
}

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

@ -49,8 +49,8 @@ export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
} }
// 删除项记录表(设备 模具 保养 维修 巡检点检) // 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => { export const deleteDeviceMoldItems = async (id: number, remark: string) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id }) return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id + `&remark=` + remark })
} }
// 导出项记录表(设备 模具 保养 维修 巡检点检) Excel // 导出项记录表(设备 模具 保养 维修 巡检点检) Excel

4
src/api/eam/basic/moldMaintenance/index.ts

@ -49,8 +49,8 @@ export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
} }
// 删除项记录表(设备 模具 保养 维修 巡检点检) // 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => { export const deleteDeviceMoldItems = async (id: number, remark: string) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id }) return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id + `&remark=` + remark })
} }
// 导出项记录表(设备 模具 保养 维修 巡检点检) Excel // 导出项记录表(设备 模具 保养 维修 巡检点检) Excel

111
src/views/eam/basic/deviceMaintenance/index.vue

@ -54,6 +54,33 @@
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenance.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenance.allSchemas" />
<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.remark"
placeholder="请对本次修改内容添加备注"
clearable
:rows="12"
/>
</el-form-item>
</el-form>
<template #footer>
<div style="text-align: center;">
<el-button type="primary" @click="onSubmit">提交</el-button>
</div>
</template>
</Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -63,6 +90,7 @@ import * as DeviceMaintenanceApi from '@/api/eam/basic/deviceMaintenance'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import { updateForm } from '@/api/bpm/form'
defineOptions({ name: 'DeviceMaintenance' }) defineOptions({ name: 'DeviceMaintenance' })
@ -72,6 +100,16 @@ const route = useRoute() // 路由信息
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceMaintenance.allSchemas.tableColumns) const tableColumns = ref(DeviceMaintenance.allSchemas.tableColumns)
const updateDialog = ref()
const dialogVisible = ref(false)
const updateData = ref()
const updateFormValue = reactive({
remark: '',
})
const openDataOld = ref()
const openDataNew = ref()
const operatType = ref('')
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -134,8 +172,11 @@ const butttondata = [
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
operatType.value = 'edit'
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
operatType.value = 'delete'
updateData.value = row
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -143,6 +184,8 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
openDataOld.value = row
updateFormValue.remark = ''
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -162,12 +205,20 @@ const formsSuccess = async (formType,data) => {
if (formType === 'create') { if (formType === 'create') {
await DeviceMaintenanceApi.createDeviceMoldItems(data) await DeviceMaintenanceApi.createDeviceMoldItems(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
basicFormRef.value.dialogVisible = false
getList()
} else { } else {
await DeviceMaintenanceApi.updateDeviceMoldItems(data) openDataNew.value = data
message.success(t('common.updateSuccess')) if(judgeSame()){
basicFormRef.value.dialogVisible = false
getList()
}else{
updateData.value = data
dialogVisible.value = true
}
} }
basicFormRef.value.dialogVisible = false
getList()
} }
/** 详情操作 */ /** 详情操作 */
@ -181,11 +232,9 @@ const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
//
await DeviceMaintenanceApi.deleteDeviceMoldItems(id) dialogVisible.value = true
message.success(t('common.delSuccess'))
//
await getList()
} catch {} } catch {}
} }
@ -216,6 +265,50 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const onSubmit = async () => {
console.log('submit!');
updateData.value.remark = updateFormValue.remark
try {
if(operatType.value == 'edit'){
await DeviceMaintenanceApi.updateDeviceMoldItems(updateData.value);
message.success(t('common.updateSuccess'));
// ""
basicFormRef.value.dialogVisible = false; // basicFormRef
dialogVisible.value = false; // updateDialog
}else if(operatType.value == 'delete'){
//
await DeviceMaintenanceApi.deleteDeviceMoldItems(updateData.value.id,updateData.value.remark)
message.success(t('common.delSuccess'))
dialogVisible.value = false;
}
//
await getList()
} catch (error) {
console.error(error);
// basicFormRef
// updateDialog
message.error(t('common.updateFailed'));
}
};
const handleBeforeClose = async(done)=>{
basicFormRef.value.formLoading = false
done()
}
//
const judgeSame = () => {
// openDataOld.value
const keys = Object.keys(openDataOld.value);
// 使every()
const isSame = keys.every(key => {
// openDataNew.value
return openDataNew.value.hasOwnProperty(key) && openDataOld.value[key] === openDataNew.value[key];
});
//
return isSame;
};
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

158
src/views/eam/basic/deviceMoldItemsHistory/deviceMoldItemsHistory.data.ts

@ -0,0 +1,158 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const operatTypeList = getStrDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE).filter(item => {
return (item.value == '2' || item.value == '3' || item.value == '4')
})
// 表单校验
export const DeviceMoldItemsHistoryRules = reactive({
name: [required],
deviceNumber: [required],
type: [required],
status: [required],
concurrencyStamp: [required]
})
export const DeviceMoldItemsHistory = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '保养内容',
field: 'name',
sort: 'custom',
isSearch: false
},
{
label: '设备模具编号',
field: 'deviceNumber',
sort: 'custom',
isSearch: true,
},
{
label: '设备模具名称',
field: 'deviceName',
sort: 'custom',
isSearch: false,
},
{
label: '执行周期',
field: 'executionCycle',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.MOLD_EXECUTION_CYCLE,
dictClass: 'string',
},
{
label: '设备部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: false
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select'
}
},
{
label: '项类型',
field: 'status',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEVICEMOLDITEMS_STATUS,
dictClass: 'string',
form: {
component: 'Select',
value: 'MAINTAIN',
componentProps: {
disabled: true
}
},
},
{
label: '人数',
field: 'peoples',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '预计所需时间',
field: 'estimatedMinutes',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '人数',
field: 'peopleNum',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '保养所需时间(单位小时)',
field: 'maintenanceTime',
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '操作类型',
field: 'operatType',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return operatTypeList.find((account) => account.value == cellValue)?.label
},
search: {
component: 'Select',
componentProps: {
disabled: false,
options:operatTypeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
filterable: true,
placeholder: "请选择责类型",
},
}
},
{
label: '操作备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
]))

244
src/views/eam/basic/deviceMoldItemsHistory/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DeviceMoldItemsHistory.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMoldItemsHistory.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="DeviceMoldItemsHistoryRules"
:formAllSchemas="DeviceMoldItemsHistory.allSchemas"
:apiUpdate="DeviceMoldItemsHistoryApi.updateDeviceMoldItemsHistory"
:apiCreate="DeviceMoldItemsHistoryApi.createDeviceMoldItemsHistory"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMoldItemsHistory.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/record/device-mold-items-history/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DeviceMoldItemsHistory,DeviceMoldItemsHistoryRules } from './deviceMoldItemsHistory.data'
import * as DeviceMoldItemsHistoryApi from '@/api/eam/basic/deviceMoldItemsHistory'
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: 'DeviceMoldItemsHistory' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMoldItemsHistory.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: DeviceMoldItemsHistoryApi.getDeviceMoldItemsHistoryPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMoldItemsHistory:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMoldItemsHistory:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMoldItemsHistory:export'}), //
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 == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMoldItemsHistory:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMoldItemsHistory:delete'}), //
]
// -
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 =DeviceMoldItemsHistory.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 DeviceMoldItemsHistoryApi.createDeviceMoldItemsHistory(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMoldItemsHistoryApi.updateDeviceMoldItemsHistory(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, 'basicDeviceMoldItemsHistory')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DeviceMoldItemsHistoryApi.deleteDeviceMoldItemsHistory(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 DeviceMoldItemsHistoryApi.exportDeviceMoldItemsHistory(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() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await DeviceMoldItemsHistoryApi.importTemplate()
})
</script>

3
src/views/eam/basic/fixedAssets/fixedAssets.data.ts

@ -138,6 +138,9 @@ export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: '150', width: '150',
}, },
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return supplierList.find((account) => account.number == cellValue)?.name
},
form:{ form:{
component: 'Select', component: 'Select',
componentProps: { componentProps: {

104
src/views/eam/basic/inspection/index.vue

@ -53,6 +53,34 @@
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMoldItems.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMoldItems.allSchemas" />
<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.remark"
placeholder="请对本次修改内容添加备注"
clearable
:rows="12"
/>
</el-form-item>
</el-form>
<template #footer>
<div style="text-align: center;">
<el-button type="primary" @click="onSubmit">提交</el-button>
</div>
</template>
</Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -72,6 +100,15 @@ const route = useRoute() // 路由信息
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceMoldItems.allSchemas.tableColumns) const tableColumns = ref(DeviceMoldItems.allSchemas.tableColumns)
const updateDialog = ref()
const dialogVisible = ref(false)
const updateData = ref()
const updateFormValue = reactive({
remark: '',
})
const openDataOld = ref()
const openDataNew = ref()
const operatType = ref('')
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -134,8 +171,11 @@ const butttondata = [
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
operatType.value = 'edit'
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
operatType.value = 'delete'
updateData.value = row
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -143,6 +183,8 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
openDataOld.value = row
updateFormValue.remark = ''
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -163,8 +205,14 @@ const formsSuccess = async (formType,data) => {
await DeviceMoldItemsApi.createDeviceMoldItems(data) await DeviceMoldItemsApi.createDeviceMoldItems(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await DeviceMoldItemsApi.updateDeviceMoldItems(data) openDataNew.value = data
message.success(t('common.updateSuccess')) if(judgeSame()){
basicFormRef.value.dialogVisible = false
getList()
}else{
updateData.value = data
dialogVisible.value = true
}
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
@ -181,11 +229,8 @@ const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
//
await DeviceMoldItemsApi.deleteDeviceMoldItems(id) dialogVisible.value = true
message.success(t('common.delSuccess'))
//
await getList()
} catch {} } catch {}
} }
@ -216,6 +261,51 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const onSubmit = async () => {
console.log('submit!');
updateData.value.remark = updateFormValue.remark
try {
if(operatType.value == 'edit'){
await DeviceMoldItemsApi.updateDeviceMoldItems(updateData.value);
message.success(t('common.updateSuccess'));
// ""
basicFormRef.value.dialogVisible = false; // basicFormRef
dialogVisible.value = false; // updateDialog
}else if(operatType.value == 'delete'){
//
await DeviceMoldItemsApi.deleteDeviceMoldItems(updateData.value.id,updateData.value.remark)
message.success(t('common.delSuccess'))
dialogVisible.value = false;
}
//
await getList()
} catch (error) {
console.error(error);
// basicFormRef
// updateDialog
message.error(t('common.updateFailed'));
}
};
const handleBeforeClose = async(done)=>{
basicFormRef.value.formLoading = false
done()
}
//
const judgeSame = () => {
// openDataOld.value
const keys = Object.keys(openDataOld.value);
// 使every()
const isSame = keys.every(key => {
// openDataNew.value
return openDataNew.value.hasOwnProperty(key) && openDataOld.value[key] === openDataNew.value[key];
});
//
return isSame;
};
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

100
src/views/eam/basic/moldMaintenance/index.vue

@ -53,6 +53,33 @@
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenance.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="MoldMaintenance.allSchemas" />
<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.remark"
placeholder="请对本次修改内容添加备注"
clearable
:rows="12"
/>
</el-form-item>
</el-form>
<template #footer>
<div style="text-align: center;">
<el-button type="primary" @click="onSubmit">提交</el-button>
</div>
</template>
</Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -71,6 +98,15 @@ const route = useRoute() // 路由信息
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(MoldMaintenance.allSchemas.tableColumns) const tableColumns = ref(MoldMaintenance.allSchemas.tableColumns)
const updateDialog = ref()
const dialogVisible = ref(false)
const updateData = ref()
const updateFormValue = reactive({
remark: '',
})
const openDataOld = ref()
const openDataNew = ref()
const operatType = ref('')
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -133,8 +169,11 @@ const butttondata = [
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
operatType.value = 'edit'
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
operatType.value = 'delete'
updateData.value = row
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -142,6 +181,8 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
openDataOld.value = row
updateFormValue.remark = ''
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -162,8 +203,14 @@ const formsSuccess = async (formType,data) => {
await MoldMaintenanceApi.createDeviceMoldItems(data) await MoldMaintenanceApi.createDeviceMoldItems(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await MoldMaintenanceApi.updateDeviceMoldItems(data) openDataNew.value = data
message.success(t('common.updateSuccess')) if(judgeSame()){
basicFormRef.value.dialogVisible = false
getList()
}else{
updateData.value = data
dialogVisible.value = true
}
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
@ -180,10 +227,8 @@ const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
//
await MoldMaintenanceApi.deleteDeviceMoldItems(id) dialogVisible.value = true
message.success(t('common.delSuccess'))
//
await getList() await getList()
} catch {} } catch {}
} }
@ -215,6 +260,49 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const onSubmit = async () => {
console.log('submit!');
updateData.value.remark = updateFormValue.remark
try {
if(operatType.value == 'edit'){
await MoldMaintenanceApi.updateDeviceMoldItems(updateData.value);
message.success(t('common.updateSuccess'));
// ""
basicFormRef.value.dialogVisible = false; // basicFormRef
dialogVisible.value = false; // updateDialog
}else if(operatType.value == 'delete'){
//
await MoldMaintenanceApi.deleteDeviceMoldItems(updateData.value.id,updateData.value.remark)
message.success(t('common.delSuccess'))
dialogVisible.value = false;
}
} catch (error) {
console.error(error);
// basicFormRef
// updateDialog
message.error(t('common.updateFailed'));
}
};
const handleBeforeClose = async(done)=>{
basicFormRef.value.formLoading = false
done()
}
//
const judgeSame = () => {
// openDataOld.value
const keys = Object.keys(openDataOld.value);
// 使every()
const isSame = keys.every(key => {
// openDataNew.value
return openDataNew.value.hasOwnProperty(key) && openDataOld.value[key] === openDataNew.value[key];
});
//
return isSame;
};
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

22
src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts

@ -234,22 +234,19 @@ export const DeviceMaintainOrderDetailRules = reactive({
concurrencyStamp: [required], concurrencyStamp: [required],
name: [required], name: [required],
number: [required], number: [required],
status: [required],
peoples: [ peoples: [
required,
required, { validator:validateNum, message: '请输入正整数', trigger: 'blur'},
{ validator:validateNum, message: '请输入正整数', trigger: 'blur'}, { validator:validateNum100, message: '预估人数不得超出100', trigger: 'blur'},
{ validator:validateNum100, message: '预估人数不得超出100', trigger: 'blur'},
], ],
estimatedMinutes: [ estimatedMinutes: [
required,
required, { validator:validateNum, message: '请输入正整数', trigger: 'blur'},
{ validator:validateNum, message: '请输入正整数', trigger: 'blur'},
], ],
actualMinutes: [ actualMinutes: [
required,
required, { validator:validateNum, message: '请输入正整数', trigger: 'blur'},
{ validator:validateNum, message: '请输入正整数', trigger: 'blur'},
], ],
chargePeoples: [required], chargePeoples: [required],
completionTime: [required], completionTime: [required],
@ -338,7 +335,6 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
}, },
api: () => dutyUserList, api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',') return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
}, },
form: { form: {

4
src/views/eam/device/devicemaintainjob/index.vue

@ -112,6 +112,7 @@ import * as DeviceMaintainOrderDetailApi from '@/api/eam/device/deviceMaintainOr
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'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
defineOptions({ name: 'DeviceMaintainOrderMain' }) defineOptions({ name: 'DeviceMaintainOrderMain' })
const message = useMessage() // const message = useMessage() //
@ -280,10 +281,7 @@ const openForm = (type: string, row?: any) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail =async (row: any, titleName: any, titleValue: any) => { const openDetail =async (row: any, titleName: any, titleValue: any) => {
const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const userListAll = await UserApi.getSimpleUserList() const userListAll = await UserApi.getSimpleUserList()
row.factoryAreaNumber1 = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
row.maintenanceName = userListAll.find((account) => account.id == row.maintenance)?.nickname row.maintenanceName = userListAll.find((account) => account.id == row.maintenance)?.nickname
detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintainOrderMain') detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintainOrderMain')
} }

Loading…
Cancel
Save