From c9058a246cd11d20f843e284b05ebf1807744f01 Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期四, 15 八月 2024 09:36:44 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/flow_web

---
 src/views/authority/role/index.vue |  201 ++++++++++++++-----------------------------------
 1 files changed, 58 insertions(+), 143 deletions(-)

diff --git a/src/views/authority/role/index.vue b/src/views/authority/role/index.vue
index 2704363..baa7842 100644
--- a/src/views/authority/role/index.vue
+++ b/src/views/authority/role/index.vue
@@ -77,9 +77,6 @@
         <template #index="{ rowIndex }">
           {{ rowIndex + 1 + (pagination.current - 1) * pagination.pageSize }}
         </template>
-        <template #dept="{ record }">{{
-          record.dept ? record.dept.deptName : ''
-        }}</template>
         <template #status="{ record }">
           <a-switch
             checked-value="1"
@@ -90,9 +87,11 @@
         </template>
         <template #operations="{ record }">
           <a-space>
-            <a-button type="outline" @click="operation(2, record)"
-              >缂栬緫</a-button
-            >
+            <a-button
+              type="dashed"
+              status="warning"
+              @click="operation(4, record)"
+            >瑙掕壊鏉冮檺</a-button>
             <a-popconfirm
               content="Are you sure you want to delete?"
               type="success"
@@ -100,15 +99,8 @@
             >
               <a-button type="outline" status="danger">鍒犻櫎</a-button>
             </a-popconfirm>
-            <a-button
-              type="dashed"
-              status="warning"
-              @click="operation(4, record)"
-              >鏉冮檺閰嶇疆</a-button
-            >
-            <a-button status="success" @click="operation(5, record)"
-              >閮ㄩ棬閰嶇疆</a-button
-            >
+
+
           </a-space>
         </template>
       </a-table>
@@ -120,59 +112,13 @@
       @ok="editHandleOk"
     >
       <a-form :model="editform">
-        <a-form-item field="roleName" label="瑙掕壊鍚�">
+        <a-form-item required field="roleName" label="瑙掕壊鍚�">
           <a-input v-model="editform.roleName" />
-        </a-form-item>
-        <a-form-item field="roleKey" label="鏉冮檺瀛楃涓�">
-          <a-input v-model="editform.roleKey" />
         </a-form-item>
         <a-form-item field="remark" label="澶囨敞">
           <a-input v-model="editform.remark" />
         </a-form-item>
       </a-form>
-    </a-modal>
-    <a-modal
-      width="50%"
-      v-model:visible="deptvisible"
-      title="閮ㄩ棬閰嶇疆"
-      @cancel="handleCancel(2)"
-      @ok="editDeptHandleOk"
-    >
-      <div :style="{ display: 'flex' }">
-        <a-card
-          :style="{ 'width': '460px', 'height': '500px', 'overflow-y': 'auto' }"
-          title="鏈烘瀯"
-          hoverable
-        >
-          <a-tree
-            class="tree-demo"
-            v-model:checked-keys="checkedKeys"
-            v-model:expanded-keys="expandKdys"
-            :checkable="true"
-            :data="treeData"
-            :show-line="showLine"
-            @check="onCheck"
-            :fieldNames="{
-              key: 'deptId',
-              title: 'deptName',
-              children: 'children',
-            }"
-            :check-strictly="checkStrictly"
-          >
-          </a-tree>
-        </a-card>
-        <a-card class="card-demo" title="鐢ㄦ埛鎵�灞炴満鏋�" hoverable>
-          <a-space wrap>
-            <a-tag
-              v-for="(tag, index) of checkStrictly"
-              :key="tag.deptId"
-              @close="handleRemove(tag)"
-            >
-              {{ tag.deptName }}
-            </a-tag>
-          </a-space>
-        </a-card>
-      </div>
     </a-modal>
     <a-modal
       width="30%"
@@ -215,7 +161,6 @@
             <a-space direction="vertical" size="large">
               <a-checkbox-group
                 v-model="checkedKeysKnowledge"
-                direction="vertical"
                 @change="onCheckKnowledge"
               >
                 <a-checkbox
@@ -223,7 +168,7 @@
                   :value="knowledg.id"
                   :lable="knowledg.name"
                   @change="onCheckKnowledge"
-                >
+                  style="width:150px">
                   {{ knowledg.name }}
                 </a-checkbox>
               </a-checkbox-group>
@@ -236,7 +181,6 @@
             </template>
             <a-checkbox-group
               v-model="checkedKeysDialog"
-              direction="vertical"
               @change="onCheckDialog"
             >
               <a-checkbox
@@ -244,8 +188,21 @@
                 :value="dialog.id"
                 :lable="dialog.name"
                 @change="onCheckDialog"
-              >
+                style="width:150px">
                 {{ dialog.name }}
+              </a-checkbox>
+            </a-checkbox-group>
+            <a-checkbox-group
+              v-model="checkedKeysDialog"
+              @change="onCheckDialog"
+            >
+              <a-checkbox
+                v-for="(agent, index) of AgentList"
+                :value="agent.id"
+                :lable="agent.title"
+                @change="onCheckAgent"
+                style="width:150px">
+                {{ agent.title }}
               </a-checkbox>
             </a-checkbox-group>
           </a-tab-pane>
@@ -320,11 +277,8 @@
   } from "@/api/authority";
   import { Modal } from '@arco-design/web-vue';
   import Authheader from '@/views/authority/components/authheader.vue';
-
-  let treeData = ref([]);
-  let checkedKeys = ref([]);
-  let expandKdys = ref([]);
-  let checkStrictly = ref([]);
+  import router from "@/router";
+  import { queryCanvasList } from "@/api/Agent";
 
   let treeDataMenu = ref([]);
   let checkedKeysMenu = ref([]);
