reporting_list.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <div class="mainTitle">文章列表</div>
  3. <br />
  4. <div class="lists">
  5. <!-- @click="() => toDetail(item)" -->
  6. <el-table :data="listTable" style="width: 100%">
  7. <el-table-column prop="title" label="标题" width="450px" />
  8. <el-table-column prop="phone" label="用户名" />
  9. <el-table-column prop="source" label="来源">
  10. <template #default="scope">
  11. {{ source[scope.row.source - 1] }}
  12. </template>
  13. </el-table-column>
  14. <el-table-column prop="" label="回复状态">
  15. <template #default="scope">
  16. {{ replyFlag[scope.row.replyFlag] }}
  17. </template>
  18. </el-table-column>
  19. <el-table-column prop="createTime" label="更新时间">
  20. <template #default="scope">
  21. {{ format(scope.row.createTime) }}
  22. </template>
  23. </el-table-column>
  24. <el-table-column prop="modifyTime" label="推送时间">
  25. <template #default="scope">
  26. {{ format(scope.row.modifyTime) }}
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="clueInfoCount" label="数量" />
  30. <el-table-column prop="" label="操作" width="200px">
  31. <template #default="scope">
  32. <el-popconfirm
  33. v-if="scope.row.status === 0"
  34. confirm-button-text="通过"
  35. cancel-button-text="不通过"
  36. @confirm="() => confirm(scope)"
  37. @cancel="() => cancel(scope)"
  38. title="是否通过该报料?"
  39. >
  40. <template #reference>
  41. <el-button link type="primary" size="small">审核</el-button>
  42. </template>
  43. </el-popconfirm>
  44. <el-button
  45. link
  46. type="primary"
  47. size="small"
  48. @click="() => lookBL(scope)"
  49. >
  50. 查看
  51. </el-button>
  52. <el-button
  53. link
  54. v-if="scope.row.replyFlag != 1"
  55. type="primary"
  56. size="small"
  57. @click="() => replyBL(scope)"
  58. >
  59. 回复
  60. </el-button>
  61. <el-button
  62. link
  63. type="danger"
  64. size="small"
  65. @click="() => deleteBL(scope)"
  66. >
  67. 删除
  68. </el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <el-dialog v-model="reportingDetail" title="报料详情" width="30%">
  73. <el-row>
  74. <el-col :span="5">联系方式:</el-col>
  75. <el-col :span="19">
  76. <div v-text="reportingDetailData.row.phone"></div>
  77. </el-col>
  78. </el-row>
  79. <el-row>
  80. <el-col :span="5">上报地址:</el-col>
  81. <el-col :span="19">
  82. <div v-text="reportingDetailData.row.address"></div>
  83. </el-col>
  84. </el-row>
  85. <el-row>
  86. <el-col :span="5">报料详情:</el-col>
  87. <el-col :span="19">
  88. <div v-text="reportingDetailData.row.content"></div>
  89. </el-col>
  90. </el-row>
  91. </el-dialog>
  92. <el-dialog v-model="reportingReplyStatus" title="回复" width="30%">
  93. <el-row>
  94. <el-col :span="5">报料内容:</el-col>
  95. <el-col :span="19">
  96. <div v-text="reportingDetailData.row.content"></div>
  97. </el-col>
  98. </el-row>
  99. <br />
  100. <el-row>
  101. <el-col :span="5">回复内容:</el-col>
  102. <el-col :span="19">
  103. <el-input
  104. v-model="reportingDetailData.row.reply"
  105. :rows="2"
  106. type="textarea"
  107. placeholder="请输入回复内容"
  108. />
  109. </el-col>
  110. </el-row>
  111. <template #footer>
  112. <span class="dialog-footer">
  113. <el-button type="primary" @click="replySave"> 确定 </el-button>
  114. </span>
  115. </template>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script setup>
  120. import { ref, defineExpose, defineEmits } from 'vue';
  121. // import { useRouter } from 'vue-router';
  122. import dayjs from 'dayjs';
  123. import { ElMessage } from 'element-plus';
  124. import {
  125. getreporting,
  126. delreporting,
  127. getreportingDetail,
  128. reportingShenhe,
  129. reportingReply,
  130. } from '../../../api/index';
  131. let T = undefined;
  132. let total = -1;
  133. // const router = useRouter();
  134. const listTable = ref([]);
  135. const reportingDetail = ref(false);
  136. const reportingReplyStatus = ref(false);
  137. const reportingDetailData = ref({});
  138. const source = ['热线电话', '微信公众号', 'app', '小程序'];
  139. const replyFlag = ['未回复', '已回复'];
  140. const emit = defineEmits(['setTotal']);
  141. const format = value => {
  142. return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
  143. };
  144. // const toDetail = item => {
  145. // router.push({
  146. // path: '/analysis_detail',
  147. // query: {
  148. // detail: JSON.stringify(item),
  149. // },
  150. // });
  151. // };
  152. const getlist = search => {
  153. if (search.page === 1) {
  154. listTable.value = [];
  155. total = -1;
  156. } else if ((search.page - 1) * search.pageSize >= total) return;
  157. if (T) T = window.clearTimeout(T);
  158. T = window.setTimeout(() => {
  159. getreporting({
  160. data: search,
  161. })
  162. .then(res => {
  163. listTable.value = res.records || [];
  164. total = res.total || 0;
  165. emit('setTotal', total);
  166. if (T) T = window.clearTimeout(T);
  167. })
  168. .catch(() => {
  169. if (T) T = window.clearTimeout(T);
  170. });
  171. }, 200);
  172. };
  173. const deleteBL = item => {
  174. delreporting({ data: { id: item.row.id } }).then(() => {
  175. ElMessage({
  176. type: 'success',
  177. message: '删除成功',
  178. });
  179. });
  180. };
  181. const lookBL = item => {
  182. getreportingDetail({ data: { id: item.row.id } }).then(res => {
  183. reportingDetail.value = true;
  184. reportingDetailData.value.row = res;
  185. });
  186. };
  187. const replyBL = item => {
  188. reportingReplyStatus.value = true;
  189. reportingDetailData.value = item;
  190. };
  191. const replySave = () => {
  192. reportingReplyStatus.value = false;
  193. reportingReply({
  194. data: {
  195. clueId: reportingDetailData.value.row.id,
  196. content: reportingDetailData.value.row.reply || '',
  197. userName: reportingReplyStatus.value.author || '',
  198. },
  199. }).then(() => {
  200. listTable.value[reportingDetailData.value.$index].replyFlag = 1;
  201. });
  202. };
  203. const confirm = item => {
  204. reportingShenhe({ data: { id: item.row.id, status: 1 } }).then(() => {
  205. ElMessage({
  206. type: 'success',
  207. message: '审核通过',
  208. });
  209. listTable.value[item.$index].status = 1;
  210. });
  211. };
  212. const cancel = item => {
  213. reportingShenhe({ data: { id: item.row.id, status: -1 } }).then(() => {
  214. ElMessage({
  215. type: 'success',
  216. message: '拒绝通过',
  217. });
  218. listTable.value[item.$index].status = -1;
  219. });
  220. };
  221. defineExpose({
  222. getlist,
  223. });
  224. </script>
  225. <style scoped>
  226. .mainTitle {
  227. padding: 0 20px;
  228. position: relative;
  229. line-height: 60px;
  230. border-bottom: 1px solid #f5f5f5;
  231. }
  232. .lists {
  233. padding: 0.5em;
  234. }
  235. .list {
  236. border-radius: 5px;
  237. padding: 0.5em;
  238. cursor: pointer;
  239. line-height: 1.8em;
  240. font-size: 16px;
  241. }
  242. .list:hover {
  243. background-color: rgba(64, 158, 255, 0.1);
  244. }
  245. .list:not(:last-child) {
  246. border-bottom: 1px dashed #b9c0d3;
  247. }
  248. .el-row {
  249. line-height: 1.5em;
  250. }
  251. </style>