From a9b4e8e7761359060b73edb86e36fd169b618b56 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 02 十一月 2023 23:52:36 +0800
Subject: [PATCH] 基础码段增加前缀后缀;主数据历史数据导入,模板下载设置编号列为文本类型
---
Source/UBCS-WEB/src/components/Master/MasterTree.vue | 96 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 78 insertions(+), 18 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
index 73dc835..17a4f13 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -1,9 +1,13 @@
<template>
- <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false"
- :option="Treeoption"
- style="height: calc(100vh - 150px);"
- @node-click=" nodeClick"
- ></avue-tree>
+ <div class="app" style="display: flex;">
+ <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 v-html="node.label"></span>
+ </template>
+ </avue-tree>
+ <div style="display: inline-block;"><i class="el-icon-refresh refresh-icon" @click="getTreeLists"></i></div>
+ </div>
</template>
<script>
@@ -15,7 +19,7 @@
props: {
pageSize: {
type: String,
- default: "10"
+ default: "100"
},
currentPage: {
type: String,
@@ -28,6 +32,7 @@
},
data() {
return {
+ TreeValue: '',
idData: '',
masterVrBtnList: [],
tableHeadFindData: [],
@@ -59,7 +64,8 @@
resolve(res.data.map(item => {
return {
...item,
- label: item.text
+ label: `<span style="color:#409EFF">${item.count}</span> ${item.text}`,
+ count: item.count
}
}))
})
@@ -71,7 +77,19 @@
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() {
@@ -80,16 +98,29 @@
this.idData = result
// console.log(this.$route)
getTreeList({'conditionMap[id]': this.idData}).then(res => {
- this.Treedata = res.data;
- const [firstProperty] = res.data;
- this.ModifyProperties(this.Treedata, 'text', 'label');
- this.codeClassifyOid = firstProperty.oid;
- this.coderuleoid = firstProperty.attributes.coderuleoid;
- this.$emit("coderuleoid", this.coderuleoid)
- this.$emit('Treedata', this.Treedata)
+ if (res) {
+ if (res.data.length === 0) {
+ this.$message.error("涓绘暟鎹垎绫绘煡璇负绌猴紒");
+ } else {
+ this.Treedata = res.data;
+ const [firstProperty] = res.data;
+ this.ModifyProperties(this.Treedata, 'text', 'label');
+ this.codeClassifyOid = firstProperty.oid;
+ 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 => {
+ // console.log(res)
this.$message.error(res)
- })
+ });
},
//瀹氫箟涓�涓慨鏀规暟鎹睘鎬у悕鐨勬柟娉�
@@ -139,7 +170,7 @@
List.forEach(item => {
let columnItem = {
label: item.title,
- prop: item.field,
+ prop: item.queryField,
// type: this.columnType[item.type],
sortable: item.sort,
width: item.minWidth
@@ -158,6 +189,10 @@
//鏍戠偣鍑讳簨浠�
async nodeClick(data) {
try {
+ // console.log(data)
+ this.TreeValue = data.label.split(" ")[0].trim();
+ // console.log('TreeValue',this.TreeValue)
+ this.$emit('TreeValue', this.TreeValue)
this.nodeClickList = data;
this.tableHeadDataFateher = []
this.tableHeadFindData = []
@@ -174,6 +209,31 @@
}
</script>
-<style scoped>
+<style lang="scss" scoped>
+.app {
+ overflow: auto;
+ height: calc(100vh - 150px);
+}
+.app::-webkit-scrollbar {
+ height: 15px; // 绾靛悜婊氬姩鏉� 蹇呭啓
+ background: white;
+ border: white;
+ width: 10px;
+
+}
+
+// 婊氬姩鏉$殑婊戝潡
+.app::-webkit-scrollbar-thumb {
+ background-color: #ececec;
+ border-radius: 20px;
+ border: #ececec;
+}
+
+.refresh-icon {
+ color: #409EFF;
+ margin-top: 8px;
+ margin-left: 6px;
+ font-size: 18px;
+}
</style>
--
Gitblit v1.9.3