| | |
| | | <template> |
| | | <div class="app" style="display: flex;"> |
| | | <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false" :option="Treeoption" @node-click="nodeClick" style="width: fit-content;"> |
| | | <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false" |
| | | :option="Treeoption" style="width: fit-content;" @node-click="nodeClick"> |
| | | <template slot-scope="{ node }"> |
| | | <span style="display: inline-block;">{{ node.label }}</span> |
| | | <span v-html="node.label"></span> |
| | | </template> |
| | | </avue-tree> |
| | | <div style="display: inline-block;"><i class="el-icon-refresh refresh-icon" @click="getTreeLists"></i></div> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | TreeValue:'', |
| | | TreeValue: '', |
| | | idData: '', |
| | | masterVrBtnList: [], |
| | | tableHeadFindData: [], |
| | |
| | | resolve(res.data.map(item => { |
| | | return { |
| | | ...item, |
| | | label: item.text |
| | | label: `<span style="color:#409EFF">${item.count}</span> ${item.text}`, |
| | | count: item.count |
| | | } |
| | | })) |
| | | }) |
| | |
| | | created() { |
| | | this.getTreeLists() |
| | | }, |
| | | computed: {}, |
| | | mounted() { |
| | | |
| | | }, |
| | | computed: { |
| | | formatCount() { |
| | | return (label) => { |
| | | const countIndex = label.indexOf('</span>') + '</span>'.length; |
| | | const count = label.slice(countIndex); |
| | | const coloredCount = `<span class="count">${count}</span>`; |
| | | return `${label.slice(0, countIndex)}${coloredCount}`; |
| | | }; |
| | | }, |
| | | }, |
| | | methods: { |
| | | //获取数据 |
| | | getTreeLists() { |
| | |
| | | this.idData = result |
| | | // console.log(this.$route) |
| | | getTreeList({'conditionMap[id]': this.idData}).then(res => { |
| | | if(res){ |
| | | if(res.data.length === 0){ |
| | | if (res) { |
| | | if (res.data.length === 0) { |
| | | this.$message.error("主数据分类查询为空!"); |
| | | }else{ |
| | | } else { |
| | | this.Treedata = res.data; |
| | | const [firstProperty] = res.data; |
| | | this.ModifyProperties(this.Treedata, 'text', 'label'); |
| | |
| | | this.coderuleoid = firstProperty.attributes.coderuleoid; |
| | | this.$emit("coderuleoid", this.coderuleoid) |
| | | this.$emit('Treedata', this.Treedata) |
| | | this.Treedata.forEach((item, index) => { |
| | | item.label = `<span style="color:#409EFF">${item.count}</span> ${item.label}`; |
| | | }); |
| | | this.$emit("coderuleoid", this.coderuleoid) |
| | | this.$emit('Treedata', this.Treedata) |
| | | console.log(this.Treedata) |
| | | } |
| | | } |
| | | }).catch(res => { |
| | |
| | | async nodeClick(data) { |
| | | try { |
| | | // console.log(data) |
| | | this.TreeValue=data.label.split(" ")[0].trim(); |
| | | this.TreeValue = data.label.split(" ")[0].trim(); |
| | | // console.log('TreeValue',this.TreeValue) |
| | | this.$emit('TreeValue',this.TreeValue) |
| | | this.$emit('TreeValue', this.TreeValue) |
| | | this.nodeClickList = data; |
| | | this.tableHeadDataFateher = [] |
| | | this.tableHeadFindData = [] |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .app{ |
| | | .app { |
| | | overflow: auto; |
| | | height: calc(100vh - 150px); |
| | | } |
| | | .app::-webkit-scrollbar { |
| | | height: 15px ; // 纵向滚动条 必写 |
| | | |
| | | .app::-webkit-scrollbar { |
| | | height: 15px; // 纵向滚动条 必写 |
| | | background: white; |
| | | border: white; |
| | | width: 10px; |
| | | |
| | | } |
| | | |
| | | // 滚动条的滑块 |
| | | .app::-webkit-scrollbar-thumb { |
| | | .app::-webkit-scrollbar-thumb { |
| | | background-color: #ececec; |
| | | border-radius: 20px; |
| | | border: #ececec; |
| | | } |
| | | |
| | | .refresh-icon { |
| | | color: #409EFF; |
| | | margin-top: 8px; |