tb-group-list.html 10.0 KB

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