From a4ff2bc4898b1e8a9fad158dc3cc801a6f2969fb Mon Sep 17 00:00:00 2001 From: gaojs <757918719@qq.com> Date: Wed, 26 Jun 2024 13:27:39 +0800 Subject: [PATCH] =?UTF-8?q?EAM=20=E2=80=94=E2=80=94>=20=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=95=B0=E6=8D=AE=E8=BD=A6=E9=97=B4=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basicEamWorkshop/index.ts | 8 +++- src/views/eam/basicEamWorkshop/index.vue | 61 ++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/api/eam/basicEamWorkshop/index.ts b/src/api/eam/basicEamWorkshop/index.ts index 330e0a251..31acbb17c 100644 --- a/src/api/eam/basicEamWorkshop/index.ts +++ b/src/api/eam/basicEamWorkshop/index.ts @@ -1,4 +1,5 @@ import request from '@/config/axios' +import {EquipmentMainPartVO} from "@/api/eam/equipmentMainPart"; export interface BasicEamWorkshopVO { id: number @@ -56,4 +57,9 @@ export const exportBasicEamWorkshop = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/basic-eam-workshop/get-import-template' }) -} \ No newline at end of file +} + +// 启用 / 禁用 +export const updateEnableCode = async (data: BasicEamWorkshopVO) => { + return await request.post({ url: `/eam/basic-eam-workshop/ables` , data }) +} diff --git a/src/views/eam/basicEamWorkshop/index.vue b/src/views/eam/basicEamWorkshop/index.vue index 95ce7e199..c3739217a 100644 --- a/src/views/eam/basicEamWorkshop/index.vue +++ b/src/views/eam/basicEamWorkshop/index.vue @@ -33,7 +33,7 @@ @@ -65,6 +65,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import Detail from '@/components/Detail/src/Detail.vue' +import * as BasicFaultCauseApi from "@/api/eam/basicFaultCause"; defineOptions({ name: 'BasicEamWorkshop' }) @@ -131,11 +132,25 @@ const buttonBaseClick = (val, item) => { } } +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + // 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'eam:basicEamWorkshop:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'eam:basicEamWorkshop:delete'}), // 删除 -] +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi:'eam:basicEamWorkshop:update'}), // 编辑 + //defaultButtons.mainListDeleteBtn({hasPermi:'eam:basicEamWorkshop:delete'}), // 删除 + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:basicEamWorkshop:update'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:basicEamWorkshop:update'}), + ] +} + + // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -143,6 +158,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + } else if (val == 'enable') { + handleEnable(row.id) + } else if (val == 'disable') { + handleDisable(row.id) } } @@ -195,6 +214,38 @@ const handleDelete = async (id: number) => { } catch {} } + +/** 启用 */ +const handleEnable = async (id: number) => { + try { + const params = ref({ + id: '', + available:'', + }) + params.value.id = id + params.value.available = 'TRUE' + await BasicEamWorkshopApi.updateEnableCode(params.value) + message.success(t('common.updateSuccess')) + // 刷新列表 + await getList() + } catch {} +} +/** 禁用 */ +const handleDisable = async (id: number) => { + try { + const params = ref({ + id: '', + available:'', + }) + params.value.id = id + params.value.available = 'FALSE' + await BasicEamWorkshopApi.updateEnableCode(params.value) + message.success(t('common.updateSuccess')) + // 刷新列表 + await getList() + } catch {} +} + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => {