From eb2f43c595f6e0602c74ba8516b6324ffcab3e59 Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期三, 13 三月 2024 11:13:29 +0800
Subject: [PATCH] 原始记录模板完成

---
 src/components/tool/excel.vue                |   84 +++++++++++++++------------
 src/components/view/b2-standard-template.vue |   45 ++++++++++++--
 static/js/menu.js                            |    2 
 src/App.vue                                  |    6 +
 4 files changed, 90 insertions(+), 47 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 58de929..6238339 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -271,7 +271,7 @@
 	}
 
 	.luckysheet-cols-menu {
-	  z-index: 9004;
+	  z-index: 9000;
 	}
 
 	.luckysheet-input-box {z-index:3000}
@@ -283,6 +283,10 @@
 	.luckysheet-share-logo,.luckysheet_info_detail_save,.luckysheet_info_detail_update{
 		visibility: hidden;
 	}
+	
+	.el-loading-mask{
+		z-index: 9999;
+	}
 
 	/* 鍏ㄥ眬杈撳叆妗嗘牱寮� */
 	/* 鍏ㄥ眬鎸夐挳鏍峰紡 */
diff --git a/src/components/tool/excel.vue b/src/components/tool/excel.vue
index 3353db2..afc58d4 100644
--- a/src/components/tool/excel.vue
+++ b/src/components/tool/excel.vue
@@ -33,10 +33,11 @@
 </template>
 
 <script>
+// import { data } from 'jquery';
 	export default {
+		props: ['data','title'],
 		data() {
 			return {
-				data: {}
 			}
 		},
 		mounted() {
@@ -46,43 +47,50 @@
 		},
 		methods: {
 			templateWrite() {
-				$(function() {
-					//閰嶇疆椤�
-					var options = {
-						container: 'luckysheet',
-						title: "妯℃澘缂栧埗",
-						lang: "zh",
-						showsheetbar: false,
-						showstatisticBarConfig: {
-							view: false
-						},
-						data: [{
-							name: '妯℃澘',
-							order: '0'
-						}],
-						enableAddRow: false,
-						row: 100,
-						enableAddBackTop: false,
-						showtoolbarConfig: {
-							chart: false, // '鍥捐〃'
-							pivotTable: false,  //'鏁版嵁閫忚琛�'
-							protection:false, // '宸ヤ綔琛ㄤ繚鎶�'
-						},
-						cellRightClickConfig: {
-							copyAs: false, // 澶嶅埗涓�
-							hideRow: false, // 闅愯棌閫変腑琛屽拰鏄剧ず閫変腑琛�
-							hideColumn: false, // 闅愯棌閫変腑鍒楀拰鏄剧ず閫変腑鍒�
-							sort: false, // 鎺掑簭閫夊尯
-							filter: false, // 绛涢�夐�夊尯
-							chart: false, // 鍥捐〃鐢熸垚
-							image: false, // 鎻掑叆鍥剧墖
-							matrix: false, // 鐭╅樀鎿嶄綔閫夊尯
-						},
-						myFolderUrl: 'http://127.0.0.1/',
-						functionButton: '<button onClick="excelClosed()" class="save">淇濆瓨</button>'
-					}
-					luckysheet.create(options)
-				})
+				if(this.data!=null&&this.data!=''){
+					let option = JSON.parse(this.data)
+					option.title = this.title
+					luckysheet.create(option)
+				}else{
+					$(function() {
+						//閰嶇疆椤�
+						var options = {
+							container: 'luckysheet',
+							title: this.title,
+							lang: "zh",
+							showsheetbar: false,
+							showstatisticBarConfig: {
+								view: false
+							},
+							data: [{
+								name: '妯℃澘',
+								order: '0'
+							}],
+							enableAddRow: false,
+							row: 100,
+							column: 26,
+							enableAddBackTop: false,
+							showtoolbarConfig: {
+								chart: false, // '鍥捐〃'
+								pivotTable: false,  //'鏁版嵁閫忚琛�'
+								protection:false, // '宸ヤ綔琛ㄤ繚鎶�'
+							},
+							cellRightClickConfig: {
+								copyAs: false, // 澶嶅埗涓�
+								hideRow: false, // 闅愯棌閫変腑琛屽拰鏄剧ず閫変腑琛�
+								hideColumn: false, // 闅愯棌閫変腑鍒楀拰鏄剧ず閫変腑鍒�
+								sort: false, // 鎺掑簭閫夊尯
+								filter: false, // 绛涢�夐�夊尯
+								chart: false, // 鍥捐〃鐢熸垚
+								image: false, // 鎻掑叆鍥剧墖
+								matrix: false, // 鐭╅樀鎿嶄綔閫夊尯
+							},
+							myFolderUrl: 'http://127.0.0.1/',
+							functionButton: '<button onClick="excelClosed()" class="save">淇濆瓨</button>'
+						}
+						luckysheet.create(options)
+					})
+				}
 			}
 		}
 	}
