feat:能源统计

This commit is contained in:
shijing 2023-07-10 15:00:46 +08:00
parent f14ee6bb95
commit d195b260fa
8 changed files with 375 additions and 68 deletions

View File

@ -9,8 +9,8 @@ VUE_APP_TITLE = '曲阳金隅安全智能管控平台'
#VUE_APP_WS_API = 'ws://localhost:8000'
# VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
#VUE_APP_API_BASEURL = http://10.99.5.79:20309/api
# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
#VUE_APP_BASEURL = http://127.0.0.1:8000

View File

@ -85,5 +85,13 @@ export default {
data);
}
},
statCreate: {
name: "添加测点统计记录",
req: async function(data){
return await http.post(
`${config.API_URL}/enm/mpointstat/`,
data);
}
},
},
}

View File

@ -99,6 +99,11 @@
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="自动采集">
<el-switch v-model="form.is_auto"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
@ -123,7 +128,9 @@ export default {
edit: "编辑",
show: "查看",
},
form: {},
form: {
is_auto:true
},
rules: {
name: [{required: true, message: '请输入测点名称'}],
code: [{required: true, message: '请输入测点编号'}],

View File

@ -13,7 +13,7 @@
:model="form"
label-width="100px"
label-position="right"
:rules="rule1"
:rules="rules"
>
<el-row>
<el-col :md="12" :sm="24">
@ -46,9 +46,20 @@
<el-input v-model="form.leader_name" placeholder="班组班长" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检测时间" prop="time">
<el-date-picker
v-model="form.time"
type="datetime"
value-format="YYYY-MM-DD HH:mm"
format="YYYY-MM-DD HH:mm"
placeholder="检测时间"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" class="formUnitWrap">
<el-form-item label="水耗统计">
<el-input-number v-model="form.note" :precision="2" controls-position="right" placeholder="水耗统计" style="width: 100%;"></el-input-number>
<el-form-item label="水耗统计" prop="val">
<el-input-number v-model="form.val" :precision="2" controls-position="right" placeholder="水耗统计" style="width: 100%;"></el-input-number>
</el-form-item>
<span class="formUnit">(t)</span>
</el-col>
@ -78,10 +89,8 @@
type:10,
},
rules: {
name: [{required: true, message: "请输入", trigger: "blur"}],
number: [{required: true, message: "请输入", trigger: "blur"}],
keeper_name: [{required: true, message: "请输入", trigger: "blur"}],
belong_dept: [{required: true, message: "请选择", trigger: "blur"}]
val: [{required: true, message: "请输入检测值", trigger: "blur"}],
time: [{required: true, message: "请选择检测时间", trigger: "blur"}]
},
visible: false,
isSaveing: false,
@ -131,11 +140,16 @@
this.isSaveing = true;
try {
let obj={};
obj.note = this.form.note;
obj.team = this.form.team;
obj.shift = this.form.shift;
obj.leader = this.form.leader;
this.$API.wpm.sflog.update.req(this.form.id,obj).then(res=>{
debugger;
obj.year_s = this.form.time.slice(0,4);
obj.month_s = this.form.time.slice(5,7);
obj.day_s = this.form.time.slice(8,10);
obj.hour = this.form.time.slice(11,13);
obj.val = this.form.val;
obj.sflog = this.form.id;
obj.material = '3349350755361792000';
obj.mpoint = '3349214860667219968';
this.$API.enm.mpoint.statCreate.req(obj).then(res=>{
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;

View File

@ -105,8 +105,8 @@
};
},
mounted() {
this.test(0)
this.getData();
// this.test(0)
// this.getData();
},
methods: {
test(index){

View File

@ -71,7 +71,7 @@
</tr>
<tr>
<th colspan="2">电石渣</th>
<th colspan="2">原料</th>
<th colspan="2">原料</th>
<th rowspan="2">压缩空气m3</th>
<th colspan="4">回转窑</th>
<th colspan="2">煤磨</th>
@ -97,33 +97,32 @@
<th>t</th>
</tr>
</thead>
<tr v-for="(item,index) in tableDatas" :key="index">
<td style="width:50px">{{item.month}}</td>
<td class="numCell">{{item.name}}</td>
<td class="numCell">{{item.number}}</td>
<td class="numCell">{{item.unit}}</td>
<td class="numCell">{{item.hours}}</td>
<td class="numCell">{{item.days}}</td>
<td class="numCell">{{item.months}}</td>
<td class="numCell">{{item.hours}}</td>
<td class="numCell">{{item.days}}</td>
<td class="numCell">{{item.months}}</td>
<td class="numCell">{{item.hours}}</td>
<td class="numCell">{{item.days}}</td>
<td class="numCell">{{item.months}}</td>
<td class="numCell">{{item.months}}</td>
<td class="numCell">{{item.hours}}</td>
<td class="numCell">{{item.days}}</td>
<td class="numCell">{{item.months}}</td>
<td class="numCell">{{item.months}}</td>
<tr v-for="(item,index) in tableDatas3" :key="index">
<td style="width: 45px;">{{item[0]}}</td>
<td class="numCell">{{item[1]}}</td>
<td class="numCell">{{item[2]}}</td>
<td class="numCell">{{item[3]}}</td>
<td class="numCell">{{item[4]}}</td>
<td class="numCell">{{item[5]}}</td>
<td class="numCell">{{item[6]}}</td>
<td class="numCell">{{item[7]}}</td>
<td class="numCell">{{item[8]}}</td>
<td class="numCell">{{item[9]}}</td>
<td class="numCell">{{item[10]}}</td>
<td class="numCell">{{item[11]}}</td>
<td class="numCell">{{item[12]}}</td>
<td class="numCell">{{item[13]}}</td>
<td class="numCell">{{item[14]}}</td>
<td class="numCell">{{item[15]}}</td>
<td class="numCell">{{item[16]}}</td>
<td class="numCell">{{item[17]}}</td>
</tr>
</table>
<table border="1" cellspacing="0" :key="timeStamp" id="numTable">
<!-- <table border="1" cellspacing="0" :key="timeStamp" id="numTable">
<thead style="background: #efefef;height: 40px;">
<tr>
<template v-for="(date,ind) in tableHead" :key="ind">
<th v-if="ind==0" colspan="3">{{date}}</th>
<th v-else>{{date}}</th>
<th>{{date}}</th>
</template>
</tr>
</thead>
@ -143,7 +142,7 @@
<td class="numCell">{{item[7]}}</td>
<td class="numCell" v-if="index!==4&&index!==11&&index!==16">{{item[8]}}</td>
</tr>
</table>
</table> -->
</div>
</el-card>
</div>
@ -172,12 +171,12 @@
{month:'2023.2',name:'乙组',number:'NM005',unit:'KW·h/t',hours:'1',days:'2',months:'3'},
{month:'2023.2',name:'丙组',number:'NM006',unit:'KW·h/t',hours:'1',days:'2',months:'3'},
],
tableHead:['日期','1号','2号','3号','4号','5号','6号','87号','8号'],
tableHead:['车间','工段','能源分类','1号','2号','3号','4号','5号','6号','7号','8号'],
tableDatas2:[
['原料车间','电石渣','电量KW.h',1,2,3,4,5,6],
['原料车间','电石渣','水t',1,2,3,4,5,6],
['原料车间','原料','电量KW.h',1,2,3,4,5,6],
['原料车间','原料','水t',1,2,3,4,5,6],
['原料车间','原料','电量KW.h',1,2,3,4,5,6],
['原料车间','原料','水t',1,2,3,4,5,6],
['原料车间','压缩空气m3',1,2,3,4,5,6],
['烧成车间','回转窑','电量KW.h',1,2,3,4,5,6],
@ -188,12 +187,13 @@
['烧成车间','煤磨','水t',1,2,3,4,5,6],
['烧成车间','压缩空气m3',1,2,3,4,5,6],
['水泥车间','电石渣','电量KW.h',1,2,3,4,5,6],
['水泥车间','电石渣','水t',1,2,3,4,5,6],
['水泥车间','原料','电量KW.h',1,2,3,4,5,6],
['水泥车间','原料','水t',1,2,3,4,5,6],
['水泥车间','水泥磨','电量KW.h',1,2,3,4,5,6],
['水泥车间','水泥磨','水t',1,2,3,4,5,6],
['水泥车间','包装','电量KW.h',1,2,3,4,5,6],
['水泥车间','包装','水t',1,2,3,4,5,6],
['水泥车间','压缩空气m3',1,2,3,4,5,6],
],
tableDatas3:[],
sourceData:{}
};
},
@ -202,7 +202,7 @@
let month = myDate.getMonth()+1;
if(month<10){
month = '0'+month;
}
}
this.query.month = myDate.getFullYear()+'-'+month;
this.getData();
@ -224,38 +224,191 @@
let arr = [];
if(that.query.type==0){//
arr = that.query.month.split('-');
params.query.year_s = arr[0];
params.query.month_s = arr[1];
params.query.year_s = Number(arr[0]);
params.query.month_s = Number(arr[1]);
id='energy_day'
}else if(that.query.type==1){//
params.query.year_s = that.query.year;
params.query.year_s = Number(that.query.year);
id='energy_month'
}else{//
params.query.year_s = that.query.yearStart;
params.query.year_s = Number(that.query.yearStart);
id='energy_year'
}
this.$API.bi.dataset.exec.req(id,params).then((res) => {
that.tableName = res.name;
let data = res.data.ds0;
that.tableHead = data[0];
let data0 = data.slice(1,data.length);
console.log(this.sourceData)
let tableDatas2 = that.tableDatas2;
// data0.forEach(item => {
// for(let i=0;i<tableDatas2.length;i++){
// if(item[3]==tableDatas2[i][0]){
// if(item[4]==tableDatas2[i][1]){
// if(item[5]==tableDatas2[i][2]){
// let ind = item[2]+2;
// tableDatas2[i][ind] = item[6]
let wrapArr = [];
let innerArr = [];
let ind = 0;
let roomInd = 1;
let mgroupInd = 2;
let mpointInd =3;
let valueInd = 4;
if(that.query.type==0){//
arr = that.query.month.split('-');
var date =new Date(Number(arr[0]), Number(arr[1]), 0).getDate();
for(let d = 1;d<=date;d++){
let arr = [];
arr[0]=d;
innerArr.push(arr)
}
}else if(that.query.type==1){//
innerArr = [['一'],['二'],['三'],['四'],['五'],['六'],['七'],['八'],['九'],['十'],['十一'],['十二']]
}else{//
let nowDate = new Date().getFullYear();
let num = Number(nowDate)-Number(that.query.yearStart) +1;
for(let y = 0;y<num;y++){
let arr = [];
arr[0] = 2023-y;
innerArr.push(arr)
}
}
//1/
data0.forEach(item => {
if(that.query.type==0){//
ind = item[0]-1;
}else if(that.query.type==1){//
ind = item[0]-1;
}else{//
ind = item[0]-2023;
}
if(wrapArr[ind]){
}else{
wrapArr[ind] = [];
}
wrapArr[ind].push(item);
if(innerArr[ind]){
}else{
innerArr[ind] = [];
}
debugger;
if(item[roomInd]=="原料车间"){
if(item[mgroupInd]=="电石渣"){
if(item[mpointInd]=="动力电"){
innerArr[ind][1] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][2] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="原料磨"){
if(item[mpointInd]=="动力电"){
innerArr[ind][3] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][4] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="压缩空气"){
innerArr[ind][5] = Number(item[valueInd]).toFixed(2)
}
}else if(item[roomInd]=="烧成车间"){
if(item[mgroupInd]=="回转窑"){
if(item[mpointInd]=="动力电"){
innerArr[ind][6] = Number(item[valueInd]).toFixed(2)
}else if(item[mpointInd]=="煤粉"){
innerArr[ind][7] = Number(item[valueInd]).toFixed(2)
}else if(item[mpointInd]=="工业水"){
innerArr[ind][8] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][9] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="煤磨"){
if(item[mpointInd]=="动力电"){
innerArr[ind][10] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][11] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="压缩空气"){
innerArr[ind][12] = Number(item[valueInd]).toFixed(2)
}
}else if(item[roomInd]=="水泥车间"){
if(item[mgroupInd]=="水泥磨"){
if(item[mpointInd]=="动力电"){
innerArr[ind][13] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][14] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="包装"){
if(item[mpointInd]=="动力电"){
innerArr[ind][15] = Number(item[valueInd]).toFixed(2)
}else{
innerArr[ind][16] = Number(item[valueInd]).toFixed(2)
}
}else if(item[mgroupInd]=="压缩空气"){
innerArr[ind][17] = Number(item[valueInd]).toFixed(2)
}
}
that.tableDatas3 = innerArr;
});
//2
// let innerArr = [];
// innerArr = [];
// for(let i = 0;i<wrapArr.length;i++){
// let item0 = wrapArr[i];
// for(let j = 0;j<item0.length;j++){
// let item1 = item0[j];
// if(item1[roomInd]==""){
// if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[1] = item1[valueInd]
// }else{
// innerArr[2] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[3] = item1[valueInd]
// }else{
// innerArr[4] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// innerArr[5] = item1[valueInd]
// }
// }else if(item1[roomInd]==""){
// if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[6] = item1[valueInd]
// }else if(item1[mpointInd]==""){
// innerArr[7] = item1[valueInd]
// }else if(item1[mpointInd]==""){
// innerArr[8] = item1[valueInd]
// }else{
// innerArr[9] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[10] = item1[valueInd]
// }else{
// innerArr[11] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// innerArr[12] = item1[valueInd]
// }
// }else if(item1[roomInd]==""){
// if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[13] = item1[valueInd]
// }else{
// innerArr[14] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// if(item1[mpointInd]==""){
// innerArr[15] = item1[valueInd]
// }else{
// innerArr[16] = item1[valueInd]
// }
// }else if(item1[mgroupInd]==""){
// innerArr[17] = item1[valueInd]
// }
// }
// }
// });
// }
this.tableDatas3 = innerArr;
});
},
getTableData(){
this.getData();
},
handlePrint() {
this.$PRINT('#myReport');

View File

@ -138,7 +138,7 @@
mounted() {
var myDate = new Date();
let month = myDate.getMonth()+1;
let days = myDate.getDate();
let days = myDate.getDate()-1;
if(month<10){
month = '0'+month;
}
@ -146,8 +146,6 @@
days = '0'+days;
}
this.query.day = myDate.getFullYear()+'-'+month+'-'+days;
debugger;
console.log(this.query.day)
this.getTableData();
},

