tb-company-list.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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="../../static/kj/element-ui/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. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <div class="c-title">检索参数</div>
  22. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="text" name="名称" v-model="p.name"></sa-item>
  24. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  25. <el-button v-if="sa.isAuth('tb-company-add')" size="mini" type="primary" @click="add()">新增</el-button>
  26. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  27. </el-form>
  28. <!-- ------------- 数据列表 ------------- -->
  29. <el-table class="data-table" ref="data-table" :data="dataList" >
  30. <sa-td type="index" name="序号"></sa-td>
  31. <sa-td name="所属互市区" prop="tradeAreaName" ></sa-td>
  32. <sa-td name="名称" prop="name" ></sa-td>
  33. <sa-td name="法人" prop="legalPerson" ></sa-td>
  34. <sa-td name="手机号码" prop="contact" ></sa-td>
  35. <sa-td name="营业执照" prop="businessLicense" type="img-list"></sa-td>
  36. <sa-td name="地址" prop="address" ></sa-td>
  37. <sa-td name="创建时间" prop="createTime" width="180"></sa-td>
  38. <sa-td name="更新时间" prop="updateTime" width="180"></sa-td>
  39. <el-table-column label="操作" fixed="right" width="200px">
  40. <template slot-scope="s">
  41. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  42. <el-button v-if="sa.isAuth('tb-company-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  43. <el-button v-if="sa.isAuth('tb-company-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. <!-- ------------- 分页 ------------- -->
  48. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  49. </div>
  50. </div>
  51. <script>
  52. var app = new Vue({
  53. components: {
  54. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  55. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  56. },
  57. el: '.vue-box',
  58. data: {
  59. p: { // 查询参数
  60. id: '', //
  61. name: '', // 名称
  62. legalPerson: '', // 法人
  63. idCard: '', // 身份证号
  64. contact: '', // 手机号码
  65. bankNo: '', // 银行编号(CMB= 招商银行)
  66. bankName: '', // 银行名称
  67. bankAccount: '', // 银行账号
  68. dutyParagraph: '', // 税号
  69. addressIds: '', // 地址全路径如1,22,333
  70. address: '', // 地址
  71. detail: '', // 详细地址
  72. createTime: '', // 创建时间
  73. createBy: '', // 创建人编号
  74. createName: '', // 创建人名称
  75. updateTime: '', // 更新时间
  76. updateBy: '', // 更新人编号
  77. updateName: '', // 更新人名称
  78. deleteStatus: '', // 删除状态(0=禁用,1=启用)
  79. isLock: '', // 是否锁住
  80. tradeAreaId: '', // 互市区ID
  81. tradeAreaName: '', // 互市区名称
  82. pageNo: 1, // 当前页
  83. pageSize: 10, // 页大小
  84. sortType: 0 // 排序方式
  85. },
  86. dataCount: 0,
  87. dataList: [], // 数据集合
  88. },
  89. methods: {
  90. // 刷新
  91. f5: function() {
  92. sa.ajax('/level-two-server/TbCompany/getList', sa.removeNull(this.p), function(res) {
  93. this.dataList = res.data; // 数据
  94. this.dataCount = res.dataCount; // 数据总数
  95. sa.f5TableHeight(); // 刷新表格高度
  96. }.bind(this));
  97. },
  98. // 查看
  99. get: function(data) {
  100. sa.showIframe('数据详情', 'tb-company-info.html?id=' + data.id, '1050px', '90%');
  101. },
  102. // 查看 - 根据选中的
  103. getBySelect: function(data) {
  104. var selection = this.$refs['data-table'].selection;
  105. if(selection.length == 0) {
  106. return sa.msg('请选择一条数据')
  107. }
  108. this.get(selection[0]);
  109. },
  110. // 修改
  111. update: function(data) {
  112. sa.showIframe('修改数据', 'tb-company-add.html?id=' + data.id, '1000px', '90%');
  113. },
  114. // 新增
  115. add: function(data) {
  116. sa.showIframe('新增数据', 'tb-company-add.html?id=-1', '1000px', '90%');
  117. },
  118. // 删除
  119. del: function(data) {
  120. sa.confirm('是否删除,此操作不可撤销', function() {
  121. sa.ajax('/level-two-server/TbCompany/delete?id=' + data.id, function(res) {
  122. sa.arrayDelete(this.dataList, data);
  123. sa.ok('删除成功');
  124. sa.f5TableHeight(); // 刷新表格高度
  125. }.bind(this))
  126. }.bind(this));
  127. },
  128. // 批量删除
  129. deleteByIds: function() {
  130. // 获取选中元素的id列表
  131. let selection = this.$refs['data-table'].selection;
  132. let ids = sa.getArrayField(selection, 'id');
  133. if(selection.length == 0) {
  134. return sa.msg('请至少选择一条数据')
  135. }
  136. // 提交删除
  137. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  138. sa.ajax('/level-two-server/TbCompany/deleteByIds', {ids: ids.join(',')}, function(res) {
  139. sa.arrayDelete(this.dataList, selection);
  140. sa.ok('删除成功');
  141. sa.f5TableHeight(); // 刷新表格高度
  142. }.bind(this))
  143. }.bind(this));
  144. },
  145. // 改 - 删除状态(0=禁用,1=启用)
  146. updateDeleteStatus: function(data) {
  147. // 声明变量记录是否成功
  148. var isOk = false;
  149. var oldValue = data.deleteStatus;
  150. var ajax = sa.ajax('/level-two-server/TbCompany/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  151. isOk = true;
  152. sa.msg('修改成功');
  153. }.bind(this));
  154. // 如果未能修改成功, 则回滚
  155. $.when(ajax).done(function() {
  156. if(isOk == false) {
  157. data.status = oldValue;
  158. }
  159. })
  160. },
  161. },
  162. created: function() {
  163. this.f5();
  164. sa.onInputEnter();
  165. }
  166. })
  167. </script>
  168. </body>
  169. </html>