tb-driver-list.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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="num" name="主键" v-model="p.id"></sa-item>
  25. <sa-item type="text" name="名称" v-model="p.name"></sa-item>
  26. <sa-item type="text" name="手机号码" v-model="p.phone"></sa-item>
  27. <sa-item type="text" name="身份证" v-model="p.idCard"></sa-item>
  28. <sa-item type="text" name="创建时间" v-model="p.createTime"></sa-item>
  29. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  30. <br/>
  31. <sa-item name="综合排序">
  32. <el-radio-group v-model="p.sortType" class="s-radio-text">
  33. <el-radio :label="0">默认</el-radio>
  34. <el-radio :label="1">主键</el-radio>
  35. <el-radio :label="2">名称</el-radio>
  36. <el-radio :label="3">手机号码</el-radio>
  37. <el-radio :label="4">身份证</el-radio>
  38. <el-radio :label="5">创建时间</el-radio>
  39. </el-radio-group>
  40. </sa-item>
  41. </el-form>
  42. <!-- ------------- 快捷按钮 ------------- -->
  43. <sa-item type="fast-btn" show="add,get,delete,export,reset"></sa-item>
  44. <!-- ------------- 数据列表 ------------- -->
  45. <el-table class="data-table" ref="data-table" :data="dataList">
  46. <sa-td type="selection"></sa-td>
  47. <sa-td name="主键" prop="id" type="num"></sa-td>
  48. <sa-td name="名称" prop="name"></sa-td>
  49. <sa-td name="手机号码" prop="phone"></sa-td>
  50. <sa-td name="身份证" prop="idCard"></sa-td>
  51. <sa-td name="创建时间" prop="createTime"></sa-td>
  52. <el-table-column label="操作" fixed="right" width="240px">
  53. <template slot-scope="s">
  54. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  55. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  56. <el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <!-- ------------- 分页 ------------- -->
  61. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  62. </div>
  63. </div>
  64. <script>
  65. var app = new Vue({
  66. components: {
  67. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  68. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  69. },
  70. el: '.vue-box',
  71. data: {
  72. p: { // 查询参数
  73. id: '', // 主键
  74. name: '', // 名称
  75. phone: '', // 手机号码
  76. idCard: '', // 身份证
  77. createTime: '', // 创建时间
  78. pageNo: 1, // 当前页
  79. pageSize: 10, // 页大小
  80. sortType: 0 // 排序方式
  81. },
  82. dataCount: 0,
  83. dataList: [], // 数据集合
  84. },
  85. methods: {
  86. // 刷新
  87. f5: function () {
  88. sa.ajax('/TbDriver/getList', sa.removeNull(this.p), function (res) {
  89. this.dataList = res.data; // 数据
  90. this.dataCount = res.dataCount; // 数据总数
  91. sa.f5TableHeight(); // 刷新表格高度
  92. }.bind(this));
  93. },
  94. // 查看
  95. get: function (data) {
  96. sa.showIframe('数据详情', 'tb-driver-info.html?id=' + data.id, '1050px', '90%');
  97. },
  98. // 查看 - 根据选中的
  99. getBySelect: function (data) {
  100. var selection = this.$refs['data-table'].selection;
  101. if (selection.length == 0) {
  102. return sa.msg('请选择一条数据')
  103. }
  104. this.get(selection[0]);
  105. },
  106. // 修改
  107. update: function (data) {
  108. sa.showIframe('修改数据', 'tb-driver-add.html?id=' + data.id, '1000px', '90%');
  109. },
  110. // 新增
  111. add: function (data) {
  112. sa.showIframe('新增数据', 'tb-driver-add.html?id=-1', '1000px', '90%');
  113. },
  114. // 删除
  115. del: function (data) {
  116. sa.confirm('是否删除,此操作不可撤销', function () {
  117. sa.ajax('/TbDriver/delete?id=' + data.id, function (res) {
  118. sa.arrayDelete(this.dataList, data);
  119. sa.ok('删除成功');
  120. sa.f5TableHeight(); // 刷新表格高度
  121. }.bind(this))
  122. }.bind(this));
  123. },
  124. // 批量删除
  125. deleteByIds: function () {
  126. // 获取选中元素的id列表
  127. let selection = this.$refs['data-table'].selection;
  128. let ids = sa.getArrayField(selection, 'id');
  129. if (selection.length == 0) {
  130. return sa.msg('请至少选择一条数据')
  131. }
  132. // 提交删除
  133. sa.confirm('是否批量删除选中数据?此操作不可撤销', function () {
  134. sa.ajax('/TbDriver/deleteByIds', {ids: ids.join(',')}, function (res) {
  135. sa.arrayDelete(this.dataList, selection);
  136. sa.ok('删除成功');
  137. sa.f5TableHeight(); // 刷新表格高度
  138. }.bind(this))
  139. }.bind(this));
  140. },
  141. },
  142. created: function () {
  143. this.f5();
  144. sa.onInputEnter();
  145. }
  146. })
  147. </script>
  148. </body>
  149. </html>