parkingSpaceList.vue 8.6 KB

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