PromptInfo.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.name" placeholder="静态知识名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="标签系统名称:">
  9. <el-input size="mini" v-model="filter.tagName" placeholder="标签系统名称" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button size="mini" @click="filterDatas">确认</el-button>
  13. <router-link to="/admin/LT-YXSJWH-TJTSXX" style="margin:0 10px">
  14. <el-button size="mini" type="warning">添加静态知识</el-button>
  15. </router-link>
  16. </el-form-item>
  17. </el-form>
  18. </crumbs>
  19. <div class="contents">
  20. <el-table :data="list"
  21. border
  22. style="width: 100%">
  23. <el-table-column
  24. :resizable = "false"
  25. type="index"
  26. :index="indexMethod"
  27. label="编号"
  28. width="60">
  29. </el-table-column>
  30. <el-table-column
  31. :resizable = "false"
  32. prop="gmtOperate"
  33. label="操作时间"
  34. width="180"
  35. :show-overflow-tooltip="true">
  36. </el-table-column>
  37. <el-table-column
  38. :resizable = "false"
  39. prop="name"
  40. label="静态知识名称">
  41. </el-table-column>
  42. <el-table-column
  43. :resizable = "false"
  44. prop="tagName"
  45. label="关联标签"
  46. width="240">
  47. </el-table-column>
  48. <el-table-column
  49. :resizable = "false"
  50. prop="operatorName"
  51. label="操作人"
  52. width="80">
  53. </el-table-column>
  54. <el-table-column
  55. :resizable = "false"
  56. label="操作" width="120">
  57. <template slot-scope="scope">
  58. <el-button type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  59. <span style="margin:0 3px;">|</span>
  60. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
  61. </template>
  62. </el-table-column>
  63. <el-table-column
  64. :resizable = "false"
  65. label="详情">
  66. <template slot-scope="scope">
  67. <el-button type="text" size="small" @click="getDetailList(scope.row.id)">详情</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <el-pagination v-if="total>pageSize"
  72. :current-page.sync="currentPage"
  73. @current-change="currentChange"
  74. background
  75. :page-size="pageSize"
  76. layout="total,prev, pager, next, jumper"
  77. :total="total">
  78. </el-pagination>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import api from '@api/icss.js';
  84. import utils from '@api/utils.js';
  85. export default {
  86. name: 'prompt-info',
  87. data: function () {
  88. return {
  89. list: [],
  90. cacheData: {},
  91. currentPage: 1,
  92. pageSize: 10,
  93. total: 0,
  94. linkIn:[],
  95. pays:[],
  96. filter: {
  97. name: '',
  98. tagName:''
  99. }
  100. }
  101. },
  102. created() {
  103. this.getDataList();
  104. },
  105. methods: {
  106. toEditProduct(row){
  107. this.$router.push({
  108. name:'AddPromptInfo',
  109. params: {data:row,isEdit:true}
  110. })
  111. },
  112. filterDatas(){
  113. this.currentPage = 1;
  114. this.getDataList();
  115. },
  116. getDataList() {
  117. const param = this.getFilterItems();
  118. // const param = {
  119. // 'name':''
  120. // };
  121. api.getPromptList(param).then((res) => {
  122. if (res.data.code == '0') {
  123. const data = res.data.data;
  124. this.list = data.records;
  125. this.cacheData[param.current] = data.records;
  126. this.total = data.total;
  127. }
  128. }).catch((error) => {
  129. console.log(error);
  130. });
  131. },
  132. getDetailList(id) {
  133. const param = {'id': id,};
  134. this.$router.push({name:'PromptDetail', params:{id: id}})
  135. },
  136. getFilterItems() {
  137. const param = {
  138. name:this.filter.name,
  139. tagName:this.filter.tagName,
  140. current: this.currentPage,
  141. size: this.pageSize
  142. };
  143. return param;
  144. },
  145. indexMethod(index) {
  146. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  147. },
  148. currentChange(next) {
  149. this.currentPage = next;
  150. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  151. this.list = this.cacheData[next];
  152. } else {
  153. this.getDataList();
  154. }
  155. },
  156. warning(msg,type){
  157. this.$message({
  158. showClose: true,
  159. message:msg,
  160. type:type||'warning'
  161. })
  162. },
  163. showConfirmDialog(msg,resolve){
  164. this.$alert(msg, '提示', {
  165. confirmButtonText: '确定',
  166. type: 'warning'
  167. }).then(() => {
  168. resolve();
  169. }).catch(() => {});
  170. },
  171. showDelDialog(id){
  172. this.showConfirmDialog('是否删除该静态知识?',()=>{
  173. api.delPromptInfo({id}).then((res)=>{
  174. if(res.data.code=='0'){
  175. this.warning(res.data.msg||'操作成功','success');
  176. this.getDataList();
  177. }else{
  178. this.warning(res.data.msg);
  179. }
  180. }).catch((error)=>{
  181. this.warning(error);
  182. })
  183. });
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="less">
  189. @import "../../less/admin.less";
  190. .status-span{
  191. font-size: 12px;
  192. margin-right:10px;
  193. color: unset;
  194. }
  195. </style>