tb-enterprise-list.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>商家-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <script src="../../static/kj/upload-util.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.name"></sa-item>
  25. <sa-item type="enum" name="商户分类" v-model="p.type"
  26. :jv="{自营商铺: '自营商铺', 劳务商铺: '劳务商铺'}" jtype="3" def="不限"></sa-item>
  27. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  28. </el-form>
  29. <div class="fast-btn">
  30. <el-button v-if="sa.isAuth('tb-enterprise-add')" size="mini" type="primary" @click="add()">新增</el-button>
  31. <el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
  32. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  33. </div>
  34. <!-- ------------- 数据列表 ------------- -->
  35. <el-table class="data-table" ref="data-table" :data="dataList" >
  36. <sa-td type="selection"></sa-td>
  37. <sa-td name="名称" prop="name" ></sa-td>
  38. <sa-td name="国别" prop="nationality" ></sa-td>
  39. <sa-td name="商户分类" prop="type" type="enum" :jv="{自营商铺: '自营商铺', 劳务商铺: '劳务商铺'}"></sa-td>
  40. <sa-td name="法人" prop="legalPerson" ></sa-td>
  41. <sa-td name="身份证号" prop="idCard" ></sa-td>
  42. <sa-td name="手机号码" width="100px" prop="contact" ></sa-td>
  43. <sa-td name="营业执照" prop="businessLicense" type="img-list"></sa-td>
  44. <sa-td name="所在铺位ID" prop="shopId" ></sa-td>
  45. <sa-td name="所在铺位名称" width="120px" prop="shopName" type="enum" :jv="{1: '100-2'}"></sa-td>
  46. <sa-td name="银行编号" width="120px" prop="bankNo" type="enum" :jv="{CMB: '招商银行'}"></sa-td>
  47. <sa-td name="银行名称" prop="bankName" ></sa-td>
  48. <sa-td name="银行账号" prop="bankAccount" ></sa-td>
  49. <sa-td name="税号" prop="dutyParagraph" ></sa-td>
  50. <el-table-column 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)">查看</el-button>
  53. <el-button v-if="sa.isAuth('tb-enterprise-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  54. <el-button v-if="sa.isAuth('tb-enterprise-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <!-- ------------- 分页 ------------- -->
  59. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  60. </div>
  61. </div>
  62. <script>
  63. var app = new Vue({
  64. components: {
  65. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  66. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  67. },
  68. el: '.vue-box',
  69. data: {
  70. p: { // 查询参数
  71. id: '', //
  72. name: '', // 名称
  73. nationality: '', // 国别
  74. type: '', // 商户分类(自营商铺=自营商铺,劳务商铺=劳务商铺)
  75. legalPerson: '', // 法人
  76. idCard: '', // 身份证号
  77. contact: '', // 手机号码
  78. shopId: '', // 所在铺位ID
  79. shopName: '', // 所在铺位名称(1=100-2)
  80. bankNo: '', // 银行编号(CMB= 招商银行)
  81. bankName: '', // 银行名称
  82. bankAccount: '', // 银行账号
  83. dutyParagraph: '', // 税号
  84. pageNo: 1, // 当前页
  85. pageSize: 10, // 页大小
  86. sortType: 0 // 排序方式
  87. },
  88. dataCount: 0,
  89. dataList: [], // 数据集合
  90. },
  91. methods: {
  92. // 刷新
  93. f5: function() {
  94. sa.ajax('/level-one-server/TbEnterprise/getList', sa.removeNull(this.p), function(res) {
  95. this.dataList = res.data; // 数据
  96. this.dataCount = res.dataCount; // 数据总数
  97. sa.f5TableHeight(); // 刷新表格高度
  98. }.bind(this));
  99. },
  100. // 查看
  101. get: function(data) {
  102. sa.showIframe('数据详情', 'tb-enterprise-info.html?id=' + data.id, '1050px', '90%');
  103. },
  104. // 查看 - 根据选中的
  105. getBySelect: function(data) {
  106. var selection = this.$refs['data-table'].selection;
  107. if(selection.length == 0) {
  108. return sa.msg('请选择一条数据')
  109. }
  110. this.get(selection[0]);
  111. },
  112. // 修改
  113. update: function(data) {
  114. sa.showIframe('修改数据', 'tb-enterprise-add.html?id=' + data.id, '1000px', '90%');
  115. },
  116. // 新增
  117. add: function(data) {
  118. sa.showIframe('新增数据', 'tb-enterprise-add.html?id=-1', '1000px', '90%');
  119. },
  120. // 删除
  121. del: function(data) {
  122. sa.confirm('是否删除,此操作不可撤销', function() {
  123. sa.ajax('/level-one-server/TbEnterprise/delete?id=' + data.id, function(res) {
  124. sa.arrayDelete(this.dataList, data);
  125. sa.ok('删除成功');
  126. sa.f5TableHeight(); // 刷新表格高度
  127. }.bind(this))
  128. }.bind(this));
  129. },
  130. // 批量删除
  131. deleteByIds: function() {
  132. // 获取选中元素的id列表
  133. let selection = this.$refs['data-table'].selection;
  134. let ids = sa.getArrayField(selection, 'id');
  135. if(selection.length == 0) {
  136. return sa.msg('请至少选择一条数据')
  137. }
  138. // 提交删除
  139. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  140. sa.ajax('/level-one-server/TbEnterprise/deleteByIds', {ids: ids.join(',')}, function(res) {
  141. sa.arrayDelete(this.dataList, selection);
  142. sa.ok('删除成功');
  143. sa.f5TableHeight(); // 刷新表格高度
  144. }.bind(this))
  145. }.bind(this));
  146. },
  147. // 改 - 删除状态(0=禁用,1=启用)
  148. updateDeleteStatus: function(data) {
  149. // 声明变量记录是否成功
  150. var isOk = false;
  151. var oldValue = data.deleteStatus;
  152. var ajax = sa.ajax('/level-one-server/TbEnterprise/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  153. isOk = true;
  154. sa.msg('修改成功');
  155. }.bind(this));
  156. // 如果未能修改成功, 则回滚
  157. $.when(ajax).done(function() {
  158. if(isOk == false) {
  159. data.status = oldValue;
  160. }
  161. })
  162. },
  163. },
  164. created: function() {
  165. this.f5();
  166. sa.onInputEnter();
  167. }
  168. })
  169. </script>
  170. </body>
  171. </html>