parkingInfo-list.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div>
  3. <el-breadcrumb separator=">">
  4. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item>
  6. <a href="#">物业管理</a>
  7. </el-breadcrumb-item>
  8. <el-breadcrumb-item>
  9. <a href="#">车位收费管理</a>
  10. </el-breadcrumb-item>
  11. <el-breadcrumb-item>
  12. <a href="/base/parkingInfo">车位管理</a>
  13. </el-breadcrumb-item>
  14. </el-breadcrumb>
  15. <el-divider></el-divider>
  16. <!--
  17. 要resetFields起作用,必须配置:model和prop
  18. -->
  19. <el-form
  20. ref="queryForm"
  21. :model="queryModel"
  22. inline
  23. class="demo-form-inline"
  24. >
  25. <el-form-item label="名称" prop="parkingName">
  26. <el-input
  27. type="text"
  28. size="mini"
  29. v-model="queryModel.parkingName"
  30. ></el-input>
  31. </el-form-item>
  32. <!-- <el-form-item label="上级" prop="parentId">
  33. <el-select-tree
  34. size="mini"
  35. :props="parentProps"
  36. :options="parentResult"
  37. v-model="queryModel.parentId"
  38. height="200"
  39. ></el-select-tree>
  40. </el-form-item> -->
  41. <el-form-item>
  42. <el-button
  43. type="primary"
  44. size="mini"
  45. icon="ios-search"
  46. @click="changePage(1)"
  47. :loading="loading"
  48. >查询</el-button
  49. >&nbsp;
  50. <el-button
  51. type="info"
  52. size="mini"
  53. style="margin-left: 8px"
  54. @click="handleReset('queryForm')"
  55. >重置</el-button
  56. >&nbsp;
  57. </el-form-item>
  58. </el-form>
  59. <el-divider></el-divider>
  60. <el-row class="button-group">
  61. <el-button
  62. type="primary"
  63. size="small"
  64. plain
  65. icon="el-icon-circle-plus"
  66. @click="handleAdd"
  67. >新增</el-button
  68. >
  69. <el-button
  70. type="primary"
  71. size="small"
  72. plain
  73. icon="el-icon-circle-plus"
  74. :disabled="multipleSelection.length == 0"
  75. @click="handleBatchDelete"
  76. >删除选中项</el-button
  77. >
  78. </el-row>
  79. <el-table
  80. :data="tableData"
  81. style="min-height: 400px"
  82. v-loading="loading"
  83. stripe
  84. @sort-change="sortChange"
  85. @selection-change="handleSelectionChange"
  86. >
  87. <el-table-column type="selection" width="55"></el-table-column>
  88. <el-table-column
  89. prop="parkingName"
  90. label="名称"
  91. width="180"
  92. ></el-table-column>
  93. <el-table-column
  94. prop="parkId"
  95. label="停车场编号"
  96. width="180"
  97. ></el-table-column>
  98. <el-table-column
  99. prop="parentName"
  100. label="上级"
  101. width="180"
  102. ></el-table-column>
  103. <el-table-column
  104. prop="companyName"
  105. label="所属物业公司"
  106. width="180"
  107. ></el-table-column>
  108. <el-table-column
  109. prop="createTime"
  110. label="创建时间"
  111. width="180"
  112. ></el-table-column>
  113. <el-table-column
  114. prop="updateTime"
  115. label="更新时间"
  116. width="180"
  117. ></el-table-column>
  118. <el-table-column label="操作">
  119. <template slot-scope="{ row }">
  120. <el-button
  121. size="mini"
  122. type="primary"
  123. @click="handleOpenChannel(row)"
  124. v-if="row.parkId != 0"
  125. >查看车道</el-button
  126. >
  127. <el-button size="mini" type="warning" @click="handleEdit(row)"
  128. >编辑</el-button
  129. >
  130. <el-button size="mini" type="danger" @click="handleDelete(row)"
  131. >删除</el-button
  132. >
  133. </template>
  134. </el-table-column>
  135. </el-table>
  136. <el-pagination
  137. :current-page.sync="pageIndex"
  138. :total="totalElements"
  139. :page-sizes="pageSizeList"
  140. @current-change="changePage"
  141. @size-change="pageSizeChange"
  142. layout="total, sizes, prev, pager, next, jumper"
  143. ></el-pagination>
  144. <parkingInfo-detail
  145. v-if="showModal"
  146. :businessKey="businessKey"
  147. :title="modalTitle"
  148. @close="onDetailModalClose"
  149. ></parkingInfo-detail>
  150. <parkingChannel-list
  151. v-if="showChannelModal"
  152. :parkId="parkId"
  153. @close="onDetailModalClose"
  154. ></parkingChannel-list>
  155. </div>
  156. </template>
  157. <script>
  158. import Constant from "@/constant";
  159. import ParkingInfoDetail from "./parkingInfo-detail";
  160. import ParkingChannelList from "./parkingChannel-list";
  161. import parkingInfoApi from "@/api/base/parkingInfo";
  162. import NProgress from "nprogress"; // progress bar
  163. import "nprogress/nprogress.css"; // progress bar style
  164. import SelectTree from "@/components/SelectTree";
  165. export default {
  166. data() {
  167. var self = this;
  168. return {
  169. queryModel: {
  170. id: "",
  171. companyId: "",
  172. parkingName: "",
  173. parentId: "",
  174. ownerId: "",
  175. parkingPrice: "",
  176. rentPrice: "",
  177. contractType: "",
  178. effectiveTime: "",
  179. expirationTime: "",
  180. delFlag: "",
  181. createBy: "",
  182. createTime: "",
  183. updateBy: "",
  184. updateTime: "",
  185. },
  186. loading: false,
  187. tableData: [],
  188. pageIndex: 1,
  189. pageSize: 10,
  190. totalPages: 0,
  191. totalElements: 0,
  192. field: "",
  193. direction: "",
  194. pageSizeList: [10, 20, 30],
  195. multipleSelection: [],
  196. showModal: false,
  197. modalTitle: "",
  198. businessKey: "",
  199. parentResult: [],
  200. parentProps: {
  201. value: "id",
  202. label: "parkingName",
  203. },
  204. showChannelModal: false,
  205. parkId: "",
  206. };
  207. },
  208. // created() {
  209. // var self = this;
  210. // parkingInfoApi.query().then(function (response) {
  211. // var jsonData = response.data;
  212. // if (jsonData.result) {
  213. // self.parentResult = jsonData.data;
  214. // }
  215. // });
  216. // },
  217. methods: {
  218. changePage(pageIndex) {
  219. var self = this;
  220. self.loading = true;
  221. self.pageIndex = pageIndex;
  222. var formData = new FormData();
  223. formData.append("pageIndex", self.pageIndex);
  224. formData.append("pageSize", self.pageSize);
  225. formData.append("parkingName", self.queryModel.parkingName);
  226. formData.append("parentId", self.queryModel.parentId);
  227. if (this.field != null) {
  228. formData.append("field", this.field);
  229. }
  230. if (this.direction != null) {
  231. formData.append("direction", this.direction);
  232. }
  233. parkingInfoApi
  234. .pageList(formData)
  235. .then(function (response) {
  236. self.loading = false;
  237. var jsonData = response.data.data;
  238. self.tableData = jsonData.data;
  239. self.totalPages = jsonData.totalPages;
  240. self.totalElements = jsonData.recordsTotal;
  241. })
  242. .catch((error) => {
  243. self.loading = false;
  244. // self.$message.error(error + "");
  245. });
  246. },
  247. pageSizeChange(pageSize) {
  248. this.pageSize = pageSize;
  249. this.$nextTick(() => {
  250. this.changePage(this.pageIndex);
  251. });
  252. },
  253. sortChange(data) {
  254. this.field = data.column.field;
  255. this.direction = data.order == "ascending" ? "asc" : "desc";
  256. this.changePage(this.pageIndex);
  257. },
  258. handleSelectionChange(val) {
  259. this.multipleSelection = val;
  260. },
  261. handleReset(name) {
  262. this.$refs[name].resetFields();
  263. },
  264. handleAdd() {
  265. this.modalTitle = "新增";
  266. this.businessKey = "";
  267. this.showModal = true;
  268. },
  269. handleEdit(record) {
  270. this.modalTitle = "编辑";
  271. this.businessKey = record.id;
  272. this.showModal = true;
  273. },
  274. handleOpenChannel(record) {
  275. this.parkId = record.parkId;
  276. this.showChannelModal = true;
  277. },
  278. handleDelete(record) {
  279. var self = this;
  280. self
  281. .$confirm("是否确认删除?", "提示", {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning",
  285. })
  286. .then(() => {
  287. parkingInfoApi.remove(record.id).then(function (response) {
  288. var jsonData = response.data;
  289. if (jsonData.result) {
  290. // var index = self.tableData.indexOf(record);
  291. // self.tableData.splice(index, 1);
  292. self.changePage(self.pageIndex);
  293. self.$message({
  294. type: "success",
  295. message: "删除成功!",
  296. });
  297. }
  298. });
  299. });
  300. },
  301. handleBatchDelete() {
  302. var self = this;
  303. var idList = this.multipleSelection.map((record) => {
  304. return record.id;
  305. });
  306. this.$confirm("是否确认删除选中项?", "提示", {
  307. confirmButtonText: "确定",
  308. cancelButtonText: "取消",
  309. type: "warning",
  310. }).then(() => {
  311. parkingInfoApi.batchRemove(idList).then(function (response) {
  312. var jsonData = response.data;
  313. if (jsonData.result) {
  314. self.changePage(self.pageIndex);
  315. self.$message({
  316. type: "success",
  317. message: "删除成功!",
  318. });
  319. }
  320. });
  321. });
  322. },
  323. onDetailModalClose(refreshed) {
  324. //保存成功后回调
  325. this.showModal = false;
  326. this.showChannelModal = false;
  327. if (refreshed) {
  328. this.changePage(this.pageIndex);
  329. }
  330. },
  331. },
  332. mounted: function () {
  333. this.changePage(1);
  334. },
  335. components: {
  336. "parkingInfo-detail": ParkingInfoDetail,
  337. "parkingChannel-list": ParkingChannelList,
  338. },
  339. };
  340. </script>
  341. <style lang="scss" scoped>
  342. .el-breadcrumb {
  343. margin: 10px;
  344. line-height: 20px;
  345. }
  346. .el-divider {
  347. margin: 5px 0;
  348. }
  349. .demo-form-inline {
  350. margin-left: 10px;
  351. text-align: left;
  352. }
  353. .button-group {
  354. margin-left: 10px;
  355. text-align: left;
  356. }
  357. </style>