301 lines
6.2 KiB
Vue
301 lines
6.2 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2021-11-18 14:16:25
|
|
* @LastEditors: DY
|
|
* @LastEditTime: 2024-02-26 08:40:22
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-drawer
|
|
:visible.sync="visible"
|
|
:show-close="false"
|
|
:wrapper-closable="true"
|
|
class="drawer"
|
|
size="50%">
|
|
<small-title slot="title" :no-padding="true">
|
|
<!-- {{ isdetail ? '详情' : '添加巡检' }} -->
|
|
{{ '添加内容' }}
|
|
</small-title>
|
|
<div class="content">
|
|
<div class="visual-part">
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<div class="blodTip">巡检单名称</div>
|
|
<div class="lightTip">{{ dataForm.name }}</div>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="blodTip">部门</div>
|
|
<div class="lightTip">{{ dataForm.department }}</div>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="blodTip">巡检时间</div>
|
|
<div class="lightTip">{{ parseTime(dataForm.planCheckTime) }}</div>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
|
|
<el-divider />
|
|
|
|
<div class="attr-list">
|
|
<small-title
|
|
style="margin: 16px 0; padding-left: 8px"
|
|
:no-padding="true">
|
|
巡检内容
|
|
</small-title>
|
|
|
|
<div v-if="!isdetail" class="action_btn">
|
|
<template>
|
|
<span style="display: inline-block;">
|
|
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button>
|
|
</span>
|
|
</template>
|
|
</div>
|
|
<base-table
|
|
:table-props="tableProps"
|
|
:page="listQuery.pageNo"
|
|
:limit="listQuery.pageSize"
|
|
:table-data="checkDetList">
|
|
<method-btn
|
|
v-if="!isdetail"
|
|
slot="handleBtn"
|
|
:width="120"
|
|
label="操作"
|
|
:method-list="tableBtn"
|
|
@clickBtn="handleClick" />
|
|
</base-table>
|
|
<pagination
|
|
v-show="listQuery.total > 0"
|
|
:total="listQuery.total"
|
|
:page.sync="listQuery.pageNo"
|
|
:limit.sync="listQuery.pageSize"
|
|
:page-sizes="[5, 10, 15]"
|
|
@pagination="getList" />
|
|
|
|
<!-- <div class="drawer-body__footer">
|
|
<el-button type="primary" @click="goback()">关闭</el-button>
|
|
</div> -->
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<attr-add
|
|
v-if="addOrUpdateVisible"
|
|
ref="addOrUpdate"
|
|
:order-id="dataForm.id"
|
|
@refreshDataList="getList" />
|
|
</el-drawer>
|
|
</template>
|
|
|
|
<script>
|
|
import { getCheckOrder } from "@/api/equipment/base/inspection/settings";
|
|
import { deleteCheckOrderDet, getCheckOrderDetPage } from '@/api/equipment/base/inspection/record';
|
|
import SmallTitle from './SmallTitle';
|
|
import attrAdd from './attr-add';
|
|
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
|
|
import { parseTime } from '../../../../core/mixins/code-filter';
|
|
|
|
const tableBtn = [
|
|
{
|
|
type: 'edit',
|
|
btnName: '编辑',
|
|
},
|
|
{
|
|
type: 'delete',
|
|
btnName: '删除',
|
|
},
|
|
];
|
|
const tableProps = [
|
|
{
|
|
prop: 'equipmentName',
|
|
label: '设备名称',
|
|
},
|
|
{
|
|
prop: 'program',
|
|
label: '检查项目',
|
|
}
|
|
];
|
|
|
|
export default {
|
|
components: { SmallTitle, attrAdd },
|
|
data() {
|
|
return {
|
|
tableBtn,
|
|
tableProps,
|
|
addOrUpdateVisible: false,
|
|
urlOptions: {
|
|
infoURL: getCheckOrder,
|
|
},
|
|
listQuery: {
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
total: 0,
|
|
},
|
|
dataForm: {
|
|
id: undefined,
|
|
name: undefined,
|
|
department: undefined,
|
|
planCheckTime: undefined
|
|
},
|
|
checkDetList: [],
|
|
visible: false,
|
|
isdetail: false
|
|
};
|
|
},
|
|
mounted() {},
|
|
methods: {
|
|
initData() {
|
|
this.checkDetList.splice(0);
|
|
this.listQuery.total = 0;
|
|
},
|
|
handleClick(raw) {
|
|
if (raw.type === 'delete') {
|
|
this.$confirm(
|
|
`是否确认删除巡检项目名称为"${raw.data.program}"的数据项?`,
|
|
'提示',
|
|
{
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
}
|
|
)
|
|
.then(() => {
|
|
deleteCheckOrderDet(raw.data.id).then(({ data }) => {
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.getList();
|
|
},
|
|
});
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
} else {
|
|
this.addNew(raw.data.id);
|
|
}
|
|
},
|
|
getList() {
|
|
// 获取巡检项目分页
|
|
getCheckOrderDetPage({
|
|
...this.listQuery,
|
|
orderId: this.dataForm.id,
|
|
}).then((response) => {
|
|
this.checkDetList = response.data.list;
|
|
this.listQuery.total = response.data.total;
|
|
});
|
|
},
|
|
init(id, isdetail) {
|
|
this.initData();
|
|
this.isdetail = isdetail || false;
|
|
this.dataForm.id = id || undefined;
|
|
this.visible = true;
|
|
|
|
this.$nextTick(() => {
|
|
// this.$refs['dataForm'].resetFields();
|
|
|
|
if (this.dataForm.id) {
|
|
// 获取设备巡检详情
|
|
this.urlOptions.infoURL(id).then(response => {
|
|
this.dataForm = response.data
|
|
});
|
|
// 获取设备项目列表
|
|
this.getList();
|
|
} else {
|
|
if (this.urlOptions.isGetCode) {
|
|
this.getCode()
|
|
}
|
|
}
|
|
});
|
|
},
|
|
goback() {
|
|
this.$emit('refreshDataList');
|
|
this.visible = false;
|
|
// this.initData();
|
|
},
|
|
goEdit() {
|
|
this.isdetail = false;
|
|
},
|
|
// 新增 / 修改
|
|
addNew(id) {
|
|
this.addOrUpdateVisible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.addOrUpdate.init(id);
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.drawer >>> .el-drawer {
|
|
border-radius: 8px 0 0 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.drawer >>> .el-form-item__label {
|
|
padding: 0;
|
|
}
|
|
|
|
.drawer >>> .el-drawer__header {
|
|
margin: 0;
|
|
padding: 32px 32px 24px;
|
|
border-bottom: 1px solid #dcdfe6;
|
|
}
|
|
.drawer >>> .el-drawer__body {
|
|
flex: 1;
|
|
height: 1px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.drawer >>> .content {
|
|
padding: 30px 24px;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
/* height: 100%; */
|
|
}
|
|
|
|
.drawer >>> .visual-part {
|
|
flex: 1 auto;
|
|
max-height: 10vh;
|
|
overflow: hidden;
|
|
overflow-y: scroll;
|
|
padding-right: 10px; /* 调整滚动条样式 */
|
|
}
|
|
|
|
.drawer >>> .el-form,
|
|
.drawer >>> .attr-list {
|
|
padding: 0 16px;
|
|
}
|
|
|
|
.drawer-body__footer {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
padding: 18px;
|
|
}
|
|
.action_btn {
|
|
float: right;
|
|
margin: -40px 15px;
|
|
font-size: 14px;
|
|
}
|
|
.add {
|
|
color: #0b58ff;
|
|
}
|
|
.blodTip {
|
|
height: 16px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: rgba(0,0,0,0.85);
|
|
margin-bottom: 8px;
|
|
}
|
|
.lightTip {
|
|
/* height: 16px; */
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: rgba(102,102,102,0.75);
|
|
margin-bottom: 12px;
|
|
}
|
|
</style>
|