From d88faab9fd9966a816d63ce9564e28603299fe18 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Tue, 27 Feb 2024 14:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=A6=E6=83=85=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail/src/Detail.vue | 29 +++++++++++++---- .../deviceAccounts/deviceAccounts.data.ts | 8 +++++ .../deviceMaintainOrderMain.data.ts | 12 ++----- .../device/deviceMaintainOrderMain/index.vue | 32 +++++++++++++++---- .../mold/moldAccounts/moldAccounts.data.ts | 8 +++++ 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index d88b999..45da9ea 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -117,6 +117,7 @@ :apiCreate="apiCreate" :fromeWhere="fromeWhere" :isDetail="true" + @onChange="onChange" @searchTableSuccess="searchTableSuccess" :detailData="detailData" @submitForm="submitForm" @@ -135,7 +136,6 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import TableHead from '@/components/TableHead/src/TableHead.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import { isString } from '@/utils/is' -import { Console } from 'console' defineOptions({ name: 'Detail' }) @@ -277,6 +277,12 @@ const props = defineProps({ required: false, default: true }, + // 表格按钮权限控制 + buttonControllFunction: { + type: Function, + required: false, + default: undefined + }, }) const isShowDrawer = ref(false) const detailLoading = ref(false) @@ -350,7 +356,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: let detailButtonAdd: any = [] detailButtonAdd = props.isShowAddBtn?[ defaultButtons.defaultAddBtn({ - hide: isShowMainButton(row, ['1']) + hide: !isShowMainButton(row, 'add') }) ]:[] HeadButttondata.value = [...detailButtonAdd] @@ -359,10 +365,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: buttondata.value = [ ...[ defaultButtons.mainListEditBtn({ - hide: isShowMainButton(row, ['1']) + hide: !isShowMainButton(row, 'edit') }), // 编辑 defaultButtons.mainListDeleteBtn({ - hide: isShowMainButton(row, ['1']) + hide: !isShowMainButton(row, 'delete') }) ], // 删除 ...props.buttondataTable @@ -404,7 +410,12 @@ detailAllSchemasRef.value = props.detailAllSchemas // 根据状态返回该按钮是否显示 const isShowMainButton = (row, val) => { - return false + if (props.buttonControllFunction != undefined) { + return props.buttonControllFunction(row, val) + } else { + return true + } + } // 获得表格的各种操作 @@ -504,7 +515,8 @@ const emit = defineEmits([ 'detailOpenForm', 'tableFormButton', 'openImage', - 'detailSubmitForm' + 'detailSubmitForm', + 'detailOnChange' ]) /** 删除按钮操作 */ const handleDelete = async (id: number) => { @@ -576,6 +588,11 @@ watch( getList() } ) + +function onChange(field, cur, item) { + emit('detailOnChange', field, cur, item) +} +