Commit 0bf7bf0a by 无尘

fix: 修改日权重显示

parent a9754f08
...@@ -145,3 +145,20 @@ export const postForm = (url, params) => { ...@@ -145,3 +145,20 @@ export const postForm = (url, params) => {
headers: {} //'content-type': 'application/x-www-form-urlencoded'multipart/form-data{"token": token} headers: {} //'content-type': 'application/x-www-form-urlencoded'multipart/form-data{"token": token}
}); });
}; };
/**
* post excel
*/
export const postExcel = (url, params) => {
params.requestProject = 'haoban-manage-web';
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: qs.stringify(params),
responseType: 'blob',
headers: {
'content-type': 'application/x-www-form-urlencoded'
} //multipart/form-data{"token": token}
});
};
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="day grid white-color" v-for="(it, index) in myObject.empytGrids" :key="index + 'empytGrids'"></div> <div class="day grid white-color" v-for="(it, index) in myObject.empytGrids" :key="index + 'empytGrids'"></div>
</template> </template>
<div class="day w-p-14 selectable" :class="day == 0 ? 'hide' : ''" v-for="(day, index) in myObject.days" :key="index"> <div class="day w-p-14 selectable" :class="day == 0 ? 'hide' : ''" v-for="(day, index) in myObject.days" :key="index">
<div class="w-120 font-14 color-909399 day-performance">{{ day.performanceDay }}</div> <div class="w-120 font-14 color-909399 day-performance">{{ day.month +'-'+ day.performanceDay }}</div>
<div class="target-value "> <div class="target-value ">
<el-input class="w-120" v-model="day.weightValue" placeholder="请输入权重值" :disabled="settingAble == 0"></el-input> <el-input class="w-120" v-model="day.weightValue" placeholder="请输入权重值" :disabled="settingAble == 0"></el-input>
</div> </div>
...@@ -115,19 +115,19 @@ export default { ...@@ -115,19 +115,19 @@ export default {
* 一位数添加 0 * 一位数添加 0
* @param num (如:1-9) * @param num (如:1-9)
*/ */
addZero: function(num) { addZero(num) {
return num < 10 ? '0' + parseInt(num) : num; return num < 10 ? '0' + parseInt(num) : num;
}, },
// =============获取当月有多少天(下个月月初是多少)========== // =============获取当月有多少天(下个月月初是多少)==========
getThisMonthDays: function(year, month) { getThisMonthDays(year, month) {
return new Date(year, month, 0).getDate(); return new Date(year, month, 0).getDate();
}, },
// =============获取当月第一周第一天是周几=========== // =============获取当月第一周第一天是周几===========
getFirstDayOfWeek: function(year, month) { getFirstDayOfWeek(year, month) {
return new Date(Date.UTC(year, month - 1, 1)).getDay(); return new Date(Date.UTC(year, month - 1, 1)).getDay();
}, },
// =============获取当月最后一天是周几=========== // =============获取当月最后一天是周几===========
getLastDayOfWeek: function(year, month) { getLastDayOfWeek(year, month) {
return new Date(Date.UTC(year, month - 1, this.getThisMonthDays(year, month))).getDay(); return new Date(Date.UTC(year, month - 1, this.getThisMonthDays(year, month))).getDay();
}, },
// =============获取当年月日是周几=========== // =============获取当年月日是周几===========
...@@ -135,8 +135,8 @@ export default { ...@@ -135,8 +135,8 @@ export default {
return new Date(year, month - 1, day).getDay(); return new Date(year, month - 1, day).getDay();
}, },
//====================计算当前年月空的几天 ============= //====================计算当前年月空的几天 =============
calculateEmptyGrids: function(year, month) { async calculateEmptyGrids(year, month) {
const firstDayOfWeek = this.getFirstDayOfWeek(year, month); const firstDayOfWeek = await this.getFirstDayOfWeek(year, month);
let empytGrids = []; let empytGrids = [];
if (firstDayOfWeek > 0) { if (firstDayOfWeek > 0) {
for (let i = 0; i < firstDayOfWeek; i++) { for (let i = 0; i < firstDayOfWeek; i++) {
...@@ -146,8 +146,8 @@ export default { ...@@ -146,8 +146,8 @@ export default {
return empytGrids; return empytGrids;
}, },
//====================计算当前年月最后几天空的几天 ============= //====================计算当前年月最后几天空的几天 =============
calculateLastEmptyGrids: function(year, month) { async calculateLastEmptyGrids(year, month) {
const lastDayOfWeek = this.getLastDayOfWeek(year, month); const lastDayOfWeek = await this.getLastDayOfWeek(year, month);
let lastEmpytGrids = []; let lastEmpytGrids = [];
if (lastDayOfWeek >= 0) { if (lastDayOfWeek >= 0) {
for (let i = 0; i < 6 - lastDayOfWeek; i++) { for (let i = 0; i < 6 - lastDayOfWeek; i++) {
...@@ -156,13 +156,13 @@ export default { ...@@ -156,13 +156,13 @@ export default {
} }
return lastEmpytGrids; return lastEmpytGrids;
}, },
calculateDays: function(year, month) { async calculateDays(year, month) {
let that = this; let that = this;
let myObject = {}; //月对象 let myObject = {}; //月对象
myObject['year'] = year; myObject['year'] = year;
myObject['month'] = that.addZero(month); myObject['month'] = await that.addZero(month);
//计算当前年月空的几天 //计算当前年月空的几天
let empytGrids = that.calculateEmptyGrids(year, month); let empytGrids = await that.calculateEmptyGrids(year, month);
if (empytGrids.length > 0) { if (empytGrids.length > 0) {
myObject['hasEmptyGrid'] = true; myObject['hasEmptyGrid'] = true;
myObject['empytGrids'] = empytGrids; myObject['empytGrids'] = empytGrids;
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
myObject['empytGrids'] = []; myObject['empytGrids'] = [];
} }
// 最后空格 // 最后空格
let lastEmpytGrids = that.calculateLastEmptyGrids(year, month); let lastEmpytGrids = await that.calculateLastEmptyGrids(year, month);
if (lastEmpytGrids.length > 0) { if (lastEmpytGrids.length > 0) {
myObject['hasLastEmptyGrid'] = true; myObject['hasLastEmptyGrid'] = true;
myObject['lastEmpytGrids'] = lastEmpytGrids; myObject['lastEmpytGrids'] = lastEmpytGrids;
...@@ -180,7 +180,7 @@ export default { ...@@ -180,7 +180,7 @@ export default {
myObject['lastEmpytGrids'] = []; myObject['lastEmpytGrids'] = [];
} }
let days = []; let days = [];
let thisMonthDays = that.getThisMonthDays(year, month); //这个月有多少天 let thisMonthDays = await that.getThisMonthDays(year, month); //这个月有多少天
for (let i = 1; i <= thisMonthDays; i++) { for (let i = 1; i <= thisMonthDays; i++) {
let day = {}; let day = {};
/* 判断权重值 */ /* 判断权重值 */
...@@ -201,8 +201,9 @@ export default { ...@@ -201,8 +201,9 @@ export default {
} }
} }
day['performanceDay'] = i; //that.addZero(i); day['performanceDay'] = that.addZero(i);
day['date'] = year + '-' + that.addZero(month) + '-' + that.addZero(i); day['date'] = year + '-' + that.addZero(month) + '-' + that.addZero(i);
day['month'] = that.addZero(month);
days.push(day); days.push(day);
} }
myObject['days'] = days; myObject['days'] = days;
......
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