Browse Source

详情及头部组件修改按钮显隐情况

master
陈薪名 1 year ago
parent
commit
0785c51623
  1. 44
      src/components/Detail/src/Detail.vue
  2. 9
      src/components/TableHead/src/TableHead.vue

44
src/components/Detail/src/Detail.vue

@ -35,7 +35,7 @@
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" >
<template #action="{ row }">
<ButtonBase :Butttondata="buttondata(row)" @button-base-click="buttonTableClick($event, row)" />
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -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]
})

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

Loading…
Cancel
Save