452 lines
14 KiB
Vue
452 lines
14 KiB
Vue
<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="关键词" prop="contact" >
|
|
<el-input
|
|
v-model="queryParams.keyWords"
|
|
placeholder="请输入关键词"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
|
|
|
<el-select v-model="queryParams.status" clearable placeholder="请选择">
|
|
<el-option
|
|
|
|
label="待处理"
|
|
value="0">
|
|
</el-option>
|
|
<el-option
|
|
label="已处理"
|
|
value="1">
|
|
</el-option>
|
|
</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-row :gutter="10" class="mb8">
|
|
<!-- <el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
v-hasPermi="['system:complaint:add']"
|
|
>新增</el-button>
|
|
</el-col> -->
|
|
|
|
<!-- <el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['system:complaint:remove']"
|
|
>删除</el-button>
|
|
</el-col> -->
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
@click="handleExport"
|
|
v-hasPermi="['system:complaint:export']"
|
|
>导出</el-button>
|
|
</el-col>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="complaintList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
<el-table-column label="问题描述" align="center" prop="desc" />
|
|
<el-table-column label="关键词" align="center" prop="keyWords" />
|
|
<el-table-column label="照片" align="center" prop="photos" min-width="100">
|
|
<template slot-scope="scope">
|
|
<ImagePreview width="100px" height="100px" :src=" scope.row.photos" />
|
|
|
|
<!--<div class="imgaes">
|
|
<span v-for="(url,index) in scope.row.photos" :key="index">
|
|
<el-image
|
|
style="width: 100px; height: 100px"
|
|
:src=" url"
|
|
:preview-src-list="scope.row.photos">
|
|
</el-image>
|
|
</span>
|
|
</div>-->
|
|
</template>
|
|
|
|
</el-table-column>
|
|
<el-table-column label="联系人" align="center" prop="contact" />
|
|
<el-table-column label="联系电话" align="center" prop="contactNumber" />
|
|
<el-table-column label="处理状态" align="center" prop="status">
|
|
<template slot-scope="scope" >
|
|
<el-tag v-if="scope.row.status == 0" type="primary" >待处理</el-tag>
|
|
<el-tag v-if="scope.row.status == 1" type="success" >已处理</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="提交时间" align="center" prop="createTime" />
|
|
<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-edit"
|
|
@click="handleProcess(scope.row)"
|
|
v-if="scope.row.status == 0"
|
|
>处理</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleDetail(scope.row)"
|
|
v-if="scope.row.status ==1"
|
|
>查看详情</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"
|
|
/>
|
|
|
|
<!-- 添加或修改【请填写功能名称】对话框 -->
|
|
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
|
<el-form ref="form" :disabled="!editable" :model="form" :rules="rules" label-width="80px" >
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="联系人" prop="contact" >
|
|
<el-input v-model="form.contact" placeholder="请输入联系人" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="联系电话" prop="contactNumber">
|
|
<el-input v-model="form.contactNumber" placeholder="请输入联系电话" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="关键词" prop="keyWords">
|
|
<el-input v-model="form.keyWords" placeholder="请输入内容" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-form-item label="问题描述" prop="desc">
|
|
<el-input v-model="form.desc" :rows="4" type="textarea" placeholder="请输入内容" />
|
|
</el-form-item>
|
|
</el-row>
|
|
|
|
|
|
<el-row>
|
|
<el-form-item label="照片地址" prop="photos">
|
|
|
|
<!-- <sapn v-for="(url,index ) in form.photos" :key="index" style="padding:10px">
|
|
<el-image
|
|
style="width: 100px; height: 100px"
|
|
:src="url"
|
|
:preview-src-list="form.photos">
|
|
</el-image>
|
|
|
|
|
|
</sapn>-->
|
|
<ImagePreview width="100px" height="100px" :src=" form.photos" />
|
|
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-row>
|
|
<el-form-item label="反馈意见" prop="feedback" >
|
|
<el-input v-model="form.feedback" :rows="4" type="textarea" placeholder="请输入内容" />
|
|
</el-form-item>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" v-show="editable" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog :title="title" :visible.sync="openProcessDialog" width="1000px" append-to-body>
|
|
|
|
<el-form ref="formData" :model="formData" label-width="80px" >
|
|
<el-row>
|
|
<el-form-item label="反馈意见" prop="feedback" :rules="rules">
|
|
<el-input v-model="formData.feedback" :rows="4" type="textarea" placeholder="请输入内容" />
|
|
</el-form-item>
|
|
</el-row>
|
|
<!-- 上传图片 -->
|
|
<el-row>
|
|
<el-form-item label="上传反馈意见图片" prop="feedbackImages" :rules="rules">
|
|
<image-upload
|
|
v-model="formData.feedbackImages"
|
|
:limit="1"
|
|
:file-size="2"
|
|
:file-type="['png', 'jpg', 'jpeg']"
|
|
is-show-tip
|
|
/>
|
|
</el-form-item>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button v-show="editable" type="primary" @click="submitProcessForm" >确 定</el-button>
|
|
<el-button @click="openProcessDialog = false">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { addComplaint, delComplaint, getComplaint, listComplaint, process as processComplaint, updateComplaint } from "@/api/complaint/complaint";
|
|
import ImageUpload from "@/components/ImageUpload/index.vue"; //图片上传
|
|
|
|
export default {
|
|
name: "Complaint",
|
|
components: { ImageUpload }, // 注册
|
|
data() {
|
|
return {
|
|
|
|
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 【请填写功能名称】表格数据
|
|
complaintList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
desc: null,
|
|
keyWords: null,
|
|
photos: null,
|
|
contact: null,
|
|
contactNumber: null,
|
|
status: null,
|
|
feedback: null,
|
|
createId: null,
|
|
updateId: null,
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
// rules: {
|
|
// },
|
|
editable:false,
|
|
openProcessDialog:false,
|
|
//反馈和反馈图片
|
|
formData: {
|
|
id: null,
|
|
feedback: '',
|
|
feedbackImages: '' // 新增字段,用于存储上传的图片地址
|
|
},
|
|
rules: [
|
|
{ required: true, message: '此项必填', trigger: 'blur', whitespace:true },
|
|
{ required: true, message: '请上传至少一张图片', trigger: 'change' }
|
|
],
|
|
//{ required: true, message: '此项必填', trigger: 'blur',whitespace:true },
|
|
|
|
|
|
baseurl: process.env.VUE_APP_BASE_API,
|
|
};
|
|
},
|
|
created() {
|
|
|
|
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
|
|
/** 查询【请填写功能名称】列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listComplaint(this.queryParams).then(response => {
|
|
this.complaintList = response.rows;
|
|
// for(let i =0;i < this.complaintList.length;i++){
|
|
|
|
// if(this.complaintList[i].photos != null){
|
|
|
|
// let ps = this.complaintList[i].photos.split(",");
|
|
// let photos = [];
|
|
// for(let j = 0;j < ps.length;j++){
|
|
// photos.push(ps[j])
|
|
// }
|
|
// this.complaintList[i].photos = photos;
|
|
// }else {
|
|
// this.complaintList[i].photos = []
|
|
// }
|
|
// }
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
|
|
console.log( this.complaintList);
|
|
});
|
|
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
desc: null,
|
|
keyWords: null,
|
|
photos: null,
|
|
contact: null,
|
|
contactNumber: null,
|
|
status: null,
|
|
feedback: null,
|
|
createId: null,
|
|
createTime: null,
|
|
updateId: null,
|
|
updateTime: null,
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.queryParams = {};
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.id)
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset();
|
|
this.open = true;
|
|
this.title = "添加【请填写功能名称】";
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
const id = row.id || this.ids
|
|
getComplaint(id).then(response => {
|
|
this.form = response.data;
|
|
this.open = true;
|
|
this.title = "修改";
|
|
});
|
|
},
|
|
// 查看查看详情
|
|
handleDetail(row) {
|
|
this.reset();
|
|
this.editable = false;
|
|
this.form = row;
|
|
this.open = true;
|
|
this.title = "查看详情";
|
|
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
updateComplaint(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
});
|
|
} else {
|
|
addComplaint(this.form).then(response => {
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row.id || this.ids;
|
|
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
|
|
return delComplaint(ids);
|
|
}).then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {});
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
this.download('comprehensive/complaint/export', {
|
|
...this.queryParams
|
|
}, `complaint_${new Date().getTime()}.xlsx`)
|
|
},
|
|
//处理
|
|
handleProcess(row){
|
|
this.formData.id = row.id;
|
|
this.openProcessDialog = true,
|
|
this.title = "反馈意见",
|
|
this.editable = true;
|
|
},
|
|
|
|
submitProcessForm(){
|
|
this.$refs["formData"].validate(valid => {
|
|
if(valid) {
|
|
//处理反馈数据
|
|
const params = {
|
|
id: this.formData.id,
|
|
feedback: this.formData.feedback,
|
|
photos: this.formData.feedbackImages // 图片路径列表
|
|
};
|
|
processComplaint(params).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.openProcessDialog = false;
|
|
this.resetForm("formData");
|
|
this.getList();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.imgaes{
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: start;
|
|
gap: 10px;
|
|
}
|
|
</style> |