factory_web/src/views/enm_rm/logDetail.vue

918 lines
23 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<el-container>
<el-main class="nopadding">
<el-card 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'"
style="
position: absolute;
top: 6px;
right: 43%;
z-index: 100;
"
>新增异常</el-button
>
<el-tabs
v-model="activeName"
class="demo-tabs"
@tab-click="handleClick"
height="600px"
>
<el-tab-pane label="班组" name="first">
<el-form
ref="teamForm"
:model="form"
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 == '白班' &&
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
:md="12"
:sm="24"
v-if="mgroupId == '3555859873776693248'"
>
<el-form-item label="石灰石破碎产量">
<el-input-number
v-model="form.pcoal_heat"
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>
</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
v-if="
mgroupId == '3346491835287007232' ||
mgroupId == '3347217651339837440' ||
mgroupId == '3347217246321065984'
"
>
<el-form
ref="thirdForms"
:model="thirdForm"
label-width="100px"
label-position="right"
>
<!-- 电石渣 -->
<el-row
v-if="mgroupId == '3346491835287007232'"
>
<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="mgroupId == '3347217246321065984'"
>
<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="mgroupId == '3347217651339837440'"
>
<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-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>
<div
v-else
style="
width: 100%;
height: 200px;
line-height: 200px;
text-align: center;
"
>
无其他成本
</div>
</el-tab-pane>
<el-tab-pane label="异常" name="fourth">
<el-row :gutter="20">
<el-col :span="14">
<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="停机时长"
prop="duration"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link
size="small"
@click="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>
</el-table>
</el-col>
<el-col :span="10">
<el-table
ref="expTable"
:data="sflogexpList"
row-key="id"
stripe
:height="300"
highlightCurrentRow
>
<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)
"
type="primary"
>编辑</el-button
>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<!-- <el-row :gutter="20" v-if="sflogExpVisiable"> -->
<el-dialog :title="stlogTitle" v-model="visible">
<el-form
v-if="sflogExpVisiable"
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-form
v-else
ref="stlogForms"
:rules="rules"
label-width="100px"
:model="stlogForm"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="异常类别">
<el-tag
v-if="stlogForm.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="异常名称">
<el-input
:disabled="
stlogForm.is_shutdown
"
v-model="stlogForm.title"
placeholder="异常名称"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="发生时间"
prop="start_time"
>
<el-date-picker
:disabled="
stlogForm.is_shutdown
"
v-model="stlogForm.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="结束时间">
<el-date-picker
:disabled="
stlogForm.is_shutdown
"
v-model="stlogForm.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="cate"
>
<el-input
v-model="stlogForm.cate"
placeholder="原因类别"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处置措施">
<el-input
v-model="stlogForm.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="stlogForm.current_note"
placeholder="处理备注"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer>
<el-button
v-if="sflogExpVisiable"
type="primary"
:loading="isSaveing"
@click="submit42"
>保存</el-button
>
<el-button
v-else
type="primary"
:loading="isSaveing"
@click="submit4"
>保存</el-button
>
<el-button @click="visible = false"
>取消</el-button
>
</el-footer>
</el-dialog>
</el-tab-pane>
</el-tabs>
</el-card>
</el-main>
</el-container>
</template>
<script>
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,
},
data() {
return {
deptId: "",
mgroupId: "",
hideAdd: true,
visible: false,
hideDelete: true,
isSaveing: false,
activeName: "fourth",
stlogTitle: "新增异常",
clickItem: {},
sflogItem: {},
form: {},
thirdForm: {
num: "",
},
stlogForm: {
current_sflog: "",
current_note: "",
title: "",
start_time: "",
end_time: "",
cate: "",
reason: "",
measure: "",
handler: "",
mgroup: "",
is_shutdown: false,
},
query: {
page: 0,
},
rules: {
start_time: [{ required: true, message: "请选择发生时间" }],
current_note: [
{ required: true, message: "请填写值班异常处理备注" },
],
},
sflogExpForm: {
note: "",
},
sflogExpVisiable: false,
checkList: [],
stlogList: [],
teamOptions: [],
sflogexpList: [],
apiObj: this.$API.wpm.sflogexp.list,
};
},
mounted() {
this.deptId = this.$route.query.deptId;
this.mgroupId = this.$route.query.mgroupId;
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
console.log(this.form);
this.getTeam();
this.getStlog();
},
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;
});
},
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.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;
});
}
});
},
//****** 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 异常 ****** */
//获取异常列表
getStlog() {
let obj = {};
obj.page = 0;
obj.mgroup = this.mgroupId;
this.$API.wpm.stlog.list.req(obj).then((res) => {
this.stlogList = res;
});
},
//异常添加
addStlog() {
console.log("USER_INFO", this.$TOOL.data.get("USER_INFO"));
this.stlogForm.current_sflog = this.form.id;
this.stlogForm.current_note = "";
this.stlogForm.cate = "1";
this.stlogForm.title = "";
this.stlogForm.reason = "";
this.stlogForm.measure = "";
this.stlogForm.start_time = "";
this.stlogForm.end_time = "";
this.stlogForm.handler = this.$TOOL.data.get("USER_INFO").id;
this.stlogForm.mgroup = this.mgroupId;
this.stlogTitle = "新增异常";
this.sflogExpVisiable = false;
this.visible = true;
},
//异常编辑
editStlog(row) {
this.stlogTitle = "编辑异常";
this.stlogForm = row;
this.stlogForm.current_sflog = row.sflog;
this.sflogExpVisiable = false;
this.visible = true;
},
handleStlog() {
this.stlogTitle = "异常处理";
this.stlogForm = row;
this.visible = true;
this.sflogExpVisiable = true;
},
//新增异常提交
submit4() {
let that = this;
that.$refs.stlogForms.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
if (that.stlogTitle == "新增异常") {
that.$API.wpm.stlog.create
.req(that.stlogForm)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
this.getStlog();
})
.catch((res) => {
that.isSaveing = false;
});
} else if (that.stlogTitle == "编辑异常") {
console.log("that.stlogForm", that.stlogForm);
console.log("that.stlogForm.id", that.stlogForm.id);
that.$API.wpm.stlog.update
.req(that.stlogForm.id, that.stlogForm)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
this.getStlog();
})
.catch((res) => {
that.isSaveing = false;
});
}
}
});
},
submit42() {
let that = this;
that.$API.wpm.sflogexp.update
.req(that.sflogExpForm.id, that.sflogExpForm)
.then((res) => {
this.sflogExpVisiable = false;
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
that.getSflogexp(that.clickItem.id);
})
.catch((res) => {
this.sflogExpVisiable = false;
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.getStlog();
})
.catch((err) => {
this.$message.success(err);
});
});
},
//点击stlog展示sflogexp
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.sflogExpVisiable = true;
this.visible = true;
},
//异常处理
sflogexp_handle(row) {
this.stlogForm = row;
this.stlogTitle = "异常处理";
this.stlogForm.handler = this.$TOOL.data.get("USER_INFO").id;
this.visible = true;
this.sflogExpVisiable = 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;
}
</style>