index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="用户" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入用户id"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <!-- <el-form-item label="用户名字" prop="userName">
  14. <el-input
  15. v-model="queryParams.userName"
  16. placeholder="请输入用户名字"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item> -->
  22. <el-form-item label="联系方式" prop="phone">
  23. <el-input
  24. v-model="queryParams.phone"
  25. placeholder="请输入联系方式"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <!-- 添加处理状态筛选 -->
  32. <el-form-item label="处理状态" prop="isHandle">
  33. <el-select
  34. v-model="queryParams.isHandle"
  35. placeholder="请选择处理状态"
  36. clearable
  37. size="small"
  38. >
  39. <el-option label="未处理" value="0"></el-option>
  40. <el-option label="已处理" value="1"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="投诉时间" prop="complaintTime">
  44. <el-date-picker v-model="complaintTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <!-- <el-col :span="1.5">
  53. <el-button
  54. type="primary"
  55. plain
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd"
  59. v-hasPermi="['his:complaint:add']"
  60. >新增</el-button>
  61. </el-col> -->
  62. <!-- <el-col :span="1.5">
  63. <el-button
  64. type="success"
  65. plain
  66. icon="el-icon-edit"
  67. size="mini"
  68. :disabled="single"
  69. @click="handleUpdate"
  70. v-hasPermi="['his:complaint:edit']"
  71. >修改</el-button>
  72. </el-col> -->
  73. <!-- <el-col :span="1.5">
  74. <el-button
  75. type="danger"
  76. plain
  77. icon="el-icon-delete"
  78. size="mini"
  79. :disabled="multiple"
  80. @click="handleDelete"
  81. v-hasPermi="['his:complaint:remove']"
  82. >删除</el-button>
  83. </el-col> -->
  84. <el-col :span="1.5">
  85. <el-button
  86. type="warning"
  87. plain
  88. icon="el-icon-download"
  89. size="mini"
  90. :loading="exportLoading"
  91. @click="handleExport"
  92. v-hasPermi="['his:complaint:export']"
  93. >导出</el-button>
  94. </el-col>
  95. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  96. </el-row>
  97. <el-table border v-loading="loading" :data="complaintList" @selection-change="handleSelectionChange">
  98. <el-table-column type="selection" width="55" align="center" />
  99. <el-table-column label="id" align="center" prop="id" />
  100. <el-table-column label="用户" align="center" prop="userName" />
  101. <!-- <el-table-column label="联系方式" align="center" prop="phone" /> -->
  102. <el-table-column label="投诉时间" align="center" prop="createTime" />
  103. <!-- 修改处理状态列显示 -->
  104. <el-table-column label="是否处理" align="center" prop="isHandle">
  105. <template slot-scope="scope">
  106. <el-tag
  107. :type="scope.row.isHandle == 1 ? 'success' : 'warning'"
  108. disable-transitions
  109. >
  110. {{ formatHandleStatus(scope.row.isHandle) }}
  111. </el-tag>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="备注" align="center" prop="remarks" />
  115. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  116. <template slot-scope="scope">
  117. <el-button
  118. size="mini"
  119. type="text"
  120. icon="el-icon-edit"
  121. v-hasPermi="['his:complaint:edit']"
  122. @click="handleUpdate(scope.row)"
  123. >投诉详情</el-button>
  124. <!-- <el-button
  125. size="mini"
  126. type="text"
  127. icon="el-icon-edit"
  128. @click="handleUpdate(scope.row)"
  129. v-hasPermi="['his:complaint:edit']"
  130. >修改</el-button> -->
  131. <el-button
  132. size="mini"
  133. type="text"
  134. icon="el-icon-delete"
  135. @click="handleDelete(scope.row)"
  136. v-hasPermi="['his:complaint:remove']"
  137. >删除</el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <pagination
  142. v-show="total>0"
  143. :total="total"
  144. :page.sync="queryParams.pageNum"
  145. :limit.sync="queryParams.pageSize"
  146. @pagination="getList"
  147. />
  148. <!-- 修改用户投诉对话框 -->
  149. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  150. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  151. <!-- <el-form-item label="用户id" prop="userId">
  152. <el-input v-model="form.userId" placeholder="请输入用户id" />
  153. </el-form-item> -->
  154. <el-form-item label="投诉内容" prop="name">
  155. <el-input v-model="form.name" :disabled="true" />
  156. </el-form-item>
  157. <el-form-item label="详细内容" v-if="form.content && form.content!=''">
  158. <el-input type="textarea" v-model="form.content" :disabled="true"/>
  159. </el-form-item>
  160. <el-form-item label="联系方式" prop="phone" v-if="form.phone && form.phone!=''">
  161. <el-input v-model="form.phone" :disabled="true"/>
  162. </el-form-item>
  163. <el-form-item label="图片" v-if="form.urls && form.urls!=''">
  164. <div v-for="(url, index) in imageUrls(form.urls)" :key="index" class="image-container">
  165. <el-image :src="url" :preview-src-list="[url]" style="width: 100px; height: 100px;"></el-image>
  166. </div>
  167. </el-form-item>
  168. <el-form-item label="交易截图" v-if="form.tradeImage && form.tradeImage!=''">
  169. <!-- <ImageUpload v-model="form.tradeImage" type="image" :num="10" :width="150" :height="150" /> -->
  170. <div v-for="(url, index) in imageUrls(form.tradeImage)" :key="index" class="image-container">
  171. <el-image :src="url" :preview-src-list="[url]" style="width: 100px; height: 100px;"></el-image>
  172. </div>
  173. </el-form-item>
  174. <el-form-item label="被投诉人信息" prop="account" v-if="form.account && form.account!=''">
  175. <el-input v-model="form.account" :disabled="true"/>
  176. </el-form-item>
  177. <!-- 修改处理状态为下拉选择 -->
  178. <el-form-item label="是否处理" prop="isHandle">
  179. <el-select v-model="form.isHandle" placeholder="请选择处理状态">
  180. <el-option label="未处理" :value="0"></el-option>
  181. <el-option label="已处理" :value="1"></el-option>
  182. </el-select>
  183. </el-form-item>
  184. <el-form-item label="备注" prop="remarks">
  185. <el-input type="textarea" v-model="form.remarks" :maxlength="250" />
  186. </el-form-item>
  187. </el-form>
  188. <div slot="footer" class="dialog-footer">
  189. <el-button type="primary" @click="submitForm">确 定</el-button>
  190. <el-button @click="cancel">取 消</el-button>
  191. </div>
  192. </el-dialog>
  193. </div>
  194. </template>
  195. <script>
  196. import { listComplaint, getComplaint, delComplaint, addComplaint, updateComplaint, exportComplaint } from "@/api/his/complaint";
  197. export default {
  198. name: "Complaint",
  199. data() {
  200. return {
  201. complaintTime:null,
  202. // 遮罩层
  203. loading: true,
  204. // 导出遮罩层
  205. exportLoading: false,
  206. // 选中数组
  207. ids: [],
  208. // 非单个禁用
  209. single: true,
  210. // 非多个禁用
  211. multiple: true,
  212. // 显示搜索条件
  213. showSearch: true,
  214. // 总条数
  215. total: 0,
  216. // 用户投诉表格数据
  217. complaintList: [],
  218. // 弹出层标题
  219. title: "",
  220. // 是否显示弹出层
  221. open: false,
  222. // 查询参数
  223. queryParams: {
  224. pageNum: 1,
  225. pageSize: 10,
  226. userId: null,
  227. userName: null, // 添加用户名查询参数
  228. templateId: null,
  229. content: null,
  230. phone: null,
  231. urls: null,
  232. account: null,
  233. isHandle: null
  234. },
  235. // 表单参数
  236. form: {},
  237. // 表单校验
  238. rules: {
  239. userId: [
  240. { required: true, message: "用户id不能为空", trigger: "blur" }
  241. ],
  242. templateId: [
  243. { required: true, message: "投诉模板id不能为空", trigger: "blur" }
  244. ],
  245. }
  246. };
  247. },
  248. created() {
  249. this.getList();
  250. },
  251. methods: {
  252. imageUrls(urls) {
  253. return String(urls).split(",");
  254. },
  255. /**
  256. * 格式化处理状态显示
  257. * @param {Number} status - 处理状态 0:未处理 1:已处理
  258. * @returns {String} - 格式化后的状态文本
  259. */
  260. formatHandleStatus(status) {
  261. return status == 1 ? '已处理' : '未处理';
  262. },
  263. /** 查询用户投诉列表 */
  264. getList() {
  265. this.loading = true;
  266. console.log(this.queryParams);
  267. listComplaint(this.queryParams).then(response => {
  268. this.complaintList = response.rows;
  269. this.total = response.total;
  270. this.loading = false;
  271. });
  272. },
  273. // 取消按钮
  274. cancel() {
  275. this.open = false;
  276. this.reset();
  277. },
  278. // 表单重置
  279. reset() {
  280. this.form = {
  281. id: null,
  282. userId: null,
  283. templateId: null,
  284. content: null,
  285. phone: null,
  286. urls: null,
  287. account: null,
  288. createTime: null,
  289. isHandle: 0, // 默认设置为未处理
  290. remarks:null
  291. };
  292. this.resetForm("form");
  293. },
  294. /** 搜索按钮操作 */
  295. handleQuery() {
  296. this.queryParams.pageNum = 1;
  297. this.getList();
  298. },
  299. /** 重置按钮操作 */
  300. resetQuery() {
  301. this.complaintTime = null;
  302. this.queryParams.complaintsTime=null;
  303. this.queryParams.complainteTime=null;
  304. this.resetForm("queryForm");
  305. this.handleQuery();
  306. },
  307. // 多选框选中数据
  308. handleSelectionChange(selection) {
  309. this.ids = selection.map(item => item.id)
  310. this.single = selection.length !== 1
  311. this.multiple = !selection.length
  312. },
  313. /** 新增按钮操作 */
  314. handleAdd() {
  315. this.reset();
  316. this.open = true;
  317. this.title = "添加用户投诉";
  318. },
  319. /** 修改按钮操作 */
  320. handleUpdate(row) {
  321. this.reset();
  322. const id = row.id || this.ids
  323. getComplaint(id).then(response => {
  324. this.form = response.data;
  325. this.open = true;
  326. this.title = "投诉详情";
  327. });
  328. },
  329. /** 提交按钮 */
  330. submitForm() {
  331. this.$refs["form"].validate(valid => {
  332. if (valid) {
  333. if (this.form.id != null) {
  334. updateComplaint(this.form).then(response => {
  335. this.msgSuccess("修改成功");
  336. this.open = false;
  337. this.getList();
  338. });
  339. } else {
  340. addComplaint(this.form).then(response => {
  341. this.msgSuccess("新增成功");
  342. this.open = false;
  343. this.getList();
  344. });
  345. }
  346. }
  347. });
  348. },
  349. /** 删除按钮操作 */
  350. handleDelete(row) {
  351. const ids = row.id || this.ids;
  352. this.$confirm('是否确认删除用户投诉编号为"' + ids + '"的数据项?', "警告", {
  353. confirmButtonText: "确定",
  354. cancelButtonText: "取消",
  355. type: "warning"
  356. }).then(function() {
  357. return delComplaint(ids);
  358. }).then(() => {
  359. this.getList();
  360. this.msgSuccess("删除成功");
  361. }).catch(() => {});
  362. },
  363. /** 导出按钮操作 */
  364. handleExport() {
  365. const queryParams = this.queryParams;
  366. this.$confirm('是否确认导出所有用户投诉数据项?', "警告", {
  367. confirmButtonText: "确定",
  368. cancelButtonText: "取消",
  369. type: "warning"
  370. }).then(() => {
  371. this.exportLoading = true;
  372. return exportComplaint(queryParams);
  373. }).then(response => {
  374. this.download(response.msg);
  375. this.exportLoading = false;
  376. }).catch(() => {});
  377. },
  378. changeTime(){
  379. if(this.complaintTime!=null){
  380. this.queryParams.complaintsTime=this.complaintTime[0];
  381. this.queryParams.complainteTime=this.complaintTime[1];
  382. }else{
  383. this.queryParams.complaintsTime=null;
  384. this.queryParams.complainteTime=null;
  385. }
  386. },
  387. }
  388. };
  389. </script>