Commit 77d0f7ba by 无尘

fix: 修改编辑月指标

parent e145c134
.color1[data-v-23dbe625]{font-size:16px;padding-right:15px;font-weight:600}.content-data[data-v-23dbe625]{position:relative}.content-data .color2[data-v-23dbe625]{position:relative;font-size:14px;font-weight:400}.content-data .color2[data-v-23dbe625]:not(:first-of-type){padding-left:16px}.content-data .color2[data-v-23dbe625]:not(:first-of-type):before{content:"|";position:absolute;left:0;color:#dcdfe6}.target-title[data-v-23dbe625]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;width:1145px;margin:20px}.target-title span[data-v-23dbe625]{font-weight:600}.target-table[data-v-23dbe625]{width:1145px;margin:0 20px 50px}.table-title[data-v-23dbe625]{display:-webkit-box;display:-ms-flexbox;display:flex;background-color:#ebecf0}.table-title li[data-v-23dbe625]{width:163px;height:48px;line-height:48px;text-indent:35px;font-weight:500}.table-title li[data-v-23dbe625]:not(:last-of-type){border-right:1px solid #dcdfe6}.table-content[data-v-23dbe625]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.table-content li[data-v-23dbe625]{width:163px;height:70px;padding:5px 0 8px 10px;border-bottom:1px solid #dcdfe6}.table-content li[data-v-23dbe625]:not(:nth-of-type(7n)){border-right:1px solid #dcdfe6}.el-input-number[data-v-23dbe625] .el-input__inner{text-align:left;border:none;background-color:#f5f7fa}.el-form-item[data-v-23dbe625]{margin-bottom:10px}[data-v-23dbe625] .el-alert--danger{width:456px;margin-bottom:20px;background:#fffbe6;border-radius:2px;border:1px solid #ffe58f}[data-v-23dbe625] .el-alert--danger .el-alert__icon{color:#faad14}
\ No newline at end of file
.color1[data-v-2e984be4]{font-size:16px;padding-right:15px;font-weight:600}.content-data[data-v-2e984be4]{position:relative}.content-data .color2[data-v-2e984be4]{position:relative;font-size:14px;font-weight:400}.content-data .color2[data-v-2e984be4]:not(:first-of-type){padding-left:16px}.content-data .color2[data-v-2e984be4]:not(:first-of-type):before{content:"|";position:absolute;left:0;color:#dcdfe6}.target-title[data-v-2e984be4]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;width:1145px;margin:20px}.target-title span[data-v-2e984be4]{font-weight:600}.target-table[data-v-2e984be4]{width:1145px;margin:0 20px 50px}.table-title[data-v-2e984be4]{display:-webkit-box;display:-ms-flexbox;display:flex;background-color:#ebecf0}.table-title li[data-v-2e984be4]{width:163px;height:48px;line-height:48px;text-indent:35px;font-weight:500}.table-title li[data-v-2e984be4]:not(:last-of-type){border-right:1px solid #dcdfe6}.table-content[data-v-2e984be4]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.table-content li[data-v-2e984be4]{width:163px;height:70px;padding:5px 0 8px 10px;border-bottom:1px solid #dcdfe6}.table-content li[data-v-2e984be4]:not(:nth-of-type(7n)){border-right:1px solid #dcdfe6}.el-input-number[data-v-2e984be4] .el-input__inner{text-align:left;border:none;background-color:#f5f7fa}.el-form-item[data-v-2e984be4]{margin-bottom:10px}[data-v-2e984be4] .el-alert--danger{width:456px;margin-bottom:20px;background:#fffbe6;border-radius:2px;border:1px solid #ffe58f}[data-v-2e984be4] .el-alert--danger .el-alert__icon{color:#faad14}
\ No newline at end of file
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-12 10:47:17
* @LastEditors: 无尘
* @LastEditTime: 2020-11-23 10:17:38
* @LastEditTime: 2020-11-23 10:35:48
-->
<template>
<div class="common-app-right" style="padding: 20px 0;color: #303133">
......@@ -87,7 +87,7 @@
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmMonthTarget">确 定</el-button>
<el-button type="primary" :loading="loadMonth" @click="confirmMonthTarget">确 定</el-button>
</span>
</el-dialog>
</div>
......@@ -128,6 +128,7 @@ export default {
zerofill: [],
zerofillLast: [],
loadMonth: false,
targetForm: {
value: ''
},
......@@ -167,43 +168,51 @@ export default {
// 初始化表格
init() {
const that = this;
let { date, flag, performanceType, performanceYm, performanceSubType, storeInfoId } = this.form;
date = date && date.length ? date : [ 2020, 1 ];
let week = new Date(date[0], date[1] - 1).getDay(); // 第一天周几
let days = this.days = new Date(date[0], date[1], 0).getDate(); // 一个月天数
this.zerofill = new Array(week).fill(null); // 补空白
this.tableData = new Array(days).fill(null).map((item, i) => {
let days = that.days = new Date(date[0], date[1], 0).getDate(); // 一个月天数
that.zerofill = new Array(week).fill(null); // 补空白
that.tableData = new Array(days).fill(null).map((item, i) => {
return {
performanceDay: i + 1,
performanceValue: 0
performanceValue: 1
};
});
// 末尾补空白
let len = (this.zerofill.length + this.tableData.length) % 7;
if (len) this.zerofillLast = new Array(7 - len).fill(null);
let len = (that.zerofill.length + that.tableData.length) % 7;
if (len) that.zerofillLast = new Array(7 - len).fill(null);
// 默认值
if (flag === 'false') {
this.setDefault();
that.setDefault();
} else if (flag === 'true') {
let par = {
enterpriseId: this.brandId,
enterpriseId: that.brandId,
performanceType,
performanceYm,
performanceSubType,
storeInfoId
};
getStorePerformanceDay(par, { headers: { sign: this.brandId } })
getStorePerformanceDay(par, { headers: { sign: that.brandId } })
.then(res => {
console.log(res.performanceValue);
res.result.forEach(ele => {
ele.performanceDay = ele.performanceDay.split('-')[2];
});
that.tableData = res.result;
});
}
},
// 修改月指标
confirmMonthTarget() {
const that = this;
that.loadMonth = true;
that.$refs.targetForm.validate(valid => {
if (!valid) return;
if (!valid) {
that.loadMonth = false;
return;
}
const { performanceYm, performanceType, storeInfoId } = that.form;
let params = {
......@@ -216,7 +225,13 @@ export default {
changeStorePerformanceMonth(params, { headers: { sign: that.brandId } })
.then(res => {
// 重新设置指标额
that.loadMonth = false;
that.form.performanceValue = params.performanceValue;
that.dialogVisible = false;
})
.finally(() => {
that.dialogVisible = false;
that.loadMonth = false;
});
});
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment