parkingSpaceList.vue 7.1 KB

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