tb-mild-car-list.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>4.2~9.6车辆管理-列表</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.company"></sa-item>
  25. <sa-item type="text" name="车牌号" v-model="p.carNo"></sa-item>
  26. <sa-item type="text" name="联系人" v-model="p.contact"></sa-item>
  27. <sa-item type="text" name="联系电话" v-model="p.contactPhone"></sa-item>
  28. <div>
  29. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  30. <el-button type="info" icon="el-icon-search"
  31. @click="p.carNo = '';p.company='';p.contact='';p.contactPhone=''; f5()">重置
  32. </el-button>
  33. <el-button v-if="sa.isAuth('tb-mild-car-add')" size="mini" type="primary" @click="add()">
  34. 新增
  35. </el-button>
  36. <el-button v-if="sa.isAuth('tb-mild-car-export')" size="mini" type="success"
  37. @click="exportFn()">
  38. 导出
  39. </el-button>
  40. </div>
  41. </el-form>
  42. <!-- ------------- 数据列表 ------------- -->
  43. <el-table class="data-table" ref="data-table" :data="dataList" style="margin-top: 10px;">
  44. <sa-td type="index" name="序号"></sa-td>
  45. <sa-td name="所属公司" prop="company" width="180"></sa-td>
  46. <sa-td name="车牌号" prop="carNo"></sa-td>
  47. <sa-td name="车辆类型" prop="carType"></sa-td>
  48. <sa-td name="长度(米)" prop="carLength"></sa-td>
  49. <sa-td name="载重(kg)" prop="carWeight"></sa-td>
  50. <sa-td name="联系人" prop="contact"></sa-td>
  51. <sa-td name="联系电话" prop="contactPhone" width="140"></sa-td>
  52. <sa-td name="行驶证" prop="carCertificate" type="img-list"></sa-td>
  53. <sa-td name="创建时间" prop="createTime" width="140"></sa-td>
  54. <sa-td name="更新时间" prop="updateTime" width="140"></sa-td>
  55. <sa-td name="创建人" prop="createBy" width="140"></sa-td>
  56. <sa-td name="更新时间" prop="updateBy" width="140"></sa-td>
  57. <el-table-column label="操作" fixed="right" width="200px">
  58. <template slot-scope="s">
  59. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  60. </el-button>
  61. <el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除
  62. </el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <!-- ------------- 分页 ------------- -->
  67. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  68. </sa-item>
  69. </div>
  70. </div>
  71. <script>
  72. var app = new Vue({
  73. components: {
  74. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  75. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  76. },
  77. el: '.vue-box',
  78. data: {
  79. p: { // 查询参数
  80. id: '', // 主键
  81. company: '', // 所属公司
  82. carNo: '', // 车牌号
  83. contact: '', // 联系人
  84. contactPhone: '', // 联系电话
  85. pageNo: 1, // 当前页
  86. pageSize: 10, // 页大小
  87. },
  88. dataCount: 0,
  89. dataList: [], // 数据集合
  90. },
  91. methods: {
  92. exportFn() {
  93. this.$confirm('确定导出符合条件的数据?', '提示', {
  94. confirmButtonText: '确定',
  95. cancelButtonText: '取消',
  96. type: 'warning'
  97. }).then(() => {
  98. sa.ajax('/TbMildCar/export', sa.removeNull(this.p), function(resp) {
  99. window.location.href = resp.data;
  100. }.bind(this))
  101. }).catch(() => {
  102. });
  103. },
  104. // 刷新
  105. f5: function() {
  106. sa.ajax('/TbMildCar/getList', sa.removeNull(this.p), function(res) {
  107. this.dataList = res.data; // 数据
  108. this.dataCount = res.dataCount; // 数据总数
  109. sa.f5TableHeight(); // 刷新表格高度
  110. }.bind(this));
  111. },
  112. // 查看
  113. get: function(data) {
  114. sa.showIframe('数据详情', 'tb-mild-car-info.html?id=' + data.id, '1050px', '90%');
  115. },
  116. // 查看 - 根据选中的
  117. getBySelect: function(data) {
  118. var selection = this.$refs['data-table'].selection;
  119. if (selection.length == 0) {
  120. return sa.msg('请选择一条数据')
  121. }
  122. this.get(selection[0]);
  123. },
  124. // 修改
  125. update: function(data) {
  126. sa.showIframe('修改数据', 'tb-mild-car-add.html?id=' + data.id, '800px', '70%');
  127. },
  128. // 新增
  129. add: function(data) {
  130. sa.showIframe('新增数据', 'tb-mild-car-add.html?id=-1', '800px', '70%');
  131. },
  132. // 删除
  133. del: function(data) {
  134. sa.confirm('是否删除,此操作不可撤销', function() {
  135. sa.ajax('/TbMildCar/delete?id=' + data.id, function(res) {
  136. sa.arrayDelete(this.dataList, data);
  137. sa.ok('删除成功');
  138. sa.f5TableHeight(); // 刷新表格高度
  139. }.bind(this))
  140. }.bind(this));
  141. },
  142. // 批量删除
  143. deleteByIds: function() {
  144. // 获取选中元素的id列表
  145. let selection = this.$refs['data-table'].selection;
  146. let ids = sa.getArrayField(selection, 'id');
  147. if (selection.length == 0) {
  148. return sa.msg('请至少选择一条数据')
  149. }
  150. // 提交删除
  151. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  152. sa.ajax('/TbMildCar/deleteByIds', {
  153. ids: ids.join(',')
  154. }, function(res) {
  155. sa.arrayDelete(this.dataList, selection);
  156. sa.ok('删除成功');
  157. sa.f5TableHeight(); // 刷新表格高度
  158. }.bind(this))
  159. }.bind(this));
  160. },
  161. },
  162. created: function() {
  163. this.f5();
  164. sa.onInputEnter();
  165. }
  166. })
  167. </script>
  168. </body>
  169. </html>