reporting_list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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-popconfirm
  62. confirm-button-text="删除"
  63. cancel-button-text="不删除"
  64. @confirm="() => deleteBL(scope)"
  65. title="是否删除该报料?"
  66. >
  67. <template #reference>
  68. <el-button link type="danger" size="small"> 删除 </el-button>
  69. </template>
  70. </el-popconfirm>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <el-dialog v-model="reportingDetail" title="报料详情" width="30%">
  75. <div style="overflow-y: auto">
  76. <el-row>
  77. <el-col :span="5">联系方式:</el-col>
  78. <el-col :span="19">
  79. <div v-text="reportingDetailData.row.phone"></div>
  80. </el-col>
  81. </el-row>
  82. <el-row>
  83. <el-col :span="5">上报地址:</el-col>
  84. <el-col :span="19">
  85. <div v-text="reportingDetailData.row.address"></div>
  86. </el-col>
  87. </el-row>
  88. <el-row>
  89. <el-col :span="5">报料详情:</el-col>
  90. <el-col :span="19">
  91. <div
  92. v-for="(v, i) in reportingDetailData.row.clueInfos"
  93. :key="i"
  94. style="padding: 10px 0; position: relative;padding-right: 112px;"
  95. >
  96. <span v-if="v.type == 0" v-text="v.materialUrl"></span>
  97. <img
  98. v-if="v.type == 1"
  99. :src="v.localUrl"
  100. alt="图片丢失"
  101. style="width: 80px"
  102. />
  103. <small
  104. style="
  105. color: #999;
  106. position: absolute;
  107. right: 0;
  108. top: 50%;
  109. transform: translateY(-50%);
  110. "
  111. v-text="format(v.addTime)"
  112. ></small>
  113. </div>
  114. </el-col>
  115. </el-row>
  116. <el-row
  117. v-if="
  118. reportingDetailData.row.clueReplies &&
  119. reportingDetailData.row.clueReplies.length
  120. "
  121. >
  122. <el-col :span="5">回复内容:</el-col>
  123. <el-col :span="19">
  124. <div v-text="reportingDetailData.row.clueReplies[0].content"></div>
  125. </el-col>
  126. </el-row>
  127. </div>
  128. </el-dialog>
  129. <el-dialog v-model="reportingReplyStatus" title="回复" width="30%">
  130. <el-row>
  131. <el-col :span="5">报料内容:</el-col>
  132. <el-col :span="19">
  133. <div
  134. v-for="(v, i) in reportingDetailData.row.clueInfos"
  135. :key="i"
  136. style="padding: 2px 0; position: relative;padding-right: 112px;"
  137. >
  138. <span v-if="v.type == 0" v-text="v.materialUrl"></span>
  139. <img
  140. v-if="v.type == 1"
  141. :src="v.localUrl"
  142. alt="图片丢失"
  143. style="width: 80px"
  144. />
  145. <small
  146. style="
  147. color: #999;
  148. position: absolute;
  149. right: 0;
  150. top: 50%;
  151. transform: translateY(-50%);
  152. "
  153. v-text="format(v.addTime)"
  154. ></small>
  155. </div>
  156. </el-col>
  157. </el-row>
  158. <br />
  159. <el-row>
  160. <el-col :span="5">回复内容:</el-col>
  161. <el-col :span="19">
  162. <el-input
  163. v-model="reportingDetailData.row.reply"
  164. :rows="2"
  165. type="textarea"
  166. placeholder="请输入回复内容"
  167. />
  168. </el-col>
  169. </el-row>
  170. <template #footer>
  171. <span class="dialog-footer">
  172. <el-button type="primary" @click="replySave"> 确定 </el-button>
  173. </span>
  174. </template>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script setup>
  179. import { ref, defineExpose, defineEmits } from 'vue';
  180. // import { useRouter } from 'vue-router';
  181. import dayjs from 'dayjs';
  182. import { ElMessage } from 'element-plus';
  183. import {
  184. getreporting,
  185. delreporting,
  186. getreportingDetail,
  187. reportingShenhe,
  188. reportingReply,
  189. } from '../../../api/index';
  190. let T = undefined;
  191. let total = -1;
  192. // const router = useRouter();
  193. const listTable = ref([]);
  194. const reportingDetail = ref(false);
  195. const reportingReplyStatus = ref(false);
  196. const reportingDetailData = ref({});
  197. const source = ['热线电话', '微信公众号', 'app', '小程序'];
  198. const replyFlag = ['未回复', '已回复'];
  199. const emit = defineEmits(['setTotal']);
  200. const format = value => {
  201. return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
  202. };
  203. // const toDetail = item => {
  204. // router.push({
  205. // path: '/analysis_detail',
  206. // query: {
  207. // detail: JSON.stringify(item),
  208. // },
  209. // });
  210. // };
  211. const getlist = search => {
  212. if (search.page === 1) {
  213. listTable.value = [];
  214. total = -1;
  215. } else if ((search.page - 1) * search.pageSize >= total) return;
  216. if (T) T = window.clearTimeout(T);
  217. T = window.setTimeout(() => {
  218. getreporting({
  219. data: search,
  220. })
  221. .then(res => {
  222. listTable.value = res.records || [];
  223. total = res.total || 0;
  224. emit('setTotal', total);
  225. if (T) T = window.clearTimeout(T);
  226. })
  227. .catch(() => {
  228. if (T) T = window.clearTimeout(T);
  229. });
  230. }, 200);
  231. };
  232. const deleteBL = item => {
  233. delreporting({ data: { id: item.row.id } }).then(() => {
  234. ElMessage({
  235. type: 'success',
  236. message: '删除成功',
  237. });
  238. listTable.value.splice(item.$index, 1);
  239. });
  240. };
  241. const lookBL = item => {
  242. getreportingDetail({ data: { id: item.row.id } }).then(res => {
  243. reportingDetail.value = true;
  244. reportingDetailData.value.row = res;
  245. });
  246. };
  247. const replyBL = item => {
  248. getreportingDetail({ data: { id: item.row.id } }).then(res => {
  249. reportingReplyStatus.value = true;
  250. reportingDetailData.value.row = res;
  251. reportingDetailData.value.$index = item.$index;
  252. });
  253. };
  254. const replySave = () => {
  255. reportingReplyStatus.value = false;
  256. reportingReply({
  257. data: {
  258. clueId: reportingDetailData.value.row.id,
  259. content: reportingDetailData.value.row.reply || '',
  260. userName: reportingReplyStatus.value.author || '',
  261. },
  262. }).then(() => {
  263. listTable.value[reportingDetailData.value.$index].replyFlag = 1;
  264. });
  265. };
  266. const confirm = item => {
  267. reportingShenhe({ data: { id: item.row.id, status: 1 } }).then(() => {
  268. ElMessage({
  269. type: 'success',
  270. message: '审核通过',
  271. });
  272. listTable.value[item.$index].status = 1;
  273. });
  274. };
  275. const cancel = item => {
  276. reportingShenhe({ data: { id: item.row.id, status: -1 } }).then(() => {
  277. ElMessage({
  278. type: 'success',
  279. message: '拒绝通过',
  280. });
  281. listTable.value[item.$index].status = -1;
  282. });
  283. };
  284. defineExpose({
  285. getlist,
  286. });
  287. </script>
  288. <style scoped>
  289. .mainTitle {
  290. padding: 0 20px;
  291. position: relative;
  292. line-height: 60px;
  293. border-bottom: 1px solid #f5f5f5;
  294. }
  295. .lists {
  296. padding: 0.5em;
  297. }
  298. .list {
  299. border-radius: 5px;
  300. padding: 0.5em;
  301. cursor: pointer;
  302. line-height: 1.8em;
  303. font-size: 14px;
  304. }
  305. .list:hover {
  306. background-color: rgba(64, 158, 255, 0.1);
  307. }
  308. .list:not(:last-child) {
  309. border-bottom: 1px dashed #b9c0d3;
  310. }
  311. </style>
  312. <style>
  313. .lists .el-row {
  314. line-height: 2em;
  315. }
  316. </style>