index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. :option="option"
  5. :table-loading="loading"
  6. :data="data"
  7. :page="page"
  8. ref="crud"
  9. v-model="form"
  10. :permission="permissionList"
  11. @row-update="rowUpdate"
  12. @row-save="rowSave"
  13. @row-del="rowDel"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @on-load="onLoad"
  21. >
  22. <template slot="menuLeft">
  23. <el-button
  24. type="primary"
  25. size="small"
  26. icon="el-icon-plus"
  27. v-if="permission.complaint_add"
  28. @click="handleAdd"
  29. >
  30. 新增投诉
  31. </el-button>
  32. <el-button
  33. type="warning"
  34. size="small"
  35. icon="el-icon-edit"
  36. :disabled="selectionList.length !== 1"
  37. v-if="permission.complaint_edit"
  38. @click="handleBatchStatus"
  39. >
  40. 批量处理
  41. </el-button>
  42. </template>
  43. <template slot="status" slot-scope="{row}">
  44. <el-tag
  45. :type="getComplaintStatusType(row.status)"
  46. size="small"
  47. >
  48. {{ getComplaintStatusLabel(row.status) }}
  49. </el-tag>
  50. </template>
  51. <template slot="replyStatus" slot-scope="{row}">
  52. <el-tag
  53. :type="getReplyStatusType(row.replyStatus)"
  54. size="small"
  55. >
  56. {{ getReplyStatusLabel(row.replyStatus) }}
  57. </el-tag>
  58. </template>
  59. <template slot="complainantType" slot-scope="{row}">
  60. <el-tag
  61. :type="getComplainantTypeType(row.complainantType)"
  62. size="small"
  63. >
  64. {{ getComplainantTypeLabel(row.complainantType) }}
  65. </el-tag>
  66. </template>
  67. <template slot="menu" slot-scope="{row}">
  68. <el-button
  69. type="text"
  70. size="small"
  71. icon="el-icon-view"
  72. @click="handleDetail(row)"
  73. >
  74. 详情
  75. </el-button>
  76. <el-button
  77. type="text"
  78. size="small"
  79. icon="el-icon-chat-line-round"
  80. @click="handleReplyList(row)"
  81. >
  82. 回复列表
  83. </el-button>
  84. <el-button
  85. type="text"
  86. size="small"
  87. icon="el-icon-edit"
  88. v-if="permission.complaint_edit && isComplaintEditable(row.status)"
  89. @click="handleEdit(row)"
  90. >
  91. 编辑
  92. </el-button>
  93. <el-button
  94. type="text"
  95. size="small"
  96. icon="el-icon-check"
  97. v-if="isComplaintProcessable(row.status)"
  98. @click="handleProcess(row)"
  99. >
  100. 修改状态
  101. </el-button>
  102. <el-button
  103. type="text"
  104. size="small"
  105. icon="el-icon-close"
  106. v-if="permission.complaint_edit && isComplaintClosable(row.status)"
  107. @click="handleClose(row)"
  108. >
  109. 关闭
  110. </el-button>
  111. </template>
  112. </avue-crud>
  113. <!-- 投诉详情对话框 -->
  114. <el-dialog
  115. title="投诉详情"
  116. :visible.sync="detailVisible"
  117. width="800px"
  118. append-to-body
  119. :close-on-click-modal="false"
  120. :destroy-on-close="true"
  121. class="complaint-detail-dialog"
  122. >
  123. <div v-if="detailData" class="complaint-detail">
  124. <el-row :gutter="20">
  125. <el-col :span="12">
  126. <div class="detail-item">
  127. <label>投诉单号:</label>
  128. <span>{{ detailData.complaintNo }}</span>
  129. </div>
  130. </el-col>
  131. <el-col :span="12">
  132. <div class="detail-item">
  133. <label>投诉标题:</label>
  134. <span>{{ detailData.title }}</span>
  135. </div>
  136. </el-col>
  137. </el-row>
  138. <el-row :gutter="20">
  139. <el-col :span="12">
  140. <div class="detail-item">
  141. <label>投诉人类型:</label>
  142. <span>{{ getComplainantTypeLabel(detailData.complainantType) }}</span>
  143. </div>
  144. </el-col>
  145. <el-col :span="12">
  146. <div class="detail-item">
  147. <label>投诉类型:</label>
  148. <span>{{ detailData.complaintType }}</span>
  149. </div>
  150. </el-col>
  151. </el-row>
  152. <el-row :gutter="20">
  153. <el-col :span="12">
  154. <div class="detail-item">
  155. <label>联系人:</label>
  156. <span>{{ detailData.contactName }}</span>
  157. </div>
  158. </el-col>
  159. <el-col :span="12">
  160. <div class="detail-item">
  161. <label>联系电话:</label>
  162. <span>{{ detailData.contactPhone }}</span>
  163. </div>
  164. </el-col>
  165. </el-row>
  166. <el-row :gutter="20" v-if="detailData.customerName">
  167. <el-col :span="12">
  168. <div class="detail-item">
  169. <label>客户名称:</label>
  170. <span>{{ detailData.customerName }}</span>
  171. </div>
  172. </el-col>
  173. <el-col :span="12">
  174. <div class="detail-item">
  175. <label>客户编码:</label>
  176. <span>{{ detailData.customerCode }}</span>
  177. </div>
  178. </el-col>
  179. </el-row>
  180. <el-row :gutter="20">
  181. <el-col :span="12">
  182. <div class="detail-item">
  183. <label>投诉状态:</label>
  184. <el-tag :type="getComplaintStatusType(detailData.status)" size="small">
  185. {{ getComplaintStatusLabel(detailData.status) }}
  186. </el-tag>
  187. </div>
  188. </el-col>
  189. <el-col :span="12">
  190. <div class="detail-item">
  191. <label>回复状态:</label>
  192. <el-tag :type="detailData.replyStatus === 1 ? 'success' : 'info'" size="small">
  193. {{ detailData.replyStatus === 1 ? '已回复' : '未回复' }}
  194. </el-tag>
  195. </div>
  196. </el-col>
  197. </el-row>
  198. <el-row :gutter="20">
  199. <el-col :span="24">
  200. <div class="detail-item">
  201. <label>投诉内容:</label>
  202. <div class="content-text">{{ detailData.content }}</div>
  203. </div>
  204. </el-col>
  205. </el-row>
  206. <el-row :gutter="20" v-if="detailData.closeReason">
  207. <el-col :span="24">
  208. <div class="detail-item">
  209. <label>关闭原因:</label>
  210. <div class="content-text">{{ detailData.closeReason }}</div>
  211. </div>
  212. </el-col>
  213. </el-row>
  214. <el-row :gutter="20">
  215. <el-col :span="12">
  216. <div class="detail-item">
  217. <label>提交时间:</label>
  218. <span>{{ detailData.submitTime }}</span>
  219. </div>
  220. </el-col>
  221. <el-col :span="12">
  222. <div class="detail-item">
  223. <label>更新时间:</label>
  224. <span>{{ detailData.updateTime }}</span>
  225. </div>
  226. </el-col>
  227. </el-row>
  228. </div>
  229. <div slot="footer" class="dialog-footer">
  230. <el-button @click="detailVisible = false">关闭</el-button>
  231. </div>
  232. </el-dialog>
  233. <!-- 回复列表对话框 -->
  234. <el-dialog
  235. title="回复列表"
  236. :visible.sync="replyListVisible"
  237. width="1000px"
  238. append-to-body
  239. :close-on-click-modal="false"
  240. :destroy-on-close="true"
  241. class="reply-list-dialog"
  242. >
  243. <div class="reply-list-header">
  244. <el-button
  245. type="primary"
  246. size="small"
  247. icon="el-icon-plus"
  248. v-if="currentComplaintStatus !== COMPLAINT_STATUS.CLOSED && currentComplaintStatus !== COMPLAINT_STATUS.CANCELLED"
  249. @click="handleAddReply"
  250. >
  251. 新增回复
  252. </el-button>
  253. </div>
  254. <el-table
  255. :data="replyList"
  256. v-loading="replyListLoading"
  257. border
  258. stripe
  259. style="margin-top: 15px;"
  260. >
  261. <el-table-column label="回复类型" width="100" align="center">
  262. <template slot-scope="scope">
  263. <el-tag
  264. :type="getReplyTypeType(scope.row.replyType)"
  265. size="small"
  266. >
  267. {{ getReplyTypeLabel(scope.row.replyType) }}
  268. </el-tag>
  269. </template>
  270. </el-table-column>
  271. <el-table-column label="回复内容" prop="replyContent" min-width="300">
  272. <template slot-scope="scope">
  273. <div class="reply-content">
  274. {{ scope.row.replyContent }}
  275. </div>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="回复人" prop="replierName" width="120" align="center"></el-table-column>
  279. <el-table-column label="回复时间" prop="replyTime" width="160" align="center"></el-table-column>
  280. <el-table-column label="创建时间" prop="createTime" width="160" align="center"></el-table-column>
  281. </el-table>
  282. <el-pagination
  283. v-if="replyTotal > 0"
  284. @size-change="handleReplyPageSizeChange"
  285. @current-change="handleReplyPageChange"
  286. :current-page="replyPage.current"
  287. :page-sizes="[10, 20, 50, 100]"
  288. :page-size="replyPage.size"
  289. layout="total, sizes, prev, pager, next, jumper"
  290. :total="replyTotal"
  291. style="margin-top: 15px; text-align: right;"
  292. >
  293. </el-pagination>
  294. <div slot="footer" class="dialog-footer">
  295. <el-button @click="replyListVisible = false">关闭</el-button>
  296. </div>
  297. </el-dialog>
  298. <!-- 新增回复对话框 -->
  299. <el-dialog
  300. title="新增回复"
  301. :visible.sync="addReplyVisible"
  302. width="600px"
  303. append-to-body
  304. :close-on-click-modal="false"
  305. :destroy-on-close="true"
  306. >
  307. <el-form
  308. :model="replyForm"
  309. :rules="replyRules"
  310. ref="replyForm"
  311. label-width="100px"
  312. >
  313. <el-form-item label="回复类型" prop="replyType">
  314. <el-select v-model="replyForm.replyType" placeholder="请选择回复类型" style="width: 100%">
  315. <el-option
  316. v-for="item in replyTypeOptions"
  317. :key="item.value"
  318. :label="item.label"
  319. :value="item.value"
  320. ></el-option>
  321. </el-select>
  322. </el-form-item>
  323. <el-form-item label="回复内容" prop="replyContent">
  324. <el-input
  325. type="textarea"
  326. :rows="5"
  327. v-model="replyForm.replyContent"
  328. placeholder="请输入回复内容"
  329. maxlength="1000"
  330. show-word-limit
  331. ></el-input>
  332. </el-form-item>
  333. <el-form-item label="附件URL" prop="replyAttachUrl">
  334. <el-input
  335. v-model="replyForm.replyAttachUrl"
  336. placeholder="请输入附件URL(可选)"
  337. ></el-input>
  338. </el-form-item>
  339. </el-form>
  340. <div slot="footer" class="dialog-footer">
  341. <el-button @click="addReplyVisible = false">取消</el-button>
  342. <el-button type="primary" @click="confirmAddReply" :loading="addReplyLoading">确定</el-button>
  343. </div>
  344. </el-dialog>
  345. <!-- 状态处理对话框 -->
  346. <el-dialog
  347. :title="statusDialogTitle"
  348. :visible.sync="statusVisible"
  349. append-to-body
  350. width="500px"
  351. :close-on-click-modal="false"
  352. >
  353. <el-form :model="statusForm" :rules="statusRules" ref="statusForm" label-width="100px">
  354. <el-form-item label="新状态" prop="status">
  355. <el-select v-model="statusForm.status" placeholder="请选择状态" style="width: 100%">
  356. <el-option label="待处理" :value="0"></el-option>
  357. <el-option label="处理中" :value="1"></el-option>
  358. <el-option label="已回复" :value="2"></el-option>
  359. <el-option label="已关闭" :value="3"></el-option>
  360. </el-select>
  361. </el-form-item>
  362. <el-form-item label="关闭原因" prop="closeReason" v-if="statusForm.status === COMPLAINT_STATUS.CLOSED">
  363. <el-input
  364. type="textarea"
  365. :rows="3"
  366. v-model="statusForm.closeReason"
  367. placeholder="请输入关闭原因"
  368. ></el-input>
  369. </el-form-item>
  370. </el-form>
  371. <div slot="footer" class="dialog-footer">
  372. <el-button @click="statusVisible = false">取消</el-button>
  373. <el-button type="primary" @click="confirmStatusUpdate" :loading="statusLoading">确定</el-button>
  374. </div>
  375. </el-dialog>
  376. </basic-container>
  377. </template>
  378. <script>
  379. import complaintMixin from './complaintMixin';
  380. export default {
  381. mixins: [complaintMixin],
  382. }
  383. </script>
  384. <style lang="scss" scoped>
  385. .complaint-detail {
  386. .detail-item {
  387. margin-bottom: 15px;
  388. label {
  389. font-weight: bold;
  390. color: #606266;
  391. margin-right: 10px;
  392. }
  393. .content-text {
  394. margin-top: 5px;
  395. padding: 10px;
  396. background-color: #f5f7fa;
  397. border-radius: 4px;
  398. line-height: 1.6;
  399. white-space: pre-wrap;
  400. }
  401. }
  402. }
  403. .reply-list-dialog {
  404. .reply-list-header {
  405. display: flex;
  406. justify-content: flex-end;
  407. margin-bottom: 10px;
  408. }
  409. .reply-content {
  410. word-break: break-word;
  411. line-height: 1.5;
  412. max-height: 100px;
  413. overflow-y: auto;
  414. }
  415. .el-table {
  416. font-size: 14px;
  417. .el-table__cell {
  418. padding: 12px 0;
  419. }
  420. }
  421. }
  422. ::v-deep .el-col-md-8 {
  423. width: 24.33333%;
  424. }
  425. </style>