| | |
| | | <!-- 左侧菜单--> |
| | | <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> |
| | |
| | | </el-tooltip> |
| | | </template> |
| | | </avue-tree> |
| | | <div style="height: 25px"></div> |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | 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"]), |
| | |
| | | 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; |
| | |
| | | this.classifyAuthVisible = true; |
| | | }, |
| | | // 数据授权对话框打开 |
| | | dataAuthHandler(event) { |
| | | event.stopPropagation(); |
| | | dataAuthHandler() { |
| | | if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) { |
| | | this.$message.warning('请至少选择一条数据!') |
| | | return; |
| | |
| | | // this.classifyData = this.nodeClickList; |
| | | this.dataAuthVisible = true; |
| | | }, |
| | | flowingDependHandler(event) { |
| | | event.stopPropagation(); |
| | | flowingDependHandler() { |
| | | if (this.nodeClickList.length <= 0) { |
| | | this.$message.warning('请至少选择一条数据!') |
| | | return; |
| | |
| | | }, |
| | | // 关闭弹窗 |
| | | /** 导入 */ |
| | | 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); |
| | |
| | | } |
| | | }, |
| | | //树节点添加按钮 |
| | | async TreeAdd(event) { |
| | | event.stopPropagation(); |
| | | async TreeAdd() { |
| | | const loading = this.$loading({ |
| | | lock: true, |
| | | text: 'Loading', |
| | |
| | | } |
| | | }, |
| | | //树节点删除按钮 |
| | | TreeDel(event) { |
| | | event.stopPropagation(); |
| | | TreeDel() { |
| | | this.$confirm('是否删除当前选择的分类,将会把子分类一并删除,如果存在编码数据将不能被删除,是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | |
| | | }); |
| | | }, |
| | | //修改回填 |
| | | TreeEdit(event) { |
| | | event.stopPropagation(); |
| | | TreeEdit() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message({ |
| | | type: 'warning', |
| | |
| | | } |
| | | }, |
| | | //树刷新 |
| | | async flushed(event) { |
| | | event.stopPropagation(); |
| | | async flushed() { |
| | | await this.getAttr() |
| | | this.$refs.tree.setCurrentKey(null); |
| | | this.nodeClickList = {}; |
| | |
| | | }, |
| | | //启用和停用都先判断状态 |
| | | //启用 |
| | | async Enable(event) { |
| | | event.stopPropagation(); |
| | | async Enable() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message.warning('请先从树上选择一条数据'); |
| | | return; |
| | |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | async Deactivate(event) { |
| | | event.stopPropagation(); |
| | | async Deactivate() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message.warning('请先从树上选择一条数据'); |
| | | return; |