update 巡检待确认

This commit is contained in:
lb 2024-02-22 16:19:02 +08:00
parent 9ad83f84fa
commit 1dd7fef171

View File

@ -2,15 +2,16 @@
filename: Content.vue filename: Content.vue
author: liubin author: liubin
date: 2023-12-12 13:53:22 date: 2023-12-12 13:53:22
description: description: 巡检单设置
--> -->
<template> <template>
<div class="app-container SpecialEquipmentCheckContent"> <div class="app-container SpecialEquipmentCheckConfig">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBar <SearchBar
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="search-bar" ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" /> @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
@ -24,7 +25,7 @@
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="180"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -43,44 +44,53 @@
:dialogVisible="open" :dialogVisible="open"
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="handleConfirm">
<DialogForm <add ref="add" @refreshDataList="successSubmit" />
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'"
:has-files="false"
:rows="rows" />
</base-dialog> </base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteCheck } from '@/api/equipment/base/inspection/settings'; import addOrUpdata from './add-or-updata.vue';
import add from './add.vue';
import { parseTime } from '../../core/mixins/code-filter';
export default { export default {
name: 'SpecialEquipmentCheckContent', name: 'SpecialEquipmentCheckConfig',
components: {}, components: { addOrUpdata, add },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
searchBarKeys: ['content'], addOrUpdateVisible: false,
addOrEditTitle: '',
searchBarKeys: ['name'],
tableBtn: [ tableBtn: [
// this.$auth.hasPermi('equipment:check:update') this.$auth.hasPermi('equipment:check-setting:addInsp')
// ? { ? {
// type: 'detail', type: 'add',
// btnName: '', btnName: '添加',
// } showTip: '添加巡检',
// : undefined, }
this.$auth.hasPermi('equipment:check:update') : undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '修改', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('equipment:check:delete') // this.$auth.hasPermi('equipment:check-setting:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check-setting:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
@ -88,22 +98,55 @@ export default {
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'program', label: '巡检项目', showOverflowtooltip: true },
{ {
prop: 'content', prop: 'name',
label: '巡检内容', label: '巡检单名称',
minWidth: 150, width: 100,
showOverflowtooltip: true, showOverflowtooltip: true,
}, },
{ prop: 'code', label: '巡检内容编码', showOverflowtooltip: true }, {
{ prop: 'remark', label: '备注', showOverflowtooltip: true }, prop: 'code',
label: '巡检单编码',
showOverflowtooltip: true,
},
{
prop: 'department',
label: '部门',
width: 100,
showOverflowtooltip: true,
},
{
prop: 'planCheckTime',
label: '计划巡检时间',
showOverflowtooltip: true,
filter: parseTime,
},
{
width: 144,
prop: 'confirmTimeLimit',
label: '确认时限',
showOverflowtooltip: true,
filter: (val) =>
val != null && val > 24
? `${(val - (val % 24)) / 24}${val % 24}小时`
: `${val}小时`,
},
{ prop: 'groupClass', label: '班次', showOverflowtooltip: true },
{ prop: 'creator', label: '创建人', showOverflowtooltip: true },
{
prop: 'createTime',
label: '创建时间',
showOverflowtooltip: true,
filter: parseTime,
},
{ prop: 'remark', label: '备注' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
label: '巡检内容', label: '巡检单名称',
placeholder: '请输入巡检内容', placeholder: '请输入巡检单名称',
param: 'content', param: 'name',
}, },
{ {
type: 'button', type: 'button',
@ -115,14 +158,16 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('equipment:check:create') ? 'button' : '', type: this.$auth.hasPermi('equipment:check-setting:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
plain: true, plain: true,
color: 'success', color: 'success',
}, },
// { // {
// type: this.$auth.hasPermi('equipment:check:export') // type: this.$auth.hasPermi('equipment:check-setting:export')
// ? 'button' // ? 'button'
// : '', // : '',
// btnName: '', // btnName: '',
@ -130,82 +175,62 @@ export default {
// color: 'warning', // 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, open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
content: null, name: null,
status: 0,
}, },
// //
form: { form: {},
code: '', basePath: '/base/equipment-check-order',
program: '',
id: undefined,
content: '',
},
basePath: '/base/equipment-check',
mode: null, mode: null,
allSpecialEquipments: [],
}; };
}, },
created() { created() {
// this.initSearchBar(); this.initSearchBar();
this.getList(); this.getList();
}, },
methods: { methods: {
// initSearchBar() { handleConfirm() {
// this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { this.$refs.add.dataFormSubmit();
// this.$set( },
// this.searchBarFormConfig[0], successSubmit() {
// 'selectOptions', this.cancel();
// data.map((item) => ({ this.getList();
// name: item.name, },
// id: item.id, 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() { getList() {
this.loading = true; this.loading = true;
@ -218,9 +243,9 @@ export default {
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.$refs.add.reset();
this.open = false; this.open = false;
this.mode = null; this.title = '';
this.reset();
}, },
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
@ -245,18 +270,18 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
// this.reset();
this.open = true; this.open = true;
this.title = '添加巡检内容'; this.title = '添加巡检设置';
this.$nextTick(() => {
this.$refs.add.init();
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.open = true;
const id = row.id; this.title = '修改巡检设置';
this.info({ id }).then((response) => { this.$nextTick(() => {
this.form = response.data; this.$refs.add.init(row);
this.open = true;
this.title = '修改巡检内容';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -286,10 +311,9 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除该巡检项目?') .confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
.then(function () { .then(() => {
// return this.del({ id }); return this.del({ id });
return deleteCheck(id);
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
@ -297,13 +321,35 @@ export default {
}) })
.catch(() => {}); .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 }) { handleDetail({ id }) {
this.reset(); this.addOrUpdateVisible = true;
this.mode = 'detail'; this.addOrEditTitle = '详情';
this.info({ id }).then((response) => { this.$nextTick(() => {
this.form = response.data; this.$refs.addOrUpdate.init(id, true);
this.open = true; });
this.title = '修改巡检内容'; },
handleAddDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加内容';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
}); });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -313,13 +359,13 @@ export default {
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有巡检内容?') .confirm('是否确认导出所有巡检设置?')
.then(() => { .then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportEquipmentTypeExcel(params); return exportEquipmentTypeExcel(params);
}) })
.then((response) => { .then((response) => {
this.$download.excel(response, '巡检内容.xls'); this.$download.excel(response, '巡检设置.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => {}); .catch(() => {});
@ -329,6 +375,6 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.SpecialEquipmentCheckContent { .SpecialEquipmentCheckConfig {
} }
</style> </style>