Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory_web
This commit is contained in:
commit
34a80119e6
|
|
@ -261,8 +261,23 @@ export default {
|
|||
}else{
|
||||
arr[12] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100%
|
||||
}
|
||||
arr[13] = 0; //同比增长率(%)
|
||||
// arr[15] = 0.0; //得分
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[13] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[13] = tongBiRate;
|
||||
}
|
||||
arr[14] = 0;
|
||||
if (month_obj[n]) {
|
||||
const monthData = month_obj[n];
|
||||
|
|
|
|||
|
|
@ -325,20 +325,15 @@ export default {
|
|||
}
|
||||
arrs[6] = lastRate;
|
||||
//同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[index] &&
|
||||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100;
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let ind = index + 1;
|
||||
let lastYearItem = wrapArr0[ind]; // 上一年同期值
|
||||
let tongqiVal = lastYearItem ? Number(lastYearItem.elec_consume_unit) : null;
|
||||
arrs[7] = "/"; // 默认无值
|
||||
if (tongqiVal !== null && tongqiVal !== 0 && !isNaN(tongqiVal)) {
|
||||
let tongqicha = (item[1] - tongqiVal).toFixed(2);
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arrs[7] = tongBiRate; // 同比增长率(%)
|
||||
}
|
||||
arrs[7] = sameRate;
|
||||
arrs[8] = item[3];
|
||||
arrs[9] = item[4];
|
||||
wrapArrs.push(arrs);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@
|
|||
type="primary"
|
||||
@click="exportExcel()"
|
||||
:loading="exportLoading"
|
||||
v-auth="'export_excel'"
|
||||
>导出xlsx
|
||||
</el-button>
|
||||
<el-button
|
||||
|
|
@ -92,7 +93,8 @@
|
|||
<el-card style="margin-top:5px">
|
||||
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
|
||||
<el-table
|
||||
id = "greenHeadTable"
|
||||
id="myTable"
|
||||
class="myTable"
|
||||
:data="tableData"
|
||||
style="width: 70%"
|
||||
border
|
||||
|
|
@ -122,7 +124,6 @@
|
|||
border
|
||||
style="margin-left: 10px; margin-top: 10px; width: 500px; table-layout: fixed;"
|
||||
:key="timeStamp"
|
||||
class="myTable"
|
||||
>
|
||||
<!-- 第一列 -->
|
||||
<el-table-column
|
||||
|
|
@ -173,6 +174,7 @@ import * as echarts from 'echarts';
|
|||
start_time:'',
|
||||
end_time:'',
|
||||
},
|
||||
tableName:'峰谷平报表',
|
||||
tableHeight:800,
|
||||
columns: [
|
||||
{ label: '尖峰', prop: 'peak' },
|
||||
|
|
|
|||
|
|
@ -293,21 +293,23 @@ export default {
|
|||
} else{
|
||||
arr[15] = "/"
|
||||
};
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[ind] &&
|
||||
wrapArr0[ind].coal_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
(( item.coal_consume_unit -
|
||||
wrapArr0[ind].coal_consume_unit) /
|
||||
wrapArr0[ind].coal_consume_unit) *
|
||||
100;
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[16] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[16] = tongBiRate;
|
||||
}
|
||||
arr[16] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
//电耗
|
||||
//设备
|
||||
arr[17] =
|
||||
item.高温风机_consume_unit != null
|
||||
|
|
|
|||
|
|
@ -655,10 +655,10 @@ export default {
|
|||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate = "/";
|
||||
}
|
||||
|
|
@ -718,10 +718,10 @@ export default {
|
|||
wrapArr0[index].celec_consume_unit
|
||||
) {
|
||||
sameRate2 =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].celec_consume_unit) /
|
||||
wrapArr0[index].celec_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate2 = "/";
|
||||
}
|
||||
|
|
@ -781,10 +781,10 @@ export default {
|
|||
wrapArr0[index].coal_consume_unit
|
||||
) {
|
||||
sameRate3 =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].coal_consume_unit) /
|
||||
wrapArr0[index].coal_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate3 = "/";
|
||||
}
|
||||
|
|
@ -844,10 +844,10 @@ export default {
|
|||
wrapArr0[index].cen_consume_unit
|
||||
) {
|
||||
sameRate4 =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].cen_consume_unit) /
|
||||
wrapArr0[index].cen_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate4 = "/";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,23 @@ export default {
|
|||
tongqi = 0;
|
||||
}
|
||||
|
||||
arr[17] = tongqi; //同比增长率(%):本月-去年本月/去年
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[17] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[17] = tongBiRate;
|
||||
}
|
||||
// arr[18] = 0.0; //同比增长率(%)
|
||||
arr[18] = 0;
|
||||
if (month_obj[n]) {
|
||||
|
|
|
|||
|
|
@ -405,10 +405,10 @@ export default {
|
|||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate = "/";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ export default {
|
|||
// self.data = res[1];
|
||||
// console.log("目标数据", self.data);
|
||||
// }
|
||||
console.log(res,'----------res');
|
||||
self.getData(res[1]);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
@ -222,20 +221,23 @@ export default {
|
|||
}else{
|
||||
arr[8] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100%
|
||||
}
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[ind] &&
|
||||
wrapArr0[ind].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arr[3] -
|
||||
wrapArr0[ind].elec_consume_unit) /
|
||||
wrapArr0[ind].elec_consume_unit) *
|
||||
100;
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[9] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[9] = tongBiRate;
|
||||
}
|
||||
arr[9] = sameRate; ///同比增长率(%)需要当前值/ 上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
// arr[10] = item.celec_consume_unit; //同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
if (month_obj[n]) {
|
||||
const monthData = month_obj[n];
|
||||
|
|
|
|||
|
|
@ -301,10 +301,10 @@ export default {
|
|||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arrs[1] -
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100;
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate = "/";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,24 @@ export default {
|
|||
}else{
|
||||
arr[14] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100%
|
||||
}
|
||||
arr[16] = item.celec_consume_unit; //同比增长率(%)
|
||||
// arr[16] = item.celec_consume_unit; //同比增长率(%)
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[16] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[16] = tongBiRate;
|
||||
}
|
||||
|
||||
arr[17] = 0;
|
||||
if (month_obj[n]) {
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ export default {
|
|||
that.$API.mtm.mgroup.list
|
||||
.req({ page: 0, name: "原料磨" })
|
||||
.then((res) => {
|
||||
console.log("原料磨", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//月目标
|
||||
that.getMonthGoal();
|
||||
|
|
@ -171,7 +170,6 @@ export default {
|
|||
paramsGoal.page = 0;
|
||||
paramsGoal.year = that.query.year_s;
|
||||
paramsGoal.mgroup = that.query.mgroup;
|
||||
console.log("paramsGoal", paramsGoal);
|
||||
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
|
||||
if (ress.length > 0) {
|
||||
let monthGoal = [];
|
||||
|
|
@ -295,28 +293,22 @@ export default {
|
|||
lastRate = "/";
|
||||
}
|
||||
arrs[6] = lastRate;
|
||||
//同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[index] &&
|
||||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let ind = index + 1;
|
||||
let lastYearItem = wrapArr0[ind]; // 上一年同期值
|
||||
let tongqiVal = lastYearItem ? Number(lastYearItem.elec_consume_unit) : null;
|
||||
arrs[7] = "/"; // 默认无值
|
||||
if (tongqiVal !== null && tongqiVal !== 0 && !isNaN(tongqiVal)) {
|
||||
let tongqicha = (item[1] - tongqiVal).toFixed(2);
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arrs[7] = tongBiRate; // 同比增长率(%)
|
||||
}
|
||||
arrs[7] = sameRate;
|
||||
arrs[8] = item[3];
|
||||
arrs[9] = item[4];
|
||||
wrapArrs.push(arrs);
|
||||
});
|
||||
|
||||
that.tableDatas = wrapArrs;
|
||||
} else {
|
||||
}
|
||||
} else {}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -273,8 +273,24 @@ export default {
|
|||
}else{
|
||||
arr[15] = "/"; //环比增长率(%)= 当期与环期差值(kW·h/t)/环期值(kW·h/t)*100%
|
||||
}
|
||||
arr[16] = item.celec_consume_unit; //同比增长率(%)
|
||||
|
||||
// arr[16] = item.celec_consume_unit; //同比增长率(%)
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[16] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[16] = tongBiRate;
|
||||
}
|
||||
arr[17] = 0;
|
||||
if (month_obj[n]) {
|
||||
const monthData = month_obj[n];
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ export default {
|
|||
that.query.mgroup = res[0].id;
|
||||
//月目标
|
||||
that.getMonthGoal();
|
||||
that.getData();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -166,11 +165,12 @@ export default {
|
|||
let that = this;
|
||||
let paramsGoal = {};
|
||||
paramsGoal.page = 0;
|
||||
let monthGoal = [];
|
||||
paramsGoal.mgroup = that.query.mgroup;
|
||||
paramsGoal.year = that.query.year_s;
|
||||
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
|
||||
if (ress.length > 0) {
|
||||
let monthGoal = [];
|
||||
|
||||
ress.forEach((goal) => {
|
||||
if (
|
||||
goal.goal_cate_name == "单位产品分布电耗(kW·h/t)"
|
||||
|
|
@ -189,9 +189,9 @@ export default {
|
|||
monthGoal[11] = goal.goal_val_11;
|
||||
monthGoal[12] = goal.goal_val_12;
|
||||
}
|
||||
this.getData(monthGoal);
|
||||
});
|
||||
}
|
||||
that.getData(monthGoal);
|
||||
});
|
||||
},
|
||||
getData(monthGoal) {
|
||||
|
|
@ -199,7 +199,7 @@ export default {
|
|||
let query0 = {};
|
||||
query0.page = 0;
|
||||
query0.type = "month_s";
|
||||
query0.year = that.query.year_s - 1;
|
||||
query0.year_s = that.query.year_s - 1;
|
||||
query0.mgroup = that.query.mgroup;
|
||||
let wrapArr = [],
|
||||
wrapArr0 = [],
|
||||
|
|
@ -228,8 +228,7 @@ export default {
|
|||
let time = "" + item.year_s + "." + item.month_s;
|
||||
arr.push(time);
|
||||
arr.push(item.elec_consume_unit); //当期值(kW·h/t)
|
||||
arr[2] =
|
||||
monthGoal[ind] !== undefined
|
||||
arr[2] = monthGoal[ind] !== undefined
|
||||
? monthGoal[ind]
|
||||
: "/";
|
||||
arr[3] = item.note;
|
||||
|
|
@ -290,21 +289,15 @@ export default {
|
|||
lastRate = "/";
|
||||
}
|
||||
arrs[6] = lastRate;
|
||||
//同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[index] &&
|
||||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
(((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100).toFixed(2);
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let ind = index + 1;
|
||||
let lastYearItem = wrapArr0[ind]; // 上一年同期值
|
||||
let tongqiVal = lastYearItem ? Number(lastYearItem.elec_consume_unit) : null;
|
||||
arrs[7] = "/"; // 默认无值
|
||||
if (tongqiVal !== null && tongqiVal !== 0 && !isNaN(tongqiVal)) {
|
||||
let tongqicha = (item[1] - tongqiVal).toFixed(2);
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arrs[7] = tongBiRate; // 同比增长率(%)
|
||||
}
|
||||
arrs[7] = sameRate;
|
||||
arrs[8] = item[3];
|
||||
arrs[9] = item[4];
|
||||
wrapArrs.push(arrs);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ export default {
|
|||
this.timeStamp = myDate.getTime();
|
||||
that.query.year_s = year;
|
||||
this.$API.mtm.mgroup.list.req({ page: 0, search: "电石渣" }).then((res) => {
|
||||
console.log("工段数据:", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
that.getGoalData();
|
||||
});
|
||||
|
|
@ -114,7 +113,6 @@ export default {
|
|||
if (res.length > 0) {
|
||||
res.forEach((item) => {
|
||||
if (item.goal_cate_name == "单位产品分布电耗(kW·h/t)") {
|
||||
console.log("目标数据:", item);
|
||||
self.getData(item);
|
||||
}
|
||||
})
|
||||
|
|
@ -137,11 +135,11 @@ export default {
|
|||
this.$API.enm.enstat.req(query0).then((res0) => {
|
||||
if (res0.length > 0) {
|
||||
res0.forEach((item0) => {
|
||||
//先按月份排序,再按班组排序
|
||||
//先按月份排序,再按班组排序,取上一年的值为了计算同比增长率
|
||||
let month = item0.month_s;
|
||||
if (!wrapArr0[month]) {
|
||||
wrapArr0[month] = [];
|
||||
}
|
||||
}
|
||||
wrapArr0[month].push(item0);
|
||||
});
|
||||
} else { console.log('No data received.');}
|
||||
|
|
@ -183,27 +181,24 @@ export default {
|
|||
arr[5] = goalData[keyVale]; //目标值(KW·h/t)//需要接口获取
|
||||
arr[6] = (arr[4] - arr[5]).toFixed(2); //当期与目标差值(KW·h/t)
|
||||
let ind_pre = 0,
|
||||
huanqi = 0,
|
||||
tongqi = 0,
|
||||
tongqicha = 0;
|
||||
huanqi = 0;
|
||||
if (n == 1) {
|
||||
ind_pre = 12;
|
||||
if (wrapArr0[ind_pre]) {
|
||||
wrapArr0[ind_pre].forEach((item0) => {
|
||||
if (item0.team_name == item.team_name) {
|
||||
huanqi = item0.elec_consume_unit;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
wrapArr0[ind_pre].forEach((item0) => {
|
||||
if (item0.team_name == item.team_name) {
|
||||
huanqi = item0.elec_consume_unit;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 如果 wrapArr数组长度大于0,那么循环遍历wrapArr数组,找到与item.month_s相差1的元素 而 item.name相同,并赋值给huanbi
|
||||
compareArr0.forEach((item0) => {
|
||||
if (item0[0] == item.month_s - 1 && item0[1] == item.team_name) {
|
||||
huanqi = item0[2];
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[7] = Number(huanqi); //环期值(KW·h/t)上个月的值
|
||||
if (arr[6] !== "/"){
|
||||
arr[8] = (Number(arr[4]) - arr[7]).toFixed(2); //当期与环期差值(KW·h/t)
|
||||
|
|
@ -217,16 +212,23 @@ export default {
|
|||
growthRate = "/";
|
||||
}
|
||||
arr[9] = growthRate; //环比增长率(%)
|
||||
if (wrapArr0[n]) {
|
||||
tongqicha =
|
||||
item.celec_consume_unit -
|
||||
wrapArr0[n].celec_consume_unit;
|
||||
tongqi = tongqicha / tongqi;
|
||||
} else {
|
||||
tongqicha = item.celec_consume_unit;
|
||||
tongqi = 0;
|
||||
let lastYearArr = wrapArr0[n];
|
||||
let tongqiVal = null;
|
||||
if (lastYearArr && lastYearArr.length > 0) {
|
||||
lastYearArr.forEach((item0) => {
|
||||
if (item0.team_name === item.team_name){
|
||||
tongqiVal = Number(item0.elec_consume_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
arr[10] = '/'; //同比增长率(%)
|
||||
if (tongqiVal !== null && tongqiVal !== 0){
|
||||
// 同比差(当期值 - 上年同期值)
|
||||
let tongqicha = (item.elec_consume_unit - tongqiVal).toFixed(2);
|
||||
// 同比增长率 = 同比差 / 上年同期值 × 100%
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arr[10] = tongBiRate;
|
||||
}
|
||||
arr[10] = tongqi; //同比增长率(%)
|
||||
//如果n = month_list的key值,则遍历里面的对象按照value排序, 如果 index==0,则arr[11] = 100,如果 index==1,则arr[11] = 80,如果 index==2,则arr[11] = 70,如果 index==3,则arr[11] = 0
|
||||
if (month_obj[n]) {
|
||||
const monthData = month_obj[n];
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ export default {
|
|||
: "/";
|
||||
arr[3] = item.note;
|
||||
arr[4] = item.id;
|
||||
wrapArr[ind] = arr;
|
||||
wrapArr.push(arr);
|
||||
});
|
||||
wrapArr.forEach((item, index) => {
|
||||
let arrs = [];
|
||||
|
|
@ -293,20 +293,15 @@ export default {
|
|||
}
|
||||
arrs[6] = lastRate;
|
||||
//同比增长率(%)需要当前值-上一年同一个月的值即wrapArr0[ind].elec_consume_unit
|
||||
let sameRate = 0;
|
||||
if (
|
||||
wrapArr0[index] &&
|
||||
wrapArr0[index].elec_consume_unit
|
||||
) {
|
||||
sameRate =
|
||||
((arrs[1] -
|
||||
wrapArr0[index].elec_consume_unit) /
|
||||
wrapArr0[index].elec_consume_unit) *
|
||||
100;
|
||||
} else {
|
||||
sameRate = "/";
|
||||
let ind = index + 1;
|
||||
let lastYearItem = wrapArr0[ind]; // 上一年同期值
|
||||
let tongqiVal = lastYearItem ? Number(lastYearItem.elec_consume_unit) : null;
|
||||
arrs[7] = "/"; // 默认无值
|
||||
if (tongqiVal !== null && tongqiVal !== 0 && !isNaN(tongqiVal)) {
|
||||
let tongqicha = (item[1] - tongqiVal).toFixed(2);
|
||||
let tongBiRate = ((tongqicha / tongqiVal) * 100).toFixed(2);
|
||||
arrs[7] = tongBiRate; // 同比增长率(%)
|
||||
}
|
||||
arrs[7] = sameRate;
|
||||
arrs[8] = item[3];
|
||||
arrs[9] = item[4];
|
||||
wrapArrs.push(arrs);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,454 @@
|
|||
<template>
|
||||
<div style="padding: 10px">
|
||||
<div class="company-card-compact">
|
||||
<div class="company-main-content">
|
||||
<div class="company-header-compact">
|
||||
<h2 class="company-name-compact">光芯科技</h2>
|
||||
<div class="mission-tag-compact">
|
||||
<span class="mission-icon-compact">✨</span>
|
||||
<span class="mission-text-compact">材料创造美好世界</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="company-desc-compact">
|
||||
<p>公司秉承"善用资源,服务建设"的核心理念,践行"材料创造美</p>
|
||||
<p>好世界"的企业使命,坚持"创新、绩效、和谐、责任"的核心价</p>
|
||||
<p>值观,努力成长为具有创新精神和全球视野的光芯材料领先企业。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="company-chip-compact">
|
||||
<div class="chip-symbol">芯</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="statsContainer">
|
||||
<div class="statCard" @click="goDuty">
|
||||
<div class="statTitle">我的待办</div>
|
||||
<div class="statNumber">{{ dutyCount }}</div>
|
||||
</div>
|
||||
<div class="statCard" @click="goOwner">
|
||||
<div class="statTitle">我提交的</div>
|
||||
<div class="statNumber">{{ ownerCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quickActionsCard">
|
||||
<div class="quickActionsTitle">发起流程</div>
|
||||
<div class="quickActionsGrid">
|
||||
<div class="actionItem" v-for="group in wfOptions" :key="group.category" @click="startGroup(group)">
|
||||
<div class="actionIcon">↗️</div>
|
||||
<div class="actionLabel">{{ group.category }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<el-card
|
||||
v-for="item in currentWfList"
|
||||
:key="item.id"
|
||||
:body-style="{ padding: '10px', cursor: 'pointer' }"
|
||||
style="width: 180px; display: inline-block; margin: 4px; background-color: #f5f7fa;"
|
||||
shadow="hover"
|
||||
@click="startTicket(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
<el-drawer v-model="drawer" size="90%" :show-close="false">
|
||||
<template #header="{ close, titleId, titleClass }">
|
||||
<h4 :id="titleId" :class="titleClass">{{drawerName}}</h4>
|
||||
<el-button type="danger" @click="close">关闭</el-button>
|
||||
</template>
|
||||
<component :is="currentComponent" :ticketId="ticketId" :t_id="t_id" @closed="drawer = false"
|
||||
@success="handleSuccess"></component>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted, markRaw, defineAsyncComponent } from 'vue'
|
||||
import API from '@/api'
|
||||
import TOOL from "@/utils/tool.js";
|
||||
const dutyCount = ref(0);
|
||||
const ownerCount = ref(0);
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getTicketCount();
|
||||
getWfOptions();
|
||||
})
|
||||
|
||||
const getTicketCount = () => {
|
||||
API.wf.ticket.list.req({page: 1, page_size: 0, category: "duty"}).then(res=>{
|
||||
dutyCount.value = res.count
|
||||
})
|
||||
API.wf.ticket.list.req({page: 1, page_size: 0, category: "owner"}).then(res=>{
|
||||
ownerCount.value = res.count
|
||||
})
|
||||
}
|
||||
|
||||
const goDuty = () => {
|
||||
window.location.href = "/#/wf/myticket?category=duty"
|
||||
}
|
||||
|
||||
const goOwner = () => {
|
||||
window.location.href = "/#/wf/myticket?category=owner"
|
||||
}
|
||||
|
||||
const wfOptions = ref([])
|
||||
|
||||
const getWfOptions = () => {
|
||||
let permissions = TOOL.data.get("PERMISSIONS");
|
||||
const groups = {};
|
||||
API.wf.workflow.list.req({ page: 0 }).then((res) => {
|
||||
res.forEach((item) => {
|
||||
if(item.key && permissions.includes(item.key)) {
|
||||
let cate = item.cate;
|
||||
if (!cate){cate="未分组"}
|
||||
if (!groups[cate]) {
|
||||
groups[cate] = [];
|
||||
}
|
||||
groups[cate].push(item);
|
||||
}
|
||||
})
|
||||
// 转换为数组形式,便于模板遍历
|
||||
wfOptions.value = Object.keys(groups).map(category => ({
|
||||
category,
|
||||
items: groups[category]
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const currentWfList = ref([]);
|
||||
const dialogTitle = ref("");
|
||||
const startGroup = (group) => {
|
||||
dialogVisible.value = true;
|
||||
dialogTitle.value = group.category;
|
||||
currentWfList.value = group.items;
|
||||
}
|
||||
|
||||
const drawer = ref(false)
|
||||
const drawerName = ref(null)
|
||||
const currentComponent = ref(null)
|
||||
const ticketId = ref(null)
|
||||
const t_id = ref(null)
|
||||
const startTicket = (item) => {
|
||||
dialogVisible.value = false;
|
||||
drawer.value = true;
|
||||
t_id.value = null;
|
||||
drawerName.value = item.name;
|
||||
const viewPath = item.view_path;
|
||||
// 动态 import
|
||||
currentComponent.value = markRaw(
|
||||
defineAsyncComponent(() => import(`@/views${viewPath}.vue`))
|
||||
);
|
||||
}
|
||||
|
||||
const handleSuccess = () => {
|
||||
drawer.value = false;
|
||||
getTicketCount();
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.company-card-compact {
|
||||
width: 100%;
|
||||
background: linear-gradient(135deg,
|
||||
rgba(58, 149, 255, 0.95) 0%,
|
||||
rgba(27, 92, 255, 0.95) 100%);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 12px rgba(27, 92, 255, 0.2);
|
||||
color: #ffffff;
|
||||
margin-bottom: 10px;
|
||||
height: auto;
|
||||
min-height: 160px;
|
||||
}
|
||||
|
||||
.company-card-compact::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: radial-gradient(
|
||||
circle at 90% 20%,
|
||||
rgba(255, 255, 255, 0.08) 0%,
|
||||
transparent 60%
|
||||
);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.company-main-content {
|
||||
flex: 1;
|
||||
padding-right: 15px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.company-header-compact {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.company-name-compact {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
margin: 0 0 8px 0;
|
||||
letter-spacing: 0.5px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.mission-tag-compact {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
backdrop-filter: blur(5px);
|
||||
border-radius: 12px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.mission-icon-compact {
|
||||
font-size: 12px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.mission-text-compact {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.company-desc-compact {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.company-desc-compact p {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 12px;
|
||||
opacity: 0.9;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.company-desc-compact p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.company-chip-compact {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
flex-shrink: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.chip-symbol {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background: linear-gradient(135deg,
|
||||
rgba(255, 255, 255, 0.95) 0%,
|
||||
rgba(255, 255, 255, 0.8) 100%);
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1b5cff;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
/* transform: rotate(45deg); */
|
||||
}
|
||||
|
||||
.chip-symbol::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
right: 4px;
|
||||
bottom: 4px;
|
||||
border: 1px solid rgba(27, 92, 255, 0.2);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* 平板适配 */
|
||||
@media (min-width: 768px) {
|
||||
.company-card-compact {
|
||||
padding: 20px 25px;
|
||||
min-height: 140px;
|
||||
}
|
||||
|
||||
.company-name-compact {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.company-desc-compact p {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.chip-symbol {
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 桌面适配 */
|
||||
@media (min-width: 1024px) {
|
||||
.company-card-compact {
|
||||
padding: 20px 30px;
|
||||
}
|
||||
|
||||
.company-name-compact {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.company-desc-compact p {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.company-chip-compact {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.chip-symbol {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 小屏幕手机适配 */
|
||||
@media (max-width: 375px) {
|
||||
.company-card-compact {
|
||||
padding: 16px;
|
||||
min-height: 140px;
|
||||
}
|
||||
|
||||
.company-name-compact {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.company-desc-compact p {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.mission-tag-compact {
|
||||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
.mission-text-compact {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.company-chip-compact {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.chip-symbol {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 数量统计卡片样式 */
|
||||
.statsContainer {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.statCard {
|
||||
flex: 1;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.statTitle {
|
||||
font-size: 18px;
|
||||
color: #666;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.statNumber {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 快速操作卡片样式 */
|
||||
.quickActionsCard {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.quickActionsTitle {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.quickActionsGrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr);
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.actionItem {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.actionItem:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.actionIcon {
|
||||
font-size: 24px;
|
||||
margin-bottom: 8px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: #f0f7ff;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #1b5cff;
|
||||
}
|
||||
|
||||
.actionLabel {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.quickActionsGrid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.statsContainer {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -223,9 +223,9 @@ export default {
|
|||
that.year_s = year;
|
||||
that.month_s = month;
|
||||
that.day_s = day;
|
||||
this.getEquipList();
|
||||
this.getMaterialWarning();
|
||||
this.getMaterialList();
|
||||
// this.getEquipList();
|
||||
// this.getMaterialWarning();
|
||||
// this.getMaterialList();
|
||||
},
|
||||
methods: {
|
||||
// 动态绑定Class
|
||||
|
|
|
|||
Loading…
Reference in New Issue