田源
2024-03-19 b299fcd13492375b34e6fa3fd26a841d554c297a
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -4,7 +4,7 @@
    <!--    左侧菜单-->
    <el-aside>
      <basic-container>
        <div style="height: calc(100vh - 144px);!important;" @click="clearNode">
        <div 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>
@@ -699,18 +699,10 @@
  mounted() {
    this.type = this.tabOption.column[0] || {label: '基本信息', prop: 'tab1'};
    this.getAttr();
    const treeEle = this.$refs.tree.$el
    treeEle.addEventListener('click', (e) => {
      if (e.target.nodeName !== 'SPAN') {
        this.$refs.tree.setCurrentKey(null);
        this.nodeClickList = {};
        this.TreeFlagCode = true;
        this.allButtons = false;
        // this.$nextTick(()=>{
        //   this.btnAuthList = [];
        // })
      }
    }, true)
    document.addEventListener('click', this.handleGlobalClick);
  },
  beforeDestroy() {
    document.removeEventListener('click', this.handleGlobalClick);
  },
  computed: {
    ...mapGetters(["permission"]),
@@ -797,14 +789,26 @@
  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() {
    classifyAuthHandler(event) {
      event.stopPropagation();
      if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -813,7 +817,8 @@
      this.classifyAuthVisible = true;
    },
    // 数据授权对话框打开
    dataAuthHandler() {
    dataAuthHandler(event) {
      event.stopPropagation();
      if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -821,7 +826,8 @@
      // this.classifyData = this.nodeClickList;
      this.dataAuthVisible = true;
    },
    flowingDependHandler() {
    flowingDependHandler(event) {
      event.stopPropagation();
      if (this.nodeClickList.length <= 0) {
        this.$message.warning('请至少选择一条数据!')
        return;
@@ -838,11 +844,13 @@
    },
    // 关闭弹窗
    /** 导入 */
    ImportExcel() {
    ImportExcel(event) {
      event.stopPropagation();
      this.ThemeImportVisible = true;
    },
    /** 导出 */
    ExportExcel() {
    ExportExcel(event) {
      event.stopPropagation();
      if (this.nodeClickList) {
        exportClassify({oid: this.nodeClickList.oid}).then(res => {
          func.downloadFileByBlobHandler(res);
@@ -961,7 +969,8 @@
      }
    },
    //树节点添加按钮
    async TreeAdd() {
    async TreeAdd(event) {
      event.stopPropagation();
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
@@ -1021,7 +1030,8 @@
      }
    },
    //树节点删除按钮
    TreeDel() {
    TreeDel(event) {
      event.stopPropagation();
      this.$confirm('是否删除当前选择的分类,将会把子分类一并删除,如果存在编码数据将不能被删除,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -1077,7 +1087,8 @@
      });
    },
    //修改回填
    TreeEdit() {
    TreeEdit(event) {
      event.stopPropagation();
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message({
          type: 'warning',
@@ -1088,7 +1099,8 @@
      }
    },
    //树刷新
    async flushed() {
    async flushed(event) {
      event.stopPropagation();
      await this.getAttr()
      this.$refs.tree.setCurrentKey(null);
      this.nodeClickList = {};
@@ -1097,7 +1109,8 @@
    },
    //启用和停用都先判断状态
    //启用
    async Enable() {
    async Enable(event) {
      event.stopPropagation();
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message.warning('请先从树上选择一条数据');
        return;
@@ -1137,7 +1150,8 @@
        this.loading = false;
      }
    },
    async Deactivate() {
    async Deactivate(event) {
      event.stopPropagation();
      if (Object.keys(this.nodeClickList).length < 1) {
        this.$message.warning('请先从树上选择一条数据');
        return;