Browse Source

修改table

zhaoke 1 year ago
parent
commit
4119db12e8
2 changed files with 34 additions and 35 deletions
  1. 1 1
      src/views/dataAccessPage/components/accessPageTree.vue
  2. 33 34
      src/views/tablePage/index.vue

+ 1 - 1
src/views/dataAccessPage/components/accessPageTree.vue

@@ -133,7 +133,7 @@ export default {
       }).catch(() => {
         this.$message({
           type: 'info',
-          message: '已取消登录'
+          message: '已取消删除'
         });
       });
     },

+ 33 - 34
src/views/tablePage/index.vue

@@ -14,17 +14,8 @@
     </div>
     <div class="TablePage_dialog">
       <!--新增/编辑-->
-      <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">
-          <span class="el-icon-error error r10"></span>您是否确认删除<span class="error l10">{{ rmTitle }}</span>
-          ?
-        </div>
+      <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>
       <!--高级查询-->
       <PublicPageDialog dialog-title="高级查询" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedDrawer = false" @handleSubmit="advancedTable('advancedDialogForm')">
@@ -94,6 +85,7 @@ export default {
       labelWidth: '120px', //表单文字距离
       fromDataReqCatch: [], //表单规则缓存
       tableKey: null,//表格主键
+      pageAuthtrees: [], //tree数据
     }
   },
   computed: {
@@ -141,18 +133,22 @@ export default {
       if (!pageAuthArrs.length) return
       //获取tree权限
       const pageAuthtrees = pageAuthArrs.filter(item => item.pagetype == 'tree')
-      if (pageAuthtrees?.length) this.getPageTreeSetting(pageAuths, pageAuthtrees)
+      if (pageAuthtrees?.length) {
+        this.pageAuthtrees = pageAuthtrees
+        this.getPageTreeSetting(pageAuthtrees)
+      }
       //获取table权限
       const pageAuthtables = pageAuthArrs.filter(item => item.pagetype == 'table')
       if (pageAuthtables?.length) this.getPageTableSetting(pageAuths, pageAuthtables)
       //获取按钮权限
       const pageAuthbtns = pageAuthArrs.filter(item => item.pagetype == 'button')
       if (pageAuthbtns?.length) this.getPageBtnSetting(pageAuthbtns)
+      const pageAuthFforms = pageAuthArrs.filter(item => item.pagetype == 'form')
       //获取form表单弹框权限
-      if (this.tableBtns?.length) this.getPageBtnFormSetting(pageAuths, this.tableBtns)
+      if (pageAuthFforms?.length) this.getPageBtnFormSetting(pageAuths, pageAuthFforms)
     },
     //根据页面tree设置数据
-    getPageTreeSetting (pageAuths, pageAuthtrees) {
+    getPageTreeSetting (pageAuthtrees) {
       const { passparameters } = pageAuthtrees[0]
       this.treeParameters = passparameters
       this.treeData = pageAuthtrees
@@ -178,12 +174,10 @@ export default {
     },
     //根据页面按钮设置表单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])
-      })
+      const { pageconfigurationid } = [...pageAuthForms][0]
+      const tableColumnArrs = pageAuths.filter(item => item['superiorid'] == pageconfigurationid && item['pagetype'] == 'column')
+      const formItemCopy = tableColumnArrs.filter((item) => item.isdisplay == 1)
+      this.formItem = _.orderBy(formItemCopy, ['displaynumber'], ['asc'])
     },
     //获取表头数据
     getColumnData (columnArrs = []) {
@@ -228,17 +222,17 @@ export default {
     handleAdd () {
       const { openmode, pageroute } = this.pageAuthBtnAdd
       if (!openmode) return
-      if (!this.findBtntoForm(pageroute).length) 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
+      // 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 = {};
-      this.formItem = tableColumnArrs.filter(item => item.isdisplay == 1)
+      // this.formItem = tableColumnArrs.filter(item => item.isdisplay == 1)
     },
     //表格-编辑
     handleEdit (row) {
@@ -258,17 +252,21 @@ export default {
     },
     //表格-删除
     handleRemove (row) {
-      const { columncode } = this.tableCols[0]
       const { openmode, pageroute } = this.pageAuthBtnDel
       if (!openmode) return
       if (openmode != 2) this.autoBtnClick(openmode, pageroute)
-      this.rmFlag = true;
-      this.rmTitle = row[columncode];
-      this.tableObj = row;
-    },
-    //表格-删除-确认
-    tableRemove () {
-      this.generalDataReception(3, this.tableObj, this.tableKey);
+      this.$confirm('确认要删除这条信息吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.generalDataReception(3, row, this.tableKey)
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
     },
     // 新增/编辑-取消
     submitClickClose (formName) {
@@ -302,6 +300,7 @@ export default {
           this.tableForm = {};
           this.resetTable();
           this.load();
+          this.getPageTreeSetting(this.pageAuthtrees)
           // this.$router.go(0);
         } else {
           this.$message.error("操作失败");