View File

@ -0,0 +1,127 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-select
v-model="query.mgroup"
placeholder="工段"
clearable
style="width: 120px;margin-right: 5px;"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'role.create'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" hidePagination>
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="开始时间" prop="start_time" min-width="100"></el-table-column>
<el-table-column label="结束时间" prop="end_time" min-width="100"></el-table-column>
<el-table-column label="停机时长" prop="duration" min-width="150"></el-table-column>
<el-table-column label="关联工段" prop="mgroup_name" min-width="150"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope">
<el-button link size="small" @click="table_edit(scope.row)" v-auth="'team.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<script>
import saveDialog from "./feeset_form.vue";
export default {
name: 'dept',
components: {
saveDialog
},
data() {
return {
apiObj: this.$API.wpm.stlog,
query: {
mgroup:'',
},
dialog: {
save: false,
},
selection:[],
options:[],
}
},
mounted(){
this.getMgroup();
},
methods: {
//
getMgroup(){
this.$API.mtm.mgroup.list.req({page:0}).then(res=>{
this.options = res;
})
},
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
async table_del(row){
var id = row.id;
var res = await this.$API.mtm.mgroup.delete.req(id);
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//
selectionChange(selection){
this.selection = selection;
},
//
handleQuery(){
this.$refs.table.queryData(this.query)
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
}
}
</script>
<style scoped>
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;}
</style>