|
@@ -245,6 +245,7 @@
|
|
|
ref="sheetRef"
|
|
|
v-if="sheetConfigOpt.data"
|
|
|
:option="sheetConfigOpt"
|
|
|
+ @updated="hasChange=true"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -427,6 +428,8 @@ export default {
|
|
|
saveTime:"",
|
|
|
|
|
|
isEdbReFreshLoading: false,//指标刷新
|
|
|
+ // 内容是否更新
|
|
|
+ hasChange:false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -443,6 +446,7 @@ export default {
|
|
|
this.sheetAllcellData = [],//全部单元格数据 分页push
|
|
|
this.dataToalPage = 0;
|
|
|
this.sheetConfigOpt.data = null;
|
|
|
+ this.hasChange=false
|
|
|
newval && this.getDetailHandle();
|
|
|
},
|
|
|
|
|
@@ -677,7 +681,10 @@ export default {
|
|
|
this.handleDownloadResource(url,filename)
|
|
|
},
|
|
|
/* 保存表格 */
|
|
|
- saveHandle: _.debounce(async function () {
|
|
|
+ saveHandle: _.debounce(function () {
|
|
|
+ this.saveApi()
|
|
|
+ }, 300),
|
|
|
+ async saveApi(){
|
|
|
luckysheet.exitEditMode();
|
|
|
let data = luckysheet.getAllSheets();
|
|
|
|
|
@@ -692,6 +699,7 @@ export default {
|
|
|
let img = getSheetImage(data[0]);
|
|
|
const form = new FormData();
|
|
|
form.append("Image", img);
|
|
|
+ form.append("closableErrMsg123", true);
|
|
|
const { Data } = await sheetInterface.uploadImg(form);
|
|
|
|
|
|
data.luckysheet_select_save = [];
|
|
@@ -703,14 +711,16 @@ export default {
|
|
|
ExcelClassifyId,
|
|
|
ExcelImage: Data.ResourceUrl,
|
|
|
Content: JSON.stringify(data),
|
|
|
+ closableErrMsg123:true
|
|
|
});
|
|
|
this.loading.close();
|
|
|
- if (res.Ret !== 200) return;
|
|
|
+ if (res.Ret !== 200) return false;
|
|
|
+ this.hasChange=false
|
|
|
this.saveTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
|
|
|
- this.$message.success(this.$t('MsgPrompt.saved_msg'));
|
|
|
+ this.shouldClosedHintshow(this.$t('MsgPrompt.saved_msg'))
|
|
|
this.getTreeData();
|
|
|
- }, 300),
|
|
|
-
|
|
|
+ return true
|
|
|
+ },
|
|
|
/* 获取表格列表 */
|
|
|
getPublicList() {
|
|
|
sheetInterface
|
|
@@ -854,15 +864,31 @@ export default {
|
|
|
},
|
|
|
|
|
|
/* 刷新表格 */
|
|
|
- refreshSheet: _.debounce(async function() {
|
|
|
+ refreshSheet: _.debounce(function() {
|
|
|
if(this.isEdbReFreshLoading) return
|
|
|
-
|
|
|
- this.isEdbReFreshLoading = true;
|
|
|
- let res = await sheetInterface.sheetAnalysisInterface.sheetRefresh({ExcelInfoId: this.sheetDetailInfo.ExcelInfoId})
|
|
|
+ //退出编辑模式,让文本框失焦
|
|
|
+ luckysheet.exitEditMode();
|
|
|
+ // 保存逻辑延后 让hasChange取得正确的值
|
|
|
+ setTimeout(async()=>{
|
|
|
+ this.isEdbReFreshLoading = true;
|
|
|
+ let res={}
|
|
|
+ // 内容有改变 刷新前需要先保存
|
|
|
+ if(this.hasChange){
|
|
|
+ let saveSuccess = await this.saveApi()
|
|
|
+ if(!saveSuccess){
|
|
|
+ // 没保存成功
|
|
|
+ this.isEdbReFreshLoading = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ res = await sheetInterface.sheetAnalysisInterface.sheetRefresh({ExcelInfoId: this.sheetDetailInfo.ExcelInfoId,closableErrMsg123:true})
|
|
|
+ }else{
|
|
|
+ res = await sheetInterface.sheetAnalysisInterface.sheetRefresh({ExcelInfoId: this.sheetDetailInfo.ExcelInfoId,closableErrMsg123:true})
|
|
|
+ }
|
|
|
|
|
|
- this.isEdbReFreshLoading = false;
|
|
|
- if(res.Ret !== 200) return
|
|
|
- this.$message.success(res.Msg)
|
|
|
+ this.isEdbReFreshLoading = false;
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ this.shouldClosedHintshow(res.Msg)
|
|
|
+ })
|
|
|
},300),
|
|
|
|
|
|
/* 重绘右侧区域宽度 */
|
|
@@ -899,7 +925,22 @@ export default {
|
|
|
code: this.sheetDetailInfo.UniqueCode
|
|
|
}});
|
|
|
},
|
|
|
-
|
|
|
+ shouldClosedHintshow(msg){
|
|
|
+ let messageHint=this.$message.success({
|
|
|
+ message:msg,
|
|
|
+ duration:0,
|
|
|
+ showClose:true
|
|
|
+ })
|
|
|
+ this.$store.commit('PUSH_CLOSABLE_HINT',messageHint)
|
|
|
+ },
|
|
|
+ closeHint(){
|
|
|
+ // console.log(this.$store.state.closableHints,'closableHints');
|
|
|
+ if(!(this.$store.state.closableHints && this.$store.state.closableHints.length>0)) return
|
|
|
+ this.$store.state.closableHints.map(hint =>{
|
|
|
+ hint.close()
|
|
|
+ })
|
|
|
+ this.$store.commit('CLEAR_CLOSABLE_HINT')
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.$route.query.code) {
|
|
@@ -913,9 +954,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
window.addEventListener("resize", this.reloadRightWid);
|
|
|
+ document.addEventListener("click", this.closeHint);
|
|
|
},
|
|
|
destroyed() {
|
|
|
window.removeEventListener("resize", this.reloadRightWid);
|
|
|
+ document.removeEventListener("click", this.closeHint);
|
|
|
},
|
|
|
};
|
|
|
</script>
|