|
@@ -116,7 +116,7 @@
|
|
<el-link v-if="from.templateExtension" class="marleft10 colorblue" @click="delectExcelMSModel">删除</el-link>
|
|
<el-link v-if="from.templateExtension" class="marleft10 colorblue" @click="delectExcelMSModel">删除</el-link>
|
|
<el-link v-if="from.templateExtension" underline class="marleft10 colorblue"
|
|
<el-link v-if="from.templateExtension" underline class="marleft10 colorblue"
|
|
style="text-decoration:underline;" @click="downloadExcelModel()">下载模板</el-link>
|
|
style="text-decoration:underline;" @click="downloadExcelModel()">下载模板</el-link>
|
|
- <el-button type="success" size="mini" @click="saveExcelInfo" :loading="saveExcelJsonLoad">保存数据</el-button>
|
|
|
|
|
|
+ <el-button type="success" size="mini" @click="saveExcelInfo" :loading="saveExcelJsonLoad" style="margin-left: 5px;">保存数据</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -1128,34 +1128,31 @@ s
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//保存表格数据
|
|
//保存表格数据
|
|
- async saveExcelInfo(){
|
|
|
|
- this.saveExcelJsonLoad = true;
|
|
|
|
- const saveData= await this.$refs.luckySheet.getData()
|
|
|
|
-
|
|
|
|
- const { data: res } = await saveExcelJson(
|
|
|
|
- {
|
|
|
|
- key: this.from.id,
|
|
|
|
- jsonExcel: JSON.stringify(saveData)
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- this.saveExcelJsonLoad = false;
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- this.saveExcelJsonLoad = false;
|
|
|
|
- this.$message({
|
|
|
|
- message: '保存成功',
|
|
|
|
- type: 'success'
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }else{
|
|
|
|
- this.saveExcelJsonLoad = false;
|
|
|
|
- this.$message.error(res.msg)
|
|
|
|
- this.getInitialData()
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+async saveExcelInfo() {
|
|
|
|
+ this.saveExcelJsonLoad = true; // 开始加载
|
|
|
|
+ try {
|
|
|
|
+ const saveData = await this.$refs.luckySheet.getData();
|
|
|
|
+ const { data: res } = await saveExcelJson({
|
|
|
|
+ key: this.from.id,
|
|
|
|
+ jsonExcel: JSON.stringify(saveData)
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '保存成功',
|
|
|
|
+ type: 'success'
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.msg);
|
|
|
|
+ this.getInitialData();
|
|
}
|
|
}
|
|
|
|
+ } catch (error) {
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ // 无论成功还是失败,最终都会执行这里
|
|
|
|
+ this.saveExcelJsonLoad = false;
|
|
|
|
+ }
|
|
|
|
+}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.excelType()//清表类型
|
|
this.excelType()//清表类型
|