tb-message-list.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>通知消息-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css & js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="消息内容" v-model="p.contents" width="90px"></sa-item>
  25. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  26. <el-button v-if="sa.isAuth('tb-message-add')" size="mini" type="primary" @click="add()">新增</el-button>
  27. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  28. </el-form>
  29. <!-- ------------- 数据列表 ------------- -->
  30. <el-table class="data-table" ref="data-table" :data="dataList">
  31. <sa-td type="selection"></sa-td>
  32. <sa-td name="消息类型" prop="types" width="100" align="center">
  33. <template slot-scope="scope">系统消息</template>
  34. </sa-td>
  35. <sa-td name="消息内容" prop="contents"></sa-td>
  36. <sa-td name="状态" prop="enable" width="100" align="center">
  37. <template slot-scope="scope">
  38. <el-tag type="success" v-if="scope.row.enable==1">启用</el-tag>
  39. <el-tag type="danger" v-if="scope.row.enable==0">停用</el-tag>
  40. </template>
  41. </sa-td>
  42. <sa-td name="创建时间" prop="createTime" align="center" width="150"></sa-td>
  43. <el-table-column label="操作" fixed="right" width="240px">
  44. <template slot-scope="s">
  45. <el-button v-if="sa.isAuth('tb-message-edit')" class="c-btn" type="primary"
  46. icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  47. <el-button v-if="sa.isAuth('tb-message-del')" class="c-btn" type="danger"
  48. icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <!-- ------------- 分页 ------------- -->
  53. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount"
  54. @change="f5()"></sa-item>
  55. </div>
  56. </div>
  57. <script>
  58. var app = new Vue({
  59. components: {
  60. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  61. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  62. },
  63. el: '.vue-box',
  64. data: {
  65. p: { // 查询参数
  66. id: '', //
  67. types: '', // 消息类型
  68. module: '', // 模块类型
  69. contents: '', // 消息内容
  70. userId: '', // 关联用户
  71. createTime: '', // 创建时间
  72. pageNo: 1, // 当前页
  73. pageSize: 10, // 页大小
  74. sortType: 0 // 排序方式
  75. },
  76. dataCount: 0,
  77. dataList: [], // 数据集合
  78. },
  79. methods: {
  80. // 刷新
  81. f5: function() {
  82. sa.ajax('/sp-admin/TbMessage/getList', sa.removeNull(this.p), function(res) {
  83. this.dataList = res.data; // 数据
  84. console.log("11111",this.dataList)
  85. this.dataCount = res.dataCount; // 数据总数
  86. sa.f5TableHeight(); // 刷新表格高度
  87. }.bind(this));
  88. },
  89. // 查看
  90. get: function(data) {
  91. sa.showIframe('数据详情', 'tb-message-info.html?id=' + data.id, '1050px', '90%');
  92. },
  93. // 修改
  94. update: function(data) {
  95. sa.showIframe('修改数据', 'tb-message-add.html?id=' + data.id, '50%', '60%');
  96. },
  97. // 新增
  98. add: function(data) {
  99. sa.showIframe('新增数据', 'tb-message-add.html?id=-1', '50%', '60%');
  100. },
  101. // 删除
  102. del: function(data) {
  103. sa.confirm('是否删除,此操作不可撤销', function() {
  104. sa.ajax('/sp-admin/TbMessage/delete?id=' + data.id, function(res) {
  105. sa.arrayDelete(this.dataList, data);
  106. sa.ok('删除成功');
  107. sa.f5TableHeight(); // 刷新表格高度
  108. }.bind(this))
  109. }.bind(this));
  110. },
  111. // 批量删除
  112. deleteByIds: function() {
  113. // 获取选中元素的id列表
  114. let selection = this.$refs['data-table'].selection;
  115. let ids = sa.getArrayField(selection, 'id');
  116. if (selection.length == 0) {
  117. return sa.msg('请至少选择一条数据')
  118. }
  119. // 提交删除
  120. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  121. sa.ajax('/sp-admin/TbMessage/deleteByIds', {
  122. ids: ids.join(',')
  123. }, function(res) {
  124. sa.arrayDelete(this.dataList, selection);
  125. sa.ok('删除成功');
  126. sa.f5TableHeight(); // 刷新表格高度
  127. }.bind(this))
  128. }.bind(this));
  129. },
  130. },
  131. created: function() {
  132. this.f5();
  133. sa.onInputEnter();
  134. }
  135. })
  136. </script>
  137. </body>
  138. </html>