From c607413527d3e6bfb4a691fb4ba302c960f1bac3 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 02 八月 2023 14:57:02 +0800
Subject: [PATCH] 提交代码
---
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 220 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 128 insertions(+), 92 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index 6af8cef..3710c01 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -16,7 +16,7 @@
<div style="display: flex; margin-top: 10px">
<el-button plain size="small" type="primary" @click="Enable">鍚敤</el-button>
<el-button plain size="small" type="primary" @click="Deactivate">鍋滅敤</el-button>
- <el-button plain size="small" type="primary" @click="ImportExcel">瀵煎叆</el-button>
+ <el-button plain size="small" type="primary" @click.native="ImportExcel">瀵煎叆</el-button>
<el-button plain size="small" type="primary" @click="ExportExcel">瀵煎嚭</el-button>
</div>
</div>
@@ -24,7 +24,7 @@
</div>
</div>
<!-- 鏍戣妭鐐规坊鍔犲璇濇-->
- <el-dialog :title="this.TreeFlag ? '娣诲姞鍒嗙被' :'娣诲姞涓婚搴�'" :visible.sync="TreeAddFormVisible" append-to-body
+ <el-dialog :title="this.TreeFlag ? '娣诲姞鍒嗙被' :'娣诲姞涓婚搴�'" :visible.sync="TreeAddFormVisible" v-loading="AddLoading" append-to-body
style="width: 1700px;margin: auto">
<el-form :model="TreeAddform" :rules="rules">
<el-form-item :label="this.TreeFlag ? '鍒嗙被缂栧彿锛�' :'涓婚搴撶紪鍙凤細'" label-width="150px" style="display: inline-block" prop="id">
@@ -33,7 +33,7 @@
<el-form-item :label="this.TreeFlag ? '鍒嗙被鍚嶇О锛�' :'涓婚搴撳悕绉帮細'" label-width="110px" style="display: inline-block" prop="name">
<el-input v-model="TreeAddform.name" autocomplete="off" style="width: 170px"></el-input>
</el-form-item>
- <el-form-item label="瀛樺偍鐨勪笟鍔$被鍨嬶細" label-width="150px" v-if="TreeFlagCode==false" prop="btmTypeName">
+ <el-form-item label="瀛樺偍鐨勪笟鍔$被鍨嬶細" label-width="150px" v-if="TreeFlagCode" prop="btmTypeName">
<el-input v-model="TreeAddform.btmTypeName" autocomplete="off" style="width: 585px" @focus="btmFoucus"></el-input>
</el-form-item>
<el-form-item label="鎻忚堪锛�" label-width="150px">
@@ -58,7 +58,7 @@
</el-dialog>
<!-- 淇敼瀵硅瘽妗�-->
<el-dialog :visible.sync="TreeEditFormVisible" append-to-body title="淇敼鍒嗙被">
- <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'" @MasterHandler="MasterHandler" :Editclose=" ()=>{TreeEditFormVisible=false}" :TreeFlag="TreeFlagCode" ::nodeClickList="nodeClickList" @referTreeForm="referTreeForm" @flushed="flushed"></classifyTreeform>
+ <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'" @MasterHandler="MasterHandler" :Editclose=" ()=>{TreeEditFormVisible=false}" :TreeFlag="editTreeFLagCode" :nodeClickList="nodeClickList" @referTreeForm="referTreeForm" @flushed="flushed"></classifyTreeform>
</el-dialog>
<avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" :defaultExpandAll="false"
:option="Treeoption"
@@ -312,8 +312,8 @@
</div>
</div>
</el-dialog>
-<!-- <BatchImport v-if="batchImportData.visible" v-bind="batchImportData" :visible.sync="batchImportData.visible" >-->
-<!-- </BatchImport>-->
+<!-- 瀵煎嚭-->
+ <ThemeImport :visible.sync="ThemeImportVisible" :codeClassifyOid="this.codeClassifyOid"></ThemeImport>
</basic-container>
</el-main>
</el-container>
@@ -350,9 +350,17 @@
inject: ["crudTreeData"],
data() {
return {
+ AddLoading:false,
+ // 瀹氫箟涓�涓彉閲忔潵淇濆瓨鏍戣姹傜殑鏁伴噺
+ requestCount:0,
+ //瀵煎叆鐘舵�佹
+ ThemeImportVisible:false,
selectRow:'',
+ selectList:[],
//鏍戣妭鐐规樉绀洪殣钘�
- TreeFlagCode:false,
+ TreeFlagCode:true,
+ //淇敼鑺傜偣鏄剧ず闅愯棌
+ editTreeFLagCode:false,
//缂栫爜瑙勫垯
MasterdialogVisible:false,
masterData:[],
@@ -653,6 +661,13 @@
showEditBtn:false,
}
},
+ watch:{
+ TreeFlagCode:{
+ handler(newval,oldval){
+ console.log('TreeFlagCode',newval)
+ }
+ }
+ },
//tab鏍忛粯璁ゆ槸琛ㄦ牸
mounted() {
this.type = this.tabOption.column[0];
@@ -663,7 +678,7 @@
this.$refs.tree.setCurrentKey(null)
this.nodeClickList = {}
this.TreeList=[]
- this.TreeFlagCode=false;
+ this.TreeFlagCode=true;
}
}, true)
},
@@ -681,7 +696,7 @@
label: '',
prop: 'radio',
width: 60,
- hide: false,
+ display: false
},
{
label: "妯℃澘缂栧彿",
@@ -730,25 +745,18 @@
methods: {
/** 瀵煎叆 */
ImportExcel(){
- // debugger
- // this.batchImportData.visible = true
- // this.batchImportData.codeClassifyOid = this.codeClassifyOid
+ this.ThemeImportVisible=true;
},
/** 瀵煎嚭 */
ExportExcel(){
if(this.nodeClickList){
exportClassify({oid:this.nodeClickList.oid}).then(res=>{
- console.log(res)
- func.downloadFileByBlob(res);
+ func.downloadFileByBlobHandler(res);
})
}else {
this.$message.warning('璇峰厛閫夋嫨瑕佸鍑虹殑涓婚搴撳垎绫�')
}
},
- //妯℃澘绠$悊宸插彂甯冪紪杈�
- // checkShowEditBtn() {
- // this.showEditBtn = this.Formlist.some(item => item.lcStatus === 'Released');
- // },
//缂栫爜瑙勫垯澶辩劍
CodeFoucus(){
this.MasterdialogVisible=true;
@@ -966,30 +974,7 @@
this.crudOid=row.oid;
this.crudLCStatus=row.lcStatus;
this.crudArray.push(row);
- console.log(row.$index)
- gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': row.oid}).then(res => {
- this.ProData = res.data.data;
- //鍒嗙被娉ㄥ叆鏁版嵁鏍煎紡
- this.ProData = res.data.data.map((item) => {
- //濡傛灉鍒嗙被娉ㄥ叆classifyInvokeAttr涓虹┖璇存槑鏄垵濮嬬姸鎬�
- if(item.classifyInvokeAttr !== ''){
- if (!item.hasOwnProperty('classifyInvokeText')) { // 妫�鏌lassifyInvokeText灞炴�ф槸鍚﹀瓨鍦�
- item = {
- ...item,
- classifyInvokeText: {
- "娉ㄥ叆绫诲瀷": item.classifyInvokeAttr,
- "娉ㄥ叆绫诲瀷鍚嶇О": item.classifyInvokeAttrName,
- "灞傜骇璁剧疆": item.classifyInvokeLevel,
- "鏄惁鍙慨鏀�": item.classifyInvokeEditFlag
- }
- };
- }
- }
- return item;
- });
- }).catch(res => {
- this.$message.error(res)
- })
+ this.gridCode()
},
//鍒嗙被鏍戞暟鎹鐞�
getAttr() {
@@ -1003,8 +988,16 @@
})
//璋冪敤淇敼灞炴�у悕鏂规硶
this.ModifyProperties(this.CloneTreedata, 'name', 'label');
+ console.log(this.CloneTreedata)
+ this.CloneTreedata = this.CloneTreedata.map(item => {
+ if (item.attributes.lcStatus === "Disabled") {
+ item.label += '銆愬仠鐢ㄣ��';
+ }
+ return item;
+ });
}).catch(res => {
this.$message.error(res)
+
})
},
//瀹氫箟涓�涓慨鏀规暟鎹睘鎬у悕鐨勬柟娉�
@@ -1020,11 +1013,22 @@
}
},
//鏍戣妭鐐规坊鍔犳寜閽�
- TreeAdd() {
- this.TreeAddFormVisible = true;
- // 鍒ゆ柇褰撳墠鏄惁鏈夌偣鍑诲瓙椤�
- if (this.nodeClickList !== "") {
- this.TreeFlag = true
+ async TreeAdd() {
+ const loading = this.$loading({
+ lock: true,
+ text: 'Loading',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.3)'
+ });
+ try {
+ //鏂板琛ㄥご鍚嶇О
+ this.TreeFlag=!this.nodeClickList
+ await new Promise(resolve => setTimeout(resolve, 500));
+ this.TreeAddFormVisible = true;
+ loading.close();
+ } catch (error) {
+ this.$message.error(error);
+ loading.close();
}
},
//鏍戣妭鐐规坊鍔犱簨浠�
@@ -1197,37 +1201,59 @@
},
//鏍戠偣鍑讳簨浠�
async nodeClick(data) {
- //瀹氫箟涓�涓ā鏉垮睘鎬d锛屾暟鎹槸妯℃澘绠$悊琛ㄦ牸閲岄潰鐨刼id
- if(data.parentId == ""){
- this.TreeFlagCode=true;
- }
- this.nodeClickList = data
- this.ProData=[]
+ console.log(data);
+ //鎿嶄綔鏂板鍜屼慨鏀圭殑涓氬姟绫诲瀷闅愯棌
+ this.TreeFlagCode = !data;
+ this.editTreeFLagCode = !data.parentId;
+ this.nodeClickList = data;
+ this.selectRow = 0;
try {
- await TreeObjcet(data.oid).then(res => {
- this.FlagObj = res.data.data
- }).catch(res => {
- this.$message.error(res)
- })
- //妯℃澘绠$悊琛ㄦ牸鏁版嵁
- await gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}).then(res => {
- this.Formlist = res.data.data.filter(item => {
- if (item.codeclassifyoid != "") {
- this.codeClassifyOid = item.codeclassifyoid
- return item.codeclassifyoid == this.nodeClickList.oid
- }
- })
- }).catch(res => {
- this.$message.error(res)
- })
- // 鍩烘湰淇℃伅琛ㄥ崟鏁版嵁
- await getObjectByOid(this.nodeClickList.oid).then(res => {
- this.TreeList = res.data.data;
- }).catch(res => {
- this.$message.error(res)
- })
+ this.requestCount += 1;
+ const [res1, res2, res3] = await Promise.all([
+ TreeObjcet(data.oid),
+ gridCodeClassifyTemplate({ 'conditionMap[codeclassifyoid]': data.oid }),
+ getObjectByOid(data.oid)
+ ]);
+ this.FlagObj = res1.data.data;
+ this.Formlist = res2.data.data.filter(item => {
+ if (item.codeclassifyoid != "") {
+ this.codeClassifyOid = item.codeclassifyoid;
+ return item.codeclassifyoid == this.nodeClickList.oid;
+ }
+ });
+ if (this.Formlist.length >= 1) {
+ this.crudLCStatus = this.Formlist[this.selectRow].lcStatus;
+ this.crudArray.push(this.Formlist[this.selectRow]);
+ this.crudOid = this.Formlist[this.selectRow].oid;
+ await this.gridCode();
+ } else {
+ this.ProData = [];
+ this.crudOid=''
+ }
+ this.TreeList = res3.data.data;
} catch (error) {
- this.$message.error(error)
+ this.$message.error(error);
+ }
+ },
+
+ async gridCode() {
+ try {
+ const res = await gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[this.selectRow].oid, limit: -1 });
+ this.ProData = res.data.data.map(item => {
+ if (item.classifyInvokeAttr !== '') {
+ if (!item.hasOwnProperty('classifyInvokeText')) {
+ item.classifyInvokeText = {
+ '娉ㄥ叆绫诲瀷': item.classifyInvokeAttr,
+ '娉ㄥ叆绫诲瀷鍚嶇О': item.classifyInvokeAttrName,
+ '灞傜骇璁剧疆': item.classifyInvokeLevel,
+ '鏄惁鍙慨鏀�': item.classifyInvokeEditFlag
+ };
+ }
+ }
+ return item;
+ });
+ } catch (error) {
+ this.$message.error(error);
}
},
treeClick(e) {
@@ -1294,7 +1320,6 @@
});
} else {
this.$set(row, "codeclassifyoid", this.nodeClickList.oid)
- console.log(this.nodeClickList)
addSave(row).then(() => {
this.$message({
type: "success",
@@ -1334,20 +1359,6 @@
});
})
},
- //妯℃澘绠$悊琛ㄦ牸鏌ヨ,鍙湁涓�鏉℃暟鎹病蹇呰鍋氭悳绱�
- /*nterFind() {
- if (this.findText == "") {
- gridCodeClassifyTemplate().then(res => {
- this.Formlist = res.data.data
- })
- } else {
- gridCodeClassifyTemplate().then(res => {
- this.Formlist = res.data.data.filter(item => {
- return item.name.includes(this.findText)
- })
- })
- }
- },*/
//鍏嬮殕妯℃澘鏌ヨ
CloneEnterFind(){
gridCodeClassifyTemplate().then(res => {
@@ -1422,12 +1433,37 @@
},
//鍒锋柊
TemRefresh() {
- this.FormLoing = true
+ this.FormLoing = true;
if (this.nodeClickList.oid != "") {
gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': this.nodeClickList.oid}).then(res => {
this.Formlist = res.data.data.filter(item => {
return item.codeclassifyoid == this.nodeClickList.oid
})
+ this.crudLCStatus=this.Formlist[this.selectRow].lcStatus;
+ this.crudArray.push(this.Formlist[this.selectRow]);
+ gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': res.data.data[this.selectRow].oid,limit:-1}).then(res => {
+ this.ProData = res.data.data;
+ //鍒嗙被娉ㄥ叆鏁版嵁鏍煎紡
+ this.ProData = res.data.data.map((item) => {
+ //濡傛灉鍒嗙被娉ㄥ叆classifyInvokeAttr涓虹┖璇存槑鏄垵濮嬬姸鎬�
+ if(item.classifyInvokeAttr !== ''){
+ if (!item.hasOwnProperty('classifyInvokeText')) { // 妫�鏌lassifyInvokeText灞炴�ф槸鍚﹀瓨鍦�
+ item = {
+ ...item,
+ classifyInvokeText: {
+ "娉ㄥ叆绫诲瀷": item.classifyInvokeAttr,
+ "娉ㄥ叆绫诲瀷鍚嶇О": item.classifyInvokeAttrName,
+ "灞傜骇璁剧疆": item.classifyInvokeLevel,
+ "鏄惁鍙慨鏀�": item.classifyInvokeEditFlag
+ }
+ };
+ }
+ }
+ return item;
+ });
+ }).catch(res => {
+ this.$message.error(res)
+ })
})
} else {
this.FormLoing = true
--
Gitblit v1.9.3