tb-message-list.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="text" name="消息内容" v-model="p.contents"></sa-item>
  24. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  25. </el-form>
  26. <div class="fast-btn">
  27. <el-button v-if="sa.isAuth('tb-message-add')" size="mini" type="primary" @click="add()">新增</el-button>
  28. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  29. </div>
  30. <!-- ------------- 数据列表 ------------- -->
  31. <el-table class="data-table" ref="data-table" :data="dataList">
  32. <sa-td type="selection"></sa-td>
  33. <sa-td name="消息类型" prop="types" width="100" align="center">
  34. <template slot-scope="scope">系统消息</template>
  35. </sa-td>
  36. <sa-td name="消息内容" prop="contents"></sa-td>
  37. <sa-td name="状态" prop="enable" width="100" align="center">
  38. <template slot-scope="scope">
  39. <el-tag type="success" v-if="scope.row.enable==1">启用</el-tag>
  40. <el-tag type="danger" v-if="scope.row.enable==0">停用</el-tag>
  41. </template>
  42. </sa-td>
  43. <sa-td name="创建时间" prop="createTime" align="center" width="150"></sa-td>
  44. <el-table-column label="操作" fixed="right" width="240px">
  45. <template slot-scope="s">
  46. <el-button v-if="sa.isAuth('tb-message-edit')" class="c-btn" type="primary"
  47. icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  48. <el-button v-if="sa.isAuth('tb-message-del')" class="c-btn" type="danger"
  49. icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <!-- ------------- 分页 ------------- -->
  54. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount"
  55. @change="f5()"></sa-item>
  56. </div>
  57. </div>
  58. <script>
  59. var app = new Vue({
  60. components: {
  61. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  62. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  63. },
  64. el: '.vue-box',
  65. data: {
  66. p: { // 查询参数
  67. id: '', //
  68. types: '', // 消息类型
  69. module: '', // 模块类型
  70. contents: '', // 消息内容
  71. userId: '', // 关联用户
  72. createTime: '', // 创建时间
  73. pageNo: 1, // 当前页
  74. pageSize: 10, // 页大小
  75. sortType: 0 // 排序方式
  76. },
  77. dataCount: 0,
  78. dataList: [], // 数据集合
  79. },
  80. methods: {
  81. // 刷新
  82. f5: function() {
  83. sa.ajax('/sp-admin/TbMessage/getList', sa.removeNull(this.p), function(res) {
  84. this.dataList = res.data; // 数据
  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. getBySelect: function(data) {
  95. var selection = this.$refs['data-table'].selection;
  96. if (selection.length == 0) {
  97. return sa.msg('请选择一条数据')
  98. }
  99. this.get(selection[0]);
  100. },
  101. // 修改
  102. update: function(data) {
  103. sa.showIframe('修改数据', 'tb-message-add.html?id=' + data.id, '50%', '60%');
  104. },
  105. // 新增
  106. add: function(data) {
  107. sa.showIframe('新增数据', 'tb-message-add.html?id=-1', '50%', '60%');
  108. },
  109. // 删除
  110. del: function(data) {
  111. sa.confirm('是否删除,此操作不可撤销', function() {
  112. sa.ajax('/sp-admin/TbMessage/delete?id=' + data.id, function(res) {
  113. sa.arrayDelete(this.dataList, data);
  114. sa.ok('删除成功');
  115. sa.f5TableHeight(); // 刷新表格高度
  116. }.bind(this))
  117. }.bind(this));
  118. },
  119. // 批量删除
  120. deleteByIds: function() {
  121. // 获取选中元素的id列表
  122. let selection = this.$refs['data-table'].selection;
  123. let ids = sa.getArrayField(selection, 'id');
  124. if (selection.length == 0) {
  125. return sa.msg('请至少选择一条数据')
  126. }
  127. // 提交删除
  128. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  129. sa.ajax('/sp-admin/TbMessage/deleteByIds', {
  130. ids: ids.join(',')
  131. }, function(res) {
  132. sa.arrayDelete(this.dataList, selection);
  133. sa.ok('删除成功');
  134. sa.f5TableHeight(); // 刷新表格高度
  135. }.bind(this))
  136. }.bind(this));
  137. },
  138. },
  139. created: function() {
  140. this.f5();
  141. sa.onInputEnter();
  142. }
  143. })
  144. </script>
  145. </body>
  146. </html>