|
@@ -14,9 +14,11 @@
|
|
|
</div>
|
|
|
<div class="TablePage_dialog">
|
|
|
<!--新增/编辑-->
|
|
|
- <PublicPageDialog :dialog-title="tableTitle" dialogSize="630px" :dialog-drawer="flag" @handleClose="submitClickClose('ruleForm')" @handleSubmit="submitClickHandler">
|
|
|
- <PublicPageForm ref="ruleForm" :label-width="labelWidth" :form-item="formItem" :form-data="tableForm" />
|
|
|
- </PublicPageDialog>
|
|
|
+ <template v-if="dialogName">
|
|
|
+ <PublicPageDialog :dialog-title="tableTitle" dialogSize="630px" :dialog-drawer="flag" @handleClose="submitClickClose('ruleForm')" @handleSubmit="submitClickHandler">
|
|
|
+ <PublicPageForm ref="ruleForm" :label-width="labelWidth" :form-item="formItem" :form-data="tableForm" />
|
|
|
+ </PublicPageDialog>
|
|
|
+ </template>
|
|
|
<!--删除-->
|
|
|
<PublicPageDialog dialog-title="删除" :dialog-drawer="rmFlag" @handleClose="rmFlag = false" @handleSubmit="tableRemove">
|
|
|
<div class="content del-content">
|
|
@@ -69,6 +71,7 @@ export default {
|
|
|
defaultfilter: { 1: 1 }, //默认查询参数
|
|
|
pageQuery: {},
|
|
|
dialogFlag: false,
|
|
|
+ dialogName: '', //弹框名称
|
|
|
pageTitle: '', //页面名称
|
|
|
treeData: [], //tree数据
|
|
|
treeParameters: {}, //tree传递参数
|
|
@@ -76,6 +79,7 @@ export default {
|
|
|
tableData: [], //表格数据
|
|
|
tableBtns: [], //表格按钮权限
|
|
|
authBtns: [], //表格里面的操作按钮
|
|
|
+ tableBtnForms: [], //表格按钮下的form表单权限
|
|
|
dataContent: {}, //表格查询数据
|
|
|
pageServiceId: null, //表格serviceid
|
|
|
formItem: [], //弹框表单渲染数据
|
|
@@ -136,14 +140,16 @@ export default {
|
|
|
const pageAuthArrs = pageAuths.filter(item => item['superiorid'] == auth_id)
|
|
|
if (!pageAuthArrs.length) return
|
|
|
//获取tree权限
|
|
|
- const pageAuthtrees = pageAuthArrs.filter(item => item.pagetype == 5)
|
|
|
+ const pageAuthtrees = pageAuthArrs.filter(item => item.pagetype == 'tree')
|
|
|
if (pageAuthtrees?.length) this.getPageTreeSetting(pageAuths, pageAuthtrees)
|
|
|
//获取table权限
|
|
|
- const pageAuthtables = pageAuthArrs.filter(item => item.pagetype == 3)
|
|
|
+ const pageAuthtables = pageAuthArrs.filter(item => item.pagetype == 'table')
|
|
|
if (pageAuthtables?.length) this.getPageTableSetting(pageAuths, pageAuthtables)
|
|
|
//获取按钮权限
|
|
|
- const pageAuthbtns = pageAuthArrs.filter(item => item.pagetype == 4)
|
|
|
+ const pageAuthbtns = pageAuthArrs.filter(item => item.pagetype == 'button')
|
|
|
if (pageAuthbtns?.length) this.getPageBtnSetting(pageAuthbtns)
|
|
|
+ //获取form表单弹框权限
|
|
|
+ if (this.tableBtns?.length) this.getPageBtnFormSetting(pageAuths, this.tableBtns)
|
|
|
},
|
|
|
//根据页面tree设置数据
|
|
|
getPageTreeSetting (pageAuths, pageAuthtrees) {
|
|
@@ -157,46 +163,42 @@ export default {
|
|
|
//获取当前页面table的配置
|
|
|
const { pagename, pageconfigurationid, serviceid, pagecode, userpermissionsid, defaultfilter } = authTableObj
|
|
|
//获取当前页面table的按钮权限
|
|
|
- const currPageBtns = pageAuths.filter(item => item['superiorid'] == pageconfigurationid)
|
|
|
+ const currPageBtns = pageAuths.filter(item => item['superiorid'] == pageconfigurationid && item.pagetype == 'button')
|
|
|
if (currPageBtns?.length) this.tableBtns.push(...currPageBtns)
|
|
|
- this.authBtns = pageAuths.filter(item => item.superiorid == pageconfigurationid && item.pagetype == 4)
|
|
|
+ this.authBtns = pageAuths.filter(item => item.superiorid == pageconfigurationid && item.pagetype == 'button')
|
|
|
this.pageServiceId = Object.keys(this.msgContent).length ? this.msgContent.serviceid : serviceid;
|
|
|
this.pageTitle = pagename
|
|
|
this.defaultfilter = Object.keys(this.pageQuery).length ? this.pageQuery : defaultfilter ? this.formatDefault(defaultfilter, authTableObj) : { 1: 1 }
|
|
|
- this.getColumnData(pagecode, userpermissionsid)
|
|
|
+ const tableColumnArrs = pageAuths.filter(item => item['superiorid'] == pageconfigurationid && item['pagetype'] == 'column')
|
|
|
+ this.getColumnData(tableColumnArrs)
|
|
|
},
|
|
|
//根据页面按钮设置数据
|
|
|
getPageBtnSetting (pageAuthbtns) {
|
|
|
this.tableBtns.push(...pageAuthbtns)
|
|
|
},
|
|
|
+ //根据页面按钮设置表单form数据
|
|
|
+ getPageBtnFormSetting (pageAuths, pageAuthForms) {
|
|
|
+ const authForms = [...pageAuthForms]
|
|
|
+ authForms.map(item => {
|
|
|
+ const { pageconfigurationid } = item
|
|
|
+ const currAuthForm = pageAuths.filter(citem => citem['superiorid'] == pageconfigurationid && citem['pagetype'] == 'form')
|
|
|
+ if (currAuthForm?.length) this.tableBtnForms.push(currAuthForm[0])
|
|
|
+ })
|
|
|
+ },
|
|
|
//获取表头数据
|
|
|
- async getColumnData (pagecode, id) {
|
|
|
- try {
|
|
|
- const { code, returnData } = await Query({
|
|
|
- serviceid: '3',
|
|
|
- datacontent: { filter: Object.keys(this.msgContent).length ? this.msgContent : { pagecode } },
|
|
|
- event: "0"
|
|
|
- });
|
|
|
- if (code == 0) {
|
|
|
- if (returnData?.length) {
|
|
|
- this.$store.dispatch('auth/changeAuthMsg', returnData)
|
|
|
- const tableColsCopy = _.cloneDeep(returnData).filter((item) => item.isdisplay == 2);
|
|
|
- const tableColsCopyOrder = _.orderBy(tableColsCopy, ['displaynumber'], ['asc']);
|
|
|
- const formItemCopy = _.cloneDeep(returnData).filter((item) => item.isdisplay == 2 || item.isdisplay == 3);
|
|
|
- this.formItem = _.orderBy(formItemCopy, ['displaynumber'], ['asc']);
|
|
|
- this.tableCols = tableColsCopyOrder;
|
|
|
- const columncode = returnData.find(
|
|
|
- (item) => item.isprimarykey == 1
|
|
|
- );
|
|
|
- if (columncode && Object.keys(columncode).length) {
|
|
|
- this.tableKey = columncode['columncode']
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error("获取表头数据失败");
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.log(error)
|
|
|
+ getColumnData (columnArrs = []) {
|
|
|
+ const returnData = [...columnArrs]
|
|
|
+ this.$store.dispatch('auth/changeAuthMsg', returnData)
|
|
|
+ const tableColsCopy = _.cloneDeep(returnData).filter((item) => item.isdisplay == 1);
|
|
|
+ const tableColsCopyOrder = _.orderBy(tableColsCopy, ['displaynumber'], ['asc']);
|
|
|
+ // const formItemCopy = _.cloneDeep(returnData).filter((item) => item.isdisplay == 2 || item.isdisplay == 3);
|
|
|
+ // this.formItem = _.orderBy(formItemCopy, ['displaynumber'], ['asc']);
|
|
|
+ this.tableCols = tableColsCopyOrder;
|
|
|
+ const columncode = returnData.find(
|
|
|
+ (item) => item.isprimarykey == 1
|
|
|
+ );
|
|
|
+ if (columncode && Object.keys(columncode).length) {
|
|
|
+ this.tableKey = columncode['columncode']
|
|
|
}
|
|
|
},
|
|
|
//获取tree点击
|
|
@@ -218,18 +220,25 @@ export default {
|
|
|
})
|
|
|
return filterItem
|
|
|
},
|
|
|
+ //根据按钮权限查询表单权限
|
|
|
+ findBtntoForm (pageroute) {
|
|
|
+ return this.tableBtnForms.filter(item => item.pagecode == pageroute)
|
|
|
+ },
|
|
|
//表单-新增
|
|
|
handleAdd () {
|
|
|
const { openmode, pageroute } = this.pageAuthBtnAdd
|
|
|
if (!openmode) return
|
|
|
+ if (!this.findBtntoForm(pageroute).length) return
|
|
|
if (openmode != 2) this.autoBtnClick(openmode, pageroute)
|
|
|
+ const { pageconfigurationid } = this.findBtntoForm(pageroute)[0]
|
|
|
+ const pageAuths = this.authArrs
|
|
|
+ const tableColumnArrs = pageAuths.filter(item => item['superiorid'] == pageconfigurationid && item['pagetype'] == 'column')
|
|
|
+ this.dialogName = pageroute
|
|
|
this.flag = true;
|
|
|
this.tableType = "add";
|
|
|
this.tableTitle = "新增";
|
|
|
this.tableForm = {};
|
|
|
- for (let key in this.pageQuery) {
|
|
|
- this.tableForm[key] = this.pageQuery[key]
|
|
|
- }
|
|
|
+ this.formItem = tableColumnArrs.filter(item => item.isdisplay == 1)
|
|
|
},
|
|
|
//表格-编辑
|
|
|
handleEdit (row) {
|