故障审核和广告审核完善

This commit is contained in:
SjS 2025-04-21 18:18:57 +08:00
parent 4823497fc6
commit f2a77b3ab8
2 changed files with 410 additions and 303 deletions

View File

@ -43,6 +43,14 @@ export function handleAudit(data){
})
}
export function handleComplete(data){
return request({
url: '/bst/fault/complete',
method: 'put',
data: data
})
}
// 删除故障
export function delFault(id) {
return request({

View File

@ -1,317 +1,416 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备SN" prop="vehicleCode">
<el-input
v-model="queryParams.vehicleCode"
placeholder="请输入设备Sn"
clearable
@input="handleQuery"
@keyup.enter.native="handleQuery"
/>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备SN" prop="vehicleCode">
<el-input
v-model="queryParams.vehicleCode"
placeholder="请输入设备Sn"
clearable
@input="handleQuery"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报修进度" prop="appealStatus">
<el-select v-model="queryParams.appealStatus" placeholder="请选择报修进度" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.appeal_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="报修进度" prop="appealStatus">
<el-select v-model="queryParams.appealStatus" placeholder="请选择报修进度" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.appeal_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-has-permi="['bst:fault:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="faultList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
<template slot-scope="d">
<template v-if="column.key === 'id'">
{{d.row[column.key]}}
</template>
<template v-else-if="column.key === 'faultSite'">
<dict-tag :options="dict.type.fault_site" :value="d.row[column.key]"/>
</template>
<template v-else-if="column.key === 'picture'">
<image-preview
:src="d.row[column.key]"
alt="故障图片"
:width="50" :height="50"
/>
</template>
<template v-else-if="column.key === 'appealStatus'">
<dict-tag :options="dict.type.appeal_status" :value="d.row[column.key]" />
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
type="text"
icon="el-icon-audit"
@click="handleReject(scope.row, 0)"
v-has-permi="['bst:fault:edit']"
v-if="scope.row.appealStatus ==='1'"
>驳回</el-button>
<el-button
size="mini"
type="text"
:icon="scope.row.appealStatus === '1' ? 'el-icon-audit' : 'el-icon-check'"
@click="handleNext(scope.row, 1)"
v-has-permi="['bst:fault:edit']"
v-if="scope.row.appealStatus === '1' || scope.row.appealStatus === '2'"
@click="handleExport"
v-has-permi="['bst:fault:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="faultList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
{{ scope.row.appealStatus === '1' ? '处理' : '完成' }}
</el-button>
<template slot-scope="d">
<template v-if="column.key === 'id'">
{{d.row[column.key]}}
</template>
<template v-else-if="column.key === 'faultSite'">
<dict-tag :options="dict.type.fault_site" :value="d.row[column.key]"/>
</template>
<template v-else-if="column.key === 'picture'">
<image-preview
:src="d.row[column.key]"
alt="故障图片"
:width="50" :height="50"
/>
</template>
<template v-else-if="column.key === 'appealStatus'">
<dict-tag :options="dict.type.appeal_status" :value="d.row[column.key]" />
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-has-permi="['bst:fault:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
</el-table-column>
</el-table>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row)"
v-hasPermi="['bst:fault:list']"
>查看详情</el-button>
</template>
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-has-permi="['bst:fault:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<script>
import {handleAudit, listFault} from "@/api/bst/fault";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import FaultEditDialog from "@/views/bst/fault/components/FaultEditDialog.vue";
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
<!-- 在index.vue的template中添加弹窗结构 -->
<el-dialog
:title="`故障申报详情`"
:visible.sync="detailVisible"
width="800px"
append-to-body>
export default {
name: "Fault",
mixins: [$showColumns],
components: {FaultEditDialog, FormCol},
dicts: ['fault_site','appeal_status'],
props: {
query: {
type: Object,
default: () => ({})
}
},
data() {
return {
span: 24,
//
columns: [
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
{key: 'userName', visible: true, label: '用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'areaName', visible: true, label: '运营区', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'orderId', visible: true, label: '订单号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vehicleCode', visible: true, label: 'SN', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'faultSite', visible: true, label: '故障原因', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'picture', visible: true, label: '图片', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'faultDetail', visible: true, label: '故障详情', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'appealStatus', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createTime', visible: true, label: '提交时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
faultList: [],
//
title: "",
//
open: false,
// ID
selectedId: null,
defaultSort,
<!-- 申请信息区块 -->
<div class="info-section">
<el-descriptions title="申报信息" :column="2" border>
<el-descriptions-item label="申报用户">{{ detailForm.userName }}</el-descriptions-item>
<el-descriptions-item label="申报时间">{{ detailForm.createTime }}</el-descriptions-item>
<el-descriptions-item label="设备SN">{{ detailForm.vehicleCode }}</el-descriptions-item>
<el-descriptions-item label="所属运营区">{{ detailForm.areaName }}</el-descriptions-item>
<el-descriptions-item label="故障图片" :span="2">
<image-preview :src="detailForm.picture" :width="200" />
</el-descriptions-item>
<el-descriptions-item label="故障详情" :span="2">
<pre class="content-pre">{{ detailForm.faultDetail }}</pre>
</el-descriptions-item>
<el-descriptions-item label="审核状态">
<dict-tag :value="detailForm.appealStatus" :options="dict.type.appeal_status"/>
</el-descriptions-item>
</el-descriptions>
</div>
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
userName: null,
vehicleCode: null,
picture: null,
orderId: null,
faultSiteList:[],
faultDetail: null,
appealStatus: null,
},
//
form: {},
//
rules: {
userName: [
{ required: true, message: "用户不能为空", trigger: "blur" }
],
vehicleCode: [
{ required: true, message: "车辆编码不能为空", trigger: "blur" }
],
picture: [
{ required: true, message: "图片不能为空", trigger: "blur" }
],
faultSite: [
{ required: true, message: "故障部位不能为空", trigger: "blur" }
],
appealStatus: [
{ required: true, message: "申诉状态:0-已驳回 1-已提交 2-维修中不能为空", trigger: "change" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
]
}
};
},
created() {
Object.assign(this.queryParams, this.query, this.$route.query);
this.getList();
},
methods: {
handleReject(row, status) {
this.$modal.confirm('确认驳回该故障申报吗?').then(() => {
this.handleAudit(row.id, status); //
});
},
handleNext(row, status) {
this.$modal.confirm('确认处理该故障申报吗?').then(() => {
this.handleAudit(row.id, status); //
});
},
handleAudit(id, handle) {
// handle01
handleAudit({id, handle}).then(response => {
this.$modal.msgSuccess("操作成功");
this.getList(); //
});
},
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询故障列表 */
getList() {
this.loading = true;
listFault(this.queryParams).then(response => {
this.faultList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userName: null,
vehicleCode: null,
picture: null,
orderId: null,
faultSite: null,
faultDetail: null,
appealStatus: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 查看详情 */
handleView(row){
this.selectedId = row.id
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
<!-- 审核区块 -->
<template v-if="detailForm.appealStatus === '1'">
<el-divider />
<div class="verify-area">
<el-input
v-model="verifyRemark"
type="textarea"
:rows="4"
placeholder="请输入审核意见"
style="margin:20px 0"
/>
<div class="dialog-footer" style="display: flex; justify-content: flex-end; gap: 10px;">
<el-button type="danger" @click="reject" v-hasPermi="['bst:fault:edit']"> </el-button>
<el-button type="success" @click="audit" v-hasPermi="['bst:fault:edit']"> </el-button>
</div>
</div>
</template>
/** 导出按钮操作 */
handleExport() {
this.download('bst/fault/export', {
...this.queryParams
}, `fault_${new Date().getTime()}.xlsx`)
}
<template v-if="['0','2','3'].includes(detailForm.appealStatus)">
<el-divider />
<el-descriptions title="审核信息" :column="1" border>
<el-descriptions-item label="审核人">{{ detailForm.verifyName || '-' }}</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ detailForm.verifyEndTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="审核意见">
<pre style="white-space: pre-wrap;">{{ detailForm.verifyRemark || '无' }}</pre>
</el-descriptions-item>
</el-descriptions>
</template>
<div v-if="detailForm.appealStatus === '2'" class="dialog-footer" style="margin-top:20px;text-align:center">
<el-button
type="primary"
@click="complete"
v-hasPermi="['bst:fault:edit']"
>维修完成</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getFault, handleAudit, handleComplete, listFault} from "@/api/bst/fault";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import FaultEditDialog from "@/views/bst/fault/components/FaultEditDialog.vue";
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
};
</script>
export default {
name: "Fault",
mixins: [$showColumns],
components: {FaultEditDialog, FormCol},
dicts: ['fault_site','appeal_status'],
props: {
query: {
type: Object,
default: () => ({})
}
},
data() {
return {
span: 24,
//
columns: [
{key: 'id', visible: true, label: '故障反馈ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
{key: 'userName', visible: true, label: '用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'areaName', visible: true, label: '运营区', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
//{key: 'orderId', visible: true, label: '', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vehicleCode', visible: true, label: 'SN', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'faultSite', visible: true, label: '故障原因', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
//{key: 'picture', visible: true, label: '', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
//{key: 'faultDetail', visible: true, label: '', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'appealStatus', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createTime', visible: true, label: '提交时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
faultList: [],
//
title: "",
//
open: false,
detailVisible: false, //
detailForm: {}, //
verifyRemark: '',
// ID
selectedId: null,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
userName: null,
vehicleCode: null,
picture: null,
orderId: null,
faultSiteList:[],
faultDetail: null,
appealStatus: null,
},
//
form: {},
//
rules: {
userName: [
{ required: true, message: "用户不能为空", trigger: "blur" }
],
vehicleCode: [
{ required: true, message: "车辆编码不能为空", trigger: "blur" }
],
picture: [
{ required: true, message: "图片不能为空", trigger: "blur" }
],
faultSite: [
{ required: true, message: "故障部位不能为空", trigger: "blur" }
],
appealStatus: [
{ required: true, message: "申诉状态:0-已驳回 1-已提交 2-维修中不能为空", trigger: "change" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
]
}
};
},
created() {
Object.assign(this.queryParams, this.query, this.$route.query);
this.getList();
},
computed: {
isApproving() {
return ['1'].includes(this.detailForm.appealStatus)
},
},
methods: {
//
audit() {
this.handleVerify(true);
},
//
complete() {
this.$modal.confirm('确定当前设备故障已维修完成?').then(() => {
handleComplete({
id: this.detailForm.id,
pass: true,
}).then(() => {
this.$message.success('维修已完成')
this.detailVisible = false
this.getList()
})
})
},
//
reject() {
this.handleVerify(false);
},
//
handleVerify(Pass) {
if (!this.verifyRemark) {
this.$message.warning('请填写审核意见');
return;
}
const action = Pass ? '通过' : '驳回';
this.$modal.confirm(`确认${action}该申请吗?`).then(() => {
handleAudit({
id: this.detailForm.id,
pass: Pass, // truefalse
verifyRemark: this.verifyRemark
}).then(() => {
this.$modal.msgSuccess(`${action}成功`);
this.detailVisible = false;
this.getList();
});
});
},
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询故障列表 */
getList() {
this.loading = true;
listFault(this.queryParams).then(response => {
this.faultList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userName: null,
vehicleCode: null,
picture: null,
orderId: null,
faultSite: null,
faultDetail: null,
appealStatus: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 查看详情 */
handleView(row) {
this.loading = true;
getFault(row.id).then(response => {
this.detailForm = response.data;
this.detailVisible = true;
this.verifyRemark = '';
}).finally(() => {
this.loading = false;
});
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
this.download('bst/fault/export', {
...this.queryParams
}, `fault_${new Date().getTime()}.xlsx`)
}
}
};
</script>