فهرست منبع

模板复制粘贴操作

zhaoyk 3 سال پیش
والد
کامیت
a0f05d6074
1فایلهای تغییر یافته به همراه54 افزوده شده و 0 حذف شده
  1. 54 0
      adm_comp/src/views/DiagramTemplate.vue

+ 54 - 0
adm_comp/src/views/DiagramTemplate.vue

@@ -61,6 +61,11 @@
 					<el-button size="mini" @click="() => cancelMainLine()" :disabled="state != 9">取消绘制</el-button>
 					<el-button size="mini" @click="() => finishMainLine()" :disabled="state != 9">完成绘制</el-button>
 				</el-button-group>
+				&nbsp;
+				<el-button-group>
+					<el-button size="mini" @click="() => copy()" :disabled="state == -1 || state == 9">复制</el-button>
+					<el-button size="mini" @click="() => paste()" :disabled="state == -1 || state == 9">粘贴</el-button>
+				</el-button-group>
 				
 				<!--选中信息-->
 				<div class="info">
@@ -361,6 +366,23 @@
 			</div>
 		</el-dialog>
 		
+		<!-- 模板信息对话框 -->
+		<el-dialog :title="copyText" :visible.sync="dlgCopyVisible">
+			<div class="el-dialog-div">
+				<el-form :model="propsData">
+					<el-input
+					  type="textarea"
+					  :rows="15"
+					  v-model="propsData.copyContent">
+					</el-input>
+				</el-form>
+			</div>
+			
+			<div slot="footer" class="dialog-footer">
+				<el-button type="primary" @click='doPaste' v-if="copyText=='粘贴'">确 定</el-button>
+			</div>
+		</el-dialog>
+		
 	</div>
 </template>
 
@@ -395,6 +417,7 @@
 		dlgFilterVisible = false;
 		dlgPackVisible = false;
 		dlgDynGroupVisible = false;
+		dlgCopyVisible = false;
 		
 		propsData: any = {};
 		dataFilter: any = {};
@@ -408,6 +431,8 @@
 		dicEquips:any[] = [];
 		allCons:any[] = [];
 		dynSourceOptions:any[] = [];
+		
+		copyText = '';
 				
 		mounted() {
 			this.onWindowresize();
@@ -898,6 +923,8 @@
 							this.dlgPackVisible = false;
 						if(this.dlgDynGroupVisible)
 							this.dlgDynGroupVisible = false;
+						if(this.dlgCopyVisible)
+							this.dlgCopyVisible = false;
 						this.propsData = {};
 						
 						this.editor.show(this.currentTemplate);
@@ -960,6 +987,33 @@
 			this.callAction('drawMainPipe', params);
 		}
 		
+		copy(){
+			this.copyText = "复制";
+			this.propsData = {};
+			
+			const sel = this.editor.getSelComp();
+			const params:any = {currentCompId: sel ? sel.id : null, templateId: this.currentTemplate.id};
+			this['$axios'].post(this['$common'].url + "template/copyContent", params)
+				.then(res => {
+					const root = res.data;
+					this.propsData = {copyContent: root.data};
+				})
+				.catch(err => {
+					console.log(err);
+				});	
+			this.dlgCopyVisible = true;
+		}
+		paste(){
+			this.copyText = "粘贴";
+			this.propsData = {copyContent: ''};
+			this.dlgCopyVisible = true;
+		}
+		doPaste(){
+			const sel = this.editor.getSelComp();
+			const params:any = {content: this.propsData.copyContent, currentCompId: sel ? sel.id : null, templateId: this.currentTemplate.id};
+			this.callAction('pasteContent', params);
+		}
+		
 		//切换编辑状态
 		changeState(state) {
 			this.state = state;