parkingSpaceList.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="main">
  3. <div class="search">
  4. <el-input placeholder="车位号" class="search-input" clearable v-model="mixins_query.parkingNumber"></el-input>
  5. <el-select v-model="mixins_query.communityId" clearable placeholder="请选择社区名称">
  6. <el-option
  7. v-for="(item, index) in communityList"
  8. :label="item.label"
  9. :value="item.id"
  10. @change="communityChoice"
  11. :key="index"
  12. ></el-option>
  13. </el-select>
  14. <el-select v-model="mixins_query.garageId" clearable placeholder="请选择车库名称">
  15. <el-option v-for="(item, index) in garageList" :label="item.label" :value="item.id" :key="index"></el-option>
  16. </el-select>
  17. <el-button type="primary" @click="mixins_search" class="search-btn" icon="el-icon-search"
  18. >查询
  19. <!-- <i class="iconfont">&#xe6fc;</i> -->
  20. </el-button>
  21. <div class="search-icon">
  22. <el-tooltip class="item" effect="light" placement="bottom" content="新增">
  23. <i class="zoniot_font zoniot-icon-tianjia2" @click="addOrEdit('add')"></i>
  24. </el-tooltip>
  25. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  26. <i class="zoniot_font zoniot-icon-shanchu2" @click="deleteRow"></i>
  27. </el-tooltip>
  28. </div>
  29. </div>
  30. <div>
  31. <zz-table
  32. :cols="cols"
  33. :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
  34. :data="mixins_list"
  35. :loading="mixins_onQuery"
  36. :pageset="mixins_pageset"
  37. @page-change="pageChange"
  38. @selection-change="selectionChange"
  39. >
  40. <template slot-scope="scope" slot="opt" class="opt">
  41. <div class="opt">
  42. <el-tooltip effect="light" placement="bottom" content="编辑">
  43. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope)"></i>
  44. </el-tooltip>
  45. <el-tooltip effect="light" placement="bottom" content="删除">
  46. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
  47. </el-tooltip>
  48. </div>
  49. </template>
  50. </zz-table>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import list from '@utils/list.js';
  56. export default {
  57. mixins: [list],
  58. data() {
  59. return {
  60. communityList: [], //社区名称下拉列表
  61. garageList: [], //车库名称下拉列表
  62. cols: [
  63. {
  64. label: '所属社区',
  65. prop: 'communityName'
  66. },
  67. {
  68. label: '车库名称',
  69. prop: 'garageName'
  70. },
  71. {
  72. label: '车库区域',
  73. prop: 'garageAreaName'
  74. },
  75. {
  76. label: '车位号',
  77. prop: 'parkingNumber'
  78. },
  79. {
  80. label: '车位类别',
  81. prop: 'parkingType',
  82. format(val) {
  83. if (val == 1) {
  84. return '公共车位';
  85. } else {
  86. return '私人车位';
  87. }
  88. }
  89. },
  90. {
  91. label: '车位面积',
  92. prop: 'parkingArea'
  93. },
  94. {
  95. label: '操作',
  96. prop: 'opt',
  97. slot: 'opt'
  98. }
  99. ],
  100. selectRow: [],
  101. mixins_post: 'post'
  102. };
  103. },
  104. methods: {
  105. //获取社区名称下拉列表
  106. communityNameList() {
  107. this.communityList = [];
  108. let onOption = '';
  109. this.$http.get('/sc-community/assets/community/list', {}).then((res) => {
  110. console.log(res);
  111. res.data.map((res) => {
  112. onOption = {
  113. label: res.communityName,
  114. id: res.id
  115. };
  116. this.communityList.push(onOption);
  117. });
  118. });
  119. },
  120. communityChoice(e) {
  121. this.garageNameList();
  122. },
  123. //获取车库名称下拉列表
  124. garageNameList() {
  125. this.garageList = [];
  126. let onOption = '';
  127. this.$http.post('/sc-community/assets/garage/list', {}).then((res) => {
  128. res.data.map((res) => {
  129. onOption = {
  130. label: res.garageName,
  131. id: res.id
  132. };
  133. this.garageList.push(onOption);
  134. });
  135. });
  136. },
  137. addOrEdit(todo, scope) {
  138. let self = this;
  139. new Promise((resolve) => {
  140. let row,
  141. title = '编辑车位';
  142. if ('add' == todo) {
  143. title = '新增车位';
  144. this.addEditPopUps(title, row, todo);
  145. } else {
  146. this.$http.get('/sc-community/assets/garage/parking/find/' + scope.row.id, {}).then((res) => {
  147. // sessionStorage.setItem('communityInformation',JSON.stringify(data))
  148. row = res.data;
  149. this.addEditPopUps(title, row, todo);
  150. });
  151. }
  152. }).then(() => {
  153. this.mixins_search();
  154. });
  155. },
  156. addEditPopUps(title, row, todo) {
  157. this.$store.dispatch('addPopup', {
  158. url: '/parkingLotAdministration/pageJump/parkingLotSaveEdits.vue',
  159. title: title,
  160. width: '850px',
  161. height: '470px',
  162. props: {
  163. data: row,
  164. todo: todo,
  165. callback: this.mixins_search
  166. }
  167. });
  168. },
  169. //单个删除
  170. deleteOne(id) {
  171. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  172. .then((_) => {
  173. this.$http.post('/sc-community/assets/garage/parking/delete', [id]).then(({ status, data, msg }) => {
  174. if (0 === status) {
  175. this.$message({
  176. type: 'success',
  177. message: '删除成功!'
  178. });
  179. this.mixins_search();
  180. }
  181. });
  182. })
  183. .catch(() => {});
  184. },
  185. deleteRow() {
  186. // 获取选中列表的ids
  187. let ids = [];
  188. if (!this.selectRow.length) {
  189. this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  190. return;
  191. }
  192. this.selectRow.forEach((v) => {
  193. ids.push(v.id);
  194. });
  195. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  196. .then((_) => {
  197. this.$http.post('/sc-community/assets/garage/parking/delete', ids).then(({ status, data, msg }) => {
  198. if (0 === status) {
  199. this.$message({
  200. type: 'success',
  201. message: '删除成功!'
  202. });
  203. this.mixins_search();
  204. }
  205. });
  206. })
  207. .catch(() => {});
  208. },
  209. selectionChange(val) {
  210. this.selectRow = val;
  211. }
  212. },
  213. mounted() {},
  214. created() {
  215. this.communityNameList();
  216. this.garageNameList();
  217. this.mixins_dataUrl = '/sc-community/assets/garage/parking/page';
  218. this.mixins_query = {};
  219. this.mixins_search();
  220. }
  221. };
  222. </script>