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([