From 4fd529893fa899f9ae3c2fac54de0e0f162fca0c Mon Sep 17 00:00:00 2001 From: zhaoyiran Date: Mon, 28 Oct 2024 16:48:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E7=BB=84=E5=90=88=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E5=90=AF=E7=94=A8=E3=80=81=E5=81=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/itemSyntheticRelation/index.ts | 10 +++- .../itemSyntheticRelation/index.vue | 51 ++++++++++++++++--- .../itemSyntheticRelation.data.ts | 17 ++++--- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/src/api/wms/itemSyntheticRelation/index.ts b/src/api/wms/itemSyntheticRelation/index.ts index a3139afed..5272c3f1d 100644 --- a/src/api/wms/itemSyntheticRelation/index.ts +++ b/src/api/wms/itemSyntheticRelation/index.ts @@ -51,4 +51,12 @@ export const exportItemSyntheticRelation = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/item-synthetic-relation/get-import-template' }) -} \ No newline at end of file +} + +export async function enableItemSyntheticRelation(id: number) { + return await request.enable({ url: `/wms/item-synthetic-relation/enable?id=` + id }) +} + +export async function disableItemSyntheticRelation(id: number) { + return await request.disable({ url: `/wms/item-synthetic-relation/disable?id=` + id }) +} diff --git a/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/index.vue b/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/index.vue index aca0b5a0c..fdb7a3aa2 100644 --- a/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/index.vue +++ b/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/index.vue @@ -33,7 +33,7 @@ @@ -73,6 +73,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 SamplingProcessApi from "@/api/qms/samplingProcess"; defineOptions({ name: 'ItemSyntheticRelation' }) @@ -144,11 +145,27 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'wms:itemSyntheticRelation:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'wms:itemSyntheticRelation:delete'}), // 删除 -] +const isShowMainButton = (row, val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi:'wms:itemSyntheticRelation:update'}), // 编辑 + defaultButtons.mainListEnableBtn({ + hide: isShowMainButton(row, ['FALSE']), + hasPermi: 'wms:itemSyntheticRelation:enable' + }), + defaultButtons.mainListDisableBtn({ + hide: isShowMainButton(row, ['TRUE']), + hasPermi: 'wms:itemSyntheticRelation:disable' + }), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -156,6 +173,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) } } @@ -208,6 +229,24 @@ const handleDelete = async (id: number) => { } catch {} } +const handleEnable = async (id: number) => { + try { + await ItemSyntheticRelationApi.enableItemSyntheticRelation(id) + message.success(t('common.updateSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await ItemSyntheticRelationApi.disableItemSyntheticRelation(id) + message.success(t('common.updateSuccess')) + // 刷新列表 + await getList() + } catch {} +} + + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => { diff --git a/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/itemSyntheticRelation.data.ts b/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/itemSyntheticRelation.data.ts index 2251ea264..c06a468ed 100644 --- a/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/itemSyntheticRelation.data.ts +++ b/src/views/wms/basicDataManage/itemManage/itemSyntheticRelation/itemSyntheticRelation.data.ts @@ -92,14 +92,15 @@ export const ItemSyntheticRelation = useCrudSchemas(reactive([ table: { width: 120 }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE' - } - } + isForm:false, + // form: { + // component: 'Switch', + // value: 'TRUE', + // componentProps: { + // inactiveValue: 'FALSE', + // activeValue: 'TRUE' + // } + // } }, { label: '操作',