diff --git a/src/components/view/b2-standard-template.vue b/src/components/view/b2-standard-template.vue
index abcfd56..a01fe23 100644
--- a/src/components/view/b2-standard-template.vue
+++ b/src/components/view/b2-standard-template.vue
@@ -40,7 +40,7 @@
 	<div class="standard-template">
 		<div>
 			<el-row class="title">
-				<el-col :span="12" style="padding-left: 20px;">妫�楠屾ā鏉�</el-col>
+				<el-col :span="12" style="padding-left: 20px;">鍘熷璁板綍妯℃澘</el-col>
 				<el-col :span="12" style="text-align: right;">
 					<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板</el-button>
 				</el-col>
@@ -59,11 +59,11 @@
 		</div>
 		<div class="table">
 			<ValueTable ref="ValueTable" :url="$api.StandardTemplate.selectStandardTemplatePageList"
-				:upUrl="$api.enums.upEnum" :delUrl="$api.enums.delEnum" :componentData="componentData" :key="upIndex" />
+				:upUrl="$api.StandardTemplate.upStandardTemplate" :delUrl="$api.StandardTemplate.delStandardTemplate" :componentData="componentData" :key="upIndex" />
 		</div>
-		<el-dialog title="妯℃澘缂栧埗" :visible.sync="isShow" width="80%">
+		<el-dialog title="妯℃澘缂栧埗" :visible.sync="isShow" width="80%" :before-close="isClose">
 			<div style="width: 100%;height: 80vh;overflow: auto;" v-if="isShow">
-				<Excel></Excel>
+				<Excel :data="row.thing" :title="row.name" v-loading="loading"></Excel>
 			</div>
 		</el-dialog>
 	</div>
@@ -115,7 +115,13 @@
 				upIndex: 0,
 				addDia: false,
 				addPower: true,
-				isShow: false
+				isShow: false,
+				loading: false,
+				row: {
+					id: null,
+					thing: null,
+					name: null
+				}
 			}
 		},
 		mounted() {
@@ -161,10 +167,35 @@
 			},
 			templateWrite(row) {
 				this.isShow = true
+				this.row = row
 			},
 			closed(){
-				let data = luckysheet.getAllSheets()
-				console.log(data);
+				this.loading = true
+				let data = luckysheet.toJson()
+				this.$axios.post(this.$api.StandardTemplate.upStandardTemplate,{
+					id: this.row.id,
+					thing: JSON.stringify(data),
+					name: luckysheet.getWorkbookName(['name'])
+				},{
+					headers: {
+						'Content-Type': 'application/json'
+					}
+				}).then(res=>{
+					if (res.code==201) return
+					this.loading = false
+					this.$message.success('宸蹭繚瀛�')
+					this.isShow = false
+					this.refreshTable()
+				})
+			},
+			isClose(done){
+				this.$confirm('鏄惁闇�瑕佷繚瀛�?', "璀﹀憡", {
+					confirmButtonText: "纭畾",
+					cancelButtonText: "鍙栨秷",
+					type: "warning"
+				}).then(() => {
+					this.closed()
+				}).catch(()=>{done()})
 			}
 		}
 	}
diff --git a/static/js/menu.js b/static/js/menu.js
index a20ac97..9eed660 100644
--- a/static/js/menu.js
+++ b/static/js/menu.js
@@ -51,7 +51,7 @@
 			u: "b2-standard",
 			p: "selectStandardTreeList"
 		}, {
-			v: "妫�楠屾ā鏉�",
+			v: "鍘熷璁板綍妯℃澘",
 			i: "font icon-erjidaohang",
 			u: "b2-standard-template",
 			p: "selectStandardTemplatePageList"

--
Gitblit v1.9.3