liudong
2024-08-02 feb1bc83e9d2e2b57fef8bdafaa2e24a43fec96c
src/views/authority/users/index.vue
@@ -197,7 +197,16 @@
              <icon-user />
              智能体
            </template>
            Content of Tab Panel 3
            <a-checkbox-group v-model="checkedKeysDialog" direction="vertical" @change="onCheckDialog">
              <a-checkbox
                v-for="(dialog, index) of DialogsList"
                :value="dialog.id"
                :lable="dialog.name"
                @change="onCheckDialog"
              >
                {{ dialog.name }}
              </a-checkbox>
            </a-checkbox-group>
          </a-tab-pane>
        </a-tabs>
        <a-card :style="{ width: '100%',height: '200px', 'overflow-y': 'auto', margin:'1px'}"
@@ -226,6 +235,17 @@
              {{ tag.knowledgeName }}
            </a-tag>
          </a-space>
          <a-divider />
          <a-space wrap>
            智能体:
            <a-tag
              v-for="(tag, index) of checkStrictlyDialog"
              :key="tag.dialogId"
              @close="handleDialogRemove(tag)"
            >
              {{ tag.dialogName }}
            </a-tag>
          </a-space>
        </a-card>
      </div>
@@ -240,6 +260,7 @@
import { Pagination } from "@/types/global";
import type { TableColumnData } from "@arco-design/web-vue/es/table/interface";
import {
  DialogList,
  KnowledgeList,
  OrganizationList,
  ResourceList,
@@ -268,7 +289,12 @@
let checkedKeysKnowledge= ref([]);
let checkStrictlyKnowledge= ref([]);
let checkedKeysDialog= ref([]);
let checkStrictlyDialog= ref([]);
let knowledgeList = ref([]);
let DialogsList = ref([]);
let menuTips = ref(["权限管理", "账号"]);
type SizeProps = "mini" | "small" | "medium" | "large";
@@ -344,6 +370,23 @@
    });
  }
};
const onCheckDialog = (newCheckedKeys, event) => {
  let o = { "dialogId": event.target.value, "dialogName": event.target.labels[0].innerText };
  if (event.target.checked) {
    checkStrictlyDialog.value.push(o);
  } else {
    checkStrictlyDialog.value.forEach((val, idx, array) => {
      // val: 当前值
      if (val.dialogId == event.target.value) {
        checkStrictlyDialog.value.splice(idx, 1);
        return true;
      }
    });
  }
};
const handleRemove = (key) => {
  checkStrictly.value = checkStrictly.value.filter((tag) => tag !== key);
};
@@ -353,6 +396,10 @@
const handleKnowledgeRemove = (key) => {
  checkStrictlyKnowledge.value = checkStrictlyKnowledge.value.filter((tag) => tag !== key);
};
const handleDialogRemove = (key) => {
  checkStrictlyDialog.value = checkStrictlyDialog.value.filter((tag) => tag !== key);
};
const basePagination: Pagination = {
  current: 1,
@@ -442,15 +489,21 @@
};
const editResourceHandleOk = async () => {
  let resources: Array = [],Knowledges: Array = [], user: User = { "userId": selectUser.value.userId };
  let resources: Array = [],dialogs: Array = [],Knowledges: Array = [], user: User = { "userId": selectUser.value.userId };
  checkStrictlyMenu.value.forEach((val) => {
    resources.push(val.menuId);
  });
  user.resources = resources;
  checkStrictlyKnowledge.value.forEach((val) => {
    Knowledges.push(val.knowledgeId);
  });
  user.knowledges = Knowledges;
  checkStrictlyDialog.value.forEach((val) => {
    dialogs.push(val.dialogId);
  });
  user.dialogs = dialogs;
  await UserEdit(user).then((res) => {
    fetchData();
@@ -524,6 +577,8 @@
    checkStrictlyMenu.value = [];
    checkStrictlyKnowledge.value=[];
    checkedKeysKnowledge.value=[];
    checkStrictlyDialog.value=[];
    checkedKeysDialog.value=[];
    selectUser.value = record;
    record.resources.forEach((val) => {
      checkStrictlyMenu.value.push({ "menuId": val.menuId, "menuName": val.menuName });
@@ -533,6 +588,10 @@
    record.knowledges.forEach((val) => {
      checkStrictlyKnowledge.value.push({ "knowledgeId": val.id, "knowledgeName": val.name });
      checkedKeysKnowledge.value.push(val.id);
    });
    record.dialogs.forEach((val) => {
      checkStrictlyDialog.value.push({ "dialogId": val.id, "dialogName": val.name });
      checkedKeysDialog.value.push(val.id);
    });
  }
@@ -596,6 +655,10 @@
KnowledgeList().then((res) => {
  knowledgeList.value = res.rows;
});
DialogList().then((res) => {
  DialogsList.value = res.rows;
});
fetchData();
OrganizationData("");
MenuData();