feat: 增加 生料辅料工序

This commit is contained in:
zty 2024-12-27 14:57:45 +08:00
parent 3ce895f9e5
commit ffa8d11b67
11 changed files with 5061 additions and 0 deletions

View File

@ -220,6 +220,7 @@ let yAxis = [
position: "right",
alignTicks: true,
offset: 60,
max: 100,
axisLine: {
show: true,
lineStyle: {
@ -247,6 +248,7 @@ let yAxis = [
},
];
import scEcharts from "@/components/scEcharts";
import { max } from "d3";
import { defineAsyncComponent } from "vue";
export default {
components: {

View File

@ -0,0 +1,561 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<div style="margin-right: 20px">交接班日志</div>
<el-date-picker
v-model="query.start_time__gte"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="班开始时间起"
style="width: 200px"
/>
<el-date-picker
v-model="query.start_time__lte"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="班开始时间止"
style="margin-left: 2px; width: 200px"
/>
<el-select
v-model="query.shift"
placeholder="班次"
clearable
style="margin-left: 2px; width: 120px"
>
<el-option
v-for="item in optionsShift"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-select
v-model="query.team"
placeholder="班组"
clearable
style="margin-left: 2px; width: 120px"
>
<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"
style="margin-left: 2px"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
highlightCurrentRow
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<el-table-column label="开始时间" prop="start_time">
<template #default="scope">
<span>{{ scope.row.start_time.slice(0, 16) }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" prop="end_time">
<template #default="scope">
<span>{{ scope.row.end_time.slice(0, 16) }}</span>
</template>
</el-table-column>
<el-table-column
label="班组名称"
prop="team_name"
></el-table-column>
<el-table-column
label="当前班次"
prop="shift_name"
></el-table-column>
<el-table-column
label="班长"
prop="leader_name"
></el-table-column>
<el-table-column label="检验时间">
<template #default="scope">
<span v-if="scope.row.last_test_time">{{
scope.row.last_test_time.slice(0, 16)
}}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button
link
size="small"
@click="sflog_edit(scope.row)"
type="primary"
>编辑</el-button
>
<!-- <el-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> -->
<!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> -->
<el-divider direction="vertical"></el-divider>
<el-button
link
size="small"
@click="sflog_export(scope.row)"
type="success"
>报表</el-button
>
</template>
</el-table-column>
</scTable>
</el-main>
<el-drawer v-model="limitedExport" size="60%" :show-close="false">
<template #header="{ close, titleId, titleClass }">
<h4 :id="titleId" :class="titleClass">交接班日志</h4>
<el-button type="danger" @click="close">
<el-icon class="el-icon--left">
<CircleCloseFilled />
</el-icon>
关闭
</el-button>
</template>
<div class="left-panel">
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
v-auth="'export_excel'"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
<el-main class="nopadding">
<div ref="print" id="myReport" class="printContainer">
<div
style="
margin-right: 20px;
text-align: center;
font-size: 16px;
font-weight: bold;
margin-bottom: 20px;
"
>
<span v-if="sflogItem.end_time"
>{{ sflogItem.end_time.slice(0, 10)
}}{{ sflogItem.shift_name }}</span
>
<span v-if="sflogItem.team_name">{{
sflogItem.team_name
}}</span>
交接班记录
</div>
<table
border="1"
width="1000"
cellspacing="0"
:key="timeStamp"
id="myTable"
>
<tbody>
<tr>
<td class="numCell">日期</td>
<td class="numCell" v-if="sflogItem.end_time">
{{ sflogItem.end_time.slice(0, 10) }}
</td>
<td class="numCell">班次</td>
<td class="numCell">
{{ sflogItem.shift_name }}
</td>
<td class="numCell">班组</td>
<td class="numCell">
<span v-if="sflogItem.team_name">{{
sflogItem.team_name
}}</span>
</td>
</tr>
<tr>
<td class="numCell">产量t</td>
<td class="numCell">
{{ reportItem.total_production }}
</td>
<td class="numCell">台时t/h</td>
<td class="numCell">
{{ reportItem.production_hour }}
</td>
<td class="numCell">运转时间h</td>
<td class="numCell">
{{ reportItem.run_hour }}
</td>
</tr>
<tr>
<td class="numCell">运转率%</td>
<td class="numCell">
{{ reportItem.run_rate }}
</td>
<td class="numCell">停机时长h</td>
<td class="numCell">
{{ (reportItem.shut_sec/3600).toFixed(2) }}
</td>
<td class="numCell">
当期单位产品电耗kW·h/t
</td>
<td class="numCell">
{{ reportItem.elec_consume_unit }}
</td>
</tr>
<tr>
<td class="numCell">辅料细度合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_细度_rate_pass"
>
{{ reportItem.辅料_细度_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">辅料Fe₂O₃合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_Fe2O3_rate_pass"
>
{{ reportItem.辅料_Fe2O3_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">辅料水分合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_水分_rate_pass"
>
{{ reportItem.辅料_水分_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
</tr>
<tr>
<td class="numCell">干混生料CaO合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_CaO_rate_pass"
>
{{
reportItem.干混生料_CaO_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">
干混生料Fe₂O₃合格率%
</td>
<td
class="numCell"
v-if="reportItem.干混生料_Fe2O3_rate_pass"
>
{{
reportItem.干混生料_Fe2O3_rate_pass *
100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">干混生料细度合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_细度_rate_pass"
>
{{
reportItem.干混生料_细度_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
</tr>
<tr>
<td class="numCell">干混生料水分合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_水分_rate_pass"
>
{{
reportItem.干混生料_水分_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">单位成本/</td>
<td class="numCell">
{{ reportItem.production_cost_unit }}
</td>
<td class="numCell"></td>
<td class="numCell"></td>
</tr>
<tr v-if="sflogexpList.length > 0">
<td
class="numCell"
:rowspan="sflogexpList.length + 1"
>
生产情况记录
</td>
<td class="numCell">时间</td>
<td class="numCell">类别</td>
<td class="numCell">原因</td>
<td class="numCell">处置措施</td>
<td class="numCell">处置人</td>
</tr>
<tr v-for="item in sflogexpList" :key="item.id">
<td class="numCell">{{ item.stlog_.start_time }}</td>
<td class="numCell">{{ item.stlog_.cate }}</td>
<td class="numCell">{{ item.stlog_.reason }}</td>
<td class="numCell">{{ item.stlog_.measure }}</td>
<td class="numCell">{{ item.stlog_.handler }}</td>
</tr>
</tbody>
</table>
</div>
</el-main>
</el-drawer>
</el-container>
<!-- <save-dialog
v-if="dialog.save"
ref="saveDialog"
:deptId ="deptId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
<other-dialog
v-if="dialog.other"
ref="otherDialog"
@success="handleOtherSuccess"
@closed="dialog.other = false"
></other-dialog>
<quastat-dialog
v-if="dialog.check"
ref="checkDialog"
@success="handleCheckSuccess"
@closed="dialog.save = false"
></quastat-dialog> -->
</template>
<script>
import saveDialog from "./handover_form.vue";
import quastatDialog from "./quastat_form.vue";
import otherDialog from "./other_form.vue";
export default {
name: "sflog",
components: {
saveDialog,
otherDialog,
quastatDialog,
},
data() {
return {
apiObj: null,
apiObj2: null,
query: {
mgroup: "",
},
deptId: "",
sflogItem: {},
selection: [],
modelValue: true,
showClose: true,
echartType: "line",
asynDialog: false,
options: [],
optionsShift: [],
teamOptions: [],
limitedExport: false,
reportItem: {},
sflogexpList: [],
};
},
mounted() {
this.$API.mtm.mgroup.list
.req({ page: 0, search: "原料磨" })
.then((res) => {
console.log("原料磨", res);
this.mgroupItem = res[0];
this.query.mgroup = res[0].id;
this.apiObj = this.$API.wpm.sflog.list;
this.deptId = res[0].belong_dept;
this.getTeam();
this.getShfit();
});
},
methods: {
getTeam() {
let form = {};
form.page = 0;
form.belong_dept = this.deptId;
this.$API.mtm.team.list.req(form).then((res) => {
this.options = res;
});
},
getShfit() {
this.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
this.optionsShift = res;
});
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
sflog_export() {
this.limitedExport = true;
},
rowClick(row) {
this.sflogId = row.id;
this.sflogItem = row;
this.getSflogItem(row.id);
this.getSflogexp(row.id);
},
getSflogexp(id) {
let that = this;
that.$API.wpm.sflogexp.list
.req({ page: 0, sflog: id })
.then((res) => {
console.log("sflogexp", res);
that.sflogexpList = res;
});
},
getSflogItem(id) {
let that = this;
that.$API.enm.enstat
.req({ type: "sflog", sflog: id, page: 0 })
.then((res) => {
if (res.length > 0) {
that.reportItem = res[0];
}
console.log(res[0]);
});
},
//
sflog_edit(row) {
let jsonStr = JSON.stringify(row);
this.$TOOL.data.remove("sflogItem");
this.$TOOL.data.set("sflogItem", jsonStr);
this.$router.push({
name: "logDetail",
query: {
mgroupId: row.mgroup,
deptId: this.deptId,
},
});
// this.dialog.save = true;
// this.$nextTick(() => {
// this.$refs.saveDialog.open("edit").setData(row);
// });
},
//
sflog_check(row) {
this.dialog.check = true;
this.$nextTick(() => {
this.$refs.checkDialog.open("edit").setData(row);
});
},
//
sflog_other(row) {
this.dialog.other = true;
this.$nextTick(() => {
this.$refs.otherDialog.open("edit").setData(row);
});
},
// //
// table_show(row) {
// this.dialog.save = true;
// this.$nextTick(() => {
// this.$refs.checkDialog.open("edit").setData(row);
// });
// },
//
async table_del(row) {
this.$API.wpm.sflog.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
return res;
})
.catch((err) => {
return err;
});
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh();
this.dialog.save = false;
},
handleOtherSuccess() {
this.dialog.other = false;
},
handleCheckSuccess() {
this.dialog.check = false;
},
closed() {
this.dialog.save = false;
this.$refs.table2.refresh();
},
handleDel(row) {
this.$confirm(`确定删除选中的记录吗?`, "提示", {
type: "warning",
})
.then(() => {
this.$API.wpm.shift.delete.req(row.id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
// const loading = this.$loading();
// this.$refs.table2.refresh();
// loading.close();
// this.$message.success("");
}
});
})
.catch(() => {});
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script>
<style scoped>
#numTable {
margin-left: 37px;
}
#numTable td {
height: 32px;
padding-left: 5px;
}
.numCell {
width: 80px;
}
.numCell.numCell_last {
width: 100px;
}
.searchHead {
display: flex;
}
.middleText {
height: 32px;
line-height: 32px;
margin: 0 5px;
display: inline-block;
}
.searchBtn {
margin-left: 5px;
}
</style>

View File

@ -0,0 +1,184 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form ref="dialogForm" :model="form" label-width="100px" label-position="right" :rules="rule1">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="关联工段" prop="mgroup">
<el-input v-model="form.mgroup_name" placeholder="关联工段" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当班班次" prop="shift">
<el-input v-model="form.shift_name" placeholder="当班班次" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="开始时间" prop="start_time">
<el-date-picker disabled v-model="form.start_time" type="datetime" format="YYYY-MM-DD HH:mm"
placeholder="开始时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="end_time">
<el-date-picker disabled v-model="form.end_time" type="datetime" format="YYYY-MM-DD HH:mm"
placeholder="结束时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当班班组" prop="team">
<el-select v-model="form.team" placeholder="当班班组" clearable style="width: 100%;" @change="teamChange">
<el-option v-for="item in teamOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班组班长" prop="leader_name">
<el-input v-model="form.leader_name" placeholder="班组班长" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.shift_name == '白班' && mgroupId == '3347217246321065984'">
<el-form-item label="煤粉热值(大卡)">
<el-input-number v-model="form.pcoal_heat" controls-position="right" placeholder="煤粉热值" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="生产情况记录">
<el-input type="textarea" :rows="4" v-model="form.note" placeholder="生产情况记录" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
deptId: {
// v-model
type: [String],
default: "",
},
mgroupId: {
// v-model
type: [String],
default: "",
},
},
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "交接班日志",
edit: "交接班日志",
show: "查看交接班日志",
},
form: {
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" }]
},
visible: false,
isSaveing: false,
keeperOptions: [],
depOptions: [],
selectionFilters: [],
setFiltersVisible: false,
teamOptions: [],
shiftOptions: [],
};
},
mounted() {
this.mgroup = this.mgroupId;
debugger;
console.log(this.deptId)
console.log(this.mgroupId)
//
this.getTeam();
this.getShfit();
},
methods: {
getTeam() {
debugger;
let form = {};
form.page = 0;
form.belong_dept = this.deptId;
debugger;
this.$API.mtm.team.list.req(form).then(res => {
this.teamOptions = res;
})
},
getShfit() {
this.$API.mtm.shift.list.req({ page: 0 }).then(res => {
this.shiftOptions = res;
})
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
teamChange(data) {
let that = this;
that.teamOptions.forEach(item => {
if (item.id == data) {
that.form.leader_name = item.leader_name;
that.form.leader = item.leader;
}
})
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
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;
obj.pcoal_heat = this.form.pcoal_heat;
this.$API.wpm.sflog.update.req(this.form.id, obj).then(res => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
return res;
})
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,998 @@
<template>
<el-container>
<el-main id="elMain" class="nopadding">
<el-card id="logDetail" style="margin: 6px; position: relative">
<el-descriptions title="日志信息" :column="3">
<el-descriptions-item label="所属工段:">
<span>{{ form.mgroup_name }}</span>
</el-descriptions-item>
<el-descriptions-item label="工作班次:" :span="3">
{{ form.shift_name }}
</el-descriptions-item>
<el-descriptions-item label="开始时间:">
<span>{{ form.start_time }}</span>
</el-descriptions-item>
<el-descriptions-item label="结束时间:" :span="3">
{{ form.end_time }}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card style="margin: 6px; position: relative">
<el-button
type="primary"
@click.stop="addStlog"
v-if="activeName == 'fourth'"
v-auth="'sflogexp.create'"
style="
position: absolute;
top: 6px;
right: 43%;
z-index: 100;
"
>新增异常</el-button
>
<el-select
v-if="activeName == 'mpoint'"
v-model="querymplog.mpoint"
placeholder="请选择"
clearable
class="mpointChange"
@change="mpointChange"
>
<el-option
v-for="item in mpointOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-tabs
ref="infoTabd"
v-model="activeName"
class="demo-tabs"
@tab-click="handleClick"
height="600px"
>
<el-tab-pane label="班组" name="first">
<el-form
ref="teamForm"
:model="form"
:rules="rules"
label-width="120px"
label-position="right"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="当班班组" prop="team">
<el-select
v-model="form.team"
placeholder="当班班组"
clearable
style="width: 100%"
@change="teamChange"
>
<el-option
v-for="item in teamOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="班组班长"
prop="leader_name"
>
<el-input
v-model="form.leader_name"
placeholder="班组班长"
disabled
/>
</el-form-item>
</el-col>
<!-- <el-col
:md="12"
:sm="24"
v-if="
form.shift_name == '白班' &&
form.mgroup_name == '电石渣'
"
>
<el-form-item label="煤粉热值">
<el-input-number
v-model="form.pcoal_heat"
controls-position="right"
placeholder="煤粉热值"
style="width: 100%"
/>
</el-form-item>
</el-col> -->
<!-- 煤粉热值 -->
<el-col
:md="12"
:sm="24"
v-if="form.mgroup_name == '回转窑' && (form.shift_name == '白班' || form.shift_name == '早班')"
>
<el-form-item label="煤粉热值">
<el-input-number
v-model="form.pcoal_heat"
controls-position="right"
placeholder="煤粉热值"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit" v-auth="'sflog.update'"
>保存</el-button
>
</el-footer>
</el-tab-pane>
<el-tab-pane label="测点录入" name="mpoint">
<el-row>
<el-col :md="12" :sm="24" :key="updateKey">
<el-form
:key="updateKey"
ref="mpointForm"
:rules="rules"
label-width="150px"
label-position="right"
v-if="mpointOptions.length > 0"
>
<template
v-for="item in mpointOptions"
:key="item.id"
>
<el-row>
<el-col :span="20">
<el-form-item
:label="item.name"
required="1"
>
<el-input-number
v-model="item.mpFormVal"
controls-position="right"
placeholder="请输入"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button
type="primary"
:loading="isSaveing"
@click="submit5(item)"
style="margin-left: 20px" v-auth="'mpointstat.create'"
>保存</el-button
>
</el-col>
</el-row>
</template>
</el-form>
</el-col>
<el-col :md="12" :sm="24">
<scTable
ref="mpointStatTable"
:apiObj="apiObj"
:query="querymplog"
:params="querymplogX"
row-key="id"
stripe
hideSetting
:height="heightTable"
highlightCurrentRow
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<template #default="scope">
<span v-if="scope.row.mpoint_nickname !=null">
{{ scope.row.mpoint_nickname }}
</span>
<span v-else>
{{ scope.row.mpoint_name }}
</span>
</template>
</el-table-column>
<el-table-column label="录入值" prop="val">
</el-table-column>
<el-table-column label="班组开始时间">
<template #default="scope">
<span>
{{ scope.row.sflog_start_time}}
</span>
</template>
</el-table-column>
<el-table-column label="班组结束时间">
<template #default="scope">
<span>
{{ scope.row.sflog_end_time}}
</span>
</template>
</el-table-column>
<el-table-column
label="录入时间"
prop="create_time"
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="60"
>
<template #default="scope">
<el-button
link
size="small"
@click="mpointStat_del(scope.row)"
type="danger"
v-auth="'mpointstat.delete_write'"
>删除</el-button
>
</template>
</el-table-column>
</scTable>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="检验" name="second">
<el-form
ref="dialogForm"
:model="form"
label-width="85px"
label-position="right"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="当前班组">
{{ form.team_name }}
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班组组长">
{{ form.leader_name }}
</el-form-item>
</el-col>
<el-divider />
</el-row>
</el-form>
<sc-form-table
v-model="checkList"
:hideAdd="hideAdd"
:hideDelete="hideDelete"
placeholder="暂无数据"
>
<el-table-column
prop="material"
label="关联产物"
min-width="150"
>
<template #default="scope">
<span v-if="scope.row.id">
{{scope.row.material_name}}
</span>
</template>
</el-table-column>
<el-table-column
prop="testitem"
label="质检项目"
min-width="150"
>
<template #default="scope">
<span v-if="scope.row.id">
{{scope.row.testitem_name}}
</span>
</template>
</el-table-column>
<el-table-column
prop="val_avg"
label="平均值"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.val_avg"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="num_test"
label="检验次数"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.num_test"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="num_ok"
label="合格次数"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.num_ok"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
</sc-form-table>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit2"
>保存</el-button
>
</el-footer>
</el-tab-pane>
<!-- <el-tab-pane label="其他成本" name="third">
<div>
<el-form
ref="thirdForms"
:model="thirdForm"
label-width="100px"
label-position="right"
>
<el-row v-if="form.mgroup_name == '电石渣'">
<el-col :md="12" :sm="24">
<el-form-item label="湿电石渣">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="湿电石渣"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.mgroup_name == '回转窑'">
<el-col :md="12" :sm="24">
<el-form-item label="柴油">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="柴油"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.mgroup_name == '水泥磨'">
<el-col :md="12" :sm="24">
<el-form-item label="助剂">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="助剂"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.mgroup_name == '水泥包装'">
<el-col :md="12" :sm="24">
<el-form-item label="包装">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="包装"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit"
>保存</el-button
>
</el-footer>
</div>
</el-tab-pane> -->
<el-tab-pane label="异常" name="fourth">
<el-row :gutter="20">
<el-col :span="14">
<scTable
ref="stlogTable"
:apiObj="apiObjStlog"
:query="querystlog"
:params="querystlog"
row-key="id"
stripe
hideSetting
:height="heightTable"
@row-click="stlogRowClick"
highlightCurrentRow
>
<!-- <el-table
ref="stlogTable"
:data="stlogList"
row-key="id"
stripe
@row-click="stlogRowClick"
:height="300"
highlightCurrentRow
> -->
<el-table-column type="index" width="50" />
<el-table-column
label="异常类别"
prop="duration"
>
<template #default="scope">
<span v-if="scope.row.is_shutdown"
>停机</span
>
<span v-else>其他</span>
</template>
</el-table-column>
<el-table-column
label="发生时间"
prop="start_time"
></el-table-column>
<el-table-column
label="结束时间"
prop="end_time"
></el-table-column>
<el-table-column
label="原因类别"
prop="cate"
></el-table-column>
<el-table-column
label="异常名称"
prop="title"
></el-table-column>
<el-table-column
label="事件原因"
prop="reason"
></el-table-column>
<el-table-column
label="处置措施"
prop="measure"
></el-table-column>
<el-table-column
label="停机时长(h)">
<template #default="scope">
<span>{{Number((scope.row.duration_sec/3600).toFixed(2))}}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link
size="small"
@click.stop="editStlog(scope.row)"
type="primary"
>编辑</el-button
>
<el-divider
direction="vertical"
></el-divider>
<el-button
link
size="small"
@click="stlog_delete(scope.row)"
type="danger"
>删除</el-button
>
</template>
</el-table-column>
</scTable>
</el-col>
<el-col :span="10">
<scTable
ref="expTable"
:data="sflogexpList"
row-key="id"
stripe
:height="heightTable"
hidePagination
highlightCurrentRow
hideDo
>
<el-table-column type="index" width="50" />
<el-table-column label="班组名称">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.shift_name
}}</span>
</template>
</el-table-column>
<el-table-column label="开始时间">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.start_time
}}</span>
</template>
</el-table-column>
<el-table-column label="结束时间">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.end_time
}}</span>
</template>
</el-table-column>
<el-table-column label="所在工段">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.mgroup_name
}}</span>
</template>
</el-table-column>
<el-table-column
label="处理备注"
prop="note"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="60"
>
<template #default="scope">
<el-button
link
size="small"
@click="
sflogexp_edit(scope.row)
"
v-auth="'sflogexp.update'"
type="primary"
>编辑</el-button
>
</template>
</el-table-column>
</scTable>
</el-col>
</el-row>
<el-dialog :title="stlogTitle" v-model="visible">
<el-form
ref="sflogExpForm"
label-width="100px"
:model="sflogExpForm"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item
label="处理备注"
prop="current_note"
>
<el-input
type="textarea"
:rows="2"
v-model="sflogExpForm.note"
placeholder="处理备注"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer>
<el-button
type="primary"
:loading="isSaveing"
@click="submit4"
>保存</el-button
>
<el-button @click="visible = false"
>取消</el-button
>
</el-footer>
</el-dialog>
<stlog-dialog
v-if="stlogVisiable"
ref="stlogDialog"
:current_sflog="current_sflog"
:mgroupId="mgroupId"
@success="stLogSuccess"
@closed="stlogVisiable = false"
></stlog-dialog>
</el-tab-pane>
</el-tabs>
</el-card>
</el-main>
</el-container>
</template>
<script>
import stlogDialog from "./stlog_form.vue";
import saveDialog from "./handover_form.vue";
import quastatDialog from "./quastat_form.vue";
import otherDialog from "./other_form.vue";
export default {
name: "listSon",
components: {
saveDialog,
otherDialog,
quastatDialog,
stlogDialog,
},
data() {
return {
deptId: "",
mgroupId: "",
sflogId: "",
hideAdd: true,
visible: false,
hideDelete: true,
isSaveing: false,
activeName: "first",
stlogTitle: "新增异常",
clickItem: {},
sflogItem: {},
form: {},
thirdForm: {
num: "",
},
stlogForm: {
current_sflog: "",
current_note: "",
title: "",
start_time: null,
end_time: null,
is_shutdown: false,
},
query: {
page: 0,
},
rules: {
start_time: [{ required: true, message: "请选择发生时间" }],
current_note: [
{ required: true, message: "请填写值班异常处理备注" },
],
},
sflogExpForm: {
note: "",
},
querymplog:{
mpoint:''
},
querymplogX: {
page: 0,
mpoint__type: 30,
has_create_by: 1,
},
querystlog: { mgroup: "", sflogs: ""},
stlogVisiable: false,
cateOptions: ["工艺", "机械", "电气", "其他"],
checkList: [],
stlogList: [],
mpointStat: [],
teamOptions: [],
sflogexpList: [],
mpointOptions: [],
apiObj: null,
apiObjStlog: null,
heightTable: null,
updateKey: false,
};
},
mounted() {
this.deptId = this.$route.query.deptId;
this.mgroupId = this.$route.query.mgroupId;
this.sflogId = this.$route.query.sflogId;
this.querymplogX.mgroup = this.mgroupId;
this.apiObj = this.$API.enm.mpoint.stat;
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
console.log('----------------',this.form);
this.querystlog.mgroup = this.mgroupId;
this.querystlog.sflogs = this.form.id;
this.apiObjStlog = this.$API.wpm.stlog.list;
this.getMpoint();
this.getTeam();
let height = document.getElementById("elMain").clientHeight;
let heightdetail = document.getElementById("logDetail").clientHeight;
let heightTabs = height - heightdetail - 40;
this.heightTable = heightTabs - 45 + "px";
this.$nextTick(() => {
this.$refs.infoTabd.$el.style.height = heightTabs + "px";
});
},
methods: {
handleClick(e) {
this.activeName = e.paneName;
if (e.paneName == "second") {
this.getsflogItem();
}
},
//******first ******* */
getTeam() {
let that = this;
let form = {};
form.page = 0;
form.belong_dept = that.deptId;
that.$API.mtm.team.list.req(form).then((res) => {
that.teamOptions = res;
});
},
getMpoint() {
let that = this;
let form = {};
form.page = 0;
form.type = 30;
form.enabled = 1;
form.mgroup = that.mgroupId;
that.$API.enm.mpoint.list.req(form).then((res) => {
if (res.length > 0) {
that.mpointOptions = [];
res.forEach((item) => {
item.mpFormVal = null;
item.mpFormValAble = false;
that.mpointOptions.push(item);
});
that.mpointOptions.forEach((item) =>{
that.$API.enm.mpoint.stat.req({mpoint: item.id, sflog: this.form.id, page: 0}).then(res=>{
if(res.length>0){
item.mpFormVal = res[0].val;
}else{
item.mpFormVal = 0;
}
})
})
that.getMpointStat();
}
});
},
getMpointStat() {
let that = this;
let form = {};
form.mpoint__type = 30;
form.has_create_by = 1;
form.mgroup = that.mgroupId;
that.$API.enm.mpoint.stat.req(form).then((res) => {
that.mpointStat = res.results;
});
},
mpointStat_del(row) {
let that = this;
that.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
that.$API.enm.mpoint.statDelete
.req(row.id)
.then((res) => {
that.getMpointStat();
that.$refs.mpointStatTable.refresh();
that.$message.success("删除成功");
})
.catch((err) => {
this.$message.success(err);
});
});
},
teamChange(data) {
let that = this;
that.teamOptions.forEach((item) => {
if (item.id == data) {
that.form.leader_name = item.leader_name;
that.form.leader = item.leader;
}
});
},
//
submit() {
let that = this;
that.$refs.teamForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.team = that.form.team;
obj.shift = that.form.shift;
obj.leader = that.form.leader;
obj.val = that.form.val;
obj.mpoint = that.form.mpoint;
obj.pcoal_heat = that.form.pcoal_heat;
that.$API.wpm.sflog.update
.req(that.form.id, obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("操作成功");
})
.catch((res) => {
that.isSaveing = false;
});
}
});
},
mpointChange(){
this.$refs.mpointStatTable.queryData(this.querymplog);
},
//****** seconed ******* */
//
getsflogItem() {
this.$API.wpm.sflog.init_test.req(this.form.id).then((res) => {
this.checkList = res;
});
},
submit2() {
this.isSaveing = true;
this.$API.qm.updateQuastat
.req("bulk", this.checkList)
.then((res) => {
this.isSaveing = false;
this.$message.success("操作成功");
})
.catch((res) => {
this.isSaveing = false;
});
},
//
sflog_check(row) {
this.dialog.check = true;
this.$nextTick(() => {
this.$refs.checkDialog.open("edit").setData(row);
});
},
//***** fourth ****** */
stLogSuccess(stlogid){
this.$refs.stlogTable.refresh();
if(stlogid != undefined || stlogid != null){
this.getSflogexp(stlogid);
}else{
this.sflogexpList = [];
}
},
//
addStlog() {
this.current_sflog = this.form.id;
this.stlogVisiable = true;
this.$nextTick(() => {
this.$refs.stlogDialog.open("add");
});
},
//
editStlog(row) {
this.current_sflog = this.form.id;
this.stlogVisiable = true;
this.$nextTick(() => {
this.$refs.stlogDialog.open("edit").setData(row);
});
},
handleStlog() {
this.stlogTitle = "异常处理";
this.stlogForm = row;
this.visible = true;
},
//
submit4() {
let that = this;
that.$API.wpm.sflogexp.update
.req(that.sflogExpForm.id, that.sflogExpForm)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
that.getSflogexp(that.clickItem.id);
})
.catch((res) => {
that.isSaveing = false;
});
},
//
async stlog_delete(row) {
this.$confirm(`确定删除选中的异常吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.wpm.stlog.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.stLogSuccess();
})
});
},
//stlogsflogexp
stlogRowClick(row) {
console.log(row);
this.clickItem = row;
this.getSflogexp(row.id);
},
getSflogexp(id) {
let obj = {};
obj.page = 0;
obj.stlog = id;
this.$API.wpm.sflogexp.list.req(obj).then((res) => {
this.sflogexpList = res;
});
},
//
sflogexp_edit(row) {
this.stlogTitle = "本班处理情况";
this.sflogExpForm.id = row.id;
this.sflogExpForm.note = row.note;
this.visible = true;
},
//
sflogexp_handle(row) {
this.stlogForm = row;
this.stlogTitle = "异常处理";
this.stlogForm.handler = this.$TOOL.data.get("USER_INFO").id;
this.visible = true;
},
//
submit5(item) {
let that = this;
that.isSaveing = true;
let obj = {};
obj.val = item.mpFormVal;
obj.sflog = that.form.id;
obj.mgroup = that.mgroupId;
obj.mpoint = item.id;
that.$API.enm.mpoint.statCreate
.req(obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("保存成功");
that.getMpointStat();
that.$refs.mpointStatTable.refresh();
})
.catch((res) => {
that.isSaveing = false;
});
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script>
<style scoped>
#numTable {
margin-left: 37px;
}
#numTable td {
height: 32px;
padding-left: 5px;
}
.numCell {
width: 80px;
}
.numCell.numCell_last {
width: 100px;
}
.searchHead {
display: flex;
}
.middleText {
height: 32px;
line-height: 32px;
margin: 0 5px;
display: inline-block;
}
.searchBtn {
margin-left: 5px;
}
.mpointChange{
width:150px;
position: absolute;
top: 6px;
right:10px;
z-index: 100;
}
</style>

View File

@ -0,0 +1,174 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form ref="dialogForm" :model="form" label-width="100px" label-position="right" :rules="rules">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="关联工段" prop="mgroup">
<el-input v-model="form.mgroup_name" placeholder="关联工段" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当班班次">
<el-input v-model="form.shift_name" placeholder="当班班次" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="开始时间" prop="start_time">
<el-input v-model="form.start_time" placeholder="结束时间" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="end_time">
<el-input v-model="form.end_time" placeholder="结束时间" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当班班组" prop="team">
<el-input v-model="form.team_name" placeholder="班组班长" disabled />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班组班长" prop="leader_name">
<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="水耗统计" 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>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "其他能源录入",
edit: "其他能源录入",
show: "其他能源录入",
},
form: {
type: 10,
},
rules: {
val: [{ required: true, message: "请输入检测值", trigger: "blur" }],
time: [{ required: true, message: "请选择检测时间", trigger: "blur" }]
},
visible: false,
isSaveing: false,
keeperOptions: [],
depOptions: [],
selectionFilters: [],
setFiltersVisible: false,
teamOptions: [],
shiftOptions: [],
};
},
mounted() {
//
this.getTeam();
this.getShfit();
},
methods: {
getTeam() {
this.$API.mtm.team.list.req({ page: 0 }).then(res => {
this.teamOptions = res;
})
},
getShfit() {
this.$API.mtm.shift.list.req({ page: 0 }).then(res => {
this.shiftOptions = res;
})
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
teamChange(data) {
let that = this;
that.teamOptions.forEach(item => {
if (item.id == data) {
that.form.leader_name = item.leader_name;
that.form.leader = item.leader;
}
})
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
try {
let obj = {};
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;
this.$message.success("操作成功");
return res;
})
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
.formUnit {
position: absolute;
right: -17px;
top: 7px;
}
.formUnitWrap {
position: relative;
}
</style>

View File

@ -0,0 +1,741 @@
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
v-auth="'export_excel'"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
</el-header>
<el-card style="margin-top: 5px">
<div class="printWrap">
<div ref="print" id="myReport" class="printContainer">
<table
border="1"
width="1035"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="6">
生料工序主要设备100KW以上单位产品电耗数据表
</th>
</tr>
<tr>
<th>设备名称</th>
<th>设备位号</th>
<th>单位产品分布电耗</th>
<th>上个小时</th>
<th>昨日</th>
<th>本月</th>
</tr>
</thead>
<tbody>
<tr v-for="item in tableDatas" :key="item">
<template
v-for="(item1, ind) in item"
:key="item1"
>
<td
v-if="ind == 0 || ind == 1 || ind == 2"
class="numCell"
>
{{ item1 }}
</td>
<td
v-if="ind == 3"
class="numCell"
@click="itemClick('hour_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 4"
class="numCell"
@click="itemClick('day_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 5"
class="numCell"
@click="itemClick('month_s', item)"
>
{{ item1 }}
</td>
</template>
</tr>
</tbody>
</table>
<div class="radioWrap">
<el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month"
>本月</el-radio-button
>
<el-radio-button label="year">本年</el-radio-button>
</el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="date"
value-format="YYYY-MM-DD"
formatter="YYYY-MM-DD"
placeholder="选择日期"
v-if="typeRadio == 'day'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div>
<div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartTitle">小时生产参数统计图</div>
<scEcharts
height="400px"
width="1033px"
:option="optionHour"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'month'">
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts
height="400px"
width="1033px"
:option="optionDay"
></scEcharts>
</div>
<div class="chartWrap" v-show="typeRadio == 'year'">
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts
height="400px"
width="1033px"
:option="optionMonth"
></scEcharts>
</div>
</div>
</div>
<charts
v-if="asynDialog"
:type="type"
:title="title"
:cate="cate"
:apiObj="apiObj"
:mpoint="mpoint"
:modelValue="modelValue"
:showClose="showClose"
:echartType="echartType"
@closed="asynDialog = false"
></charts>
</el-card>
</div>
</template>
<script>
const colors = [
"#cbd3fe",
"#8698fe",
"#EE6666",
"#a9b6fe",
"#cbd3fe",
"#91CC75",
"#647bfe",
];
let tooltip = {
show: true,
trigger: "axis",
axisPointer: {
type: "cross",
},
confine: false,
showContent: true,
triggerOn: "mousemove",
};
let grid = {
right: "3%",
left: "7%",
top: "15%",
};
let toolbox = {
right: "5%",
feature: {
dataView: { show: true, readOnly: false },
saveAsImage: { show: true },
},
};
let legend = {
top: "2%",
data: ["立磨主电机", "循环风机", "烘干破主", "废气风机", "尾排风机"],
};
let yAxis = {
type: "value",
name: "分布电耗(KW.h/t)",
alignTicks: true,
axisLine: {
show: true,
lineStyle: {
color: colors[3],
},
},
axisLabel: {
formatter: "{value}",
},
};
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from "vue";
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() =>
import("@/components/scEnm/lineChartsdialog.vue")
),
},
data() {
return {
searchDate: "",
typeRadio: "day",
chartShow: false,
exportLoading: false,
myOption: null,
timeStamp: null,
optionHour: {},
optionDay: {},
optionMonth: {},
year: 2023,
month: 1,
days: 1,
hours: 1,
query: {
mgroup: "",
},
mpoint: "",
tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [
["立磨主电机", "", "KW·h/t", "", "", ""],
["循环风机", "", "KW·h/t", "", "", ""],
// ['','','KW·h/t','','',''],
// ['','','KW·h/t','','',''],
// ['','','KW·h/t','','',''],
],
tableData: [],
modelValue: true,
type: "hour_s",
title: "生料工序",
cate: "",
apiObj: this.$API.enm.mpoint.stat,
showClose: true,
echartType: "line",
asynDialog: false,
allValHour: 0,
allValDays: 0,
allValMonth: 0,
option1: {
color: colors,
tooltip: tooltip,
grid: grid,
toolbox: toolbox,
legend: legend,
xAxis: {
axisTick: {
show: true,
length: 5,
inside: true,
},
data: [],
},
yAxis: yAxis,
series: [
{
name: "立磨主电机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
{
name: "烘干破主",
type: "bar",
data: [],
},
{
name: "废气风机",
type: "bar",
data: [],
},
{
name: "尾排风机",
type: "bar",
data: [],
},
],
},
option2: {
color: colors,
tooltip: tooltip,
grid: grid,
toolbox: toolbox,
legend: legend,
xAxis: {
axisTick: {
show: true,
length: 5,
inside: true,
},
data: [],
},
yAxis: yAxis,
series: [
{
name: "立磨主电机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
{
name: "烘干破主",
type: "bar",
data: [],
},
{
name: "废气风机",
type: "bar",
data: [],
},
{
name: "尾排风机",
type: "bar",
data: [],
},
],
},
option3: {
color: colors,
tooltip: tooltip,
grid: grid,
toolbox: toolbox,
legend: legend,
xAxis: {
axisTick: {
show: true,
length: 5,
inside: true,
},
data: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
},
yAxis: yAxis,
series: [
{
name: "立磨主电机",
type: "bar",
data: [],
},
{
name: "循环风机",
type: "bar",
data: [],
},
{
name: "烘干破主",
type: "bar",
data: [],
},
{
name: "废气风机",
type: "bar",
data: [],
},
{
name: "尾排风机",
type: "bar",
data: [],
},
],
},
mpoints: [],
};
},
mounted() {
//
let that = this;
var myDate = new Date();
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.hours = myDate.getHours();
that.getMpoints();
that.getTableHourData();
that.getHourData(that.year, that.month, that.days);
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "原料磨";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
const arr = res.filter(item => item.name !== "原料车间合计").map(item => item.name)
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (val !== null) {
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
}
},
getTableHourData() {
let that = this;
that.tableDatas = [];
let nowDate = new Date();
let timeDate = new Date().getTime();
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
let obj = {};
obj.type = "hour_s";
obj.year = year_h;
obj.month = month_h;
obj.day = days_h;
obj.hour = hours_h;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
if (item.mpoint_name === "原料车间合计") {
return;
}
let index = that.mpoints.indexOf(item.mpoint_name);
let obj = [];
obj[0] = item.ep_monitored_name?item.ep_monitored_name:item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[4] = 0;
obj[5] = 0;
obj[6] = item.mpoint;
that.tableDatas[index] = obj;
});
let ystDate = null;
if(hours_h>21){//
ystDate = nowDate;
}else{//
let yetTime = timeDate - 3600000 * 24;
ystDate = new Date(yetTime);
}
let year_d = ystDate.getFullYear();
let month_d = ystDate.getMonth() + 1;
let days_d = ystDate.getDate();
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_d;
obj_d.month_s = month_d;
obj_d.day_s = days_d;
obj_d.mgroup__name = "原料磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(
item.mpoint_name
);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.ep_monitored_name?item.ep_monitored_name:item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "原料磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
if (item.mpoint_name === "原料车间合计"){
return;
}
let index_m = that.mpoints.indexOf(
item.mpoint_name
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][5] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.ep_monitored_name?item.ep_monitored_name:item.mpoint_nickname?item.mpoint_nickname:item.mpoint_name;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[5] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
})
.then(() => {});
},
//
getHourData(year, month, days) {
let that = this;
let obj = {};
obj.type = "hour_s";
obj.year = year;
obj.month = month;
obj.day = days;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
// obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
if (item.mpoint_name === "原料车间合计") {
return;
}
let index = that.mpoints.indexOf(item.mpoint_name); //mpoint
if(index==-1){
return;
}
let ind = item.hour; //xAxis
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option1 };
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let hourXAxis = [];
for (let i = 0; i < 24; i++) {
let item = i + "时";
hourXAxis.push(item);
}
options.xAxis.data = hourXAxis;
that.optionHour = options;
});
},
//
getDayData(year, month) {
let that = this;
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
// obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
if (item.mpoint_name === "原料车间合计") {
return;
}
let index = that.mpoints.indexOf(item.mpoint_name); //mpoint
if(index==-1){
return;
}
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
console.log(dayXAxis);
options.xAxis.data = dayXAxis;
console.log(dayXAxis);
that.optionDay = options;
});
},
//
getMonthData(year) {
let that = this;
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
// obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
if (item.mpoint_name === "原料车间合计") {
return;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_name); //mpoint
if(index==-1){
return;
}
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option3 };
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}
options.xAxis.data = monthXAxis;
that.optionMonth = options;
});
},
itemClick(type, item) {
this.type = type;
this.cate = item[0];
this.mpoint = item[6];
this.asynDialog = true;
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script>
<style scoped>
.printContainer {
padding-left: 20px;
}
.printWrap {
overflow-x: auto;
}
.radioWrap {
display: flex;
justify-content: center;
padding-top: 10px;
position: relative;
}
</style>

View File

@ -0,0 +1,203 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
id="bigDialog"
class="bigDialog"
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
label-width="85px"
label-position="right"
:rules="rule1"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="关联工段">
<el-input v-model="form.mgroup_name" placeholder="关联工段" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当前班次">
<el-input v-model="form.shift_name" placeholder="当前班次" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="当前班组">
<el-input v-model="form.team_name" placeholder="当前班组" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班组组长">
<el-input v-model="form.team_name" placeholder="班组组长" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="开始时间">
<el-input v-model="form.start_time" placeholder="开始时间" disabled/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间">
<el-input v-model="form.end_time" placeholder="结束时间" disabled/>
</el-form-item>
</el-col>
<el-divider />
</el-row>
</el-form>
<sc-form-table
v-model="form.list"
:addTemplate="addTemplate"
:hideAdd="hideAdd"
:hideDelete="hideDelete"
placeholder="暂无数据"
>
<el-table-column prop="material" label="关联产物" min-width="150">
<template #default="scope">
<span v-if="scope.row.id">{{ scope.row.material_name }}</span>
</template>
</el-table-column>
<el-table-column prop="testitem" label="质检项目" min-width="150">
<template #default="scope">
<span v-if="scope.row.id">{{ scope.row.testitem_name }}</span>
</template>
</el-table-column>
<el-table-column prop="val_avg" label="平均值" min-width="150">
<template #default="scope">
<el-input
v-model="scope.row.val_avg"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column prop="num_test" label="检验次数" min-width="150">
<template #default="scope">
<el-input
v-model="scope.row.num_test"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column prop="num_ok" label="合格次数" min-width="150">
<template #default="scope">
<el-input
v-model="scope.row.num_ok"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
</sc-form-table>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
addTemplate: {
material: "",
testitem: "",
val_avg: "",
num_test: "",
num_ok: "",
},
hideAdd:true,
hideDelete:true,
loading: false,
mode: "add",
titleMap: {
add: "质量检验",
edit: "质量检验",
show: "质量检验",
},
form: {
type:10,
list:[]
},
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"}]
},
visible: false,
isSaveing: false,
keeperOptions: [],
depOptions: [],
selectionFilters: [],
setFiltersVisible: false,
teamOptions:[],
shiftOptions:[],
};
},
mounted() {
//
//initget
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
getReceptionist(data) {
this.form.leader=data.id;
this.form.leader_name=data.name
},
//
submit() {
this.isSaveing = true;
this.$API.qm.updateQuastat.req('bulk',this.form.list).then(res=>{
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
}).catch(res=>{
this.isSaveing = false;
})
// this.$refs.dialogForm.validate(async (valid) => {
// if (valid) {
// }
// });
},
//
setData(data) {
Object.assign(this.form,data);
this.getsflogItem(this.form.id);
},
getsflogItem(id){
this.$API.wpm.sflog.init_test.req(id).then(res=>{
this.form.list = res;
})
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style scoped>
#bigDialog{
width: 90%;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,243 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:rules="rules"
label-width="100px"
:model="form"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="异常类别">
<el-tag v-if="form.is_shutdown" type="danger"
>停机</el-tag
>
<el-tag v-else type="danger">其他</el-tag>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="异常名称" prop="title">
<el-input
:disabled="form.is_shutdown"
v-model="form.title"
placeholder="异常名称"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="发生时间" prop="start_time">
<el-date-picker
:disabled="form.is_shutdown"
v-model="form.start_time"
type="datetime"
placeholder="发生时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="end_time">
<el-date-picker
:disabled="form.is_shutdown"
v-model="form.end_time"
type="datetime"
placeholder="结束时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="异常原因" prop="reason">
<el-input
v-model="form.reason"
placeholder="异常原因"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="原因类别">
<el-select
v-model="form.cate"
placeholder="原因类别"
clearable
style="width: 100%"
>
<el-option
v-for="item in cateOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处置人员">
<el-input
v-model="form.handler"
placeholder="处置人员"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处置措施">
<el-input
v-model="form.measure"
placeholder="处置措施"
/>
</el-form-item>
</el-col>
<el-divider></el-divider>
<el-col>
<p>本班处理情况</p>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注" prop="current_note">
<el-input
type="textarea"
:rows="2"
v-model="form.current_note"
placeholder="处理备注"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
current_sflog: {
type: [String],
default: "",
},
mgroupId: {
type: [String],
default: "",
},
},
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增异常",
edit: "编辑异常",
show: "查看异常",
},
form: {
current_sflog: "",
current_note: "",
title: "",
is_shutdown: false,
},
rules: {
title: [
{
required: true,
message: "请输入异常名称",
trigger: "blur",
},
],
reason: [
{
required: true,
message: "请输入异常原因",
trigger: "blur",
},
],
start_time: [{ required: true, message: "请选择发生时间" }],
// end_time: [{ required: true, message: "" }],
current_note: [
{ required: true, message: "请填写值班异常处理备注" },
],
},
visible: false,
isSaveing: false,
cateOptions: ["工艺", "机械", "电气", "其他"],
setFiltersVisible: false,
};
},
mounted() {
console.log(this.current_sflog)
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.current_sflog = that.current_sflog;
if (that.mode == "add") {
that.form.mgroup = that.mgroupId;
that.$API.wpm.stlog.create
.req(that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success", res.id);
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
} else {
that.$API.wpm.stlog.update
.req(that.form.id, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success", res.id);
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,408 @@
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-date-picker
v-model="query.year_s"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="查询年份"
class="headerSearch"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
v-auth="'export_excel'"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
</el-header>
<el-card style="margin-top: 5px">
<div class="printWrap">
<div ref="print" id="myReport" class="printContainer">
<table
border="1"
width="2400"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="23">生料工序班组月度对比分析</th>
</tr>
<tr>
<th rowspan="2">月份</th>
<th rowspan="2">班组</th>
<th colspan="2">产量</th>
<th>运转率</th>
<th>成本</th>
<th colspan="7">质量</th>
<th colspan="9">单位产品电耗</th>
<th rowspan="2">得分</th>
</tr>
<tr>
<th>总产量t</th>
<th>台时产量t/h</th>
<th>运转率%</th>
<th>单位产品成本/</th>
<th>细度%</th>
<th>Fe₂O₃%</th>
<th>水分%</th>
<th>细度%</th>
<th>Fe₂O₃%</th>
<th>水分%</th>
<th>CaO%</th>
<th>循环风机KW·h/t</th>
<th>立磨主电机KW·h/t</th>
<th>当期值KW·h/t</th>
<th>目标值KW·h/t</th>
<th>当期与目标差值KW·h/t</th>
<th>环期值KW·h/t</th>
<th>当期与环期差值KW·h/t</th>
<th>环比增长率%</th>
<th>同比增长率%</th>
</tr>
</thead>
<tr v-for="(item, index) in tableDatas" :key="index">
<td
v-for="(item0, index0) in item"
:key="index0"
class="numCell"
>
{{ item0 }}
</td>
</tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
timeStamp: 0,
query: {
year_s: "",
page: 0,
type: "month_st",
mgroup: "",
},
tableDatas: [],
goalDatas: [],
exportLoading: false,
};
},
mounted() {
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
that.query.year_s = year;
this.$API.mtm.mgroup.list
.req({ page: 0, search: "原料磨" })
.then((res) => {
that.query.mgroup = res[0].id;
let params = {};
params.page = 0;
params.year = year;
params.mgroup = that.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => {
if (res.length > 0) {
res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗KW·h/t") {
that.getData(item);
}
})
}
});
});
},
methods: {
getGoalData() {
const self = this;
let params = {};
params.page = 0;
params.year = self.query.year_s;
params.mgroup = self.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => {
if (res.length > 0) {
res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗KW·h/t") {
this.getData(item);
}
})
}
})
.catch((error) => {
console.error('获取目标数据失败:', error);
});
},
getData(goalData) {
let that = this;
let query0 = {};
query0.page = 0;
query0.type = "month_st";
query0.year_s = that.query.year_s - 1;
query0.mgroup = that.query.mgroup;
let wrapArr = [],
wrapArr0 = [],
wrapArrs = [],
month_obj = {},
compareArr0 = [];
this.$API.enm.enstat.req(query0).then((res0) => {
let data0 = res0;
if (data0.length > 0) {
data0.forEach((item0) => {
//
wrapArr0[ind0] = item0;
});
} else {
}});
this.$API.enm.enstat.req(that.query).then((res) => {
let data = res;
if (data.length > 0) {
data.forEach((item) => {
//
let compareArr = [];
compareArr.push(item.month_s);
compareArr.push(item.team_name);
compareArr.push(item.elec_consume_unit);
compareArr0.push(compareArr);
if (!month_obj[item.month_s]) {
month_obj[item.month_s] = [];
}
month_obj[item.month_s].push(
{
team:item.team_name,
production_hour: item.production_hour,
run_rate:item.run_rate,
production_cost_unit:item.production_cost_unit,
xidu:item.辅料_细度_rate_pass,
Fe203:item.辅料_Fe2O3_rate_pass,
elec:item.elec_consume_unit,
}
);
});
data.forEach((item) => {
//
let n = item.month_s;
let ind = 0;
let arr = [];
let time = "" + item.year_s + "." + item.month_s;
arr.push(time);
arr.push(item.team_name);
arr.push(item.total_production);
arr.push(item.production_hour);
arr.push(item.run_rate);
arr.push(item.production_cost_unit);
//
arr[6] =
item.辅料_细度_rate_pass != null
? item.辅料_细度_rate_pass
: "/";
arr[7] =
item.辅料_Fe2O3_rate_pass != null
? item.辅料_Fe2O3_rate_pass
: "/";
arr[8] =
item.辅料_水分_rate_pass != null
? item.辅料_水分_rate_pass
: "/";
arr[9] =
item.干混生料_细度_rate_pass != null
? item.干混生料_细度_rate_pass
: "/";
arr[10] =
item.干混生料_Fe2O3_rate_pass != null
? item.干混生料_Fe2O3_rate_pass
: "/";
arr[11] =
item.干混生料_水分_rate_pass != null
? item.干混生料_水分_rate_pass
: "/";
arr[12] =
item.干混生料_CaO_rate_pass != null
? item.干混生料_CaO_rate_pass
: "/";
//
arr[13] =
item.循环风机_consume_unit != null
? item.循环风机_consume_unit
: "/";
arr[14] =
item.立磨主电机_consume_unit != null
? item.立磨主电机_consume_unit
: "/";
//
arr[15] = item.elec_consume_unit; //KW·h/t
let keyVale = "goal_val_" + n;
arr[16] = goalData[keyVale]?goalData[keyVale]:0; //KW·h/t//
arr[17] = (arr[15] - arr[16]).toFixed(2); //KW·h/t
let ind_pre = 0,
huanbi = 0;
if (item.month_s == 1) {
ind_pre = 12;
huanbi = wrapArr0[ind_pre]
? wrapArr0[ind_pre].elec_consume_unit
: "/";
} else {
// wrapArr0wrapArritem.month_s1 item.namehuanbi
compareArr0.forEach((item0) => {
if (item0[0] == item.month_s - 1 && item0[1] == item.team_name) {
huanbi = item0[2];
}
})
}
arr[18] = huanbi; //KW·h/t
//KW·h/t
if (arr[19] !== "/"){
arr[19] = (arr[15] - arr[18]).toFixed(2); //KW·h/t
}else{
arr[19] = "/"; //KW·h/t
}
arr[20] = 0; //%
if (arr[18] !=="/" && arr[19] !==0 && arr[19] !== "undefined" && arr[18] !== 0){
arr[20] = ((arr[19]/arr[18])*100).toFixed(2);
}else{
arr[20] = "/"; //%= KW·h/t/KW·h/t*100%
}
arr[21] = item.celec_consume_unit; //%
arr[22] = 0;
if (month_obj[n]) {
const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; //
const sortedData = monthData.sort((a, b) => parseFloat(b.elec) - parseFloat(a.elec));
const index = sortedData.findIndex(obj => parseFloat(obj.elec) === parseFloat(itemValue));
let elec_score = 0;
if (index === 0){
elec_score= 20;
} else if (index === 1) {
elec_score= 15;
} else if (index === 2) {
elec_score= 5;
} else if (index === 3) {
elec_score= 0;
}
arr[22] += elec_score;
const run_rate_itemValue = item.run_rate; //
const run_rate_sortedData = monthData.sort((a, b) => parseFloat(b.run_rate) - parseFloat(a.run_rate));
const run_rate_index = run_rate_sortedData.findIndex(obj => parseFloat(obj.run_rate) === parseFloat(run_rate_itemValue));
let run_rate_score = 0;
if (run_rate_index === 0){
run_rate_score= 10;
} else if (run_rate_index === 1) {
run_rate_score= 7;
} else if (run_rate_index === 2) {
run_rate_score= 3;
} else if (run_rate_index === 3) {
run_rate_score= 0;
}
arr[22] += run_rate_score;
const production_hour_itemValue = item.production_hour; //
const production_hour_sortedData = monthData.sort((a, b) => parseFloat(b.production_hour) - parseFloat(a.production_hour));
const production_hour_index = production_hour_sortedData.findIndex(obj => parseFloat(obj.production_hour) === parseFloat(production_hour_itemValue));
let production_hour_score = 0;
if (production_hour_index === 0){
production_hour_score= 20;
} else if (production_hour_index === 1) {
production_hour_score= 15;
} else if (production_hour_index === 2) {
production_hour_score= 5;
} else if (production_hour_index === 3) {
production_hour_score= 0;
}
arr[22] += production_hour_score;
const production_cost_unit_itemValue = item.production_cost_unit; //
const production_cost_unit_sortedData = monthData.sort((a, b) => parseFloat(b.production_cost_unit) - parseFloat(a.production_cost_unit));
const production_cost_unit_index = production_cost_unit_sortedData.findIndex(obj => parseFloat(obj.production_cost_unit) === parseFloat(production_cost_unit_itemValue));
let production_cost_unit_score = 0;
if (production_cost_unit_index === 0){
production_cost_unit_score= 10;
} else if (production_cost_unit_index === 1) {
production_cost_unit_score= 7;
} else if (production_cost_unit_index === 2) {
production_cost_unit_score= 3;
} else if (production_cost_unit_index === 3) {
production_cost_unit_score= 0;
}
arr[22] += production_cost_unit_score;
const xidu_itemValue = item.辅料_细度_rate_pass; //
const xidu_sortedData = monthData.sort((a, b) => parseFloat(b.xidu) - parseFloat(a.xidu));
const xidu_index = xidu_sortedData.findIndex(obj => parseFloat(obj.xidu) === parseFloat(xidu_itemValue));
let xidu_score = 0;
if (xidu_index === 0){
xidu_score= 20;
} else if (xidu_index === 1) {
xidu_score= 15;
} else if (xidu_index === 2) {
xidu_score= 5;
} else if (xidu_index === 3) {
xidu_score= 0;
}
arr[22] += xidu_score;
const Fe203_itemValue = item.辅料_Fe2O3_rate_pass; // Fe203
const Fe203_sortedData = monthData.sort((a, b) => parseFloat(b.Fe203) - parseFloat(a.Fe203));
const Fe203_index = Fe203_sortedData.findIndex(obj => parseFloat(obj.Fe203) === parseFloat(Fe203_itemValue));
let Fe203_score = 0;
if (Fe203_index === 0){
Fe203_score= 20;
} else if (Fe203_index === 1) {
Fe203_score= 15;
} else if (Fe203_index === 2) {
Fe203_score= 5;
} else if (Fe203_index === 3) {
Fe203_score= 0;
}
arr[22] += Fe203_score;
}
wrapArr.push(arr);
});
that.tableDatas = wrapArr;
} else {
}
});
},
handleQuery() {
this.tableDatas = [];
this.getGoalData();
},
itemClick(type, item) {
this.type = type;
this.asynDialog = true;
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script>
<style scoped>
.printWrap {
width: 100%;
overflow-x: scroll;
}
</style>

View File

@ -0,0 +1,348 @@
<template>
<div class="app-container">
<el-header>
<div class="left-panel">
<el-date-picker
v-model="query.year_s"
type="year"
value-format="YYYY"
format="YYYY"
placeholder="查询年份"
class="headerSearch"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
v-auth="'export_excel'"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
</el-header>
<el-card style="margin-top: 5px">
<div class="printWrap">
<div ref="print" id="myReport" class="printContainer">
<table
border="1"
width="1075"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="9">
生料工序车间单位产品电耗月度分析表
</th>
</tr>
<tr>
<th>月份</th>
<th>当期值KW·h/t</th>
<th>目标值KW·h/t</th>
<th>当期与目标差值KW·h/t</th>
<th>环期值KW·h/t</th>
<th>当期与环期差值KW·h/t</th>
<th>环比增长率%</th>
<th>同比增长率%</th>
<th>分析说明</th>
</tr>
</thead>
<tbody>
<tr v-for="item in tableDatas" :key="item">
<td
v-for="(item1, ind) in item"
:key="ind"
class="numCell"
:style="{width: ind == 8 ? '300px' : '100px',display: ind == 9 ? 'none' : 'table-cell'}"
>
<div :class="bindClass(item1, ind)" v-if="ind !=8 && ind !=9">
<span v-if="item1 > 0 && ind == 3"
></span
>
<span v-if="item1 < 0 && ind == 3"
></span
>
<span v-if="item1 > 0 && ind == 5"
></span
>
<span v-if="item1 < 0 && ind == 5"
></span
>
{{ item1 }}
</div>
<el-popover
trigger="hover"
placement="top"
width="auto"
v-if="ind == 8"
:content="item[ind]"
>
<template #reference>
<el-input @change="((val)=>{enstatNoteChange(val, item)})" v-model="item[ind]"></el-input>
</template>
</el-popover>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from "vue";
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() =>
import("@/components/scEnm/lineChartsdialog.vue")
),
},
data() {
return {
chartShow: false,
exportLoading: false,
timeStamp: null,
myOption: null,
query: {
mgroup: "",
},
tableDatas: [],
modelValue: true,
type: "hours",
title: "title",
apiObj: "",
showClose: true,
echartType: "line",
asynDialog: false,
monthGoal: [],
};
},
mounted() {
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
that.query.year_s = year;
that.timeStamp = myDate.getTime();
that.$API.mtm.mgroup.list
.req({ page: 0, name: "原料磨" })
.then((res) => {
console.log("原料磨", res);
that.query.mgroup = res[0].id;
//
that.getMonthGoal();
that.getData();
});
},
methods: {
// Class
bindClass(item, index) {
let classInfo = { redColor: false, greenColor: false };
if (index == 3 || index == 5) {
if ( item != "/") {
item = Number(item);
if (item > 0) {
classInfo.greenColor = false;
classInfo.redColor = true;
} else if (item < 0) {
classInfo.redColor = false;
classInfo.greenColor = true;
}
}
}
return classInfo;
},
//
getMonthGoal() {
let that = this;
let paramsGoal = {};
paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup;
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"
) {
monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_2;
monthGoal[2] = goal.goal_val_3;
monthGoal[3] = goal.goal_val_4;
monthGoal[4] = goal.goal_val_5;
monthGoal[5] = goal.goal_val_6;
monthGoal[6] = goal.goal_val_7;
monthGoal[7] = goal.goal_val_8;
monthGoal[8] = goal.goal_val_9;
monthGoal[9] = goal.goal_val_10;
monthGoal[10] = goal.goal_val_11;
monthGoal[11] = goal.goal_val_12;
monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
}
});
} else {
this.getData();
}
});
},
getData() {
let that = this;
let query0 = {};
query0.page = 0;
query0.type = "month_s";
query0.year_s = that.query.year_s - 1;
query0.mgroup = that.query.mgroup;
let wrapArr = [],
wrapArr0 = [],
wrapArrs = [];
this.$API.enm.enstat.req(query0).then((res0) => {
let data0 = res0;
if (data0.length > 0) {
data0.forEach((item0) => {
//
let ind0 = item0.month_s;
wrapArr0[ind0] = item0;
});
}
let query = {};
query.page = 0;
query.type = "month_s";
query.year_s = that.query.year_s;
query.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(query).then((res) => {
let data = res;
if (data.length > 0) {
data.forEach((item) => {
//
let ind = item.month_s;
let arr = [];
let time = "" + item.year_s + "." + item.month_s;
arr.push(time);
arr.push(item.elec_consume_unit); //KW·h/t
arr[2] =
that.monthGoal[ind] !== undefined
? that.monthGoal[ind]
: "/";
arr[3] = item.note;
arr[4] = item.id;
wrapArr.push(arr);
});
wrapArr.forEach((item, index) => {
let arrs = [];
arrs[0] = item[0];
arrs[1] = item[1];
arrs[2] = item[2];
//KW·h/t//
//KW·h/t
let diff = 0;
if (item[2] !== "/") {
diff = (item[1] - item[2]).toFixed(2);
} else {
diff = "/";
}
arrs[3] = diff;
//KW·h/t
let lastNum = 0;
if (index > 0) {
let num = index - 1;
if (
wrapArr[num] &&
wrapArr[num][1]
) {
lastNum = wrapArr[num][1];
} else {
lastNum = "/";
}
} else {
lastNum = wrapArr0[12]
? wrapArr0[12].elec_consume_unit
: "/";
}
arrs[4] = lastNum;
//KW·h/t
let lastDiff = 0;
if (arrs[1] !== "/" && arrs[4] !== "/") {
lastDiff = (arrs[1] - arrs[4]).toFixed(2);
} else {
lastDiff = "/";
}
arrs[5] = lastDiff;
//%
let lastRate = 0;
if (
lastDiff !== "/" &&
lastNum !== "/" &&
lastNum != 0
) {
lastRate = ((lastDiff / lastNum) * 100).toFixed(2);
} else {
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 = "/";
}
arrs[7] = sameRate;
arrs[8] = item[3];
arrs[9] = item[4];
wrapArrs.push(arrs);
});
that.tableDatas = wrapArrs;
} else {
}
});
});
},
itemClick(type, item) {
this.type = type;
this.asynDialog = true;
},
handleQuery() {
this.getMonthGoal();
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
enstatNoteChange(val, item){
this.$API.enm.enstat_update.req(item[9], {"note": val}).then((res)=>{
this.$message.success("修改成功");
}
)
}
},
};
</script>
<style scoped>
.printWrap {
width: 100%;
overflow-x: auto;
}
</style>