@@ -337,8 +291,12 @@
   let checkedKeysDialog = ref([]);
   let checkStrictlyDialog = ref([]);
 
+  let checkedKeysAgent = ref([]);
+  let checkStrictlyAgent = ref([]);
+
   let knowledgeList = ref([]);
   let DialogsList = ref([]);
+  let AgentList = ref([]);
 
   let menuTips = ref(['鏉冮檺绠$悊', '瑙掕壊']);
   type SizeProps = 'mini' | 'small' | 'medium' | 'large';
@@ -369,24 +327,9 @@
 
   let size = ref<SizeProps>('medium');
   let visible = ref(false);
-  let deptvisible = ref(false);
   let resourcevisible = ref(false);
   let selectRole = ref({});
 
-  const onCheck = (newCheckedKeys, event) => {
-    let o = { deptId: event.node.deptId, deptName: event.node.deptName };
-    if (event.checked) {
-      checkStrictly.value.push(o);
-    } else {
-      checkStrictly.value.forEach((val, idx, array) => {
-        // val: 褰撳墠鍊�
-        if (val.deptId == event.node.deptId) {
-          checkStrictly.value.splice(idx, 1);
-          return true;
-        }
-      });
-    }
-  };
   const onCheckMenu = (newCheckedKeys, event) => {
     let o = { menuId: event.node.menuId, menuName: event.node.menuName };
     if (event.checked) {
@@ -413,6 +356,23 @@
         // val: 褰撳墠鍊�
         if (val.knowledgeId == event.target.value) {
           checkStrictlyKnowledge.value.splice(idx, 1);
+          return true;
+        }
+      });
+    }
+  };
+  const onCheckAgent = (newCheckedKeys, event) => {
+    let o = {
+      agentId: event.target.value,
+      agentTitle: event.target.labels[0].innerText,
+    };
+    if (event.target.checked) {
+      checkStrictlyAgent.value.push(o);
+    } else {
+      checkStrictlyAgent.value.forEach((val, idx, array) => {
+        // val: 褰撳墠鍊�
+        if (val.agentId == event.target.value) {
+          checkStrictlyAgent.value.splice(idx, 1);
           return true;
         }
       });
@@ -492,15 +452,6 @@
       dataIndex: 'roleName',
     },
     {
-      title: t('鍒涘缓鏃堕棿'),
-      dataIndex: 'createTime',
-    },
-    {
-      title: t('鏉冮檺瀛楃涓�'),
-      dataIndex: 'roleKey',
-      slotName: 'roleKey',
-    },
-    {
       title: t('鐘舵��'),
       dataIndex: 'status',
       slotName: 'status',
@@ -521,24 +472,10 @@
       visible.value = false;
     }
     if (type == 2) {
-      deptvisible.value = false;
-    }
-    if (type == 2) {
       resourcevisible.value = false;
     }
   };
 
-  const editDeptHandleOk = async () => {
-    let depts: Array = [],
-      role: Role = { roleId: selectRole.value.roleId };
-    checkStrictly.value.forEach((val) => {
-      depts.push(val.deptId);
-    });
-    role.dept = depts;
-    await RoleEdit(role).then((res) => {
-      fetchData();
-    });
-  };
 
   const editResourceHandleOk = async () => {
     let resources: Array = [],
@@ -566,6 +503,13 @@
   };
 
   const editHandleOk = async () => {
+    if(editform.value.roleName==""){
+      Modal.warning({
+        title: '璀﹀憡',
+        content: '鍚嶇О涓嶈兘涓虹┖'
+      });
+      return;
+    }
     if (editform.value.roleId.length > 0) {
       await RoleEdit({
         ...editform.value,
@@ -588,15 +532,7 @@
       editform.value.roleKey = "";
       editform.value.remark = "";
     }
-    //缂栬緫
-    if (t == 2) {
-      visible.value = true;
-      save.value = '缂栬緫';
-      editform.value.roleId=record.roleId
-      editform.value.roleName = record.roleName;
-      editform.value.roleKey = record.roleKey;
-      editform.value.remark = record.remark;
-    }
+
     //鍒犻櫎
     if (t == 3) {
       await RoleDelete(record.roleId).then((res) => {
@@ -645,25 +581,6 @@
         });
       }
     }
-    //鏈烘瀯
-    if (t == 5) {
-      deptvisible.value = true;
-      checkedKeys.value = [];
-      expandKdys.value = [];
-      checkStrictly.value = [];
-      selectRole.value = record;
-      expandKdys.value.push('0');
-      if (record.dept) {
-        record.dept.forEach((val) => {
-          checkStrictly.value.push({
-            deptId: val.deptId,
-            deptName: val.deptName,
-          });
-          checkedKeys.value.push(val.deptId);
-          expandKdys.value.push(val.deptId);
-        });
-      }
-    }
   };
 
   const fetchData = async (
@@ -695,11 +612,7 @@
     fetchData({ ...basePagination, current });
   };
 
-  const OrganizationData = async (key) => {
-    await OrganizationList(key).then((res) => {
-      treeData.value = [...res.rows];
-    });
-  };
+
   const MenuData = async (key) => {
     await ResourceList(key).then((res) => {
       treeDataMenu.value = [...res.rows];
@@ -713,8 +626,10 @@
   DialogList().then((res) => {
     DialogsList.value = res.rows;
   });
+  queryCanvasList(null).then((canvas) => {
+    AgentList= canvas.data
+  });
   fetchData();
-  OrganizationData('');
   MenuData();
 
   const reset = () => {

--
Gitblit v1.8.0