|
|
|
|
@ -9,27 +9,16 @@
|
|
|
|
|
<!-- @keyup.enter.native="handleQuery"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="停机原因" prop="shutReason">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.shutReason"
|
|
|
|
|
placeholder="请输入停机原因"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="停机类型" prop="shutTypeId" >
|
|
|
|
|
<el-select v-model="queryParams.shutTypeId"
|
|
|
|
|
placeholder="请输入设备类型"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="停机原因" prop="shutReasonId">
|
|
|
|
|
<el-select v-model="queryParams.shutReasonId" placeholder="请选择停机原因" clearable @change="handleQuery">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in shutTypeList"
|
|
|
|
|
:key="item.shutTypeId"
|
|
|
|
|
:label="item.shutTypeName"
|
|
|
|
|
:value="item.shutTypeId" />
|
|
|
|
|
|
|
|
|
|
v-for="item in shutReasonList"
|
|
|
|
|
:key="item.shutReasonId"
|
|
|
|
|
:label="item.shutReason"
|
|
|
|
|
:value="item.shutReasonId" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="停机时间" prop="shutBeginTime">
|
|
|
|
|
<!-- <el-form-item label="停机时间" prop="shutBeginTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="queryParams.shutBeginTime"
|
|
|
|
|
type="datetime"
|
|
|
|
|
@ -45,7 +34,7 @@
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
placeholder="请选择停机结束时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
<!-- <el-form-item label="停机时长" prop="shutTime">-->
|
|
|
|
|
<!-- <el-input-->
|
|
|
|
|
<!-- v-model="queryParams.shutTime"-->
|
|
|
|
|
@ -117,15 +106,10 @@
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<!-- <el-table-column label="主键标识;scada上报的记录" align="center" prop="recordShutDownId" />-->
|
|
|
|
|
<el-table-column label="设备" align="center" prop="deviceName" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>
|
|
|
|
|
v-for="(item, index) in ledgerList"
|
|
|
|
|
:key="index"
|
|
|
|
|
:value="item.ledgerList"
|
|
|
|
|
v-if="scope.row.deviceId == item.deviceId"
|
|
|
|
|
>
|
|
|
|
|
{{ item.deviceId }}
|
|
|
|
|
</span>
|
|
|
|
|
<template slot-scope="{ row }">
|
|
|
|
|
<span v-if="row.deviceName">{{ row.deviceName }}</span>
|
|
|
|
|
<span v-else-if="ledgerMap[row.deviceId]">{{ ledgerMap[row.deviceId].deviceName || ledgerMap[row.deviceId].deviceCode }}</span>
|
|
|
|
|
<span v-else>{{ row.deviceId }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- <el-table-column label="设备名称" align="center" prop="deviceId" >-->
|
|
|
|
|
@ -141,18 +125,7 @@
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
|
<!-- <el-table-column label="停机类型ID,关联dm_base_shut_type的shut_type_id" align="center" prop="shutType" />-->
|
|
|
|
|
<el-table-column label="停机类型" align="center" prop="shutType" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span
|
|
|
|
|
v-for="(item, index) in shutTypeList"
|
|
|
|
|
:key="index"
|
|
|
|
|
:value="item.shutTypeList"
|
|
|
|
|
v-if="scope.row.shutType == item.shutTypeId"
|
|
|
|
|
>
|
|
|
|
|
{{ item.shutTypeName }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- 停机类型后端自动赋值,前端不展示选择 -->
|
|
|
|
|
<el-table-column label="停机原因" align="center" prop="shutReason" />
|
|
|
|
|
<el-table-column label="停机开始时间" align="center" prop="shutBeginTime" width="200">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
@ -169,13 +142,13 @@
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- type="text"-->
|
|
|
|
|
<!-- icon="el-icon-edit"-->
|
|
|
|
|
<!-- @click="handleUpdate(scope.row)"-->
|
|
|
|
|
<!-- v-hasPermi="['dms:shutDown:edit']"-->
|
|
|
|
|
<!-- >修改</el-button>-->
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['dms:shutDown:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
@ -197,7 +170,7 @@
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改停机记录对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
<!-- <el-form-item label="设备ID,关联dms_base_device_ledger的device_id" prop="deviceId">-->
|
|
|
|
|
<!-- <el-input v-model="form.deviceId" placeholder="请输入设备ID,关联dms_base_device_ledger的device_id" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
@ -211,19 +184,16 @@
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="停机类型" prop="shutType" >
|
|
|
|
|
<el-select v-model="form.shutType" placeholder="请选择停机类型">
|
|
|
|
|
<el-form-item label="停机原因" prop="shutReasonId">
|
|
|
|
|
<el-select v-model="form.shutReasonId" placeholder="请选择停机原因" @change="onReasonChange">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in shutTypeList"
|
|
|
|
|
:key="item.shutTypeId"
|
|
|
|
|
:label="item.shutTypeName"
|
|
|
|
|
:value="item.shutTypeId">
|
|
|
|
|
</el-option>
|
|
|
|
|
v-for="item in shutReasonList"
|
|
|
|
|
:key="item.shutReasonId"
|
|
|
|
|
:label="item.shutReason"
|
|
|
|
|
:value="item.shutReasonId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="停机原因" prop="shutReason">
|
|
|
|
|
<el-input v-model="form.shutReason" placeholder="请输入停机原因" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="停机开始时间" prop="shutBeginTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.shutBeginTime"
|
|
|
|
|
@ -260,7 +230,7 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listShutDown, getShutDown, delShutDown, addShutDown, updateShutDown } from "@/api/dms/shutDown";
|
|
|
|
|
import { listShutType } from '@/api/dms/shutType'
|
|
|
|
|
import { selectDmsBaseShutReasonList } from '@/api/dms/shutReason'
|
|
|
|
|
import { getDeviceLedgerList } from '@/api/base/deviceLedger'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
@ -268,7 +238,8 @@ export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
ledgerList:[],
|
|
|
|
|
shutTypeList:[],
|
|
|
|
|
ledgerMap:{},
|
|
|
|
|
shutReasonList:[],
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 选中数组
|
|
|
|
|
@ -292,8 +263,7 @@ export default {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
deviceId: null,
|
|
|
|
|
shutType: null,
|
|
|
|
|
shutReason: null,
|
|
|
|
|
shutReasonId: null,
|
|
|
|
|
shutBeginTime: null,
|
|
|
|
|
shutEndTime: null,
|
|
|
|
|
shutTime: null,
|
|
|
|
|
@ -303,31 +273,38 @@ export default {
|
|
|
|
|
form: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
|
|
|
|
|
isFlag: [
|
|
|
|
|
{ required: true, message: "是否标识:1-是;2-否不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
shutReasonId: [
|
|
|
|
|
{ required: true, message: "请选择停机原因", trigger: "change" }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getDevice();
|
|
|
|
|
this.getShutType();
|
|
|
|
|
this.getShutReason();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 查询停机类型信息列表 */
|
|
|
|
|
getShutType() {
|
|
|
|
|
listShutType(this.queryParams).then(response => {
|
|
|
|
|
console.log(response)
|
|
|
|
|
this.shutTypeList = response.rows;
|
|
|
|
|
/** 停机原因列表 */
|
|
|
|
|
getShutReason() {
|
|
|
|
|
selectDmsBaseShutReasonList({}).then(res => {
|
|
|
|
|
this.shutReasonList = res.rows || res.data || [];
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onReasonChange(val) {
|
|
|
|
|
const found = this.shutReasonList.find(r => r.shutReasonId === val);
|
|
|
|
|
this.form.shutReason = found ? found.shutReasonName : null;
|
|
|
|
|
},
|
|
|
|
|
//查询设备信息
|
|
|
|
|
getDevice(){
|
|
|
|
|
getDeviceLedgerList({}).then(response => {
|
|
|
|
|
// console.log(response)
|
|
|
|
|
this.ledgerList = response.data;
|
|
|
|
|
this.ledgerMap = Array.isArray(response.data)
|
|
|
|
|
? response.data.reduce((acc, cur) => {
|
|
|
|
|
acc[cur.deviceId] = cur;
|
|
|
|
|
return acc;
|
|
|
|
|
}, {})
|
|
|
|
|
: {};
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 查询停机记录列表 */
|
|
|
|
|
@ -349,7 +326,7 @@ export default {
|
|
|
|
|
this.form = {
|
|
|
|
|
recordShutDownId: null,
|
|
|
|
|
deviceId: null,
|
|
|
|
|
shutType: null,
|
|
|
|
|
shutReasonId: null,
|
|
|
|
|
shutReason: null,
|
|
|
|
|
shutBeginTime: null,
|
|
|
|
|
shutEndTime: null,
|
|
|
|
|
@ -399,6 +376,11 @@ export default {
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
// 将选择的原因名称写回描述,便于后台使用
|
|
|
|
|
if (this.form.shutReasonId && !this.form.shutReason) {
|
|
|
|
|
const found = this.shutReasonList.find(r => r.shutReasonId === this.form.shutReasonId);
|
|
|
|
|
this.form.shutReason = found ? found.shutReasonName : this.form.shutReason;
|
|
|
|
|
}
|
|
|
|
|
if (this.form.recordShutDownId != null) {
|
|
|
|
|
updateShutDown(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
|