From e67d5ed9974308207b7f6340bb3952240978546c Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期五, 09 八月 2024 17:21:51 +0800
Subject: [PATCH] 知识库管理的bug修改

---
 src/views/authority/users/index.vue |  233 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 191 insertions(+), 42 deletions(-)

diff --git a/src/views/authority/users/index.vue b/src/views/authority/users/index.vue
index d4cfc99..4219037 100644
--- a/src/views/authority/users/index.vue
+++ b/src/views/authority/users/index.vue
@@ -2,7 +2,69 @@
   <div class="container">
     <authheader :items="menuTips"></authheader>
     <a-card ref="account" class="general-card">
-      <a-row>
+      <div class="table-page-search-wrapper">
+        <div class="search-wrapper">
+          <div>
+            <a-input
+              v-model="formModel.name"
+              :style="{ width: '320px' }"
+              :placeholder="$t('璇疯緭鍏�')"
+            />
+          </div>
+          <div>
+            <a-button
+              type="primary"
+              @click="search"
+              style="margin-right: 20px; margin-left: 10px"
+            >
+              <template #icon>
+                <icon-search />
+              </template>
+              {{ $t('searchTable.form.search') }}
+            </a-button>
+            <a-button @click="reset">
+              <template #icon>
+                <icon-refresh />
+              </template>
+              {{ $t('searchTable.form.reset') }}
+            </a-button>
+          </div>
+        </div>
+        <div class="search-wrapper">
+          <div>
+            <a-space>
+              <a-button type="primary" :align="'right'" @click="operation(0)"
+                >+ 鏂板缓璐︽埛</a-button
+              >
+            </a-space></div
+          >
+          <div class="wrapper-icon">
+            <a-tooltip :content="$t('searchTable.actions.refresh')">
+              <div class="action-icon" @click="search">
+                <icon-refresh size="18" />
+              </div>
+            </a-tooltip>
+            <a-dropdown @select="handleSelectDensity">
+              <a-tooltip :content="$t('searchTable.actions.density')">
+                <div class="action-icon">
+                  <icon-line-height size="18" />
+                </div>
+              </a-tooltip>
+              <template #content>
+                <a-doption
+                  v-for="item in densityList"
+                  :key="item.value"
+                  :value="item.value"
+                  :class="{ active: item.value === size }"
+                >
+                  <span>{{ item.name }}</span>
+                </a-doption>
+              </template>
+            </a-dropdown>
+          </div>
+        </div>
+      </div>
+      <!-- <a-row>
         <a-col :flex="2"></a-col>
         <a-col :flex="1">
           <a-form :model="formModel" style="margin-top: 30px">
@@ -16,21 +78,21 @@
           </a-form>
         </a-col>
         <a-col :flex="'200px'" style="text-align: right; margin-top: 30px">
-          <a-button @click="reset" style="margin-right: 20px">
-            <template #icon>
-              <icon-refresh />
-            </template>
-            {{ $t('searchTable.form.reset') }}
-          </a-button>
-          <a-button type="primary" @click="search">
+          <a-button type="primary" @click="search" style="margin-right: 20px">
             <template #icon>
               <icon-search />
             </template>
             {{ $t('searchTable.form.search') }}
           </a-button>
+          <a-button @click="reset">
+            <template #icon>
+              <icon-refresh />
+            </template>
+            {{ $t('searchTable.form.reset') }}
+          </a-button>
         </a-col>
-      </a-row>
-      <a-divider style="margin-top: 0" />
+      </a-row> -->
+      <!-- <a-divider style="margin-top: 0" />
       <a-row style="margin-bottom: 16px">
         <a-col :span="12">
           <a-space>
@@ -66,7 +128,7 @@
             </template>
           </a-dropdown>
         </a-col>
-      </a-row>
+      </a-row> -->
       <a-table
         row-key="id"
         :loading="loading"
