田源
2024-03-19 3362fc8656fb3587198beb71a56b5bf6525027cc
整合修改代码
已修改1个文件
77 ■■■■■ 文件已修改
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -4,7 +4,7 @@
    <!--    左侧菜单-->
    <el-aside>
      <basic-container>
        <div style="height: calc(100vh - 144px);!important;">
        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
          <div class="headerCon" style="display: flex; flex-wrap: wrap;margin-bottom: 5px">
            <el-button v-if="permissionList.TreeAddStatus" plain size="small" type="primary" @click="TreeAdd">添加
            </el-button>
@@ -62,7 +62,6 @@
                </el-tooltip>
              </template>
            </avue-tree>
            <div style="height: 25px"></div>
          </div>
        </div>
@@ -699,10 +698,26 @@
  mounted() {
    this.type = this.tabOption.column[0] || {label: '基本信息', prop: 'tab1'};
    this.getAttr();
    document.addEventListener('click', this.handleGlobalClick);
  },
  beforeDestroy() {
    document.removeEventListener('click', this.handleGlobalClick);
    // const treeEle = this.$refs.tree.$el;
    const TreeBox = this.$refs.TreeBox;
    // console.log(this.$refs.TreeBox)
    // treeEle.addEventListener('click', (e) => {
    //   console.log('2')
    //   if (e.target.nodeName !== 'SPAN') {
    //     this.$refs.tree.setCurrentKey(null);
    //     this.nodeClickList = {};
    //     this.TreeFlagCode = true;
    //     this.allButtons = false;
    //   }
    // }, true)
    TreeBox.addEventListener('click', (e) => {
      if (e.target.nodeName !== 'SPAN') {
        this.$refs.tree.setCurrentKey(null);
        this.nodeClickList = {};
        this.TreeFlagCode = true;
        this.allButtons = false;
      }
    }, true)
  },
  computed: {
    ...mapGetters(["permission"]),
@@ -789,26 +804,8 @@
  created() {
  },
  methods: {
    handleGlobalClick(event) {
      // 判断是否存在树节点引用以及引用的元素是否存在
      if (this.$refs.tree && this.$refs.tree.$el) {
        // 判断点击事件是否发生在树节点以外的区域
        const isOutsideTree = !this.$refs.tree.$el.contains(event.target);
        if (isOutsideTree) {
          this.clearNode();
        }
      }
    },
    clearNode(){
      // this.getAttr()
      this.$refs.tree.setCurrentKey(null);
      this.nodeClickList = {};
      this.TreeFlagCode = true;
      this.allButtons = false;
    },
    // 分类授权对话框打开
    classifyAuthHandler(event) {
      event.stopPropagation();
    classifyAuthHandler() {
      if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -817,8 +814,7 @@
      this.classifyAuthVisible = true;
    },
    // 数据授权对话框打开
    dataAuthHandler(event) {
      event.stopPropagation();
    dataAuthHandler() {
      if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -826,8 +822,7 @@
      // this.classifyData = this.nodeClickList;
      this.dataAuthVisible = true;
    },
    flowingDependHandler(event) {
      event.stopPropagation();
    flowingDependHandler() {
      if (this.nodeClickList.length <= 0) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -844,13 +839,11 @@
    },
    // 关闭弹窗
    /** 导入 */
    ImportExcel(event) {
      event.stopPropagation();
    ImportExcel() {
      this.ThemeImportVisible = true;
    },
    /** 导出 */
    ExportExcel(event) {
      event.stopPropagation();
    ExportExcel() {
      if (this.nodeClickList) {
        exportClassify({oid: this.nodeClickList.oid}).then(res => {
          func.downloadFileByBlobHandler(res);
@@ -969,8 +962,7 @@
      }
    },
    //树节点添加按钮
    async TreeAdd(event) {
      event.stopPropagation();
    async TreeAdd() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
@@ -1030,8 +1022,7 @@
      }
    },
    //树节点删除按钮
    TreeDel(event) {
      event.stopPropagation();
    TreeDel() {
      this.$confirm('是否删除当前选择的分类,将会把子分类一并删除,如果存在编码数据将不能被删除,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -1087,8 +1078,7 @@
      });
    },
    //修改回填
    TreeEdit(event) {
      event.stopPropagation();
    TreeEdit() {
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message({
          type: 'warning',
@@ -1099,8 +1089,7 @@
      }
    },
    //树刷新
    async flushed(event) {
      event.stopPropagation();
    async flushed() {
      await this.getAttr()
      this.$refs.tree.setCurrentKey(null);
      this.nodeClickList = {};
@@ -1109,8 +1098,7 @@
    },
    //启用和停用都先判断状态
    //启用
    async Enable(event) {
      event.stopPropagation();
    async Enable() {
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message.warning('请先从树上选择一条数据');
        return;
@@ -1150,8 +1138,7 @@
        this.loading = false;
      }
    },
    async Deactivate(event) {
      event.stopPropagation();
    async Deactivate() {
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message.warning('请先从树上选择一条数据');
        return;