Compare commits

..

5 Commits

Author SHA1 Message Date
lb
aaa131cb1f update 巡检记录 2023-12-18 17:00:47 +08:00
lb
f6af441030 update 巡检配置 2023-12-18 16:32:16 +08:00
lb
cb9132abc1 update 2023-12-18 15:48:18 +08:00
lb
5886875770 update 维修 2023-12-18 15:39:18 +08:00
lb
fd4b0088dc update 特殊设备保养 2023-12-18 14:25:08 +08:00
15 changed files with 3981 additions and 140 deletions

View File

@ -6,19 +6,427 @@
-->
<template>
<div class="SpecialEquipmentCheckConfig"></div>
<div class="app-container SpecialEquipmentCheckConfig">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="180"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="handleConfirm">
<add ref="add" @refreshDataList="successSubmit" />
</base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
</div>
</template>
<script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue';
import add from './add.vue';
export default {
name: 'SpecialEquipmentCheckConfig',
components: {},
props: {},
components: { addOrUpdata, add },
mixins: [basicPageMixin],
data() {
return {};
return {
addOrUpdateVisible: false,
addOrEditTitle: '',
searchBarKeys: ['equipmentId', 'name', 'specialType'],
tableBtn: [
this.$auth.hasPermi('equipment:check-setting:addInsp')
? {
type: 'add',
btnName: '添加',
showTip: '添加巡检',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'name',
label: '配置名',
width: 110,
showOverflowtooltip: true,
},
{ prop: 'lineName', label: '产线', showOverflowtooltip: true },
{
prop: 'equipmentCategory',
label: '设备大类',
filter: (val) =>
val != null ? ['-', '安全', '消防', '特种'][val] : '-',
},
{ prop: 'equipmentName', label: '设备', showOverflowtooltip: true },
{
prop: 'equipmentCode',
label: '设备编码',
minWidth: 150,
showOverflowtooltip: true,
},
{ prop: 'responsible', label: '负责人' },
{ prop: 'remark', label: '描述' },
{ prop: 'checkNumber', label: '巡检条数' }, // TODO:
],
searchBarFormConfig: [
{
type: 'input',
label: '配置名称',
placeholder: '请输入配置名称',
param: 'name',
},
{
type: 'select',
label: '设备大类',
placeholder: '请选择设备大类',
param: 'specialType',
onchange: true,
selectOptions: [
{ id: 1, name: '安全设备' },
{ id: 2, name: '消防设备' },
{ id: 3, name: '特种设备' },
],
filterable: true,
},
{
type: 'select',
label: '设备名称',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:check-setting:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('equipment:check-setting:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '配置名称',
prop: 'name',
rules: [
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '配置编码',
prop: 'code',
url: '/base/equipment-check-config/getCode',
rules: [
{ required: true, message: '配置编码不能为空', trigger: 'blur' },
],
},
],
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
},
rules: [
{
required: true,
message: '设备名称不能为空',
trigger: 'change',
},
],
},
{
input: true,
label: '设备编码', // TODO:
prop: 'equipmentCode',
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
equipmentId: null,
name: null,
special: true,
specialType: null,
},
//
form: {},
basePath: '/base/equipment-check-config',
mode: null,
allSpecialEquipments: [],
};
},
created() {
this.initSearchBar();
this.getList();
},
methods: {
handleConfirm() {
this.$refs.add.dataFormSubmit();
},
successSubmit() {
this.cancel();
this.getList();
},
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = data.filter((item) => item.special);
this.setSearchBarEquipmentList(data.filter((item) => item.special));
});
},
//
handleSearchBarChange({ param, value }) {
if ('specialType' === param) {
if (!value) {
this.setSearchBarEquipmentList(this.allSpecialEquipments);
return;
}
this.setSearchBarEquipmentList(
this.allSpecialEquipments.filter((item) => item.specialType == value)
);
}
},
setSearchBarEquipmentList(eqList) {
this.$set(
this.searchBarFormConfig[2],
'selectOptions',
eqList.map((item) => ({
name: item.name,
id: item.id,
}))
);
},
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.$refs.add.formClear();
this.open = false;
this.title = '';
// this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
name: null,
content: null,
program: null,
remark: null,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
this.open = true;
this.title = '添加巡检设置';
this.$nextTick(() => {
this.$refs.add.init();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
// const id = row.id;
// this.info({ id }).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = '';
// });
this.open = true;
this.title = '修改巡检设置';
this.$nextTick(() => {
this.$refs.add.init(row.id);
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
.then(() => {
return this.del({ id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
//
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
case 'detail':
this.handleDetail(data);
break;
case 'add':
this.handleAddDetail(data);
break;
}
},
handleDetail({ id }) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
});
},
handleAddDetail({ id }) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加巡检';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检设置?')
.then(() => {
this.exportLoading = true;
return exportEquipmentTypeExcel(params);
})
.then((response) => {
this.$download.excel(response, '巡检设置.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
computed: {},
methods: {},
};
</script>

View File

@ -6,19 +6,325 @@
-->
<template>
<div class="SpecialEquipmentCheckContent"></div>
<div class="app-container SpecialEquipmentCheckContent">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'"
:has-files="false"
:rows="rows" />
</base-dialog>
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteCheck } from '@/api/equipment/base/inspection/settings';
export default {
name: 'SpecialEquipmentCheckContent',
components: {},
props: {},
mixins: [basicPageMixin],
data() {
return {};
return {
searchBarKeys: ['content'],
tableBtn: [
// this.$auth.hasPermi('equipment:check:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'program', label: '巡检项目', showOverflowtooltip: true },
{
prop: 'content',
label: '巡检内容',
minWidth: 150,
showOverflowtooltip: true,
},
{ prop: 'code', label: '巡检内容编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注', showOverflowtooltip: true },
],
searchBarFormConfig: [
{
type: 'input',
label: '巡检内容',
placeholder: '请输入巡检内容',
param: 'content',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:check:create') ? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('equipment:check:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '巡检内容编号',
prop: 'code',
url: '/base/equipment-check/getCode',
rules: [
{
required: true,
message: '巡检内容编号不能为空',
trigger: 'blur',
},
],
},
{
input: true,
label: '巡检项目',
prop: 'program',
rules: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '巡检内容',
prop: 'content',
rules: [
{ required: true, message: '巡检内容不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '备注',
prop: 'remark',
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
content: null,
},
//
form: {
code: '',
program: '',
id: undefined,
content: '',
},
basePath: '/base/equipment-check',
mode: null,
};
},
created() {
// this.initSearchBar();
this.getList();
},
methods: {
// initSearchBar() {
// this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
// this.$set(
// this.searchBarFormConfig[0],
// 'selectOptions',
// data.map((item) => ({
// name: item.name,
// id: item.id,
// }))
// );
// });
// },
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
name: null,
content: null,
program: null,
remark: null,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
this.open = true;
this.title = '添加巡检内容';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
this.info({ id }).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改巡检内容';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除该巡检项目?')
.then(function () {
// return this.del({ id });
return deleteCheck(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
handleDetail({ id }) {
this.reset();
this.mode = 'detail';
this.info({ id }).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改巡检内容';
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检内容?')
.then(() => {
this.exportLoading = true;
return exportEquipmentTypeExcel(params);
})
.then((response) => {
this.$download.excel(response, '巡检内容.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
computed: {},
methods: {},
};
</script>

View File

@ -0,0 +1,491 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-10-31 15:55:13
description:
-->
<template>
<el-drawer
ref="drawer"
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="55%"
@closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '查看详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<el-form
ref="dataForm"
style="margin: 0 16px; padding: 0 16px"
:model="dataForm"
:rules="dataRule"
label-width="100px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item
label="设备大类"
prop="equipmentCategory"
:rules="[
{ required: true, message: '请选择设备大类', trigger: 'blur' },
]">
<el-select
v-model="dataForm.equipmentCategory"
:disabled="isdetail"
:placeholder="`请选择设备大类`"
filterable
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择设备名称"
@change="setConfig">
<el-option
v-for="dict in equipmentOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<!-- <el-form-item label="物料名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入物料名称" />
</el-form-item> -->
<el-form-item label="巡检配置名称" prop="configId">
<el-select
v-model="dataForm.configId"
filterable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择巡检配置"
@change="setInspectionContet">
<el-option
v-for="dict in configList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="dataForm.equipmentCode"
disabled
clearable
placeholder="请输入设备编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="巡检人" prop="responsible">
<el-input
v-model="dataForm.responsible"
:disabled="isdetail"
clearable
placeholder="请输入巡检人" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="巡检时间" prop="actualTime">
<el-date-picker
v-model="dataForm.actualTime"
type="datetime"
:disabled="isdetail"
format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
placeholder="选择巡检时间" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数据来源" prop="origin">
<el-select
v-model="dataForm.origin"
filterable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择数据来源">
<el-option key="1" label="手动" :value="1" />
<el-option key="2" label="PDA" :value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="巡检内容">
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="list" />
</el-form-item>
<el-form-item label="巡检详情" prop="description">
<editor
v-if="!isdetail"
v-model="dataForm.description"
:min-height="150" />
<div
v-else
v-html="dataForm.description"
style="padding: 5px; margin-left: 5px; border: 1px solid #dfdfdf" />
</el-form-item>
<el-form-item label="附件">
<FileUpload
v-model="file"
:limit="1"
:f-name="fileName"
:disabled="isdetail"
@name="setFileName" />
</el-form-item>
</el-form>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</el-drawer>
</template>
<script>
import SmallTitle from './SmallTitle.vue';
import {
createCheckLog,
updateCheckLog,
getcheckConfigByEqList,
getEqCheckLog,
} from '@/api/equipment/base/inspection/record';
import { getEquipmentAll } from '@/api/base/equipment';
import Editor from '@/components/Editor';
import { getCheckDetPage } from '@/api/equipment/base/inspection/settings';
// import FileUpload from "@/components/FileUpload";
// import { parseTime } from '../../../../core/mixins/code-filter';
// import attrAdd from './attr-add';
import FileUpload from '@/components/FileUpload';
const tableBtn = [
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'content',
label: '巡检内容',
},
];
export default {
name: 'AddRecord',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: { SmallTitle, Editor, FileUpload },
props: {
// dataForm: {
// type: Object,
// default: () => ({}),
// },
// disabled: {
// type: Boolean,
// default: false
// },
},
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
formLoading: true,
visible: false,
isdetail: false,
dataForm: {
id: undefined,
configId: undefined,
equipmentId: undefined,
actualTime: undefined,
responsible: undefined,
description: undefined,
equipmentCode: undefined,
equipmentCategory: undefined,
origin: 1,
files: [],
},
equipmentTypeOptions: [
{ label: '安全设备', value: 1 },
{ label: '消防设备', value: 2 },
{ label: '特种设备', value: 3 },
],
list: [],
eqList: [],
configList: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
file: '',
fileName: '',
dataRule: {
responsible: [
{ required: true, message: '巡检人不能为空', trigger: 'blur' },
],
actualTime: [
{ required: true, message: '巡检时间不能为空', trigger: 'blur' },
],
},
};
},
mounted() {
this.getDict();
},
methods: {
setFileName(val) {
this.fileName = val;
},
async getDict() {
const res = await getEquipmentAll();
this.eqList = res.data;
this.handleEqTypeChange();
const configres = await getcheckConfigByEqList();
this.configList = configres.data;
},
async setConfig() {
const configres = await getcheckConfigByEqList({
equipmentId: this.dataForm.equipmentId,
});
this.configList = configres.data;
this.dataForm.configId =
this.configList.filter((it) => {
return it.id === this.dataForm.configId;
})[0]?.id ?? undefined;
this.dataForm.equipmentCode =
this.eqList.filter((item) => {
return item.id === this.dataForm.equipmentId;
})[0]?.code ?? undefined;
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
},
goEdit() {
this.isdetail = false;
},
/** 模拟透传 ref */
validate(cb) {
return this.$refs.dataForm.validate(cb);
},
resetFields(args) {
return this.$refs.dataForm.resetFields(args);
},
initData() {
this.list = [];
this.file = '';
this.fileName = '';
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
// const scrollContainer = this.$refs.dataForm;
// const scrollPosition = scrollContainer.scrollTop;
// console.log('12', scrollPosition);
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
getEqCheckLog(this.dataForm.id).then((response) => {
this.formLoading = false;
this.dataForm = response.data;
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl;
this.fileName = this.dataForm.files[0].fileName;
}
this.dataForm.description = this.dataForm.description || '无';
this.setConfig();
this.setInspectionContet();
});
} else {
// if (this.urlOptions.isGetCode) {
// this.getCode()
// }
}
});
this.formLoading = false;
},
setInspectionContet() {
//
getCheckDetPage({
pageNo: 1,
pageSize: 99,
configId: this.dataForm.configId,
}).then((response) => {
this.list = response.data.list;
this.listQuery.total = response.data.total;
});
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
handleEqTypeChange(type) {
this.dataForm.equipmentId = null;
this.dataForm.equipmentCode = null;
if (type) {
this.equipmentOptions = this.eqList
.filter((item) => item.special)
.filter((item) => item.specialType === type)
.map((item) => ({ label: item.name, value: item.id }));
} else
this.equipmentOptions = this.eqList
// .filter((item) => item.special)
.map((item) => ({
label: item.name,
value: item.id,
}));
// this.$emit('update', this.form)
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
if (this.file) {
const temp = this.file.split(','); //
let arry = [];
temp.forEach((item, index) => {
arry.push({
fileName: this.fileName,
fileType: 2,
fileUrl: item,
});
});
this.dataForm.files = arry;
} else {
this.dataForm.files = [];
}
//
if (this.dataForm.id) {
updateCheckLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createCheckLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>
<style scoped>
.el-date-editor,
.el-select {
width: 100%;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: 5px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
.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;
margin: 10px 0;
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: 76vh;
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;
}
</style>

View File

@ -6,19 +6,440 @@
-->
<template>
<div class="SpecialEquipmentCheckRecord"></div>
<div class="app-container SpecialEquipmentCheckRecord">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'"
:has-files="true"
:rows="rows" />
</base-dialog>
<addRecord
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addRecord from './Record-add.vue';
import {
exportCheckLogExcel,
deleteEqCheckLog,
} from '@/api/equipment/base/inspection/record';
import { parseTime } from '../../core/mixins/code-filter';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default {
name: 'SpecialEquipmentCheckRecord',
components: {},
props: {},
components: { addRecord },
mixins: [basicPageMixin],
data() {
return {};
return {
addOrUpdateVisible: false,
searchBarKeys: ['equipmentId', 'actualTime', 'specialType'],
tableBtn: [
this.$auth.hasPermi('equipment:check-record:detail')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'configName', label: '配置名称' },
{ prop: 'equipmentName', label: '设备名称' },
{
prop: 'origin',
label: '数据来源',
filter: (val) => ['', '手动', 'PDA'][val],
},
// { prop: 'sectionName', label: '' },
{ prop: 'actualTime', label: '实际巡检时间', filter: parseTime },
// { prop: 'maintenanceDetail', label: '' },
{ prop: 'responsible', label: '巡检人' },
],
searchBarFormConfig: [
{
type: 'select',
label: '设备大类',
placeholder: '请选择设备大类',
param: 'specialType',
onchange: true,
selectOptions: [
{ id: 1, name: '安全设备' },
{ id: 2, name: '消防设备' },
{ id: 3, name: '特种设备' },
],
filterable: true,
},
{
type: 'select',
label: '设备',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
//
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'actualTime',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:check-record:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
plain: true,
color: 'primary',
},
{
type: this.$auth.hasPermi('equipment:check-record:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
},
],
rows: [
[
{
input: true,
label: '维修单号',
prop: 'repairOrderNumber',
},
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
},
rules: [
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
],
},
],
[
{
// TODO:
select: true,
label: '维修工',
prop: 'repairman',
// url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
multiple: true,
},
rules: [
{ required: true, message: '维修工不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '联系方式',
prop: 'repairmanPhone',
},
],
[
{
datetime: true,
label: '故障发生时间',
prop: 'faultTime',
rules: [
{
required: true,
message: '故障发生时间不能为空',
trigger: 'blur',
},
],
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
{
select: true,
label: '故障级别',
prop: 'faultLevel', //
options: this.getDictDatas(this.DICT_TYPE.FAULT_LEVEL),
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintenanceStatus: null,
createTime: null,
equipmentId: null,
special: true,
specialType: null,
},
//
form: {},
basePath: '/base/equipment-check-log',
mode: null,
allSpecialEquipments: [],
};
},
created() {
this.initSearchBar();
this.getList();
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = data.filter((item) => item.special);
this.setSearchBarEquipmentList(data.filter((item) => item.special));
});
},
//
handleSearchBarChange({ param, value }) {
if ('specialType' === param) {
if (!value) {
this.setSearchBarEquipmentList(this.allSpecialEquipments);
return;
}
this.setSearchBarEquipmentList(
this.allSpecialEquipments.filter((item) => item.specialType == value)
);
}
},
setSearchBarEquipmentList(eqList) {
this.$set(
this.searchBarFormConfig[1],
'selectOptions',
eqList.map((item) => ({
name: item.name,
id: item.id,
}))
);
},
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
repairOrderNumber: null,
equipmentId: null,
repairman: null,
repairmanPhone: null,
faultTime: null,
faultLevel: null,
maintenanceStartTime: null,
maintenanceFinishTime: null,
faultType: null,
repairMode: null,
maintenanceStatus: null,
faultDetail: null,
maintenanceDetail: null,
remark: null,
files: [
// {
// fileName: '',
// fileType: '',
// fileUrl: '',
// },
],
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
// this.open = true;
// this.title = '';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
// const id = row.id;
// this.info({ id }).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = '';
// });
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row.id);
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm(
'是否删除设备巡检记录配置名称为"' + row.configName + '"的数据项?'
)
.then(function () {
return deleteEqCheckLog(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
handleDetail({ id }) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有设备巡检记录?')
.then(() => {
this.exportLoading = true;
return exportCheckLogExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备巡检记录.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
computed: {},
methods: {},
};
</script>

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,341 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-12-01 11:02:43
* @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-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="设备大类" prop="equipmentCategory">
<span>
{{
['-', '安全设备', '消防设备', '特种设备'][
dataForm.equipmentCategory || 0
]
}}
</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName">
{{ dataForm.equipmentName }}
<!-- <el-input v-model="dataForm.equipmentName" disabled clearable placeholder="请输入设备名称" /> -->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备编码" prop="equipmentCode">
{{ dataForm.equipmentCode }}
<!-- <el-input
v-model="dataForm.equipmentCode"
clearable
disabled
placeholder="请输入设备编码" /> -->
</el-form-item>
</el-col>
</el-row>
</el-form>
</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"
:config-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import {
getEqCheck,
getCheckDetPage,
deleteCheckDet,
} from '@/api/equipment/base/inspection/settings';
import SmallTitle from './SmallTitle';
import attrAdd from './attr-add';
import { DICT_TYPE, getDictDatas } from '@/utils/dict';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'content',
label: '巡检内容',
},
{
prop: 'code',
label: '巡检内容编码',
},
{
prop: 'description',
label: '备注',
},
];
export default {
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: {
infoURL: getEqCheck,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
name: '',
materialType: undefined,
productType: undefined,
area: undefined,
specifications: undefined,
processTime: 0,
remark: undefined,
unit: undefined,
},
checkDetList: [],
visible: false,
isdetail: false,
dataRule: {
code: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '物料名称不能为空', trigger: 'blur' },
],
materialType: [
{ required: true, message: '物料类型不能为空', trigger: 'change' },
],
productType: [
{ required: true, message: '产品类型不能为空', trigger: 'change' },
],
processTime: [
{
required: true,
message: '产线生产单位用时不能为空',
trigger: 'blur',
},
],
},
};
},
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(() => {
deleteCheckDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getCheckDetPage({
...this.listQuery,
configId: 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; */
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form {
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;
}
</style>

View File

@ -0,0 +1,167 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-25 16:23:13
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="配置名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入配置名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配置编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入配置编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="设备大类"
prop="equipmentCategory"
:rules="[
{ required: true, message: '请选择设备大类', trigger: 'blur' },
]">
<el-select
v-model="dataForm.equipmentCategory"
:placeholder="`请选择设备大类`"
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
style="width: 100%"
placeholder="请选择设备名称"
@change="setCode">
<el-option
v-for="d in equipmentOptions"
:key="d.value"
:label="d.label"
:value="d.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="dataForm.equipmentCode"
disabled
placeholder="请输入设备编码" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import {
getEqCheck,
getCode,
createCheckConfig,
updateCheckConfig,
} from '@/api/equipment/base/inspection/settings';
import { getEquipmentAll } from '@/api/base/equipment';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createCheckConfig,
updateURL: updateCheckConfig,
infoURL: getEqCheck,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
equipmentId: undefined,
equipmentCode: undefined,
equipmentCategory: undefined,
},
eqList: [],
dataRule: {
equipmentId: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
code: [
{ required: true, message: '配置编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
},
equipmentOptions: [],
equipmentTypeOptions: [
{ label: '安全设备', value: 1 },
{ label: '消防设备', value: 2 },
{ label: '特种设备', value: 3 },
],
};
},
mounted() {
this.getDict();
},
methods: {
async getDict() {
//
const res = await getEquipmentAll();
this.eqList = res.data;
this.$nextTick(() => {
this.handleEqTypeChange();
});
},
setCode() {
const chooseM = this.eqList.filter((item) => {
return item.id === this.dataForm.equipmentId;
});
this.dataForm.equipmentCode = chooseM[0].code;
},
// handlers
handleEqTypeChange(type) {
this.dataForm.equipmentId = null;
this.dataForm.equipmentCode = null;
if (type) {
this.equipmentOptions = this.eqList
.filter((item) => item.special)
.filter((item) => item.specialType === type)
.map((item) => ({ label: item.name, value: item.id }));
} else
this.equipmentOptions = this.eqList
.filter((item) => item.special)
.map((item) => ({
label: item.name,
value: item.id,
}));
// this.$emit('update', this.form)
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -0,0 +1,145 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="60px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="巡检" prop="checkId">
<el-select v-model="dataForm.checkId" filterable placeholder="请选择巡检" style="width: 100%">
<el-option v-for="dict in checkList" :key="dict.id" :label="dict.content"
:value="dict.id" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="description">
<el-input
v-model="dataForm.description"
placeholder="请输入备注"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getCheckDet, createCheckDet, updateCheckDet, getcheckList } from "@/api/equipment/base/inspection/settings";
export default {
props: {
configId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: undefined,
checkId: undefined,
configId: undefined,
description: ''
},
checkList: [],
dataRule: {
checkId: [{ required: true, message: '巡检不能为空', trigger: 'blur' }],
},
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
const res = await getcheckList()
this.checkList = res.data
},
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getCheckDet(this.dataForm.id).then((res) => {
// const { name, value } = res.data;
// this.dataForm.name = name;
// this.dataForm.value = value;
this.dataForm = res.data
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateCheckDet({
...this.dataForm,
configId: this.configId
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createCheckDet({
...this.dataForm,
configId: this.configId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -0,0 +1,399 @@
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="disabled"
class="drawer"
custom-class="mes-drawer"
size="65%"
@closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{
disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成'
}}
</small-title>
<div class="drawer-body flex">
<div class="drawer-body__content">
<el-form
ref="form"
:model="dataForm"
label-width="100px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="维修单号" prop="repairOrderNumber">
<span>{{ dataForm.repairOrderNumber }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备大类" prop="equipmentCategory">
<span>
{{
['-', '安全设备', '消防设备', '特种设备'][
dataForm.equipmentCategory || 0
]
}}
</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName">
<span>{{ dataForm.equipmentName }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="维修工" prop="repairman">
<span>{{ dataForm.repairman }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="故障发生时间" prop="faultTime">
<span>{{ parseTime(dataForm.faultTime) }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="故障级别" prop="faultLevel">
<span>
{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}
</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="联系方式" prop="repairmanPhone">
<span>{{ dataForm.repairmanPhone }}</span>
</el-form-item>
</el-col>
</el-row>
<el-divider />
<div
v-if="
disabled && dataForm.maintenanceStatus === 1
? true
: !disabled
? true
: false
">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
{{ '设备维修信息' }}
</small-title>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item
label="维修开始时间"
prop="maintenanceStartTime"
:rules="[
{
required: true,
message: '维修开始时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="dataForm.maintenanceStartTime"
type="datetime"
:disabled="disabled"
placeholder="请选择维修开始时间"
value-format="timestamp" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="维修结束时间"
prop="maintenanceFinishTime"
:rules="[
{
required: true,
message: '维修结束时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="dataForm.maintenanceFinishTime"
type="datetime"
:disabled="disabled"
placeholder="请选择维修开始时间"
value-format="timestamp" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="维修方式"
prop="repairMode"
:rules="[
{
required: true,
message: '维修方式不能为空',
trigger: 'blur',
},
]">
<el-select
:disabled="disabled"
v-model="dataForm.repairMode"
placeholder="请选择维修方式">
<el-option
v-for="opt in getDictDatas('repair-mode')"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="故障类型" prop="faultType">
<el-select
:disabled="disabled"
v-model="dataForm.faultType"
placeholder="请选择故障类型">
<el-option
v-for="opt in getDictDatas('fault-type')"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item
label="故障明细"
prop="faultDetail"
:rules="[
{
required: true,
message: '故障明细不能为空',
trigger: 'blur',
},
]">
<!-- // -->
<editor
v-model="dataForm.faultDetail"
:read-only="disabled"
:min-height="150" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="维修记录" prop="maintenanceDetail">
<!-- // -->
<editor
v-model="dataForm.maintenanceDetail"
:read-only="disabled"
:min-height="150" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="维修附件" prop="file">
<FileUpload
v-model="file"
:limit="1"
:f-name="fileName"
:disabled="disabled"
@name="setFileName" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
:placeholder="`请输入备注`"
:disabled="disabled" />
</el-form-item>
</el-col>
</el-row>
</div>
</el-form>
<div v-if="!disabled" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
</div>
</el-drawer>
</template>
<script>
import SmallTitle from './SmallTitle.vue';
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair';
import Editor from '@/components/Editor';
import FileUpload from '@/components/FileUpload';
import { getDictDatas } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
import { getDictDataLabel } from '@/utils/dict';
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: { SmallTitle, Editor, FileUpload },
props: {
// dataForm: {
// type: Object,
// default: () => ({}),
// },
// disabled: {
// type: Boolean,
// default: false
// },
},
data() {
return {
formLoading: true,
visible: false,
disabled: false,
dataForm: {},
file: '',
fileName: '',
};
},
mounted() {},
methods: {
setFileName(val) {
this.fileName = val;
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
},
goEdit() {
this.disabled = false;
},
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
initData() {
this.file = '';
this.fileName = '';
},
init(row, isdetail) {
this.initData();
this.disabled = isdetail || false;
this.dataForm.id = row.id || undefined;
this.visible = true;
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.dataForm.id) {
//
getEqRepair(this.dataForm.id).then((response) => {
this.formLoading = false;
this.dataForm = response.data;
debugger;
this.dataForm.maintenanceStatus =
this.dataForm.maintenanceStatus || 0;
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl;
this.fileName = this.dataForm.files[0].fileName;
}
});
} else {
// if (this.urlOptions.isGetCode) {
// this.getCode()
// }
}
});
},
//
dataFormSubmit() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.file) {
const temp = this.file.split(','); //
let arry = [];
temp.forEach((item) => {
arry.push({
fileName: this.fileName,
fileType: 2,
fileUrl: item,
});
});
this.dataForm.files = arry;
}
if (this.dataForm.id) {
updateEqRepair(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
// this.urlOptions.createURL(this.dataForm).then(response => {
// this.$modal.msgSuccess("");
// this.visible = false;
// this.$emit("refreshDataList");
// });
});
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -9,12 +9,59 @@
<el-form
ref="form"
:model="form"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20">
<!-- 设备大类 -->
<!-- 是否计划保养 -->
<el-col :span="8">
<el-form-item
label="是否计划保养"
prop="relatePlan"
:rules="[
{
required: true,
message: '是否计划保养不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.relatePlan"
:placeholder="`是否计划保养`"
:disabled="disabled"
@change="handlePlanChange">
<el-option
v-for="opt in [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 所属计划 -->
<el-col :span="8" v-if="form.relatePlan == 1">
<el-form-item label="所属计划" prop="maintainPlanId">
<el-select
v-model="form.maintainPlanId"
:placeholder="`请选择所属计划`"
:disabled="disabled"
filterable
clearable
@change="$emit('update', form)">
<el-option
v-for="opt in planOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 设备大类 -->
<el-col :span="8" v-if="form.relatePlan == 1">
<el-form-item
label="设备大类"
prop="equipmentCategory"
@ -25,6 +72,8 @@
v-model="form.equipmentCategory"
:placeholder="`请选择设备大类`"
:disabled="disabled"
clearable
filterable
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
@ -47,6 +96,8 @@
v-model="form.equipmentId"
:placeholder="`请选择设备`"
:disabled="disabled"
filterable
clearable
@change="handleEqChange">
<el-option
v-for="opt in equipmentOptions"
@ -57,96 +108,6 @@
</el-form-item>
</el-col>
<!-- 保养单号 -->
<el-col :span="8">
<el-form-item label="保养单号" prop="maintainOrderNumber">
<el-input
v-model="form.name"
@change="$emit('update', form)"
:placeholder="`请输入保养单号`"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 保养人员 -->
<el-col :span="8">
<el-form-item
label="保养人员"
prop="maintainWorker"
:rules="[
{ required: true, message: '保养人员不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择保养人员`"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in workerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 是否计划保养 -->
<el-col :span="8">
<el-form-item
label="是否计划保养"
prop="relatePlan"
:rules="[
{
required: true,
message: '是否计划保养不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.relatePlan"
:placeholder="`是否计划保养`"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 所属计划 -->
<el-col :span="8">
<el-form-item label="所属计划" prop="maintainPlanId">
<el-select
v-model="form.maintainPlanId"
:placeholder="`请选择所属计划`"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in planOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 保养用时 -->
<el-col :span="8">
<el-form-item label="保养用时(h)" prop="timeUsed">
<el-input
v-model="form.timeUsed"
@change="$emit('update', form)"
:placeholder="`请输入保养用时(h)`"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 开始时间 -->
<el-col :span="8">
<el-form-item
@ -187,6 +148,53 @@
</el-form-item>
</el-col>
<!-- 保养人员 -->
<el-col :span="8">
<el-form-item
label="保养人员"
prop="maintainWorker"
:rules="[
{ required: true, message: '保养人员不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择保养人员`"
:disabled="disabled"
filterable
clearable
multiple
@change="$emit('update', form)">
<el-option
v-for="opt in workerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 保养单号 -->
<el-col :span="8">
<el-form-item label="保养单号" prop="maintainOrderNumber">
<el-input
v-model="form.maintainOrderNumber"
@change="$emit('update', form)"
:placeholder="`请输入保养单号`"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 保养用时 -->
<el-col :span="8">
<el-form-item label="保养用时(h)" prop="timeUsed">
<el-input
v-model="form.timeUsed"
@change="$emit('update', form)"
:placeholder="`请输入保养用时(h)`"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 上传文件 -->
<el-col :span="24">
<el-form-item label="上传文件" prop="files">
@ -209,11 +217,7 @@
icon="el-icon-upload2"
:disabled="disabled"
:before-upload="beforeUpload"
:on-success="
(response, file, fileList) => {
handleUploadSuccess(response, file, col.prop);
}
">
:on-success="handleUploadSuccess">
<el-button size="mini" :disabled="disabled">
<svg-icon
icon-class="icon-upload"
@ -241,23 +245,25 @@
<el-form-item label="保养描述" prop="maintenanceDes">
<div style="position: relative">
<div
v-if="1"
v-if="disabled"
class="modal"
style="
position: absolute;
top: 0;
left: 0;
z-index: 1000;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(2px);
background: #ccc3;
user-select: none;
cursor: not-allowed;
"></div>
<Editor
style="margin-top: 40px"
v-model="form.maintenanceDes"
class="record-add__editor"
:value="form.maintenanceDes"
:min-height="192"
:disabled="disabled"
@change="$emit('update', form)" />
@input="handleEditorInput" />
</div>
</el-form-item>
</el-col>
@ -269,6 +275,68 @@
import { getAccessToken } from '@/utils/auth';
import Editor from '@/components/Editor';
import tupleImg from '@/assets/images/tuple.png';
const uploadedFile = {
name: 'UploadedFile',
props: ['file', 'disabled'],
data() {
return {};
},
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
async handleDownload() {
const data = await this.$axios({
url: this.file.fileUrl,
method: 'get',
responseType: 'blob',
});
await this.$message.success('开始下载');
// create download link
const url = window.URL.createObjectURL(data);
const link = document.createElement('a');
link.href = url;
link.download = this.file.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
mounted() {},
render: function (h) {
return (
<div
title={this.file.fileName}
onClick={this.handleDownload}
style={{
background: `url(${tupleImg}) no-repeat`,
backgroundSize: '14px',
backgroundPosition: '0 55%',
paddingLeft: '20px',
paddingRight: '24px',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
cursor: 'pointer',
display: 'inline-block',
}}>
{this.file.fileName}
{!this.disabled && (
<el-button
type="text"
icon="el-icon-close"
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
class="dialog__upload_component__close"
onClick={this.handleDelete}
/>
)}
</div>
);
},
};
export default {
name: 'DialogForm',
model: {
@ -276,7 +344,7 @@ export default {
event: 'update',
},
emits: ['update'],
components: { Editor },
components: { Editor, uploadedFile },
props: {
dataForm: {
type: Object,
@ -286,6 +354,10 @@ export default {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: 'top',
},
},
data() {
return {
@ -301,6 +373,8 @@ export default {
{ label: '消防设备', value: 2 },
{ label: '特种设备', value: 3 },
],
workerOptions: [],
planOptions: [],
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // headersurl
};
@ -335,7 +409,6 @@ export default {
},
mounted() {
this.initOptions();
this.getEquipmentList();
this.getCode('/base/equipment-maintain-plan/getCode');
},
methods: {
@ -361,12 +434,12 @@ export default {
this.initPlan();
},
async initEquipment() {
async initEquipment(type = 'special-equipment') {
this.formLoading = true;
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
const equipmentOptions = (response.data || [])
.filter((item) => item.special)
.filter((item) => (type == 'special-equipment' ? item.special : true))
.map((item) => ({
label: item.name,
value: item.id,
@ -376,9 +449,30 @@ export default {
this.formLoading = false;
},
async initWorker() {},
async initWorker() {
this.formLoading = true;
const response = await this.$axios({
url: '/base/core-worker/listAll',
});
this.workerOptions = (response.data || []).map((item) => ({
label: item.name,
value: item.id,
}));
this.formLoading = false;
},
async initPlan() {},
async initPlan() {
this.formLoading = true;
const response = await this.$axios({
url: '/base/equipment-maintain-plan/page',
params: { pageNo: 1, pageSize: 100, speical: true },
});
this.planOptions = (response.data?.list || []).map((item) => ({
label: item.name,
value: item.id,
}));
this.formLoading = false;
},
// handlers
handleEqTypeChange(type) {
@ -396,12 +490,40 @@ export default {
// this.$emit('update', this.form)
},
handleEqChange() {
this.$emit('update', this.form);
},
//
handlePlanChange(val) {
console.log('handlePlanChange', val);
this.form.equipmentCategory = null;
this.form.equipmentId = null;
this.$emit('update', { ...this.form, relatePlan: val });
this.initEquipment(val == 1 ? 'special-equipment' : null);
},
handleEditorInput(html) {
this.$emit('update', {
...this.form,
maintenanceDes: html,
});
},
// upload
handleFilesOpen() {},
beforeUpload() {},
handleUploadSuccess() {},
handleUploadSuccess(response, file) {
this.$modal.msgSuccess('上传成功');
console.log('file', file);
this.form.files.push({
fileName: file.name,
fileUrl: response.data,
});
this.$emit('update', this.form);
},
handleDeleteFile(file) {},
},
@ -424,7 +546,7 @@ export default {
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
margin-top: 40px;
// margin-top: 40px;
}
.upload-in-dialog {
@ -460,4 +582,10 @@ export default {
.height-48 {
height: 35px !important;
}
:deep(.record-add__editor) {
.ql-picker-label {
display: flex;
}
}
</style>

View File

@ -519,7 +519,7 @@ export default {
relatePlan: null,
maintainPlanId: null,
equipmentId: null,
maintainWorker: null,
maintainWorker: [],
maintainOrderNumber: null,
startTime: null,
endTime: null,
@ -582,10 +582,12 @@ export default {
if (!valid) {
return;
}
this.form.maintainWorker = this.form.maintainWorker.join(',');
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.put({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
@ -593,10 +595,27 @@ export default {
return;
}
//
this.post(this.form).then((response) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
//
const toSparePartsMaintain = () => {
this.open = false;
//
};
this.$confirm('是否有备品备件更换?', '提示', {
confirmButtonText: '有',
cancelButtonText: '没有',
})
.then(toSparePartsMaintain)
.catch(() => {
this.open = false;
this.getList();
});
});
});
},

View File

@ -0,0 +1,402 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20">
<!-- 维修单号 -->
<el-col :span="12">
<el-form-item
label="维修单号"
prop="repairOrderNumber"
:rules="[
{ required: true, message: '维修单号不能为空', trigger: 'blur' },
]">
<el-input
v-model="form.repairOrderNumber"
@change="$emit('update', form)"
placeholder="请输入维修单号"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 维修工 -->
<el-col :span="12">
<el-form-item
label="维修工"
prop="repairman"
:rules="[
{ required: true, message: '维修工不能为空', trigger: 'blur' },
]">
<el-input
v-model="form.repairman"
@change="$emit('update', form)"
placeholder="请输入维修工"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 设备大类 -->
<el-col :span="12">
<el-form-item
label="设备大类"
prop="equipmentCategory"
:rules="[
{ required: true, message: '设备大类不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.equipmentCategory"
:placeholder="`请选择设备大类`"
:disabled="disabled"
clearable
filterable
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 设备名称 -->
<el-col :span="12">
<el-form-item
label="设备名称"
prop="equipmentId"
:rules="[
{ required: true, message: '设备不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.equipmentId"
:placeholder="`请选择设备`"
:disabled="disabled"
filterable
clearable
@change="$emit('update', form)">
<el-option
v-for="opt in equipmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 故障发生时间 -->
<el-col :span="12">
<el-form-item
label="故障发生时间"
prop="faultTime"
:rules="[
{
required: true,
message: '故障发生时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.faultTime"
type="datetime"
:disabled="disabled"
:placeholder="`请选择故障发生时间`"
value-format="timestamp"
format="yyyy-MM-dd HH:mm:ss"
clearable
@change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 故障级别 -->
<el-col :span="12">
<el-form-item
label="故障级别"
prop="faultLevel"
:rules="[
{
required: true,
message: '故障级别不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.faultLevel"
placeholder="故障级别"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.FAULT_LEVEL)"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 联系方式 -->
<el-col :span="24">
<el-form-item
label="联系方式"
prop="repairmanPhone"
:rules="[
{ required: true, message: '联系方式不能为空', trigger: 'blur' },
]">
<el-input
v-model="form.repairmanPhone"
@change="$emit('update', form)"
placeholder="请输入联系方式"
:disabled="disabled" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: 'top',
},
},
data() {
return {
allSpeicalEquipments: [],
uploadOpen: false,
form: {},
formLoading: true,
dataLoaded: false,
equipmentList: [],
equipmentOptions: [],
equipmentTypeOptions: [
{ label: '安全设备', value: 1 },
{ label: '消防设备', value: 2 },
{ label: '特种设备', value: 3 },
],
workerOptions: [],
planOptions: [],
};
},
watch: {
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
if (this.form.equipmentCategory != null) {
setTimeout(() => {
this.equipmentOptions = this.equipmentList
.filter((item) => item.special)
.filter(
(item) => item.specialType === this.form.equipmentCategory
)
.map((item) => ({ label: item.name, value: item.id }));
}, 1000);
}
if (this.hasFiles) {
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
this.form.files = this.form.files ?? [];
} else if (Array.isArray(this.hasFiles)) {
this.hasFiles.forEach((prop) => {
this.form[prop] = this.form[prop] ?? [];
});
}
}
},
deep: true,
immediate: true,
},
},
mounted() {
this.initOptions();
// this.getCode('/base/equipment-maintain-plan/getCode');
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
// async getCode(url) {
// this.formLoading = true;
// const response = await this.$axios(url);
// this.formLoading = false;
// this.form.code = response.data || '';
// },
// initialize
async initOptions() {
this.initEquipment();
// this.initWorker();
// this.initPlan();
},
async initEquipment(type = 'special-equipment') {
this.formLoading = true;
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
const equipmentOptions = (response.data || [])
.filter((item) => (type == 'special-equipment' ? item.special : true))
.map((item) => ({
label: item.name,
value: item.id,
}));
this.equipmentOptions = equipmentOptions;
this.allSpeicalEquipments = equipmentOptions;
this.formLoading = false;
},
// async initWorker() {
// this.formLoading = true;
// const response = await this.$axios({
// url: '/base/core-worker/listAll',
// });
// this.workerOptions = (response.data || []).map((item) => ({
// label: item.name,
// value: item.id,
// }));
// this.formLoading = false;
// },
// async initPlan() {
// this.formLoading = true;
// const response = await this.$axios({
// url: '/base/equipment-maintain-plan/page',
// params: { pageNo: 1, pageSize: 100, speical: true },
// });
// this.planOptions = (response.data?.list || []).map((item) => ({
// label: item.name,
// value: item.id,
// }));
// this.formLoading = false;
// },
// handlers
handleEqTypeChange(type) {
this.form.equipmentId = null;
if (type) {
this.equipmentOptions = this.equipmentList
.filter((item) => item.special)
.filter((item) => item.specialType === type)
.map((item) => ({ label: item.name, value: item.id }));
} else
this.equipmentOptions = this.equipmentList.map((item) => ({
label: item.name,
value: item.id,
}));
// this.$emit('update', this.form)
},
handleEqChange() {
this.$emit('update', this.form);
},
//
handlePlanChange(val) {
console.log('handlePlanChange', val);
this.form.equipmentCategory = null;
this.form.equipmentId = null;
this.$emit('update', { ...this.form, relatePlan: val });
this.initEquipment(val == 1 ? 'special-equipment' : null);
},
handleEditorInput(html) {
this.$emit('update', {
...this.form,
maintenanceDes: html,
});
},
// upload
handleFilesOpen() {},
beforeUpload() {},
handleUploadSuccess(response, file) {
this.$modal.msgSuccess('上传成功');
console.log('file', file);
this.form.files.push({
fileName: file.name,
fileUrl: response.data,
});
this.$emit('update', this.form);
},
handleDeleteFile(file) {},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
.upload-area {
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
}
.upload-in-dialog {
margin-right: 24px;
position: relative;
float: left;
}
.close-icon {
position: absolute;
top: 0;
right: 12px;
z-index: 100;
transition: transform 0.3s ease-out;
}
.close-icon.open {
transform: rotateZ(90deg);
}
.dialog__upload_component__close {
color: #ccc;
}
.dialog__upload_component__close:hover {
/* color: #777; */
color: red;
}
.height-48 {
height: 35px !important;
}
:deep(.record-add__editor) {
.ql-picker-label {
display: flex;
}
}
</style>

View File

@ -6,19 +6,468 @@
-->
<template>
<div class="SpecialEquipmentRepair"></div>
<div class="app-container SpecialEquipmentRepair">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'" />
</base-dialog>
<CustomDialogForm
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
</div>
</template>
<script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import CustomDialogForm from './CustomDialogForm.vue';
import {
deleteRepair,
exportRepairLogExcel,
} from '@/api/equipment/base/repair';
import { parseTime } from '@/utils/ruoyi';
import htmls from './htmls.vue';
import DialogForm from './Repair--add.vue';
export default {
name: 'SpecialEquipmentRepair',
components: {},
props: {},
components: { CustomDialogForm, DialogForm },
mixins: [basicPageMixin],
data() {
return {};
return {
addOrUpdateVisible: false,
searchBarKeys: [
'maintenanceStatus',
'createTime',
'equipmentId',
'specialType',
],
tableBtn: [
this.$auth.hasPermi('equipment:repair:finish')
? {
type: 'finish',
btnName: '完成',
}
: undefined,
this.$auth.hasPermi('equipment:repair:update')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
// this.$auth.hasPermi('equipment:repair:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:repair:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 150,
filter: parseTime,
},
{
prop: 'repairOrderNumber',
label: '设备维修单号',
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'maintenanceStartTime',
label: '开始时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'maintenanceFinishTime',
label: '结束时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'maintenanceStatus',
label: '维修状态',
filter: (v) => (v != null ? ['未完成', '完成', '进行中'][v] : ''),
},
{ prop: 'maintenanceDuration', label: '维修时长(h)', width: 110 },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{
prop: 'equipmentName',
label: '设备名称',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'maintenanceDetail',
label: '维修明细',
subcomponent: htmls,
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'repairman',
label: '维修工',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'repairmanPhone',
label: '联系方式',
minWidth: 100,
showOverflowtooltip: true,
},
{
prop: 'remark',
label: '备注',
minWidth: 120,
showOverflowtooltip: true,
},
],
searchBarFormConfig: [
{
type: 'select',
label: '设备大类',
placeholder: '请选择设备大类',
param: 'specialType',
onchange: true,
selectOptions: [
{ id: 1, name: '安全设备' },
{ id: 2, name: '消防设备' },
{ id: 3, name: '特种设备' },
],
filterable: true,
},
{
type: 'select',
label: '设备',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
{
type: 'select',
label: '状态',
placeholder: '请选择状态',
param: 'maintenanceStatus',
selectOptions: [
{ name: '未完成', id: '0' },
{ name: '完成', id: '1' },
{ name: '进行中', id: '2' },
],
},
//
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
// valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'createTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:repair:export') ? 'button' : '',
btnName: '导出',
name: 'export',
plain: true,
color: 'primary',
},
{
type: this.$auth.hasPermi('equipment:repair:create') ? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintenanceStatus: null,
createTime: null,
equipmentId: null,
special: true,
specialType: null,
},
//
form: {},
basePath: '/base/equipment-repair-log',
mode: null,
allSpecialEquipments: [],
};
},
created() {
this.initSearchBar();
this.getList();
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = data.filter((item) => item.special);
this.setSearchBarEquipmentList(data.filter((item) => item.special));
});
},
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
repairOrderNumber: null,
equipmentId: null,
repairman: null,
repairmanPhone: null,
faultTime: null,
faultLevel: null,
maintenanceStartTime: null,
maintenanceFinishTime: null,
faultType: null,
repairMode: null,
maintenanceStatus: null,
faultDetail: null,
maintenanceDetail: null,
remark: null,
files: [
// {
// fileName: '',
// fileType: '',
// fileUrl: '',
// },
],
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加维修记录';
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
// const id = row.id;
// this.info({ id }).then((response) => {
// this.form = response.data;
// // this.form.repairman = this.form.repairman.split(',')
// this.open = true;
// this.title = '';
// });
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init({ id: row.id });
});
},
/** 完成按钮操作 */
handlFinish(row) {
this.addOrUpdateVisible = true;
const params = {
id: row.id,
maintenanceStatus: 1,
};
this.$nextTick(() => {
this.$refs.addOrUpdate.init(params);
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
// if (this.form.repairman) {
// this.form.repairman = this.form.repairman.join(',')
// }
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除维修单号为"' + row.repairOrderNumber + '"的数据?')
.then(() => {
return deleteRepair(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
handleDetail({ id }) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init({ id: id }, true);
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有维修记录?')
.then(() => {
this.exportLoading = true;
return exportRepairLogExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备维修.xls');
this.exportLoading = false;
})
.catch(() => {});
},
//
handleTableBtnClick({ data, type }) {
console.log('nihc', data, type);
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
case 'detail':
this.handleDetail(data);
break;
case 'finish':
this.handlFinish(data);
break;
}
},
//
handleSearchBarChange({ param, value }) {
if ('specialType' === param) {
if (!value) {
this.setSearchBarEquipmentList(this.allSpecialEquipments);
return;
}
this.setSearchBarEquipmentList(
this.allSpecialEquipments.filter((item) => item.specialType == value)
);
}
},
setSearchBarEquipmentList(eqList) {
this.$set(
this.searchBarFormConfig[1],
'selectOptions',
eqList.map((item) => ({
name: item.name,
id: item.id,
}))
);
},
},
computed: {},
methods: {},
};
</script>

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,35 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 14:00:52
* @LastEditTime: 2023-12-01 10:12:27
* @LastEditors: DY
* @Description:
-->
<template>
<div v-html="content" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
content: ''
}
},
mounted() {
this.getContent()
},
methods: {
getContent() {
this.content = this.injectData[this.injectData.prop] ?? ''
}
}
}
</script>