From 0785c516239b225265ae1d92cff32f05253be06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Thu, 2 Nov 2023 16:30:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=8F=8A=E5=A4=B4=E9=83=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BF=AE=E6=94=B9=E6=8C=89=E9=92=AE=E6=98=BE?= =?UTF-8?q?=E9=9A=90=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail/src/Detail.vue | 44 ++++++++++++++-------- src/components/TableHead/src/TableHead.vue | 9 +++++ 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index 9066457e4..0491409a6 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -35,7 +35,7 @@ v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" > @@ -221,6 +221,11 @@ const masterParmas=ref({ status: '',//主表状态 用于控制子表新增编辑按钮显示情况 }) +// 列表头部按钮 +const HeadButttondata = ref() +// 列表-操作按钮 +const buttondata = ref() + /** 打开弹窗 */ const titleNameRef = ref() const titleValueRef = ref() @@ -250,7 +255,16 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: getRemarkList() getFileList() getChangeRecordList() - + // 判断详情新增按钮是否显示 + HeadButttondata.value = [ + defaultButtons.defaultAddBtn({hide:isShowMainButton(row,['ORDER_READY','PLAN_NEW','PLAN_PURCHASE_READY','REQUEST_NEW'])}), // 新增 + defaultButtons.defaultFilterBtn(null), // 筛选 + ] + // 动态显示操作列按钮 + buttondata.value = [ + defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['ORDER_READY','PLAN_NEW','PLAN_PURCHASE_READY','REQUEST_NEW'])}), // 编辑 + defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['ORDER_READY','PLAN_NEW','PLAN_PURCHASE_READY','REQUEST_NEW'])}), // 删除 + ] } finally { detailLoading.value = false } @@ -281,13 +295,20 @@ const getChangeRecordList = async () => { const { tableObject, tableMethods } = useTable({ getListApi: props.apiPage // 分页接口 }) + +// 根据状态返回该按钮是否显示 +const isShowMainButton = (row,val) => { + if (val.indexOf(row.status) > -1) { + return false + } else { + return true + } +} + + // 获得表格的各种操作 const { getList } = tableMethods -// 列表头部按钮 -const HeadButttondata = ref([ - defaultButtons.defaultAddBtn(null), // 新增 - defaultButtons.defaultFilterBtn(null), // 筛选 -]) + // 头部按钮事件 const buttonBaseClick = (val, item) => { if (val == 'add') { // 新增 @@ -308,13 +329,7 @@ const buttonBaseClick = (val, item) => { // const updataTableColumns = (val) => { // detailAllSchemas.tableColumns.value = val // } -// 列表-操作按钮 -const buttondata = (row) => { - return [ - defaultButtons.mainListEditBtn({ hide: masterParmas.value.status=='REQUEST_NEW'?false:true, hasPermi: 'wms:purchaseclaim-request-main:update' }), // 编辑 - defaultButtons.mainListDeleteBtn({ hide: masterParmas.value.status=='REQUEST_NEW'?false:true, hasPermi: 'wms:purchaseclaim-request-main:delete' }), // 删除 - ] -} + // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { if (val == 'edit') { // 编辑 @@ -335,7 +350,6 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => } else { const setV = {} setV[formField] = val[0][searchField] - console.log(formField); props.Echo.forEach((item)=>{ setV[item] = val[0][item] }) diff --git a/src/components/TableHead/src/TableHead.vue b/src/components/TableHead/src/TableHead.vue index 241d3445c..d61e20aa6 100644 --- a/src/components/TableHead/src/TableHead.vue +++ b/src/components/TableHead/src/TableHead.vue @@ -83,6 +83,8 @@ import rowDrop from "@/components/rowDrop/index.vue" // const defaultButtons = inject('global').defaultButtons // 创建左右按钮数据 const buttonsLeftOrRight = () => { + buttonsRight.value = [] + buttonsLeft.value = [] // 判断是否有筛选按钮(判断筛选按钮的逻辑位置,影响筛选按钮的位置) // let _primarySearchOption = primarySearch[props.vueName] // let _highSearchOption = highSearch[props.vueName] @@ -100,6 +102,13 @@ import rowDrop from "@/components/rowDrop/index.vue" } buttonsLeftOrRight() +watch( + () => props.HeadButttondata, + () => { + buttonsLeftOrRight() + } +) + // 传递给父类 const emit = defineEmits([