DisclaimerInformation.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div>
  3. <crumbs title="免责声明维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标题:">
  6. <el-input size="mini" v-model="filter.title" placeholder="输入标题"></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <router-link to="/admin/LT-YXSJWH-TJMZSM" style="margin:0 10px">
  11. <el-button size="mini" type="warning">添加</el-button>
  12. </router-link>
  13. </el-form-item>
  14. </el-form>
  15. </crumbs>
  16. <div class="contents">
  17. <el-table :data="list"
  18. border
  19. style="width: 100%">
  20. <el-table-column
  21. type="index"
  22. :index="indexMethod"
  23. label="编号"
  24. width="60">
  25. </el-table-column>
  26. <el-table-column
  27. prop="gmtCreate"
  28. label="操作时间"
  29. :show-overflow-tooltip="true">
  30. </el-table-column>
  31. <el-table-column
  32. prop="modifier"
  33. label="操作人">
  34. </el-table-column>
  35. <el-table-column
  36. prop="title"
  37. label="标题">
  38. </el-table-column>
  39. <el-table-column
  40. prop="disclaimerCode"
  41. label="归属">
  42. </el-table-column>
  43. <el-table-column
  44. label="状态">
  45. <template slot-scope="scope">
  46. <el-button type="text" size="small" :class="{forbid:scope.row.status==0}" @click="toOpen(scope.row)">启用</el-button>
  47. <span style="margin:0 3px;">|</span>
  48. <el-button type="text" size="small" :class="['delete',{'forbid':scope.row.status==1}]" @click="toClose(scope.row)">停用</el-button>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. label="操作">
  53. <template slot-scope="scope">
  54. <el-button type="text" size="small" @click="toEditDiscl(scope.row)">修改</el-button>
  55. <span style="margin:0 3px;">|</span>
  56. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. label="详情">
  61. <template slot-scope="scope">
  62. <el-button type="text" size="small" @click="getDetail(scope.row)">详情</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <el-pagination v-if="total>pageSize"
  67. :current-page.sync="currentPage"
  68. @current-change="currentChange"
  69. background
  70. :page-size="pageSize"
  71. layout="total,prev, pager, next, jumper"
  72. :total="total">
  73. </el-pagination>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import api from '@api/icss.js';
  79. import utils from '@api/utils.js';
  80. export default {
  81. name: 'DisclaimerInformation',
  82. data: function () {
  83. return {
  84. list: [],
  85. cacheData: {},
  86. currentPage: 1,
  87. pageSize: 10,
  88. total: 0,
  89. linkIn:[],
  90. pays:[],
  91. filter: {
  92. title: ''
  93. }
  94. }
  95. },
  96. created() {
  97. this.getDataList();
  98. },
  99. methods: {
  100. toEditDiscl(row){
  101. this.$router.push({
  102. name:'AddDisclInfo',
  103. params: {info:row}
  104. })
  105. },
  106. filterDatas(){
  107. this.currentPage = 1;
  108. this.getDataList();
  109. },
  110. getDataList() {
  111. const param = this.getFilterItems();
  112. api.discInformation(param).then((res) => {
  113. if (res.data.code == '0') {
  114. const data = res.data.data;
  115. this.list = data.records;
  116. this.cacheData[param.current] = data.records;
  117. this.total = data.total;
  118. }
  119. }).catch((error) => {
  120. console.log(error);
  121. });
  122. },
  123. getDetail(item) {
  124. this.$router.push({name:'DiscInfoDetail', params:{info: item}})
  125. },
  126. getFilterItems() {
  127. const param = {
  128. title: this.filter.title,
  129. current: this.currentPage,
  130. size: this.pageSize
  131. };
  132. return param;
  133. },
  134. indexMethod(index) {
  135. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  136. },
  137. currentChange(next) {
  138. this.currentPage = next;
  139. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  140. this.list = this.cacheData[next];
  141. } else {
  142. this.getDataList();
  143. }
  144. },
  145. warning(msg,type){
  146. this.$message({
  147. showClose: true,
  148. message:msg,
  149. type:type||'warning'
  150. })
  151. },
  152. showConfirmDialog(msg,resolve){
  153. this.$alert(msg, '提示', {
  154. confirmButtonText: '确定',
  155. type: 'warning'
  156. }).then(() => {
  157. resolve();
  158. }).catch(() => {});
  159. },
  160. showDelDialog(id){
  161. this.showConfirmDialog('是否删除该免责声明?',()=>{
  162. api.delDiscInformation({id}).then((res)=>{
  163. if(res.data.code=='0'){
  164. this.warning(res.data.msg||'操作成功','success');
  165. this.getDataList();
  166. }else{
  167. this.warning(res.data.msg);
  168. }
  169. }).catch((error)=>{
  170. this.warning(error);
  171. })
  172. });
  173. },
  174. toOpen(item){
  175. // status=0停用,status=1启用
  176. if(item.status==0){
  177. this.showConfirmDialog('是否启用该免责声明?',()=>{
  178. api.openInformation({id:item.id}).then((res)=>{
  179. if(res.data.code==0){
  180. this.$message({
  181. type:'success',
  182. message:res.data.msg ||"启用成功"
  183. })
  184. this.getDataList();
  185. }
  186. }).catch((error)=>{
  187. this.warning(error);
  188. })
  189. });
  190. }
  191. },
  192. toClose(item){
  193. if(item.status==1){
  194. this.showConfirmDialog('是否停用该免责声明?',()=>{
  195. api.closeInformation({id:item.id}).then((res)=>{
  196. if(res.data.code==0){
  197. this.$message({
  198. type:'success',
  199. message:res.data.msg ||"停用成功"
  200. })
  201. this.getDataList();
  202. }
  203. }).catch((error)=>{
  204. this.warning(error);
  205. })
  206. });
  207. }
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="less" scoped>
  213. @import "../../less/admin.less";
  214. .delete{
  215. color: red !important;
  216. }
  217. .forbid{
  218. color: #BFBFBF !important;
  219. }
  220. </style>