tb-partner-list.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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="text" name="名称" v-model="p.name"></sa-item>
  25. <sa-item type="text" name="联系电话" v-model="p.phone"></sa-item>
  26. <sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
  27. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  28. <el-button style="display: inline;" type="primary" icon="el-icon-plus" @click="add()" v-if="sa.isAuth('tb-partner-add')">新增
  29. </el-button>
  30. <el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  31. </el-form>
  32. <!-- ------------- 数据列表 ------------- -->
  33. <el-table class="data-table" ref="data-table" :data="dataList">
  34. <sa-td type="selection"></sa-td>
  35. <sa-td name="名称" prop="name"></sa-td>
  36. <sa-td name="类型" prop="typeDes"></sa-td>
  37. <sa-td name="联系人" prop="dutyPeople"></sa-td>
  38. <sa-td name="联系电话" prop="phone"></sa-td>
  39. <sa-td name="营业执照" prop="businessLicence" type="img"></sa-td>
  40. <sa-td name="添加时间" prop="creareTime" width="160px"></sa-td>
  41. <el-table-column label="操作" fixed="right" width="320px">
  42. <template slot-scope="s">
  43. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  44. </el-button>
  45. <el-button v-if="sa.isAuth('tb-partner-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  46. </el-button>
  47. <el-button v-if="sa.isAuth('tb-partner-user')" class="c-btn" type="primary" icon="el-icon-user-solid" @click="userFn(s.row)">用户
  48. </el-button>
  49. <el-button v-if="sa.isAuth('tb-partner-del')" class="c-btn" type="danger" icon="el-icon-delete"
  50. @click="del(s.row)">删除</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <!-- ------------- 分页 ------------- -->
  55. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  56. </sa-item>
  57. </div>
  58. </div>
  59. <script>
  60. var app = new Vue({
  61. components: {
  62. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  63. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  64. },
  65. el: '.vue-box',
  66. data: {
  67. modal: {
  68. visible: false,
  69. form: {
  70. id: '',
  71. judgeContent: '审核通过'
  72. }
  73. },
  74. p: { // 查询参数
  75. partner: 1,
  76. name: '', // 名称
  77. phone: '', // 联系号码
  78. dutyPeople: '', // 负责人
  79. addressIds: '', // 地址id
  80. addressStr: '', // 地址
  81. status: '', // 状态(0=否,1=是)
  82. creareTime: '', // 创建时间
  83. judgeStatus: '', // 审核状态(1=未审核,2审核通过,3审核不通过)
  84. judgeTime: '', // 审核时间
  85. judgeContent: '', // 审核意见
  86. pageNo: 1, // 当前页
  87. pageSize: 10, // 页大小
  88. sortType: 0 // 排序方式
  89. },
  90. dataCount: 0,
  91. dataList: [], // 数据集合
  92. currentCustomerId: '1',
  93. },
  94. methods: {
  95. accountFn(data) {
  96. sa.showIframe('账户管理', 'tb-account-manager.html?customerId=' + data.id, '450px', '60%');
  97. },
  98. judgeFn(data) {
  99. Object.assign(this.modal, {
  100. visible: true,
  101. form: {
  102. id: data.id,
  103. judgeContent: data.judgeContent,
  104. judgeStatus: data.judgeStatus
  105. }
  106. })
  107. },
  108. getCustomer() {
  109. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  110. this.currentCustomerId = resp.data;
  111. }.bind(this));
  112. },
  113. userFn(data) {
  114. sa.showIframe('企业用户', 'customer-admin-list.html?customerId=' + data.id, '1050px', '90%');
  115. },
  116. // 刷新
  117. f5: function() {
  118. sa.ajax('/TbCostomer/getList', sa.removeNull(this.p), function(res) {
  119. this.dataList = res.data; // 数据
  120. this.dataCount = res.dataCount; // 数据总数
  121. sa.f5TableHeight(); // 刷新表格高度
  122. }.bind(this));
  123. },
  124. // 查看
  125. get: function(data) {
  126. sa.showIframe('数据详情', 'tb-partner-info.html?id=' + data.id, '800px', '80%');
  127. },
  128. // 查看 - 根据选中的
  129. getBySelect: function(data) {
  130. var selection = this.$refs['data-table'].selection;
  131. if (selection.length == 0) {
  132. return sa.msg('请选择一条数据')
  133. }
  134. this.get(selection[0]);
  135. },
  136. // 修改
  137. update: function(data) {
  138. sa.showIframe('修改数据', 'tb-partner-add.html?id=' + data.id, '500px', '70%');
  139. },
  140. // 新增
  141. add: function(data) {
  142. sa.showIframe('新增数据', 'tb-partner-add.html?id=-1', '550px', '80%');
  143. },
  144. // 删除
  145. del: function(data) {
  146. sa.confirm('是否删除,此操作不可撤销', function() {
  147. sa.ajax('/TbCostomer/delete?id=' + data.id, function(res) {
  148. sa.arrayDelete(this.dataList, data);
  149. sa.ok('删除成功');
  150. sa.f5TableHeight(); // 刷新表格高度
  151. }.bind(this))
  152. }.bind(this));
  153. },
  154. // 批量删除
  155. deleteByIds: function() {
  156. // 获取选中元素的id列表
  157. let selection = this.$refs['data-table'].selection;
  158. let ids = sa.getArrayField(selection, 'id');
  159. if (selection.length == 0) {
  160. return sa.msg('请至少选择一条数据')
  161. }
  162. // 提交删除
  163. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  164. sa.ajax('/TbCostomer/deleteByIds', {
  165. ids: ids.join(',')
  166. }, function(res) {
  167. sa.arrayDelete(this.dataList, selection);
  168. sa.ok('删除成功');
  169. sa.f5TableHeight(); // 刷新表格高度
  170. }.bind(this))
  171. }.bind(this));
  172. },
  173. // 改 - 状态(0=否,1=是)
  174. updateStatus: function(data) {
  175. // 声明变量记录是否成功
  176. var isOk = false;
  177. var oldValue = data.status;
  178. var ajax = sa.ajax('/TbCostomer/updateStatus', {
  179. id: data.id,
  180. value: data.status
  181. }, function(res) {
  182. isOk = true;
  183. sa.msg('修改成功');
  184. }.bind(this));
  185. // 如果未能修改成功, 则回滚
  186. $.when(ajax).done(function() {
  187. if (isOk == false) {
  188. data.status = oldValue;
  189. }
  190. })
  191. },
  192. },
  193. created: function() {
  194. this.f5();
  195. this.getCustomer();
  196. sa.onInputEnter();
  197. }
  198. })
  199. </script>
  200. </body>
  201. </html>