tb-costomer-maintain.html 8.6 KB

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