@@ -369,6 +431,7 @@
   let editform = ref<User>({
     createTime: '',
     dept: undefined,
+    deptName: '',
     email: '',
     nickName: '',
     phoneNumber: '',
@@ -468,7 +531,7 @@
 
   const basePagination: Pagination = {
     current: 1,
-    pageSize: 20,
+    pageSize: 15,
   };
   const pagination = reactive({
     ...basePagination,
@@ -508,8 +571,8 @@
     },
     {
       title: t('鎵�灞為儴闂�'),
-      dataIndex: 'dept',
-      slotName: 'dept',
+      dataIndex: 'deptName',
+      slotName: 'deptName',
     },
     {
       title: t('鐘舵��'),
@@ -630,7 +693,7 @@
     //鍒犻櫎
     if (t == 3) {
       await UserDelete(record.userId).then((res) => {
-        if (res.code == 20000) {
+        if (res.code == 200) {
           fetchData();
         }
       });
@@ -646,28 +709,34 @@
       checkStrictlyDialog.value = [];
       checkedKeysDialog.value = [];
       selectUser.value = record;
-      record.resources.forEach((val) => {
-        checkStrictlyMenu.value.push({
-          menuId: val.menuId,
-          menuName: val.menuName,
+      if (record.resources) {
+        record.resources.forEach((val) => {
+          checkStrictlyMenu.value.push({
+            menuId: val.menuId,
+            menuName: val.menuName,
+          });
+          checkedKeysMenu.value.push(val.menuId);
+          expandKdysMenu.value.push(val.menuId);
         });
-        checkedKeysMenu.value.push(val.menuId);
-        expandKdysMenu.value.push(val.menuId);
-      });
-      record.knowledges.forEach((val) => {
-        checkStrictlyKnowledge.value.push({
-          knowledgeId: val.id,
-          knowledgeName: val.name,
+      }
+      if (record.knowledges) {
+        record.knowledges.forEach((val) => {
+          checkStrictlyKnowledge.value.push({
+            knowledgeId: val.id,
+            knowledgeName: val.name,
+          });
+          checkedKeysKnowledge.value.push(val.id);
         });
-        checkedKeysKnowledge.value.push(val.id);
-      });
-      record.dialogs.forEach((val) => {
-        checkStrictlyDialog.value.push({
-          dialogId: val.id,
-          dialogName: val.name,
+      }
+      if (record.dialogs) {
+        record.dialogs.forEach((val) => {
+          checkStrictlyDialog.value.push({
+            dialogId: val.id,
+            dialogName: val.name,
+          });
+          checkedKeysDialog.value.push(val.id);
         });
-        checkedKeysDialog.value.push(val.id);
-      });
+      }
     }
     //鏈烘瀯
     if (t == 5) {
@@ -677,14 +746,16 @@
       checkStrictly.value = [];
       selectUser.value = record;
       expandKdys.value.push('0');
-      record.dept.forEach((val) => {
-        checkStrictly.value.push({
-          deptId: val.deptId,
-          deptName: val.deptName,
+      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);
         });
-        checkedKeys.value.push(val.deptId);
-        expandKdys.value.push(val.deptId);
-      });
+      }
     }
   };
 
@@ -694,6 +765,17 @@
     setLoading(true);
     try {
       await UserList(params).then((res) => {
+        for (const user of res.rows) {
+          if (user.dept) {
+            for (const d of user.dept) {
+              if (user.deptName) {
+                user.deptName += d.deptName + ',';
+              } else {
+                user.deptName = d.deptName + ',';
+              }
+            }
+          }
+        }
         renderData.value = res.rows;
         console.log(renderData);
         pagination.current = params.current;
@@ -751,7 +833,7 @@
   };
 </script>
 
-<style scoped>
+<style scoped lang="less">
   .card-demo {
     width: 460px;
     margin-left: 24px;
@@ -761,4 +843,71 @@
   .card-demo:hover {
     transform: translateY(-4px);
   }
+  .table-page-search-wrapper {
+    padding-top: 10px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 20px;
+    padding-bottom: 10px;
+    border-bottom: 1px solid #e8e8e8;
+    .search-wrapper {
+      display: flex;
+      .wrapper-icon {
+        display: flex;
+        align-items: center;
+        margin-left: 40px;
+        // margin-right: 40px;
+      }
+    }
+  }
+</style>
+<style lang="less">
+  .ant-table-wrapper {
+    .ant-table-tbody {
+      tr {
+        td {
+          .ant-table-row-cell-break-word {
+            .ant-table-column-sorter {
+              display: none;
+            }
+          }
+        }
+      }
+    }
+
+    .search-wrapper {
+      display: flex;
+      .wrapper-icon {
+        display: flex;
+        align-items: center;
+        margin-left: 40px;
+        // margin-right: 40px;
+      }
+    }
+  }
+</style>
+<style lang="less">
+  .ant-table-wrapper {
+    .ant-table-tbody {
+      tr {
+        td {
+          .ant-table-row-cell-break-word {
+            .ant-table-column-sorter {
+              display: none;
+            }
+          }
+        }
+      }
+    }
+  }
+</style>
+<style lang="less" scoped>
+  .table-page-search-wrapper {
+    .ant-form-inline {
+      :deep(.ant-form-item) {
+        display: flex;
+      }
+    }
+  }
 </style>

--
Gitblit v1.8.0