tb-group-list.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 @change="f5()" 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"
  29. :value="item.id"> </el-option>
  30. </el-select>
  31. </div>
  32. <div class="c-item">
  33. <label class="c-label">名称:</label>
  34. <el-input size="mini" v-model="p.name"></el-input>
  35. </div>
  36. <div class="c-item" style="min-width: 0px;">
  37. <el-button size="mini" type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  38. <el-button size="mini" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  39. </div>
  40. </el-form>
  41. <!-- ------------- 数据列表 ------------- -->
  42. <el-table class="data-table" ref="data-table" :data="dataList" size="small">
  43. <el-table-column align="center" type="selection" width="45px"></el-table-column>
  44. <el-table-column align="center" label="名称" prop="orgName"></el-table-column>
  45. <el-table-column align="center" label="场站编码" prop="fieldCode"></el-table-column>
  46. <el-table-column align="center" label="所属场所" prop="tradeAreaName" width="180"></el-table-column>
  47. <el-table-column align="center" label="组长" prop="leaderName">
  48. <template slot-scope='s'>
  49. <b v-if="s.row.leaderName" style="color: #066CF3;cursor: pointer;" @click="editLeaderFn(s.row.id,s.row.leaderId)">{{s.row.leaderName}}</b>
  50. <b v-else>-</b>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" label="组长电话" prop="leaderPhone">
  54. <template slot-scope='s'>
  55. <b v-if="s.row.leaderPhone">{{s.row.leaderPhone}}</b>
  56. <b v-else>-</b>
  57. </template>
  58. </el-table-column>
  59. <el-table-column align="center" label="创建时间" class-name="tc-date">
  60. <template slot-scope="s">{{s.row.createTime}}</template>
  61. </el-table-column>
  62. <el-table-column align="center" label="操作" fixed="right" width="270px">
  63. <template slot-scope="s">
  64. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  65. </el-button>
  66. <el-button class="c-btn" type="primary" icon="el-icon-view" @click="peopleFn(s.row)">边民
  67. </el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <!-- ------------- 分页 ------------- -->
  72. <div class="page-box">
  73. <el-pagination background layout="total, prev, pager, next, sizes, jumper"
  74. :current-page.sync="p.pageNo" :page-size.sync="p.pageSize" :total="dataCount"
  75. :page-sizes="[10, 20, 30, 40, 50, 100, 1000]" @current-change="f5()" @size-change="f5()">
  76. </el-pagination>
  77. </div>
  78. </div>
  79. <el-dialog title="导入互助组" :visible.sync="upload" width="500px">
  80. <div class="c-item br">
  81. <label class="c-label"><label style="color: red">*</label>所在地区:</label>
  82. <el-cascader size="mini" @change="addressChange" placeholder="请选择" v-model="address_arry"
  83. :options="options" :props={value:'id',label:'district'}></el-cascader>
  84. <span style="color: red; margin-left: 20px;" v-if="showError">请选择</span>
  85. </div>
  86. <div style="text-align: center;margin-top: 20px;">
  87. <el-upload class="upload-demo" :auto-upload="false" drag ref="uploadExcel" :limit="1"
  88. :headers=headers :data="extraData" :limit="1" accept=".xls,.xlsx" :on-success="onSuccess"
  89. :action="importExcelUrl" :multiple="false">
  90. <i class="el-icon-upload"></i>
  91. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  92. <div class="el-upload__tip" slot="tip">只能上传excel文件</div>
  93. </el-upload>
  94. </div>
  95. <span slot="footer" class="dialog-footer">
  96. <el-button @click="upload = false">取 消</el-button>
  97. <el-button type="primary" @click="sureUpload">确 定</el-button>
  98. </span>
  99. </el-dialog>
  100. </div>
  101. <script>
  102. var app = new Vue({
  103. components: {
  104. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  105. },
  106. el: '.vue-box',
  107. data: {
  108. upload: false,
  109. address_arry: [],
  110. showError: false,
  111. importExcelUrl: sa.cfg.api_url + '/levelone-server/TbGroup/import',
  112. headers: {
  113. satoken: localStorage.tokenValue
  114. },
  115. p: { // 查询参数
  116. id: '', //
  117. name: '', // 名称
  118. leaderId: '', // 组长ID
  119. leaderName: '', // 组长名
  120. leaderPhone: '', // 组长电话
  121. code: '', //
  122. status: '', // 状态(0=禁用,1=启用)
  123. pageNo: 1, // 当前页
  124. pageSize: 10, // 页大小
  125. sortType: 0 // 排序方式
  126. },
  127. dataCount: 0,
  128. dataList: [], // 数据集合
  129. options: [],
  130. tradeAreaList:[],
  131. extraData: {
  132. addressIds: ''
  133. }
  134. },
  135. methods: {
  136. getTradeArea() {
  137. sa.ajax('/level-one-server/TbTradeArea/getList', {
  138. pageSize: 100,
  139. pageNo: 1
  140. }, function(resp) {
  141. this.tradeAreaList = resp.data;
  142. }.bind(this));
  143. },
  144. addressChange(value) {
  145. console.log(value);
  146. },
  147. sureUpload() {
  148. this.showError = this.address_arry.length == 0;
  149. if (this.showError) {
  150. return;
  151. }
  152. this.$refs.uploadExcel.submit();
  153. },
  154. getImportExcel() {
  155. window.location.href = '../../static/excel/group.xlsx'
  156. },
  157. showUpload() {
  158. this.upload = true;
  159. this.showError = false;
  160. this.address_arry = [];
  161. this.extraData.addressIds = '';
  162. this.getAddress();
  163. },
  164. getAddress() {
  165. sa.ajax('/level-one-server/TbDistrict/getTreeData', function(resp) {
  166. this.options = resp.data;
  167. }.bind(this));
  168. },
  169. onSuccess(res, file, fileList) {
  170. fileList = [];
  171. if (res.code === 500) {
  172. sa.alert(res.msg);
  173. } else {
  174. sa.alert('导入成功');
  175. this.f5();
  176. }
  177. this.$refs.uploadExcel.clearFiles();
  178. this.upload = false;
  179. },
  180. peopleFn(group){
  181. sa.showIframe("【"+group.orgName+'】边民管理', 'tb-group-people.html?groupId='+group.id, '1080px', '100%');
  182. },
  183. addLeaderFn(groupId){
  184. sa.showIframe('添加组长', 'tb-group-leader.html?groupId='+groupId, '950px', '90%');
  185. },
  186. editLeaderFn(groupId,leaderId){
  187. sa.showIframe('组长详情', 'tb-group-leader.html?groupId='+groupId+'&leaderId='+leaderId, '950px', '90%');
  188. },
  189. // 刷新
  190. f5: function() {
  191. sa.ajax('/level-one-server/TbGroup/getList', sa.removeNull(this.p), function(res) {
  192. this.dataList = res.data; // 数据
  193. this.dataCount = parseInt(res.dataCount); // 数据总数
  194. sa.f5TableHeight(); // 刷新表格高度
  195. }.bind(this));
  196. },
  197. // 查看
  198. get: function(data) {
  199. sa.showIframe('数据详情', 'tb-group-info.html?id=' + data.id, '950px', '90%');
  200. },
  201. // 修改
  202. update: function(data) {
  203. sa.showIframe('修改数据', 'tb-group-add.html?id=' + data.id, '550px', '90%');
  204. },
  205. // 新增
  206. add: function(data) {
  207. sa.showIframe('新增数据', 'tb-group-add.html?id=-1', '550px', '90%');
  208. },
  209. // 删除
  210. del: function(data) {
  211. sa.confirm('是否删除,此操作不可撤销', function() {
  212. sa.ajax('/level-one-server/TbGroup/delete?id=' + data.id, function(res) {
  213. sa.arrayDelete(this.dataList, data);
  214. sa.ok('删除成功');
  215. sa.f5TableHeight(); // 刷新表格高度
  216. }.bind(this))
  217. }.bind(this));
  218. },
  219. // 批量删除
  220. deleteByIds: function() {
  221. // 获取选中元素的id列表
  222. let selection = this.$refs['data-table'].selection;
  223. let ids = sa.getArrayField(selection, 'id');
  224. if (selection.length == 0) {
  225. return sa.msg('请至少选择一条数据')
  226. }
  227. // 提交删除
  228. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  229. sa.ajax('/level-one-server/TbGroup/deleteByIds', {
  230. ids: ids.join(',')
  231. }, function(res) {
  232. sa.arrayDelete(this.dataList, selection);
  233. sa.ok('删除成功');
  234. sa.f5TableHeight(); // 刷新表格高度
  235. }.bind(this))
  236. }.bind(this));
  237. },
  238. },
  239. created: function() {
  240. this.f5();
  241. sa.onInputEnter();
  242. this.getTradeArea();
  243. }
  244. })
  245. </script>
  246. </body>
  247. </html>