index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item prop="vehiclenumber">
  11. <!-- <el-input
  12. v-model="queryParams.vehiclenumber"
  13. placeholder="请输入车牌号"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. /> -->
  18. <el-select
  19. v-model="queryParams.peopleId"
  20. placeholder="请选择车辆所有人"
  21. @change="handleQuery"
  22. filterable
  23. class="input_xiala"
  24. >
  25. <el-option
  26. v-for="item in renYuans"
  27. :key="item.id"
  28. :label="item.name"
  29. :value="item.id"
  30. class="input_xiala"
  31. >
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <!-- <el-button
  37. type="primary"
  38. icon="el-icon-search"
  39. size="mini"
  40. @click="handleQuery"
  41. >搜索</el-button
  42. > -->
  43. <el-button size="btr" @click="resetQuery">重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. plain
  51. icon="el-icon-plus"
  52. size="mini"
  53. @click="handleAdd"
  54. v-hasPermi="['militaryvehicleManagement:privateCar:add']"
  55. >新增</el-button
  56. >
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="success"
  61. plain
  62. icon="el-icon-edit"
  63. size="mini"
  64. :disabled="single"
  65. @click="handleUpdate"
  66. v-hasPermi="['militaryvehicleManagement:privateCar:edit']"
  67. >修改</el-button
  68. >
  69. </el-col>
  70. <el-col :span="1.5">
  71. <el-button
  72. type="danger"
  73. plain
  74. icon="el-icon-delete"
  75. size="mini"
  76. :disabled="multiple"
  77. @click="handleDelete"
  78. v-hasPermi="['militaryvehicleManagement:privateCar:remove']"
  79. >删除</el-button
  80. >
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. class="box"
  85. type="warning"
  86. plain
  87. icon="el-icon-download"
  88. size="mini"
  89. :loading="exportLoading"
  90. @click="handleExport"
  91. v-hasPermi="['militaryvehicleManagement:privateCar:export']"
  92. >导出</el-button
  93. >
  94. </el-col>
  95. </el-row>
  96. <el-table
  97. v-loading="loading"
  98. :data="privateCarList"
  99. @selection-change="handleSelectionChange"
  100. :header-cell-style="{ background: '#003C69', color: 'white' }"
  101. >
  102. <el-table-column type="selection" width="55" align="center" />
  103. <el-table-column label="序号" align="center" prop="id">
  104. <template scope="scope">
  105. <span>{{
  106. (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
  107. }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="车辆所有人" align="center" prop="peopleName" />
  111. <el-table-column label="车牌号" align="center" prop="vehiclenumber" />
  112. <el-table-column label="车辆型号" align="center" prop="vehiclemodel" />
  113. <el-table-column label="车辆颜色" align="center" prop="vehiclecolor" />
  114. <el-table-column
  115. label="车辆类别"
  116. align="center"
  117. prop="vehiclecategory"
  118. :formatter="carLei"
  119. />
  120. <el-table-column label="联系方式" align="center" prop="contactnumber" />
  121. <el-table-column
  122. label="证件类型"
  123. align="center"
  124. prop="documenttype"
  125. :formatter="zhenJian"
  126. />
  127. <el-table-column
  128. label="证件号"
  129. align="center"
  130. prop="certificatenumber"
  131. width="170"
  132. />
  133. <el-table-column label="备注" align="center" prop="remarks" />
  134. <!-- <el-table-column label="创建人" align="center" prop="adminId" />
  135. <el-table-column label="创建时间" align="center" prop="createtime" /> -->
  136. <!-- <el-table-column
  137. label="临时车辆所有人"
  138. align="center"
  139. prop="peopleName"
  140. />
  141. <el-table-column label="修改时间" align="center" prop="updatetime" />
  142. <el-table-column label="授权开始时间" align="center" prop="authStime" />
  143. <el-table-column label="授权结束时间" align="center" prop="authEtime" /> -->
  144. <el-table-column
  145. label="操作"
  146. align="center"
  147. class-name="small-padding fixed-width"
  148. >
  149. <template slot-scope="scope">
  150. <el-button
  151. size="btu"
  152. type="text"
  153. @click="handleUpdate(scope.row)"
  154. v-hasPermi="['militaryvehicleManagement:privateCar:edit']"
  155. >修改</el-button
  156. >
  157. <el-button
  158. size="btd"
  159. type="text"
  160. @click="handleDelete(scope.row)"
  161. v-hasPermi="['militaryvehicleManagement:privateCar:remove']"
  162. >删除</el-button
  163. >
  164. </template>
  165. </el-table-column>
  166. </el-table>
  167. <pagination
  168. v-show="total > 0"
  169. :total="total"
  170. :page.sync="queryParams.pageNum"
  171. :limit.sync="queryParams.pageSize"
  172. @pagination="getList"
  173. />
  174. <!-- 添加或修改私家车管理对话框 -->
  175. <el-dialog
  176. :title="title"
  177. :visible.sync="open"
  178. width="500px"
  179. append-to-body
  180. :close-on-click-modal="false"
  181. >
  182. <el-form
  183. ref="form"
  184. :model="form"
  185. :rules="rules"
  186. label-width="80px"
  187. inline
  188. >
  189. <el-form-item label="车辆类型" prop="vehiclecategory">
  190. <el-select
  191. v-model="form.vehiclecategory"
  192. placeholder="请输入车辆型号"
  193. >
  194. <el-option
  195. v-for="(item, i) in privateCar"
  196. :key="i"
  197. :label="item.dictLabel"
  198. :value="item.dictValue"
  199. class="input_xiala"
  200. >
  201. </el-option>
  202. </el-select>
  203. </el-form-item>
  204. <el-form-item label="车辆所有人" prop="peopleId">
  205. <el-select v-model="form.peopleId" placeholder="请输入车辆所有人">
  206. <el-option
  207. v-for="(item, i) in renYuan"
  208. :key="i"
  209. :label="item.name"
  210. :value="item.id"
  211. @click.native="suoYouRen(item.name)"
  212. class="input_xiala"
  213. >
  214. </el-option>
  215. </el-select>
  216. </el-form-item>
  217. <el-form-item label="车牌号" prop="vehiclenumber">
  218. <el-input v-model="form.vehiclenumber" placeholder="请输入车牌号" />
  219. </el-form-item>
  220. <el-form-item label="车辆颜色" prop="vehiclecolor">
  221. <el-input v-model="form.vehiclecolor" placeholder="请输入车辆颜色" />
  222. </el-form-item>
  223. <el-form-item label="车辆型号" prop="vehiclemodel">
  224. <el-input v-model="form.vehiclemodel" placeholder="请输入车辆型号" />
  225. </el-form-item>
  226. <el-form-item label="联系方式" prop="contactnumber">
  227. <el-input v-model="form.contactnumber" placeholder="请输入联系方式" />
  228. </el-form-item>
  229. <el-form-item label="证件类型" prop="documenttype">
  230. <el-select v-model="form.documenttype" placeholder="请选择证件类型">
  231. <el-option
  232. v-for="(item, i) in documentType"
  233. :key="i"
  234. :label="item.dictLabel"
  235. :value="item.dictValue"
  236. class="input_xiala"
  237. >
  238. </el-option>
  239. </el-select>
  240. </el-form-item>
  241. <el-form-item label="证件号" prop="certificatenumber">
  242. <el-input
  243. v-model="form.certificatenumber"
  244. placeholder="请输入证件号"
  245. />
  246. </el-form-item>
  247. <el-form-item label="授权开始时间" prop="authStime">
  248. <!-- <el-input v-model="form.authStime" placeholder="请输入授权开始时间" /> -->
  249. <el-date-picker
  250. clearable
  251. size="small"
  252. v-model="form.authStime"
  253. type="date"
  254. value-format="yyyy-MM-dd"
  255. placeholder="请输入授权开始时间"
  256. >
  257. </el-date-picker>
  258. </el-form-item>
  259. <el-form-item label="授权结束时间" prop="authEtime">
  260. <!-- <el-input v-model="form.authEtime" placeholder="请输入授权结束时间" /> -->
  261. <el-date-picker
  262. clearable
  263. size="small"
  264. v-model="form.authEtime"
  265. type="date"
  266. value-format="yyyy-MM-dd"
  267. placeholder="请输入授权结束时间"
  268. >
  269. </el-date-picker>
  270. </el-form-item>
  271. <div class="jiben">备注</div>
  272. <el-form-item prop="remarks">
  273. <el-input
  274. v-model="form.remarks"
  275. type="textarea"
  276. placeholder="请输入内容"
  277. />
  278. </el-form-item>
  279. </el-form>
  280. <div slot="footer" class="dialog-footer">
  281. <el-button type="primary" @click="submitForm">确 定</el-button>
  282. <el-button @click="cancel" size="btn">取 消</el-button>
  283. </div>
  284. </el-dialog>
  285. </div>
  286. </template>
  287. <script>
  288. import {
  289. listPrivateCar,
  290. getPrivateCar,
  291. delPrivateCar,
  292. addPrivateCar,
  293. updatePrivateCar,
  294. exportPrivateCar,
  295. getRenYuanCar,
  296. } from "@/api/militaryvehicleManagement/privateCar";
  297. // 查询字典
  298. import { getDicts } from "@/api/system/dict/data";
  299. import { getAll } from "@/api/grassrootsregistration/bdglmeeting";
  300. export default {
  301. name: "PrivateCar",
  302. data() {
  303. return {
  304. // 遮罩层
  305. loading: true,
  306. // 导出遮罩层
  307. exportLoading: false,
  308. // 选中数组
  309. ids: [],
  310. // 非单个禁用
  311. single: true,
  312. // 非多个禁用
  313. multiple: true,
  314. // 显示搜索条件
  315. showSearch: true,
  316. // 总条数
  317. total: 0,
  318. // 私家车管理表格数据
  319. privateCarList: [],
  320. // 弹出层标题
  321. title: "",
  322. // 是否显示弹出层
  323. open: false,
  324. // 查询参数
  325. queryParams: {
  326. pageNum: 1,
  327. pageSize: 10,
  328. vehiclenumber: null,
  329. vehiclemodel: null,
  330. vehiclecolor: null,
  331. vehiclecategory: null,
  332. peopleId: null,
  333. peopleName: null,
  334. contactnumber: null,
  335. documenttype: null,
  336. certificatenumber: null,
  337. remarks: null,
  338. adminId: null,
  339. createtime: null,
  340. updatetime: null,
  341. authStime: null,
  342. authEtime: null,
  343. },
  344. // 表单参数
  345. form: {},
  346. // 表单校验
  347. rules: {
  348. adminId: [
  349. { required: true, message: "创建人不能为空", trigger: "blur" },
  350. ],
  351. },
  352. // 车辆类别
  353. privateCar: [],
  354. // 人员列表
  355. renYuan: [],
  356. // 证件类别
  357. documentType: [],
  358. // 外面的人员
  359. renYuans: [],
  360. };
  361. },
  362. created() {
  363. this.getList();
  364. getDicts("privateCar").then((response) => {
  365. this.privateCar = response.data;
  366. });
  367. getDicts("documentType").then((response) => {
  368. this.documentType = response.data;
  369. });
  370. this.getSuo();
  371. },
  372. methods: {
  373. // 获取搜索所有人
  374. getSuo() {
  375. getAll().then((res) => {
  376. this.renYuans = res.rows;
  377. });
  378. },
  379. // 证件类型翻译
  380. zhenJian(row, column) {
  381. var zhenJian = "";
  382. this.documentType.map((item) => {
  383. if (item.dictValue == row.documenttype) {
  384. zhenJian = item.dictLabel;
  385. }
  386. });
  387. return zhenJian;
  388. },
  389. // 车辆类别翻译
  390. carLei(row, column) {
  391. var carLei = "";
  392. this.privateCar.map((item) => {
  393. if (item.dictValue == row.vehiclecategory) {
  394. carLei = item.dictLabel;
  395. }
  396. });
  397. return carLei;
  398. },
  399. // 点击车辆所有人选中触发
  400. suoYouRen(name) {
  401. this.form.peopleName = name;
  402. },
  403. // 人员列表
  404. getRen() {
  405. getRenYuanCar().then((response) => {
  406. this.renYuan = response.rows;
  407. });
  408. },
  409. /** 查询私家车管理列表 */
  410. getList() {
  411. this.loading = true;
  412. listPrivateCar(this.queryParams).then((response) => {
  413. this.privateCarList = response.rows;
  414. this.total = response.total;
  415. this.loading = false;
  416. });
  417. },
  418. // 取消按钮
  419. cancel() {
  420. this.open = false;
  421. this.reset();
  422. },
  423. // 表单重置
  424. reset() {
  425. this.form = {
  426. id: null,
  427. vehiclenumber: null,
  428. vehiclemodel: null,
  429. vehiclecolor: null,
  430. vehiclecategory: null,
  431. peopleId: null,
  432. peopleName: null,
  433. contactnumber: null,
  434. documenttype: null,
  435. certificatenumber: null,
  436. remarks: null,
  437. adminId: null,
  438. createtime: null,
  439. updatetime: null,
  440. authStime: null,
  441. authEtime: null,
  442. };
  443. this.resetForm("form");
  444. },
  445. /** 搜索按钮操作 */
  446. handleQuery() {
  447. this.queryParams.pageNum = 1;
  448. this.getList();
  449. },
  450. /** 重置按钮操作 */
  451. resetQuery() {
  452. this.queryParams.peopleId = null;
  453. this.resetForm("queryForm");
  454. this.handleQuery();
  455. },
  456. // 多选框选中数据
  457. handleSelectionChange(selection) {
  458. this.ids = selection.map((item) => item.id);
  459. this.single = selection.length !== 1;
  460. this.multiple = !selection.length;
  461. },
  462. /** 新增按钮操作 */
  463. handleAdd() {
  464. this.getRen();
  465. this.reset();
  466. this.open = true;
  467. this.title = "添加私家车管理";
  468. },
  469. /** 修改按钮操作 */
  470. handleUpdate(row) {
  471. this.reset();
  472. this.getRen();
  473. const id = row.id || this.ids;
  474. getPrivateCar(id).then((response) => {
  475. this.form = response.data;
  476. this.open = true;
  477. this.title = "修改私家车管理";
  478. });
  479. },
  480. /** 提交按钮 */
  481. submitForm() {
  482. this.$refs["form"].validate((valid) => {
  483. if (valid) {
  484. if (this.form.id != null) {
  485. updatePrivateCar(this.form).then((response) => {
  486. this.$modal.msgSuccess("修改成功");
  487. this.open = false;
  488. this.getList();
  489. });
  490. } else {
  491. addPrivateCar(this.form).then((response) => {
  492. this.$modal.msgSuccess("新增成功");
  493. this.open = false;
  494. this.getList();
  495. });
  496. }
  497. }
  498. });
  499. },
  500. /** 删除按钮操作 */
  501. handleDelete(row) {
  502. const ids = row.id || this.ids;
  503. this.$modal
  504. .confirm("是否确认删除私家车管理的数据项?")
  505. .then(function () {
  506. return delPrivateCar(ids);
  507. })
  508. .then(() => {
  509. this.getList();
  510. this.$modal.msgSuccess("删除成功");
  511. })
  512. .catch(() => {});
  513. },
  514. /** 导出按钮操作 */
  515. handleExport() {
  516. const queryParams = this.queryParams;
  517. this.$modal
  518. .confirm("是否确认导出所有私家车管理数据项?")
  519. .then(() => {
  520. this.exportLoading = true;
  521. return exportPrivateCar(queryParams);
  522. })
  523. .then((response) => {
  524. this.$download.name(response.msg);
  525. this.exportLoading = false;
  526. })
  527. .catch(() => {});
  528. },
  529. },
  530. };
  531. </script>
  532. <style scoped>
  533. /* 对话框背景颜色 */
  534. ::v-deep .el-dialog {
  535. background: #004d86 !important;
  536. width: 800px !important;
  537. }
  538. ::v-deep .el-textarea__inner {
  539. width: 610px;
  540. height: 104px;
  541. margin: auto;
  542. }
  543. ::v-deep .el-dialog__header {
  544. border-bottom: 1px solid #718a9d;
  545. }
  546. ::v-deep .el-dialog__title {
  547. color: #fff;
  548. font: 18px;
  549. }
  550. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  551. color: #fff;
  552. }
  553. ::v-deep .el-form-item__label {
  554. font: 16px;
  555. color: #fff;
  556. width: 100px !important;
  557. }
  558. ::v-deep .el-input__inner {
  559. /* width: 200px !important;
  560. height: 36px; */
  561. background: transparent;
  562. color: #fff;
  563. border: 1px solid white !important;
  564. }
  565. /* 单位框背景颜色 */
  566. ::v-deep .vue-treeselect__control {
  567. background: #004d86 !important;
  568. }
  569. /* 基本信息背景 */
  570. .jiben {
  571. width: 620px;
  572. height: 32px;
  573. background-image: url(../../../images/小标题底.png);
  574. background-size: 100%;
  575. margin-bottom: 25px;
  576. color: #fff;
  577. padding-left: 16px;
  578. line-height: 32px;
  579. }
  580. /*调整表单间距 */
  581. ::v-deep .el-form-item__content {
  582. width: 200px;
  583. }
  584. ::v-deep .el-input__inner {
  585. cursor: pointer !important;
  586. }
  587. /* 底部确定取消按钮 */
  588. ::v-deep .el-dialog__footer {
  589. padding: 30px 50px;
  590. }
  591. ::v-deep .el-dialog__body {
  592. margin: 10px 24px 20px 30px;
  593. padding-top: 20px !important;
  594. box-sizing: border-box;
  595. /* padding: 30px 12px 30px 28px; */
  596. }
  597. .contents {
  598. padding: 0px 40px !important;
  599. }
  600. /* 下拉菜单 */
  601. .el-dropdown-link {
  602. cursor: pointer;
  603. color: #409eff;
  604. }
  605. .el-icon-arrow-down {
  606. font-size: 12px;
  607. }
  608. /* 下拉菜单字体/背景颜色 */
  609. .el-select-dropdown__item.hover,
  610. .el-select-dropdown__item:hover {
  611. background-color: #004d86;
  612. color: #fff;
  613. }
  614. .el-select-dropdown__item {
  615. color: #fff;
  616. }
  617. /* 时间选择 */
  618. ::v-deep .el-input--small .el-input__inner {
  619. width: 200px;
  620. height: 36px;
  621. line-height: 36px;
  622. }
  623. .el-date-editor.el-input {
  624. width: 200px;
  625. height: 36px;
  626. margin-right: 48px;
  627. }
  628. ::v-deep .el-date-editor.el-input .el-input__inner {
  629. height: 36px;
  630. line-height: 36px;
  631. }
  632. /* 单位框背景颜色 */
  633. ::v-deep .vue-treeselect__control {
  634. background: #004d86 !important;
  635. color: #fff;
  636. }
  637. /* 单位下拉菜单选中字体颜色 */
  638. ::v-deep .vue-treeselect__single-value {
  639. color: #fff !important;
  640. }
  641. /* 分页按钮 */
  642. ::v-deep .el-pagination.is-background .el-pager li {
  643. background-color: #004d86;
  644. color: #fff;
  645. }
  646. ::v-deep .el-pagination.is-background .btn-next {
  647. background-color: #004d86;
  648. color: #fff;
  649. }
  650. /* 底部确定取消按钮 */
  651. ::v-deep .el-dialog__footer {
  652. padding: 18px 50px;
  653. margin-right: 42px;
  654. }
  655. ::v-deep .el-dialog__body {
  656. padding: 30px 63px;
  657. }
  658. /* 小手样式 */
  659. ::v-deep .el-table__cell {
  660. cursor: pointer;
  661. }
  662. .el-button--mini {
  663. width: 80px !important;
  664. border: 1px solid transparent;
  665. padding: 3px 8px;
  666. font-size: 14px;
  667. line-height: 1.5;
  668. border-radius: 3px;
  669. color: #fff;
  670. background-color: #1890ff;
  671. }
  672. /* 调整输入框提示文字颜色 */
  673. ::v-deep .vue-treeselect__placeholder {
  674. color: #bdbdbd4f !important;
  675. }
  676. ::v-deep input::-webkit-input-placeholder {
  677. color: #bdbdbd4f !important;
  678. }
  679. ::v-deep input:-moz-placeholder {
  680. color: #bdbdbd4f !important;
  681. }
  682. /* 文本域提示文字颜色 */
  683. ::v-deep ::-webkit-input-placeholder {
  684. color: #bdbdbd4f !important;
  685. }
  686. .box {
  687. background-color: #ffba00 !important;
  688. }
  689. </style>