From 62654cb7d3e23074278c7c061bef8f6cbee90d73 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 10 十一月 2023 09:48:21 +0800
Subject: [PATCH] 修改历史数据导入时限制单次导入通过配置做限制,开启多线程分批并行执行insert,注解开启事务回滚失效,对象方式开启事务实现手动提交事务,异常回滚事务
---
Source/UBCS-WEB/src/components/Master/MasterTree.vue | 200 +++++++++++++++++++++++++++++++++----------------
1 files changed, 133 insertions(+), 67 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
index 0aae92f..c1e383e 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -1,45 +1,52 @@
<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;">
+ <el-link class="refresh-icon" icon="el-icon-refresh" @click="getTreeLists"></el-link>
+ </div>
+ </div>
</template>
<script>
import {getTreeList} from "@/api/MasterData/master";
-import {mapMutations, mapState} from "vuex";
-import {TableData,MasterTable} from "@/api/GetItem";
+import {TableData, MasterTable} from "@/api/GetItem";
export default {
name: "MasterTree",
- props:{
- pageSize:{
- type:String,
- default:"10"
+ props: {
+ pageSize: {
+ type: String,
+ default: "100"
},
- currentPage:{
- type:String,
- default:"1"
+ currentPage: {
+ type: String,
+ default: "1"
},
- templateOid:{
- type:String,
- default:''
+ templateOid: {
+ type: String,
+ default: ''
},
},
- data(){
- return{
- idData:'',
- masterVrBtnList:[],
- tableHeadFindData:[],
- tableHeadDataFateher:[],
- templateOids:"",
- tableDataArray:[],
- codeClassifyOid:"",
- coderuleoid:"",
- CloneTreeAvueform:{},
- loading:false,
- Treedata:[],
+ data() {
+ return {
+ TreeValue: '',
+ idData: '',
+ referTreeId: '',
+ masterVrBtnList: [],
+ tableHeadFindData: [],
+ tableHeadDataFateher: [],
+ templateOids: "",
+ tableDataArray: [],
+ codeClassifyOid: "",
+ coderuleoid: "",
+ CloneTreeAvueform: {},
+ loading: false,
+ Treedata: [],
nodeClickList: "",
Treeoption: {
addBtn: false,
@@ -52,15 +59,20 @@
// console.log(node)
// console.log(resolve)
// }
- treeLoad:function (node, resolve){
- if(node.data != false){
+ treeLoad: (node, resolve) => {
+ if (node.data != false) {
const parentId = (node.level === 0) ? 0 : node.data.oid;
- const parentBtmName = node.data.attributes.btmname
- getTreeList({parentOid:parentId,parentBtmName:parentBtmName}).then(res=>{
- resolve(res.data.map(item=>{
+ const parentBtmName = node.data.attributes.btmname;
+ getTreeList({
+ parentOid: parentId,
+ parentBtmName: parentBtmName,
+ 'conditionMap[btmTypeId]': this.referTreeId
+ }).then(res => {
+ resolve(res.data.map(item => {
return {
...item,
- label:item.text
+ label: `<span style="color:#409EFF">${item.count}</span> ${item.text}`,
+ count: item.count
}
}))
})
@@ -72,27 +84,53 @@
created() {
this.getTreeLists()
},
- computed:{
- },
- methods:{
+ 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(){
+ getTreeLists() {
const index = this.$route.query.id.indexOf('@');
const result = this.$route.query.id.substring(0, index);
- this.idData=result
+ this.idData = result
// console.log(this.$route)
- console.log(this.idData)
- getTreeList({'conditionMap[id]':this.idData }).then(res=>{
- console.log(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 )
- }).catch(res=>{
- console.log(res)
- })
+ getTreeList({'conditionMap[id]': this.idData}).then(res => {
+ 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.referTreeId = firstProperty.attributes.btmTypeId;
+ // console.log(this.referTreeId)
+ 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)
+ });
},
//瀹氫箟涓�涓慨鏀规暟鎹睘鎬у悕鐨勬柟娉�
@@ -108,29 +146,29 @@
}
},
//琛ㄦ牸鍒锋柊
- TableRend(){
+ TableRend() {
TableData({
templateOid: this.templateOids,
codeClassifyOid: this.nodeClickList.oid,
page: this.currentPage,
limit: this.pageSize,
}).then(res => {
- this.tableDataArray=res.data.data;
- this.$emit('tableDataArray',this.tableDataArray)
- this.$emit('total',res.data.total)
- console.log('table',this.tableDataArray)
+ this.tableDataArray = res.data.data;
+ this.$emit('tableDataArray', this.tableDataArray)
+ this.$emit('total', res.data.total)
})
},
//琛ㄦ牸澶撮儴
TableHeadRend() {
const index = this.$route.query.id.indexOf('@');
const result = this.$route.query.id.substring(0, index);
+ // console.log(this.$route)
return new Promise((resolve, reject) => {
MasterTable({
codeClassifyOid: this.nodeClickList.oid,
- functionId:result,
+ functionId: result,
}).then(res => {
- const flagsToDeleteBtn = ["CODEIMPORTHISTORY", "CODEEXPORT", "CODEQUERY","batchApplyCode"];
+ const flagsToDeleteBtn = ["CODEIMPORTHISTORY", "CODEEXPORT", "CODEQUERY", "batchApplyCode"];
//涓嶅悓鑺傜偣鏄剧ず涓嶅悓鎸夐挳
if (!res.data.leaf) {
this.masterVrBtnList = res.data.buttons.filter(obj => flagsToDeleteBtn.includes(obj.uniqueFlag));
@@ -143,7 +181,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
@@ -153,7 +191,6 @@
this.$emit('tableHeadDataFateher', this.tableHeadDataFateher);
this.$emit('tableHeadFindData', this.tableHeadFindData);
this.$emit('tableHeadBttoms', this.masterVrBtnList);
- console.log( 'head',this.tableHeadFindData)
resolve();
}).catch(err => {
reject(err)
@@ -163,13 +200,17 @@
//鏍戠偣鍑讳簨浠�
async nodeClick(data) {
try {
+ // console.log(data)
+ this.TreeValue = data.label.split("</span>")[1].trim();
+ // console.log('TreeValue',this.TreeValue)
+ this.$emit('TreeValue', this.TreeValue)
this.nodeClickList = data;
- this.tableHeadDataFateher=[]
- this.tableHeadFindData=[]
+ this.tableHeadDataFateher = []
+ this.tableHeadFindData = []
await this.TableHeadRend(); // 鍏堟墽琛� TableHeadRend()
this.TableRend(); // TableHeadRend() 鏂规硶瀹屾垚鍚庡啀鎵ц TableRend()
- this.$emit('nodeClick',this.templateOids)
- this.$emit("codeClassifyOid", this.nodeClickList.oid )
+ this.$emit('nodeClick', this.templateOids)
+ this.$emit("codeClassifyOid", this.nodeClickList.oid)
} catch (error) {
// 澶勭悊閿欒
this.$message.error(error)
@@ -179,6 +220,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