partitionManagement.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div class="main">
  3. <div class="search">
  4. <el-input v-model="mixins_query.areaName" clearable placeholder="分区名称" class="search-input"></el-input>
  5. <el-button type="primary" @click="mixins_search" clearable class="search-btn" icon="el-icon-search">查询 </el-button>
  6. <div class="search-icon">
  7. <el-tooltip class="item" effect="light" placement="bottom" content="新增">
  8. <i class="zoniot_font zoniot-icon-tianjia2" @click="addOrEdit('add')"></i>
  9. </el-tooltip>
  10. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  11. <i class="zoniot_font zoniot-icon-shanchu2" @click="deleteRow"></i>
  12. </el-tooltip>
  13. <el-tooltip class="item" effect="light" placement="bottom" content="返回">
  14. <i class="zoniot_font zoniot-icon-fanhui" @click="close()"></i>
  15. </el-tooltip>
  16. </div>
  17. </div>
  18. <div>
  19. <zz-table
  20. :cols="cols"
  21. :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
  22. :data="mixins_list"
  23. :loading="mixins_onQuery"
  24. :pageset="mixins_pageset"
  25. @page-change="pageChange"
  26. @selection-change="selectionChange"
  27. >
  28. <template slot-scope="scope" slot="opt" class="opt">
  29. <div class="opt">
  30. <el-tooltip effect="light" placement="bottom" content="编辑">
  31. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope)"></i>
  32. </el-tooltip>
  33. <el-tooltip effect="light" placement="bottom" content="删除">
  34. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
  35. </el-tooltip>
  36. </div>
  37. </template>
  38. </zz-table>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import list from '@utils/list.js';
  44. export default {
  45. mixins: [list],
  46. data() {
  47. return {
  48. areaName: '',
  49. communityId: '', //社区id
  50. garageId: '', //车库id
  51. selectName: 'parkingLot',
  52. cols: [
  53. {
  54. label: '车库名称',
  55. prop: 'garageName'
  56. },
  57. {
  58. label: '分区名称',
  59. prop: 'areaName'
  60. },
  61. {
  62. label: '车位数量',
  63. prop: 'parkingNumber'
  64. },
  65. {
  66. label: '备注',
  67. prop: 'remarks'
  68. },
  69. {
  70. label: '操作',
  71. prop: 'opt',
  72. slot: 'opt'
  73. }
  74. ],
  75. tableData: [],
  76. selectRow: [],
  77. mixins_post: 'post'
  78. };
  79. },
  80. methods: {
  81. //新增与编辑弹出框
  82. addOrEdit(todo, scope) {
  83. new Promise((resolve) => {
  84. let row,
  85. title = '分区编辑';
  86. if ('add' == todo) {
  87. title = '分区添加';
  88. row = {
  89. communityId: this.communityId,
  90. garageId: this.garageId
  91. };
  92. this.addEditPopUps(title, row, todo);
  93. } else {
  94. this.$http
  95. .get('/sc-community/assets/garage/area/find/' + scope.row.id, {})
  96. .then((res) => {
  97. row = res.data;
  98. this.addEditPopUps(title, row, todo);
  99. })
  100. .catch(function () {});
  101. }
  102. }).then(() => {});
  103. },
  104. addEditPopUps(title, row, todo) {
  105. this.$store.dispatch('addPopup', {
  106. url: '/parkingLotAdministration/pageJump/zoneAddEdit.vue',
  107. title: title,
  108. width: '850px',
  109. height: '600px',
  110. props: {
  111. data: row,
  112. todo: todo,
  113. callback: this.mixins_search
  114. }
  115. });
  116. },
  117. //单个删除
  118. deleteOne(ids) {
  119. this.$msgBox(`刪除`, '删除后将无法恢复,请问是否继续?')
  120. .then(() => {
  121. this.$http.post('/sc-community-web/assets/garage/area/delete', [ids]).then(({ status }) => {
  122. if (0 === status) {
  123. this.$message({
  124. type: 'success',
  125. message: '删除成功!'
  126. });
  127. this.mixins_search();
  128. } else {
  129. this.$message.error('删除失败!');
  130. }
  131. });
  132. })
  133. .catch(() => {
  134. this.$message({
  135. type: 'info',
  136. message: '已取消删除'
  137. });
  138. });
  139. },
  140. deleteRow() {
  141. // 获取选中列表的ids
  142. let ids = [];
  143. if (!this.selectRow.length) {
  144. this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  145. return;
  146. }
  147. this.selectRow.forEach((v) => {
  148. ids.push(v.id);
  149. });
  150. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  151. .then((_) => {
  152. this.$http.post('/sc-community-web/assets/garage/area/delete', ids).then(({ status, data, msg }) => {
  153. if (0 === status) {
  154. this.$message({
  155. type: 'success',
  156. message: '删除成功!'
  157. });
  158. this.mixins_search();
  159. }
  160. });
  161. })
  162. .catch(() => {});
  163. },
  164. selectionChange(val) {
  165. this.selectRow = val;
  166. },
  167. close() {
  168. let activeRout = this.$route;
  169. let tagsList = this.$store.getters['getTagsList'];
  170. tagsList.forEach((item, index) => {
  171. if (item.title == activeRout.meta.title || item.path == activeRout.path) {
  172. tagsList.splice(index, 1);
  173. history.go(-1);
  174. return true;
  175. }
  176. });
  177. }
  178. },
  179. created() {
  180. this.communityId = parseInt(sessionStorage.getItem('communityId'));
  181. this.garageId = parseInt(sessionStorage.getItem('garageId'));
  182. this.mixins_dataUrl = '/sc-community/assets/garage/area/page';
  183. this.mixins_query = {
  184. garageId: this.garageId
  185. };
  186. this.mixins_search();
  187. }
  188. };
  189. </script>