ncomplaintListDeal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div class="mainBox">
  3. <!--搜索功能 start------------------------------------------------------------>
  4. <div class="layerBox_search">
  5. <div class="layerBoxLine">
  6. <el-row>
  7. <el-col :span="6">
  8. <div class="searchBox">
  9. <div class="searchTitle">投诉主题:</div>
  10. <el-input placeholder="请输入投诉主题" autocomplete="off" v-model="getApiData.title" />
  11. </div>
  12. </el-col>
  13. <el-col :span="6">
  14. <div class="searchBox">
  15. <div class="searchTitle">投诉类型:</div>
  16. <el-input placeholder="请输入投诉类型" autocomplete="off" v-model="getApiData.title" />
  17. </div>
  18. </el-col>
  19. <el-col :span="6">
  20. <div class="searchBox">
  21. <div class="searchTitle">处理状态:</div>
  22. <el-select v-model="getApiData.deal" placeholder="请处理状态..">
  23. <el-option label="未处理" value="1"></el-option>
  24. <el-option label="处理中" value="2"></el-option>
  25. <el-option label="已完结" value="3"></el-option>
  26. <el-option label="不予处理" value="4"></el-option>
  27. </el-select>
  28. </div>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. </div>
  33. <div class="layerBoxNoBg">
  34. <div>
  35. <el-button type="primary" @click="goCreat">发布投诉举报</el-button>
  36. </div>
  37. <div>
  38. <el-button @click="clearSearchList">重置</el-button>
  39. <el-button type="primary" @click="getData('search')">搜索</el-button>
  40. </div>
  41. </div>
  42. <!--搜索功能 end------------------------------------------------------------>
  43. <!--表格内容 start------------------------------------------------------------>
  44. <div class="layerBox">
  45. <tableTitle :name="tableDivTitle" />
  46. <el-row>
  47. <template>
  48. <el-table :data="tableData" style="width: 100%">
  49. <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
  50. <el-table-column prop="title" label="投诉主题" width="">
  51. </el-table-column>
  52. <el-table-column prop="department_name" label="投诉类型" width="">
  53. </el-table-column>
  54. <el-table-column prop="cityname" label="接收人" width="">
  55. </el-table-column>
  56. <el-table-column prop="status" label="审核状态" width="">
  57. <template slot-scope="scope">
  58. <span v-if="scope.row.status == 1">
  59. 未审核
  60. </span>
  61. <span v-if="scope.row.status == 2">
  62. 已审核
  63. </span>
  64. <span v-if="scope.row.status == 3">
  65. 已拒绝
  66. </span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="deal" label="处理状态" width="">
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.deal == 1">
  72. 未处理
  73. </span>
  74. <span v-if="scope.row.deal == 2">
  75. 处理中
  76. </span>
  77. <span v-if="scope.row.deal == 3">
  78. 已完结
  79. </span>
  80. <span v-if="scope.row.deal == 4">
  81. 不予处理
  82. </span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column prop="start" label="投诉时间" width="">
  86. </el-table-column>
  87. <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
  88. <el-table-column fixed="right" label="操作" width="400" header-align="center">
  89. <template slot-scope="scope">
  90. <div class="listBtnBox">
  91. <div class="listMainBtn" v-if="scope.row.deal == 1" @click="getUpRow(scope.row.id, tableData)"><i
  92. class="el-icon-check"></i>处理
  93. </div>
  94. <div class="listMainBtn" v-if="scope.row.deal == 2" @click="setOverRow(scope.row.id, tableData)"><i
  95. class="el-icon-check"></i>完结
  96. </div>
  97. <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
  98. class="el-icon-edit-outline"></i>编辑</div>
  99. </div>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. </template>
  104. </el-row>
  105. </div>
  106. <!--分页 start------------------------------------------------------------>
  107. <div class="alignBox">
  108. <el-row>
  109. <el-col :span="24">
  110. <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page"
  111. @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
  112. :total="allCount"></el-pagination>
  113. </el-col>
  114. </el-row>
  115. </div>
  116. <!--分页 end------------------------------------------------------------>
  117. <!--弹出框1:外部表单弹出框 start------------------------------------------------------------>
  118. <el-dialog title="请输入驳回理由" :visible.sync="examineWindow" :close-on-click-modal="false">
  119. <el-form :model="form" ref="form" :rules="formRules" label-position="left">
  120. <div class="formDiv">
  121. <el-form-item label="驳回原因:" :label-width="formLabelWidth" prop="reason" class="custom-align-right">
  122. <el-input type="textarea" v-model="form.reason" class="custom-textarea" placeholder="请输入驳回原因"
  123. :rows="3"></el-input>
  124. </el-form-item>
  125. </div>
  126. </el-form>
  127. <div slot="footer" class="dialog-footer">
  128. <div>
  129. <el-button type="info" @click="examineWindow = false">取消</el-button>
  130. <el-button type="primary" @click="examineToServe">确定</el-button>
  131. </div>
  132. </div>
  133. </el-dialog>
  134. <!--弹出框1:外部表单弹出框 end------------------------------------------------------------>
  135. <!--表格内容 end------------------------------------------------------------>
  136. </div>
  137. </template>
  138. <script>
  139. //表格标题
  140. import tableTitle from './components/tableTitle';
  141. //获得用户身份
  142. import { getUseType } from '@/utils/auth'
  143. //引入公用样式
  144. import '@/styles/global.less';
  145. export default {
  146. components: {
  147. tableTitle,//表格标题
  148. },
  149. data() {
  150. return {
  151. //1.列表和分页相关 start ------------------------------------------------------------>
  152. tableDivTitle: "投诉列表",
  153. tableData: [],//内容
  154. editId: 0,//要修改的网站id
  155. examineWindow: false,//审核窗口
  156. //提交驳回
  157. formLabelWidth: '80px',//表单的长度
  158. type_id: 0,//用户身份
  159. user_id: this.$store.state.user.userid,
  160. form: {
  161. reason: ""
  162. },
  163. formRules: {
  164. },
  165. getApiData: {
  166. name: "",//标题
  167. category_name: "",//导航池id
  168. website_name: "",//网站名称
  169. type_id: "",//发布类型
  170. status: 2,//审核状态
  171. deal_user: 1,//处理状态
  172. page: 1,//当前是第几页
  173. page_size: 10,//一共多少条
  174. },
  175. allCount: 0,//总条数
  176. //分页相关 end ------------------------------------------------------------>
  177. }
  178. },
  179. methods: {
  180. //提交驳回内容
  181. examineToServe(id) {
  182. this.$refs.form.validate(valid => {
  183. if (valid) {
  184. let data = {
  185. id: this.editId,
  186. status: 2,//驳回status
  187. deal: 4,//处理状态
  188. deal_reason: this.form.reason
  189. }
  190. this.$store.dispatch('news/updateComplaintStatus', data).then(res => {
  191. if (res.code == 200) {
  192. this.$message({
  193. type: 'success',
  194. message: '操作成功!'
  195. });
  196. this.getData();
  197. this.form.reason = "";//清空上一次的输入
  198. this.examineWindow = false;
  199. }
  200. })
  201. } else {
  202. this.$message.error("驳回理由不能为空!")
  203. }
  204. })
  205. },
  206. getUpRow(id) {
  207. //设置待审核的id
  208. this.editId = id;
  209. console.log(id)
  210. this.$confirm('您将处理此投诉举报吗?', '提示', {
  211. confirmButtonText: '处理',
  212. cancelButtonText: '拒绝',
  213. distinguishCancelAndClose: true, // 关键配置项
  214. type: 'warning'
  215. }).then(() => {
  216. this.upRow(id, 2, 2)
  217. }).catch((the_reback) => {
  218. if (the_reback == "cancel") {
  219. //输入驳回理由
  220. // console.log("驳回" )
  221. this.examineWindow = true;
  222. }
  223. })
  224. },
  225. setOverRow(id) {
  226. //设置待审核的id
  227. this.editId = id;
  228. console.log(id)
  229. this.$confirm('您将完结此投诉举报吗?', '提示', {
  230. confirmButtonText: '完结',
  231. distinguishCancelAndClose: true, // 关键配置项
  232. type: 'warning'
  233. }).then(() => {
  234. this.upRow(id, 3, 2)
  235. }).catch((the_reback) => {
  236. if (the_reback == "cancel") {
  237. // //输入驳回理由
  238. // // console.log("驳回" )
  239. // this.examineWindow = true;
  240. }
  241. })
  242. },
  243. upRow(id, deal, status) {
  244. let data = {
  245. id: id,
  246. deal: deal,
  247. status: status
  248. }
  249. this.$store.dispatch('news/updateComplaintStatus', data).then(res => {
  250. if (res.code == 200) {
  251. this.$message({
  252. type: 'success',
  253. message: '投诉举报处理状态已修改!'
  254. });
  255. this.getData();
  256. }
  257. }).catch(() => {
  258. this.$message({
  259. type: 'warning',
  260. message: '已取消删除'
  261. });
  262. });
  263. },
  264. //1.列表和分页相关 start ------------------------------------------------------------>
  265. //1.1 开始请求列表信息方法
  266. getData(type) {
  267. if (type == "search") {
  268. this.getApiData.page = 1;
  269. }
  270. console.log(this.getApiData, '---1--')
  271. this.$store.dispatch('news/getComplaintList', this.getApiData).then(res => {
  272. console.log(this.getApiData, '---2-')
  273. let data = [];
  274. for (let item of res.data.rows) {
  275. data.push(item)
  276. }
  277. this.tableData = res.data.rows; //给与内容
  278. this.allCount = res.data.count; //给与总条数
  279. })
  280. },
  281. //1.2 删除内容
  282. deleteRow(id) {
  283. this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
  284. confirmButtonText: '确定',
  285. cancelButtonText: '取消',
  286. type: 'warning'
  287. }).then(() => {
  288. console.log("当前删除:" + id)
  289. this.$store.dispatch('news/deleteComplaint', { id: id }).then(res => {
  290. this.getData();
  291. this.$message({
  292. type: 'success',
  293. message: '删除成功!'
  294. });
  295. }).catch(() => {
  296. this.$message({
  297. type: 'warning',
  298. message: '网络错误,请重试!'
  299. });
  300. })
  301. }).catch(() => {
  302. this.$message({
  303. type: 'warning',
  304. message: '已取消删除'
  305. });
  306. });
  307. },
  308. //1.3 修改网站状态
  309. //1.4 列表内容分页
  310. //直接跳转
  311. handleSizeChange(val) {
  312. this.getApiData.page = val;
  313. this.getData();
  314. },
  315. //1.5 点击分页
  316. handleCurrentChange(val) {
  317. this.getApiData.page = val;
  318. this.getData();
  319. },
  320. //1.6 重置按钮
  321. clearSearchList() {
  322. this.tableData = [];
  323. this.getApiData.title = "";
  324. this.getApiData.level = "";
  325. this.getApiData.page = 1;
  326. this.getApiData.pageSize = 10;
  327. this.getData();
  328. },
  329. //列表和分页相关 end ------------------------------------------------------------>
  330. //2.添加新闻 start ------------------------------------------------------------>
  331. //跳转到投诉举报发布页面
  332. goCreat() {
  333. this.$router.push({
  334. path: '/addNComplaint',
  335. });
  336. },
  337. goEdit(id) {
  338. let data = {
  339. id: id,
  340. read: 1
  341. }
  342. this.$router.push({
  343. path: '/addNComplaint',
  344. query: data
  345. });
  346. }
  347. //添加新闻 end ------------------------------------------------------------>
  348. },
  349. mounted() {
  350. this.type_id = getUseType()
  351. //1.获得初始数据
  352. this.getData();
  353. }
  354. }
  355. </script>
  356. <style scoped lang="less"></style>