|
|
@@ -1,12 +1,19 @@
|
|
|
<template>
|
|
|
<basic-container v-loading="loading">
|
|
|
<div class="btn-wrap">
|
|
|
- <el-button type="primary" icon="el-icon-edit" @click="handleSaveBtn">保存</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-edit" :loading="confirmLoading" @click="handleSaveBtn">保存</el-button>
|
|
|
</div>
|
|
|
<div class="doc-page">
|
|
|
<h3 class="page-title" style="margin: 24px 0 16px">{{ pageTitle }}</h3>
|
|
|
- <div style="display: flex; justify-content: space-between; margin: 12px 0;">
|
|
|
- <year-month-select v-model="year" :showMonth="false" style="margin: 0;"></year-month-select>
|
|
|
+ <div style="display: flex; margin: 12px 0;">
|
|
|
+ <year-month-select v-model="year" :showMonth="false" style="margin: 0 15px 0 0;"></year-month-select>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleReady"
|
|
|
+ >
|
|
|
+ 读取数据
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
size="small"
|
|
|
@@ -490,16 +497,13 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isLoad: false, // 页面数据是否加载完成
|
|
|
loading: false,
|
|
|
+ confirmLoading: false,
|
|
|
year: "",
|
|
|
formData: {},
|
|
|
};
|
|
|
},
|
|
|
- watch: {
|
|
|
- "year"() {
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- },
|
|
|
computed: {
|
|
|
...mapGetters(['tag']),
|
|
|
pageTitle() {
|
|
|
@@ -513,13 +517,22 @@ export default {
|
|
|
getList({ year: this.year }).then(({ data }) => {
|
|
|
this.loading = false;
|
|
|
if (data.code == 200) {
|
|
|
+ this.isLoad = true;
|
|
|
this.formData = data.data;
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ handleReady() {
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
handleSaveBtn() {
|
|
|
+ if (!this.isLoad) {
|
|
|
+ this.$message.error("请读取页面数据,再保存!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.confirmLoading = true;
|
|
|
let params = {
|
|
|
yearAndMonth: this.year,
|
|
|
"d2": this.formData.d2,
|
|
|
@@ -544,10 +557,13 @@ export default {
|
|
|
"d50": this.formData.d50,
|
|
|
};
|
|
|
update(params).then(({ data }) => {
|
|
|
+ this.confirmLoading = false;
|
|
|
if (data.code == 200) {
|
|
|
this.$message.success('保存成功!');
|
|
|
this.getData();
|
|
|
}
|
|
|
+ }).catch(err => {
|
|
|
+ this.confirmLoading = false;
|
|
|
});
|
|
|
},
|
|
|
handleExport() {
|