topicList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <div class="mainBox">
  3. <!--搜索功能 start------------------------------------------------------------>
  4. <div class="layerBox_search">
  5. <div class="layerBoxLine">
  6. <el-row>
  7. <el-col :span="8">
  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="15">
  14. <div class="tag_webSite_head_btn_box">
  15. <div class="searchTitle"><span></span></div>
  16. <el-button type="primary" @click="getData('search')">搜索</el-button>
  17. <el-button type="info" @click="clearSearchList">重置</el-button>
  18. </div>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. </div>
  23. <div class="layerBoxNoBg">
  24. <div>
  25. <el-button type="primary" @click="gotoCreat">发布选题</el-button>
  26. </div>
  27. </div>
  28. <!--搜索功能 end------------------------------------------------------------>
  29. <!--表格内容 start------------------------------------------------------------>
  30. <div class="layerBox">
  31. <tableTitle :name="tableDivTitle" />
  32. <el-row>
  33. <template>
  34. <el-table :data="tableData" style="width: 100%">
  35. <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
  36. <el-table-column prop="title" label="调研标题" width="400"></el-table-column>
  37. <el-table-column prop="nickname" label="申报人" >
  38. <template slot-scope="scope">
  39. <span v-if="scope.row.real_name!=''">{{ scope.row.real_name }}</span>
  40. <span v-else>{{ scope.row.user_name }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="txry_users" label="同行人" ></el-table-column>
  44. <el-table-column prop="updated_at" label="修改时间" ></el-table-column>
  45. <el-table-column prop="status" label="状态" width="100">
  46. <template slot-scope="scope">
  47. <span v-if="scope.row.status == 0" class="status0">待审核</span>
  48. <span v-if="scope.row.status == 1" class="status1">已通过</span>
  49. <span v-if="scope.row.status == 2" class="status2">已拒绝</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column fixed="right" label="操作" width="350" header-align="center">
  53. <template slot-scope="scope">
  54. <div class="listBtnBox">
  55. <div class="listDeleteBtn" @click="deleteData(scope.row.id)">
  56. <i class="el-icon-delete"></i>删除
  57. </div>
  58. <div class="listUpBtn" @click="upData(scope.row.id)">
  59. <i class="el-icon-refresh-left"></i>撤回
  60. </div>
  61. <!--非管理员且该留言已通过申请,则无法再次编辑-->
  62. <div class="listMainBtn" @click="getDataMain(scope.row.id)" v-if="scope.row.is_update == 0">
  63. <i class="el-icon-view"></i>查看
  64. </div>
  65. <div class="listEditBtn" @click="gotoEdit(scope.row.id)" v-if="scope.row.is_update == 1">
  66. <i class="el-icon-edit-outline"></i>编辑
  67. </div>
  68. <!-- <div class="listEditBtn" @click="gotoEdit(scope.row.id)" v-if="creatNews_user_type == 10000">
  69. <i class="el-icon-edit-outline"></i>编辑
  70. </div> -->
  71. </div>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. </template>
  76. </el-row>
  77. </div>
  78. <div class="alignBox">
  79. <el-row>
  80. <el-col :span="24">
  81. <el-pagination
  82. :current-page="getApiData.page" @size-change="handleSizeChange"
  83. @current-change="handleCurrentChange"
  84. :page-size="10"
  85. layout="total, prev, pager, next, jumper"
  86. :total="allCount">
  87. </el-pagination>
  88. </el-col>
  89. </el-row>
  90. </div>
  91. <!--表格内容 end------------------------------------------------------------>
  92. </div>
  93. </template>
  94. <script>
  95. //获得用户身份
  96. import { getWebSiteId, getUseType } from '@/utils/auth'
  97. //表格标题
  98. import tableTitle from './components/tableTitle';
  99. //引入公用样式
  100. import '@/styles/global.less';
  101. export default {
  102. components: {
  103. tableTitle,//表格标题
  104. },
  105. data() {
  106. //0.全局操作 start ------------------------------------------------------------>
  107. let self = this;
  108. //0.全局操作 end ------------------------------------------------------------>
  109. return {
  110. //1.列表和分页相关 start ------------------------------------------------------------>
  111. tableDivTitle: "选题列表",
  112. tableData: [],//内容
  113. getApiData: {
  114. //website_id:0,//站点id
  115. is_master: 1,//是否审核列表 0:全部 1:已审核;2:已拒绝;3:未审核;
  116. title: "",//留言标题
  117. page: 1,//当前是第几页
  118. page_size: 10,//一共多少条
  119. due_time:"",//结束时间
  120. },
  121. allCount: 0,//总条数
  122. //分页相关 end ------------------------------------------------------------>
  123. //用户身份
  124. creatNews_user_type:0
  125. }
  126. },
  127. methods: {
  128. //1.列表和分页相关 start ------------------------------------------------------------>
  129. //1.1 开始请求列表信息方法
  130. getData(type) {
  131. //如果是搜索,重新加载第一页==搜索
  132. if (type == "search") {
  133. this.getApiData.page = 1;
  134. }
  135. this.$store.dispatch('news/getResearchTopicList', this.getApiData).then(res => {
  136. //列表
  137. this.tableData = res.data.rows;
  138. //页数
  139. this.allCount = res.data.count;
  140. }).catch(() => {
  141. this.$message({
  142. type: 'info',
  143. message: '网络错误,请重试!'
  144. });
  145. })
  146. },
  147. //1.2 删除内容
  148. deleteData(id) {
  149. this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
  150. confirmButtonText: '确定',
  151. cancelButtonText: '取消',
  152. type: 'warning'
  153. }).then(() => {
  154. console.log("当前删除:" + id)
  155. this.$store.dispatch('news/delResearchTopic', {id:id}).then(res => {
  156. if(res.code == 200) {
  157. this.$message({
  158. type: 'success',
  159. message: '删除成功!'
  160. });
  161. } else {
  162. this.$message.error(res.message);
  163. }
  164. this.getData();
  165. })
  166. }).catch(() => {
  167. this.$message({
  168. type: 'warning',
  169. message: '已取消删除操作!'
  170. });
  171. });
  172. },
  173. //1.3 撤回消息
  174. upData(id) {
  175. //拒绝消息
  176. this.$confirm('此操作将撤回该条数据至待审核列表, 是否继续?', '提示', {
  177. confirmButtonText: '确定',
  178. cancelButtonText: '取消',
  179. type: 'warning'
  180. }).then(() => {
  181. console.log("当前撤回:" + id)
  182. let data = {
  183. id:id,
  184. status:0,
  185. reason:""
  186. }
  187. this.$store.dispatch('news/checkResearchTopic', data).then(res => {
  188. if(res.code == 200) {
  189. this.$message({
  190. type: 'success',
  191. message: '撤回成功!'
  192. });
  193. } else {
  194. this.$message.error(res.message);
  195. }
  196. this.getData();
  197. })
  198. }).catch(() => {
  199. this.$message({
  200. type: 'warning',
  201. message: '已取消撤回操作!'
  202. });
  203. });
  204. },
  205. //1.4 列表内容分页
  206. handleSizeChange(val) {
  207. this.getApiData.page = val;
  208. this.getData();
  209. },
  210. //1.5 点击分页
  211. handleCurrentChange(val) {
  212. this.getApiData.page = val;
  213. this.getData();
  214. },
  215. //1.6 重置按钮
  216. clearSearchList() {
  217. this.getApiData.is_master = 1;
  218. this.getApiData.title = "";
  219. this.getApiData.page = 1;
  220. this.getApiData.page_size = 10;
  221. this.getData();
  222. },
  223. //列表和分页相关 end ------------------------------------------------------------>
  224. //跳转到添加留言页面 start ------------------------------------------------------------>
  225. //创建
  226. gotoCreat() {
  227. this.$router.push({
  228. path: '/topicAdd',
  229. query: {
  230. type: 'add',
  231. page: 'topicList'
  232. }
  233. });
  234. },
  235. //编辑
  236. gotoEdit(id) {
  237. this.$router.push({
  238. path: '/topicAdd',
  239. query: {
  240. id: id,
  241. type: 'edit',
  242. page: 'topicList'
  243. }
  244. });
  245. },
  246. //查看
  247. getDataMain(id) {
  248. this.$router.push({
  249. path: '/topicAdd',
  250. query: {
  251. id: id,
  252. type: 'view',
  253. page: 'topicList'
  254. }
  255. });
  256. },
  257. //跳转到添加留言页面 end ------------------------------------------------------------>
  258. },
  259. mounted() {
  260. //获得第一页
  261. this.getData();
  262. //1.获得用户身份
  263. this.creatNews_user_type = getUseType()
  264. //2.获得站点id
  265. this.getApiData.website_id = getWebSiteId();
  266. },
  267. }
  268. </script>
  269. <style scoped lang="less">
  270. .status0 {
  271. color: #5570F1;
  272. }
  273. .status1 {
  274. color: #519C66;
  275. }
  276. .status2 {
  277. color: #CC5F5F;
  278. }
  279. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  280. ::v-deep .custom-form-item>.el-form-item__label {
  281. line-height: 140px !important;
  282. }
  283. ::v-deep .custom-textarea .el-textarea__inner {
  284. resize: none;
  285. /* 禁止用户拖拽调整大小 */
  286. }
  287. ::v-deep .custom-align-right .el-form-item__label {
  288. text-align: right;
  289. /* 设置标签文字右对齐 */
  290. }
  291. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/
  292. .tag_webSite_head_btn_box {
  293. overflow: hidden;
  294. }
  295. .tag_webSite_head_btn_box .searchTitle {
  296. opacity: 0;
  297. span {
  298. display: block;
  299. height: 16px;
  300. }
  301. }
  302. .tag_webSite_head_btn_box button {
  303. float: right;
  304. }
  305. .tag_webSite_head_btn_box button:nth-of-type(1) {
  306. margin-left: 10px;
  307. }
  308. </style>