From 03c38da7555b69cb598e534c97fa25bd5385701c Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 29 十月 2024 17:55:50 +0800
Subject: [PATCH] 表单定义权限控制和属性权限&&成员管理添加密级&&首页修改密码&&登录判断过期停用修改密码后跳转首页

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue |  129 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 124 insertions(+), 5 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
index db8d1af..0e8b0c5 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
@@ -244,7 +244,9 @@
                     <el-form-item label="鏉冮檺鎺у埗">
                       <div style="display: flex;align-items: center">
                         <el-input v-model="form.itemRight" placeholder="璇疯緭鍏ュ唴瀹�" size="mini"></el-input>
-                        <el-button plain size="mini" style="margin-left: 3px" type="success">閫夋嫨</el-button>
+                        <el-button plain size="mini" style="margin-left: 3px" type="success" @click="authClickHandler">
+                          閫夋嫨
+                        </el-button>
                       </div>
                     </el-form-item>
                   </el-col>
@@ -517,10 +519,12 @@
           </el-col>
 
           <el-col :span="24">
-            <el-form-item label="鏉冮檺鎺у埗">
+            <el-form-item label="灞炴�ф潈闄�">
               <div style="display: flex;align-items: center">
                 <el-input v-model="customForm.itemRight" placeholder="璇疯緭鍏ュ唴瀹�" size="mini"></el-input>
-                <el-button plain size="mini" style="margin-left: 3px" type="success">閫夋嫨</el-button>
+                <el-button plain size="mini" style="margin-left: 3px" type="success" @click="customAuthClickHandler">
+                  閫夋嫨
+                </el-button>
               </div>
             </el-form-item>
           </el-col>
@@ -771,14 +775,42 @@
         </el-row>
       </el-form>
     </el-dialog>
+
+    <el-dialog
+      v-dialogDrag
+      :visible.sync="authVisible"
+      append-to-body="true"
+      class="avue-dialog"
+      title="鏉冮檺鎺у埗-浜哄憳鍒楄〃"
+      width="60%"
+      @close="authDialogClose">
+      <div style="height: 650px">
+        <div style="height: 600px;">
+          <avue-tree :key="refresh" ref="authTree" v-model="treeAuthForm" :data="treeAuthData" :option="treeAuthOption"
+                     @check-change="treeAuthCheckChange">
+              <span slot-scope="{ node, data }" class="el-tree-node__label">
+           <span style="font-size: 15px">
+              <i class="el-icon-s-promotion"></i>
+                {{ (node || {}).label }}
+            </span>
+          </span>
+          </avue-tree>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+         <el-button @click="authDialogClose">鍙� 娑�</el-button>
+         <el-button type="primary" @click="authDialogSaveHandler">纭� 瀹�</el-button>
+    </span>
+    </el-dialog>
   </el-dialog>
 </template>
 
 <script>
-import {getObjTypeQTs, getTreeAttributes, savePortalVI} from "@/api/UI/formDefine/api";
+import {getObjTypeQTs, getTreeAttributes, savePortalVI, refPersonOrgTree} from "@/api/UI/formDefine/api";
 import func from "@/util/func";
 import basicOption from "@/util/basic-option";
 import {gridAttribute} from "@/api/modeling/attributePool/api";
+import {getSysModelTreeMenuByPID} from "@/api/systemModel/mangeModel/api";
 
 export default {
   name: "formDialog",
@@ -800,6 +832,42 @@
   },
   data() {
     return {
+      authType: 'default',
+      refresh: Math.random(),
+      treeAuthOption: {
+        multiple: true,
+        height: 'auto',
+        menu: false,
+        addBtn: false,
+        defaultExpandAll: true,
+        lazy: true,
+        props: {
+          label: 'text',
+          value: 'oid',
+          children: 'childNodes',
+        },
+        treeLoad: (node, resolve) => {
+          // console.log(node);
+          const params = {
+            'conditionMap[dataType]': node.data.data,
+            'conditionMap[parentId]': node.data.data,
+            'conditionMap[orgType]': 'all'
+          }
+          refPersonOrgTree(node.level === 0 ? {} : params).then(res => {
+            resolve(res.data.treeData.map(item => {
+              return {
+                ...item,
+                id: item.id,
+                name: item.name,
+                leaf: item.leaf
+              }
+            }))
+          })
+        }
+      },
+      treeAuthData: [],
+      treeAuthForm: {},
+      authVisible: false,
       searchQtNameList: [],
       customAttrRow: {},
       customAttrOption: {
@@ -1045,7 +1113,7 @@
         text: data.text,
         oid: data.oid,
         itemType: 'text',
-        itemName:data.data.name
+        itemName: data.data.name
       }
       console.log(data);
       const isDuplicate = this.formList.some(item => item.text === data.text);
@@ -1370,6 +1438,57 @@
       })
     },
 
+    // 鏉冮檺閫夋嫨鎸夐挳
+    authClickHandler() {
+      this.authVisible = true;
+    },
+
+    // 鑷畾涔夎〃鍗曢�夋嫨鏉冮檺
+    customAuthClickHandler() {
+      this.authVisible = true;
+      this.authType = 'attr';
+    },
+
+    // 鏉冮檺鏍戝璇濇鍏抽棴
+    authDialogClose() {
+      this.authVisible = false;
+      this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+    },
+
+    // 鏉冮檺鎺у埗淇濆瓨
+    authDialogSaveHandler() {
+      const filterList = ['root', 'user', 'role', 'department']
+      const data = this.$refs.authTree.getCheckedNodes().filter(item => !filterList.includes(item.oid));
+      if (!data || data.length <= 0) {
+        this.$message.error('璇锋鏌ユ槸鍚﹀嬀閫夊瓙鑺傜偣');
+        return;
+      }
+
+      const resultMap = {};
+
+      data.forEach(item => {
+        const key = item.parentBtmName;
+        if (!resultMap[key]) {
+          resultMap[key] = []; // 鍒濆鍖栨暟缁�
+        }
+        resultMap[key].push(item.parentBtmName === 'user' ? item.data.userName : item.data.name);
+      });
+
+      // 缁勮瀛楃涓�
+      const resultString = Object.entries(resultMap).map(([key, oids]) => {
+        return `${key}=${oids.join(',')}`; // 鐢� , 杩炴帴鍚屼竴绫诲瀷鐨� oid
+      }).join('&&'); // 鏈�鍚庣敤 && 杩炴帴涓嶅悓绫诲瀷
+
+      // console.log(resultString);
+      if (this.authType === 'attr') {
+        this.customForm.itemRight = resultString;
+      } else {
+        this.form.itemRight = resultString;
+      }
+      // this.form.itemRight = resultString;
+      this.authDialogClose();
+    }
+
   }
 }
 </script>

--
Gitblit v1.9.3