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
author: liubin
date: 2023-12-12 13:53:22
description:
description: 巡检单设置
-->
<template>
<div class="app-container SpecialEquipmentCheckContent">
<div class="app-container SpecialEquipmentCheckConfig">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
@ -24,7 +25,7 @@
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:width="180"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -43,44 +44,53 @@
: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" />
@confirm="handleConfirm">
<add ref="add" @refreshDataList="successSubmit" />
</base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
</div>
</template>
<script>
import moment from 'moment';
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 {
name: 'SpecialEquipmentCheckContent',
components: {},
name: 'SpecialEquipmentCheckConfig',
components: { addOrUpdata, add },
mixins: [basicPageMixin],
data() {
return {
searchBarKeys: ['content'],
addOrUpdateVisible: false,
addOrEditTitle: '',
searchBarKeys: ['name'],
tableBtn: [
// this.$auth.hasPermi('equipment:check:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check:update')
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:delete')
// this.$auth.hasPermi('equipment:check-setting:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check-setting:delete')
? {
type: 'delete',
btnName: '删除',
@ -88,22 +98,55 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'program', label: '巡检项目', showOverflowtooltip: true },
{
prop: 'content',
label: '巡检内容',
minWidth: 150,
prop: 'name',
label: '巡检单名称',
width: 100,
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: [
{
type: 'input',
label: '巡检内容',
placeholder: '请输入巡检内容',
param: 'content',
label: '巡检单名称',
placeholder: '请输入巡检单名称',
param: 'name',
},
{
type: 'button',
@ -115,14 +158,16 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:check:create') ? 'button' : '',
type: this.$auth.hasPermi('equipment:check-setting:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('equipment:check:export')
// type: this.$auth.hasPermi('equipment:check-setting:export')
// ? 'button'
// : '',
// btnName: '',
@ -130,82 +175,62 @@ export default {
// 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,
name: null,
status: 0,
},
//
form: {
code: '',
program: '',
id: undefined,
content: '',
},
basePath: '/base/equipment-check',
form: {},
basePath: '/base/equipment-check-order',
mode: null,
allSpecialEquipments: [],
};
},
created() {
// this.initSearchBar();
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,
// }))
// );
// });
// },
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;
@ -218,9 +243,9 @@ export default {
},
/** 取消按钮 */
cancel() {
this.$refs.add.reset();
this.open = false;
this.mode = null;
this.reset();
this.title = '';
},
/** 表单重置 */
reset() {
@ -245,18 +270,18 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
this.open = true;
this.title = '添加巡检内容';
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);
});
},
/** 提交按钮 */
@ -286,10 +311,9 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除该巡检项目?')
.then(function () {
// return this.del({ id });
return deleteCheck(id);
.confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
.then(() => {
return this.del({ id });
})
.then(() => {
this.getList();
@ -297,13 +321,35 @@ export default {
})
.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.reset();
this.mode = 'detail';
this.info({ id }).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改巡检内容';
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
});
},
handleAddDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加内容';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
},
/** 导出按钮操作 */
@ -313,13 +359,13 @@ export default {
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检内容?')
.confirm('是否确认导出所有巡检设置?')
.then(() => {
this.exportLoading = true;
return exportEquipmentTypeExcel(params);
})
.then((response) => {
this.$download.excel(response, '巡检内容.xls');
this.$download.excel(response, '巡检设置.xls');
this.exportLoading = false;
})
.catch(() => {});
@ -329,6 +375,6 @@ export default {
</script>
<style scoped lang="scss">
.SpecialEquipmentCheckContent {
.SpecialEquipmentCheckConfig {
}
</style>