oil-station/fuintAdmin/src/views/feedBack/index.vue
DESKTOP-369JRHT\12997 94c0c18e6f 10.31
2024-10-31 15:36:10 +08:00

262 lines
8.0 KiB
Vue

<template>
<div class="app-container">
<div class="cot-boxs">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="120px">
<el-form-item label="" prop="userMobile" style="width: 180px">
<el-input
v-model="queryParams.userMobile"
placeholder="请输入用户手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="">
<el-date-picker
v-model="beginTime"
style="width: 160px"
type="date"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="endTime"
style="width: 160px"
type="date"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right;margin-right: 0px">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div style="height: 76.5vh;overflow: auto">
<el-table border v-loading="loading" :data="list">
<el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column align="center" prop="storeName" label="所属机构"/>
<el-table-column align="center" prop="userName" label="用户昵称"/>
<el-table-column align="center" prop="userMobile" label="用户手机号"/>
<el-table-column align="center" prop="content" label="反馈内容"/>
<el-table-column align="center" prop="screenshotUrl" label="截图信息">
<template slot-scope="scope">
<span v-if="JSON.parse(scope.row.screenshotUrl).length>0"
v-for="(item,index) in JSON.parse(scope.row.screenshotUrl)" :key="index">
<img class="list-avatar" :src="baseUrl + item">
</span>
<span v-if="scope.row.screenshotUrl=='[]'">暂无截图信息</span>
</template>
</el-table-column>
<el-table-column align="center" prop="handleStatus" label="处理状态">
<template slot-scope="scope">
<span v-if="scope.row.handleStatus==1">已处理</span>
<span v-else>未处理</span>
</template>
</el-table-column>
<el-table-column align="center" prop="handleResult" label="处理结果">
<template slot-scope="scope">
<span>{{ scope.row.handleResult || "--" }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="createTime" label="反馈时间"/>
<el-table-column align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-if="scope.row.handleStatus!=1"
>处理
</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getFeekBackList"
/>
</div>
<!-- 添加或修改对话框 -->
<el-dialog center :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="反馈内容" prop="content">
<el-input v-model="form.content" disabled placeholder="请输入反馈内容" type="textarea"/>
</el-form-item>
<el-form-item label="截图">
<span v-if="screenshotUrl.length>0"
v-for="(item,index) in screenshotUrl" :key="index">
<img style="width: 150px;margin-right: 15px" :src="baseUrl + item">
</span>
<span v-if="screenshotUrl.length==0">暂无截图信息</span>
</el-form-item>
<el-form-item label="处理结果" prop="handleResult">
<el-input v-model="form.handleResult" placeholder="请输入处理结果" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listFeekBack} from "@/api/feedback/feedBack";
import {deleteFeekBack, editFeekBack, getFeekBack} from "../../api/feedback/feedBack";
import {storesList} from "../../api/staff/store";
export default {
data() {
return {
baseUrl: process.env.VUE_APP_BASE_API,
list: [],
total: 0,
loading: false,
queryParams: {
page: 1,
pageSize: 10,
},
beginTime: "",
endTime: '',
storeList: [],
title: '',
open: false,
form: {},
screenshotUrl: [],
// 表单校验
rules: {
content: [
{required: true, message: "反馈内容不能为空", trigger: "blur"},
],
handleResult: [
{required: true, message: "处理结果不能为空", trigger: "blur"},
],
}
}
},
created() {
this.getFeekBackList()
this.getStoreList()
},
methods: {
getStoreList() {
storesList().then(response => {
this.storeList = response.data
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 提交按钮
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
editFeekBack(this.form).then(res => {
if (res.data == 1) {
this.$message.success("处理成功")
this.open = false
this.queryParams.page = 1
this.getFeekBackList()
}
})
}
}
});
},
// 表单重置
reset() {
this.resetForm("form");
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getFeekBackList();
},
// 重置按钮操作
resetQuery() {
this.queryParams = {
page: 1,
pageSize: 10,
}
this.beginTime = ''
this.endTime = ''
this.handleQuery();
},
// 删除按钮操作
handleDelete(row) {
const name = row.realName || this.id;
this.$modal.confirm('是否删除本条数据,删除后无法恢复!').then(function () {
return deleteFeekBack(row.id);
}).then(() => {
this.queryParams.page = 1
this.getFeekBackList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
handleUpdate(data) {
getFeekBack(data.id).then(res => {
this.open = true
this.title = "处理"
this.form = res.data
if (res.data) this.screenshotUrl = JSON.parse(res.data.screenshotUrl)
})
},
getFeekBackList() {
this.loading = true;
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
listFeekBack(this.addDateRange(this.queryParams, dateRange)).then(res => {
this.list = res.data.records;
this.total = res.data.total;
this.loading = false;
})
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
}
.cot-boxs {
width: 100%;
border-radius: 8px;
background: #fff;
box-sizing: border-box;
padding: 20px;
margin: 0 auto;
}
</style>