tb-shop-list.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. <div class="c-item">
  25. <label class="c-label">互市区:</label>
  26. <el-select v-model="p.tradeAreaId" placeholder="请选择" filterable size="mini">
  27. <el-option label="请选择" :value="0" disabled></el-option>
  28. <el-option v-for="(item,index) in tradeAreaList" :key="index" :label="item.name" :value="item.id"> </el-option>
  29. </el-select>
  30. </div>
  31. <div class="c-item">
  32. <label class="c-label">名称:</label>
  33. <el-input size="mini" v-model="p.shopName"></el-input>
  34. </div>
  35. <div class="c-item" style="min-width: 0px;">
  36. <el-button size="mini" type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  37. <el-button size="mini" type="primary" icon="el-icon-plus" @click="add()">新增</el-button>
  38. <el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteByIds()">删除</el-button>
  39. <el-button size="mini" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  40. </div>
  41. <br />
  42. </el-form>
  43. <!-- ------------- 数据列表 ------------- -->
  44. <el-table class="data-table" ref="data-table" :data="dataList" size="small">
  45. <el-table-column align="center" label="序号" type="index" width="45px"></el-table-column>
  46. <el-table-column align="center" label="名称" prop="shopName"></el-table-column>
  47. <el-table-column align="center" label="编号" prop="shopNo"></el-table-column>
  48. <el-table-column align="center" prop="tradeAreaName" label="所属互市区"> </el-table-column>
  49. <el-table-column align="center" prop="enterpriseName" label="入驻商家"> </el-table-column>
  50. <el-table-column align="center" label="操作" fixed="right" width="240px">
  51. <template slot-scope="s">
  52. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  53. </el-button>
  54. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  55. </el-button>
  56. <el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除
  57. </el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <!-- ------------- 分页 ------------- -->
  62. <div class="page-box">
  63. <el-pagination background layout="total, prev, pager, next, sizes, jumper"
  64. :current-page.sync="p.pageNo" :page-size.sync="p.pageSize" :total="dataCount"
  65. :page-sizes="[1, 10, 20, 30, 40, 50, 100, 1000]" @current-change="f5()" @size-change="f5()">
  66. </el-pagination>
  67. </div>
  68. </div>
  69. </div>
  70. <script>
  71. var app = new Vue({
  72. el: '.vue-box',
  73. data: {
  74. p: { // 查询参数
  75. shopName: '', // 名称
  76. tradeAreaId:'',
  77. pageNo: 1, // 当前页
  78. pageSize: 10, // 页大小
  79. sortType: 0 // 排序方式
  80. },
  81. dataCount: 0,
  82. tradeAreaList:[],
  83. dataList: [], // 数据集合
  84. },
  85. methods: {
  86. getTradeArea() {
  87. sa.ajax('/level-one-server/TbTradeArea/getList', {
  88. pageSize: 100,
  89. pageNo: 1
  90. }, function(resp) {
  91. this.tradeAreaList = resp.data;
  92. }.bind(this));
  93. },
  94. // 刷新
  95. f5: function() {
  96. sa.ajax('/level-one-server/TbShop/getList', sa.removeNull(this.p), function(res) {
  97. this.dataList = res.data; // 数据
  98. this.dataCount = parseInt(res.dataCount); // 数据总数
  99. sa.f5TableHeight(); // 刷新表格高度
  100. }.bind(this));
  101. },
  102. // 查看
  103. get: function(data) {
  104. sa.showIframe('数据详情', 'tb-shop-info.html?id=' + data.id, '750px', '70%');
  105. },
  106. // 查看 - 根据选中的
  107. getBySelect: function(data) {
  108. var selection = this.$refs['data-table'].selection;
  109. if (selection.length == 0) {
  110. return sa.msg('请选择一条数据')
  111. }
  112. this.get(selection[0]);
  113. },
  114. // 修改
  115. update: function(data) {
  116. sa.showIframe('修改数据', 'tb-shop-add.html?id=' + data.id, '700px', '70%');
  117. },
  118. // 新增
  119. add: function(data) {
  120. sa.showIframe('新增数据', 'tb-shop-add.html?id=-1', '700px', '70%');
  121. },
  122. // 删除
  123. del: function(data) {
  124. sa.confirm('是否删除,此操作不可撤销', function() {
  125. sa.ajax('/level-one-server/TbShop/delete?id=' + data.id, function(res) {
  126. sa.arrayDelete(this.dataList, data);
  127. sa.ok('删除成功');
  128. sa.f5TableHeight(); // 刷新表格高度
  129. }.bind(this))
  130. }.bind(this));
  131. },
  132. // 批量删除
  133. deleteByIds: function() {
  134. // 获取选中元素的id列表
  135. let selection = this.$refs['data-table'].selection;
  136. let ids = sa.getArrayField(selection, 'id');
  137. if (selection.length == 0) {
  138. return sa.msg('请至少选择一条数据')
  139. }
  140. // 提交删除
  141. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  142. sa.ajax('/level-one-server/TbShop/deleteByIds', {
  143. ids: ids.join(',')
  144. }, function(res) {
  145. sa.arrayDelete(this.dataList, selection);
  146. sa.ok('删除成功');
  147. sa.f5TableHeight(); // 刷新表格高度
  148. }.bind(this))
  149. }.bind(this));
  150. },
  151. // 改 - 是否可用(0=否,1=是)
  152. updateStatus: function(data) {
  153. // 声明变量记录是否成功
  154. var isOk = false;
  155. var oldValue = data.status;
  156. var ajax = sa.ajax('/level-one-server/TbShop/updateStatus', {
  157. id: data.id,
  158. value: data.status
  159. }, function(res) {
  160. isOk = true;
  161. sa.msg('修改成功');
  162. }.bind(this));
  163. // 如果未能修改成功, 则回滚
  164. $.when(ajax).done(function() {
  165. if (isOk == false) {
  166. data.status = oldValue;
  167. }
  168. })
  169. },
  170. },
  171. created: function() {
  172. this.f5();
  173. this.getTradeArea();
  174. sa.onInputEnter();
  175. }
  176. })
  177. </script>
  178. </body>
  179. </html>