综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chooseCar.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2024-03-27 11:10:16
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2024-05-23 15:37:34
  6. -->
  7. <template>
  8. <div>
  9. <el-form :inline="true">
  10. <el-form-item label="车牌号:">
  11. <el-input v-model="queryParams.licensePlate" clearable></el-input>
  12. </el-form-item>
  13. <el-form-item label="品牌:">
  14. <el-input v-model="queryParams.brand" clearable></el-input>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button @click="getList" type="primary">搜索</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <el-table ref="chooseCar" :data="list" @selection-change="handleSelectionChange" :row-key="getRowKeys">
  21. <el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
  22. <el-table-column label="车牌号" align="center" prop="licensePlate" />
  23. <el-table-column label="驾驶员" align="center" prop="driverUser.nickName" />
  24. <el-table-column label="品牌" align="center" prop="brand" />
  25. <el-table-column label="单日成本" align="center" prop="dayCost" />
  26. </el-table>
  27. <div style="text-align: right;">
  28. <el-pagination @current-change="getList" :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize"
  29. layout="total, prev, pager, next" :total="total">
  30. </el-pagination>
  31. </div>
  32. <div>
  33. 已选车辆:
  34. <el-tag v-for="item in chooseList" style="margin: 5px;" :key="item.carId">
  35. {{ item.licensePlate + item.brand }}
  36. </el-tag>
  37. </div>
  38. <div style="text-align: center;margin-top: 20px;">
  39. <el-button type="primary" @click="confirmChoose">确认选择</el-button>
  40. <el-button @click="clearChoose">清空选择</el-button>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { listCar } from "@/api/oa/car/car";
  46. import { getUserByPost } from "@/api/system/post";
  47. export default {
  48. data() {
  49. return {
  50. queryParams: {
  51. pageNum: 1,
  52. pageSize: 10
  53. },
  54. list: [],
  55. form: {},
  56. total: 0,
  57. loading: false,
  58. chooseList: [],
  59. driverList: [],
  60. }
  61. },
  62. created() {
  63. this.getList();
  64. // this.getDriverList();
  65. },
  66. methods: {
  67. /** 查询cmc车辆信息列表 */
  68. getList() {
  69. this.loading = true;
  70. listCar(this.queryParams).then(response => {
  71. this.list = response.rows;
  72. this.total = response.total;
  73. this.loading = false;
  74. });
  75. },
  76. // 查询驾驶员列表
  77. getDriverList() {
  78. getUserByPost({ postName: '驾驶员' }).then(response => {
  79. this.driverList = response.data;
  80. })
  81. },
  82. handleSelectionChange(val) {
  83. this.chooseList = val
  84. },
  85. getRowKeys(row) {
  86. return row.carId;
  87. },
  88. confirmChoose() {
  89. this.$emit('chooseList', this.chooseList)
  90. },
  91. clearChoose() {
  92. this.$refs.chooseCar.clearSelection();
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped></style>