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:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" > v-model:currentPage="tableObject.currentPage" >
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="buttondata(row)" @button-base-click="buttonTableClick($event, row)" /> <ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -221,6 +221,11 @@ const masterParmas=ref({
status: '',// status: '',//
}) })
//
const HeadButttondata = ref()
// -
const buttondata = ref()
/** 打开弹窗 */ /** 打开弹窗 */
const titleNameRef = ref() const titleNameRef = ref()
const titleValueRef = ref() const titleValueRef = ref()
@ -250,7 +255,16 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
getRemarkList() getRemarkList()
getFileList() getFileList()
getChangeRecordList() 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 { } finally {
detailLoading.value = false detailLoading.value = false
} }
@ -281,13 +295,20 @@ const getChangeRecordList = async () => {
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage // getListApi: props.apiPage //
}) })
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// //
const { getList } = tableMethods const { getList } = tableMethods
//
const HeadButttondata = ref([
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultFilterBtn(null), //
])
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
@ -308,13 +329,7 @@ const buttonBaseClick = (val, item) => {
// const updataTableColumns = (val) => { // const updataTableColumns = (val) => {
// detailAllSchemas.tableColumns.value = 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) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
@ -335,7 +350,6 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
} else { } else {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
console.log(formField);
props.Echo.forEach((item)=>{ props.Echo.forEach((item)=>{
setV[item] = val[0][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 defaultButtons = inject('global').defaultButtons
// //
const buttonsLeftOrRight = () => { const buttonsLeftOrRight = () => {
buttonsRight.value = []
buttonsLeft.value = []
// () // ()
// let _primarySearchOption = primarySearch[props.vueName] // let _primarySearchOption = primarySearch[props.vueName]
// let _highSearchOption = highSearch[props.vueName] // let _highSearchOption = highSearch[props.vueName]
@ -100,6 +102,13 @@ import rowDrop from "@/components/rowDrop/index.vue"
} }
buttonsLeftOrRight() buttonsLeftOrRight()
watch(
() => props.HeadButttondata,
() => {
buttonsLeftOrRight()
}
)
// //
const emit = defineEmits([ const emit = defineEmits([

Loading…
Cancel
Save