From b43a6c3ac232adfdbb3115c18cc024639b122f34 Mon Sep 17 00:00:00 2001
From: zhang_li <2235006734@qqq.com>
Date: Thu, 20 Jun 2024 18:45:04 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=85=BB=E7=BB=8F=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/eam/maintainExperience/index.ts | 51 ++++
src/utils/disposition/defaultButtons.ts | 14 +-
.../equipmentMaintenanceRecordMain/index.vue | 43 ++-
.../eam/equipmentRepairRecordMain/index.vue | 6 +-
src/views/eam/maintainExperience/index.vue | 256 ++++++++++++++++++
.../maintainExperience.data.ts | 93 +++++++
6 files changed, 457 insertions(+), 6 deletions(-)
create mode 100644 src/api/eam/maintainExperience/index.ts
create mode 100644 src/views/eam/maintainExperience/index.vue
create mode 100644 src/views/eam/maintainExperience/maintainExperience.data.ts
diff --git a/src/api/eam/maintainExperience/index.ts b/src/api/eam/maintainExperience/index.ts
new file mode 100644
index 000000000..f85ae6eba
--- /dev/null
+++ b/src/api/eam/maintainExperience/index.ts
@@ -0,0 +1,51 @@
+import request from '@/config/axios'
+
+export interface MaintainExperienceVO {
+ id: number
+ name: string
+ content: string
+ masterId: number
+ orderType: string
+ maintainNumber: string
+}
+
+// 查询保养经验记录列表
+export const getMaintainExperiencePage = async (params) => {
+ if (params.isSearch) {
+ delete params.isSearch
+ const data = {...params}
+ return await request.post({ url: '/record/maintain-experience/senior', data })
+ } else {
+ return await request.get({ url: `/record/maintain-experience/page`, params })
+ }
+}
+
+// 查询保养经验记录详情
+export const getMaintainExperience = async (id: number) => {
+ return await request.get({ url: `/record/maintain-experience/get?id=` + id })
+}
+
+// 新增保养经验记录
+export const createMaintainExperience = async (data: MaintainExperienceVO) => {
+ return await request.post({ url: `/record/maintain-experience/create`, data })
+}
+
+// 修改保养经验记录
+export const updateMaintainExperience = async (data: MaintainExperienceVO) => {
+ return await request.put({ url: `/record/maintain-experience/update`, data })
+}
+
+// 删除保养经验记录
+export const deleteMaintainExperience = async (id: number) => {
+ return await request.delete({ url: `/record/maintain-experience/delete?id=` + id })
+}
+
+// 导出保养经验记录 Excel
+export const exportMaintainExperience = async (params) => {
+ return await request.download({ url: `/record/maintain-experience/export-excel`, params })
+}
+
+// 下载用户导入模板
+export const importTemplate = () => {
+ return request.download({ url: '/record/maintain-experience/get-import-template' })
+}
\ No newline at end of file
diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts
index 477b8905b..f9db6f08e 100644
--- a/src/utils/disposition/defaultButtons.ts
+++ b/src/utils/disposition/defaultButtons.ts
@@ -1136,7 +1136,7 @@ export function sparePartBtn(option:any) {
hasPermi: ''
})
}
-// 主列表-备件
+// 主列表-生成维修经验
export function repairExperienceBtn(option:any) {
return __defaultBtnOption(option,{
label: '生成维修经验',
@@ -1148,6 +1148,18 @@ export function repairExperienceBtn(option:any) {
hasPermi: ''
})
}
+// 主列表-生成保养经验
+export function maintainExperienceBtn(option:any) {
+ return __defaultBtnOption(option,{
+ label: '生成保养经验',
+ name: 'maintainExperience',
+ hide: false,
+ type: 'primary',
+ color: '',
+ link: true, // 文本展现按钮
+ hasPermi: ''
+ })
+}
// 默认按钮规则
function __defaultBtnOption(option:any,specific:any){
return {
diff --git a/src/views/eam/equipmentMaintenanceRecordMain/index.vue b/src/views/eam/equipmentMaintenanceRecordMain/index.vue
index 44f0c2e27..228b3f7e9 100644
--- a/src/views/eam/equipmentMaintenanceRecordMain/index.vue
+++ b/src/views/eam/equipmentMaintenanceRecordMain/index.vue
@@ -62,7 +62,16 @@
:detailButtonIsShowDelete=false
/>
-
+
+
@@ -73,6 +82,8 @@ import { EquipmentMaintenanceRecordMain,EquipmentMaintenanceRecordMainRules } fr
import { EquipmentMaintenanceRecordDetail,EquipmentMaintenanceRecordDetailRules } from '../equipmentMaintenanceRecordDetail/equipmentMaintenanceRecordDetail.data'
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain'
import * as EquipmentMaintenanceRecordDetailApi from '@/api/eam/equipmentMaintenanceRecordDetail'
+import { MaintainExperience,MaintainExperienceRules } from '../maintainExperience/maintainExperience.data'
+import * as MaintainExperienceApi from '@/api/eam/maintainExperience'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@@ -147,6 +158,7 @@ const buttonBaseClick = (val, item) => {
const butttondata = [
//defaultButtons.mainListEditBtn({hasPermi:'eam:equipmentMaintenanceRecordMain:update'}), // 编辑
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMaintenanceRecordMain:delete'}), // 删除
+ defaultButtons.maintainExperienceBtn({ hasPermi: 'eam:equipmentMaintenanceRecordMain:maintainExperience' }) // 生成保养经验
]
// 列表-操作按钮事件
@@ -155,6 +167,9 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { // 删除
handleDelete(row.id)
+ } else if (val == 'maintainExperience') {
+ //生成保养经验
+ openMaintainExperience('update', row)
}
}
@@ -163,7 +178,11 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
-
+//打开维修经验坦诚
+const maintainExperienceFormRef = ref()
+const openMaintainExperience = (type: string, row?: any) => {
+ maintainExperienceFormRef.value.open(type, row)
+}
// form表单提交
const formsSuccess = async (formType,data) => {
var isHave =EquipmentMaintenanceRecordMain.allSchemas.formSchema.some(function (item) {
@@ -193,6 +212,26 @@ const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentMaintenanceRecordMain')
}
+// 新增生成维修经验
+const maintainExperienceFormsSuccess = async (formType, data) => {
+ console.log(data)
+ const data1 = {
+ maintainRecordNumber: data.recordNo,
+ name: data.name,
+ content: data.content,
+ masterId: data.id,
+ orderType: 'MAINTAIN',
+ }
+ console.log(data1)
+ try {
+ await MaintainExperienceApi.createMaintainExperience(data1)
+ message.success(t('common.createSuccess'))
+ maintainExperienceFormRef.value.dialogVisible = false
+ getList()
+ } finally {
+ maintainExperienceFormRef.value.formLoading = false
+ }
+}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
diff --git a/src/views/eam/equipmentRepairRecordMain/index.vue b/src/views/eam/equipmentRepairRecordMain/index.vue
index d9b2fe9bc..91aa00756 100644
--- a/src/views/eam/equipmentRepairRecordMain/index.vue
+++ b/src/views/eam/equipmentRepairRecordMain/index.vue
@@ -70,7 +70,7 @@
{
name: data.name,
content: data.content,
masterId: data.id,
- ooderType: 'REPAIR',
+ orderType: 'REPAIR',
}
console.log(data1)
try {
diff --git a/src/views/eam/maintainExperience/index.vue b/src/views/eam/maintainExperience/index.vue
new file mode 100644
index 000000000..d1b8c1620
--- /dev/null
+++ b/src/views/eam/maintainExperience/index.vue
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ row.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/eam/maintainExperience/maintainExperience.data.ts b/src/views/eam/maintainExperience/maintainExperience.data.ts
new file mode 100644
index 000000000..48c468fbc
--- /dev/null
+++ b/src/views/eam/maintainExperience/maintainExperience.data.ts
@@ -0,0 +1,93 @@
+import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
+import { dateFormatter } from '@/utils/formatTime'
+
+// 表单校验
+export const MaintainExperienceRules = reactive({
+ name: [required],
+ maintainNumber: [required],
+})
+
+export const MaintainExperience = useCrudSchemas(reactive([
+
+ {
+ label: '经验标题',
+ field: 'name',
+ sort: 'custom',
+ isSearch: true,
+ },
+ {
+ label: '经验内容',
+ field: 'content',
+ sort: 'custom',
+ isTable:false,
+ form: {
+ componentProps: {
+ type: 'textarea',
+ height: 200
+ }
+ },
+ },
+
+ {
+ label: '保养工单编号',
+ field: 'maintainNumber',
+ sort: 'custom',
+ isSearch: true,
+ isForm: false,
+ },
+ {
+ label: '工单类型',
+ field: 'orderType',
+ sort: 'custom',
+ isForm: false,
+ isTable: false,
+ form: {
+ component: 'SelectV2'
+ },
+ },
+ {
+ label: '来源字典',
+ field: 'sources',
+ sort: 'custom',
+ dictType: DICT_TYPE.EAM_MAINTENANCE_SOURCES,
+ dictClass: 'string', // 默认都是字符串类型其他暂不考虑
+ isSearch: false,
+ isForm:false
+ },
+ {
+ label: '保养类型',
+ field: 'type',
+ sort: 'custom',
+ dictType: DICT_TYPE.DEVICE_TYPE,
+ dictClass: 'string', // 默认都是字符串类型其他暂不考虑
+ isSearch: false,
+ isForm:false
+ },
+ {
+ label: '设备/工装编号',
+ field: 'equipmentCode',
+ sort: 'custom',
+ isSearch:false,
+ isForm:false
+ },
+ {
+ label: '设备/工装名称',
+ field: 'equipmentName',
+ sort: 'custom',
+ isSearch:false,
+ isForm:false
+ },
+ {
+ label: '创建时间',
+ field: 'createTime',
+ sort: 'custom',
+ formatter: dateFormatter,
+ isForm: false,
+ detail:{
+ dateFormat: 'YYYY-MM-DD HH:mm:ss'
+ }
+ },
+
+
+
+]))