details.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  1. <template>
  2. <div>
  3. <el-form
  4. ref="formDate"
  5. label-width="80px"
  6. :rules="rules"
  7. :model="formDate"
  8. >
  9. <div class="formContent-item_title">基本信息</div>
  10. <el-row>
  11. <el-col :span="9">
  12. <el-form-item
  13. label="名称"
  14. prop="userName"
  15. >
  16. <el-input
  17. placeholder="请输入车主名称"
  18. v-model="formDate.userName"
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="9">
  23. <el-form-item
  24. label="手机号"
  25. prop="tel"
  26. >
  27. <el-input
  28. placeholder="请输入手机号"
  29. v-model="formDate.tel"
  30. ></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col
  34. :span="4 "
  35. style="margin-left: 15px;"
  36. >
  37. <el-button
  38. type="primary"
  39. @click="personnel"
  40. >调取人员信息</el-button>
  41. </el-col>
  42. <el-col :span="9">
  43. <el-form-item label="房间">
  44. <el-select
  45. placeholder="请选择房间"
  46. clearable
  47. v-model="formDate.resDate"
  48. @change='formDateResDate'
  49. >
  50. <el-option
  51. v-for="(itemse,ix) in room"
  52. :key="ix"
  53. :label='itemse.name'
  54. :value='itemse.label'
  55. @click.native="resDate(itemse)"
  56. ></el-option>
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="9">
  61. <el-form-item label="备注信息">
  62. <el-input
  63. placeholder="请输入备注信息"
  64. v-model="formDate.remark"
  65. ></el-input>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. <el-row>
  70. <el-col :span="9">
  71. <el-form-item label="车位设置">
  72. <el-select
  73. placeholder="请选择停车场"
  74. clearable
  75. v-model="formDate.parkId"
  76. >
  77. <el-option
  78. v-for="(item,index) in nameParkingLot"
  79. :key="index"
  80. :value="item.label"
  81. :label="item.name"
  82. @click.native="parkingLot(item.name)"
  83. ></el-option>
  84. </el-select>
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. <div class="formContent-item_title">内部车信息</div>
  89. <el-row>
  90. <el-col :span="9">
  91. <el-form-item
  92. label="车牌类型"
  93. prop="carTypes"
  94. >
  95. <el-select
  96. placeholder="请选择车牌类型"
  97. clearable
  98. v-model="formDate.carTypes"
  99. >
  100. <el-option
  101. label="临时车"
  102. value="0"
  103. ></el-option>
  104. <el-option
  105. label="VIP车"
  106. value="1"
  107. ></el-option>
  108. <el-option
  109. label="月租车"
  110. value="2"
  111. ></el-option>
  112. <el-option
  113. label="充值车"
  114. value="3"
  115. ></el-option>
  116. <el-option
  117. label="时租车"
  118. value="4"
  119. ></el-option>
  120. <el-option
  121. label="产权车"
  122. value="5"
  123. ></el-option>
  124. <el-option
  125. label="计次车"
  126. value="6"
  127. ></el-option>
  128. <el-option
  129. label="贵宾卡"
  130. value="7"
  131. ></el-option>
  132. <el-option
  133. label="员工卡"
  134. value="8"
  135. ></el-option>
  136. <el-option
  137. label="大客车"
  138. value="9"
  139. ></el-option>
  140. <el-option
  141. label="预约车"
  142. value="100"
  143. ></el-option>
  144. </el-select>
  145. </el-form-item>
  146. </el-col>
  147. <el-col :span="9">
  148. <el-form-item
  149. label="充值规则"
  150. prop="ruleId"
  151. >
  152. <el-select
  153. placeholder="请选择充值规则"
  154. clearable
  155. v-model="formDate.ruleId"
  156. @click.native="parkingLotes"
  157. >
  158. <!-- recharge -->
  159. <el-option
  160. v-for="(itemes,indexes) in recharge"
  161. :key="indexes"
  162. :label='itemes.name'
  163. :value='itemes.label'
  164. ></el-option>
  165. </el-select>
  166. </el-form-item>
  167. </el-col>
  168. <!-- <el-col :span="9">
  169. <el-form-item label="首充时间">
  170. <el-date-picker
  171. type="date"
  172. placeholder="首充时间"
  173. value-format="yyyy-MM-dd"
  174. :editable="false"
  175. @change="timeToggle"
  176. v-model="formDate.beginTime"
  177. >
  178. </el-date-picker>
  179. </el-form-item>
  180. </el-col> -->
  181. </el-row>
  182. <div class="formContent-item_title">
  183. <el-row>
  184. <el-col :span="2">车位设置</el-col>
  185. <el-col
  186. :span="8"
  187. style="margin-top: -5px;"
  188. >
  189. </el-col>
  190. </el-row>
  191. <el-row>
  192. <el-col-2>
  193. <el-button
  194. type="primary"
  195. @click="addTime"
  196. >新增</el-button>
  197. </el-col-2>
  198. </el-row>
  199. <el-table
  200. :data="tableData"
  201. border
  202. style="width: 100%"
  203. :cell-style="{'text-align':'center'}"
  204. >
  205. <el-table-column
  206. class="tableColumn"
  207. align="center"
  208. >
  209. <!-- label="可停区域" -->
  210. <template slot-scope="scope">
  211. <el-form-item
  212. prop="parkingArea"
  213. ref="againValue"
  214. style="float: left;"
  215. >
  216. <el-select
  217. placeholder="请选择"
  218. v-model="tableData[scope.$index].parkingArea"
  219. @click.native="parking"
  220. style="float: left;"
  221. >
  222. <el-option
  223. v-for="(item,index) in eloption"
  224. :key="index"
  225. :value='item.value'
  226. :label="item.label"
  227. @click.native="parked(item)"
  228. ></el-option>
  229. </el-select>
  230. </el-form-item>
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. label="占用车位"
  235. align="center"
  236. >
  237. <el-input-number
  238. v-model="num"
  239. :disabled="true"
  240. ></el-input-number>
  241. </el-table-column>
  242. <el-table-column
  243. label="位置信息"
  244. align="center"
  245. >
  246. <template slot-scope="scope">
  247. <el-input
  248. v-model="tableData[scope.$index].positionInformation"
  249. @click.native="positionInformation(scope.$index)"
  250. placeholder="请选择车位"
  251. ></el-input>
  252. </template>
  253. </el-table-column>
  254. <el-table-column
  255. label="操作"
  256. align="center"
  257. width="100"
  258. >
  259. <template slot-scope="scope">
  260. <el-tooltip
  261. class="item"
  262. effect="light"
  263. placement="bottom"
  264. content="删除"
  265. >
  266. <i
  267. class="zoniot_font zoniot-icon-shanchu redText"
  268. @click="deleteUserByUserName(scope.$index)"
  269. ></i>
  270. </el-tooltip>
  271. </template>
  272. </el-table-column>
  273. </el-table>
  274. </div>
  275. <div class="formContent-item_title">
  276. <el-row>
  277. <el-col :span="2">车位设置</el-col>
  278. </el-row>
  279. <el-row>
  280. <el-col-2>
  281. <el-button
  282. type="primary"
  283. @click="addTimes"
  284. >新增</el-button>
  285. </el-col-2>
  286. </el-row>
  287. <el-table
  288. :data="parkingSpaceSetting"
  289. border
  290. style="width: 100%"
  291. :cell-style="{'text-align':'center'}"
  292. >
  293. <el-table-column
  294. align="center"
  295. width="230"
  296. >
  297. <template slot-scope="scope">
  298. <el-col
  299. :span="10"
  300. style="float: left;"
  301. >
  302. <el-form-item
  303. prop="againInput"
  304. ref="againInput"
  305. >
  306. <el-select v-model="parkingSpaceSetting[scope.$index].licensePlate">
  307. <el-option
  308. v-for="(item,index) in beforelicense"
  309. :key="index"
  310. :value='item.label'
  311. :label="item.label"
  312. @click.native="license"
  313. ></el-option>
  314. </el-select>
  315. </el-form-item>
  316. </el-col>
  317. <el-col
  318. :span="12"
  319. style="float: left;"
  320. >
  321. <!-- <el-form-item
  322. prop="againInput"
  323. ref="againInput"
  324. > -->
  325. <!-- <input ref="searchInput" v-focus>
  326. -->
  327. <el-form-item
  328. prop="againLicense"
  329. ref="againLicense"
  330. >
  331. <el-input
  332. placeholder="车牌号"
  333. v-model="parkingSpaceSetting[scope.$index].license"
  334. clearable
  335. ref="searchInput"
  336. @input="parkingSpace()"
  337. @blur="Setting()"
  338. >
  339. </el-input>
  340. </el-form-item>
  341. <!-- </el-form-item> -->
  342. </el-col>
  343. </template>
  344. </el-table-column>
  345. <el-table-column
  346. label="进出凭据(卡号/ETC/扫码)"
  347. align="center"
  348. width="230"
  349. >
  350. <template slot-scope="scope">
  351. <el-input
  352. placeholder="进出凭据"
  353. v-model="parkingSpaceSetting[scope.$index].accessCredentials"
  354. clearable
  355. >
  356. </el-input>
  357. </template>
  358. </el-table-column>
  359. <el-table-column
  360. label="状态"
  361. align="center"
  362. ><template slot-scope="scope">
  363. <el-select v-model="parkingSpaceSetting[scope.$index].state">
  364. <el-option
  365. label="启用"
  366. value="1"
  367. ></el-option>
  368. <el-option
  369. label="禁用"
  370. value="2"
  371. ></el-option>
  372. </el-select>
  373. </template>
  374. </el-table-column>
  375. <el-table-column
  376. label="备注"
  377. align="center"
  378. >
  379. <template slot-scope="scope">
  380. <el-input
  381. placeholder="备注"
  382. v-model="parkingSpaceSetting[scope.$index].remarks"
  383. clearable
  384. >
  385. </el-input>
  386. </template>
  387. </el-table-column>
  388. <el-table-column
  389. label="操作"
  390. align="center"
  391. >
  392. <template slot-scope="scope">
  393. <el-tooltip
  394. class="item"
  395. effect="light"
  396. placement="bottom"
  397. content="删除"
  398. >
  399. <i
  400. class="zoniot_font zoniot-icon-shanchu redText"
  401. @click="defult(scope.$index)"
  402. ></i>
  403. </el-tooltip>
  404. <el-tooltip
  405. class="item"
  406. effect="light"
  407. placement="bottom"
  408. content="编辑"
  409. >
  410. <span>
  411. <img
  412. src="../../../assets/img/btn_peizhi.png"
  413. alt=""
  414. style="width: 15px; height: 13px; margin-left: 10px; cursor: pointer;"
  415. @click="addEdit(scope.$index)"
  416. >
  417. </span>
  418. </el-tooltip>
  419. </template>
  420. </el-table-column>
  421. </el-table>
  422. </div>
  423. </el-form>
  424. <!-- </el-form> -->
  425. </div>
  426. </template>
  427. <script>
  428. import { parse } from 'path';
  429. import native from './native.vue'
  430. import configure from './configure.vue';
  431. export default {
  432. props: ['params', configure],
  433. data () {
  434. return {
  435. url: '',
  436. areaNamed: [],
  437. formDate: {
  438. userName: '',
  439. // tel: '17688920088',
  440. tel: '',
  441. residentId: '',
  442. resDate: '',
  443. remark: '',
  444. carType: '',
  445. carTypes: '',
  446. ruleId: '',
  447. beginTime: '',
  448. parkId: '',
  449. id: '',
  450. sort: '',
  451. areaName: '',
  452. idName: '',
  453. res: '',
  454. // 校验
  455. parking: false,
  456. parkingArea: '',
  457. againInput: '',
  458. againLicense: ''
  459. },
  460. tableData: [
  461. {
  462. parkingArea: '',
  463. positionInformation: '',
  464. areaName: '',
  465. parkingId: '',
  466. },
  467. ],
  468. parkingSpaceSetting: [
  469. {
  470. licensePlate: '',
  471. license: '',
  472. accessCredentials: '',
  473. state: '1',
  474. remarks: ''
  475. }
  476. ],
  477. eloption: [],
  478. num: '1',
  479. // parkingArea: '',//可停区域
  480. beforelicense: [
  481. {
  482. value: '1',
  483. label: '京'
  484. },
  485. {
  486. value: '2',
  487. label: '津'
  488. },
  489. {
  490. value: '3',
  491. label: '冀'
  492. },
  493. {
  494. value: '4',
  495. label: '晋'
  496. },
  497. {
  498. value: '5',
  499. label: '蒙'
  500. },
  501. {
  502. value: '6',
  503. label: '辽'
  504. },
  505. {
  506. value: '7',
  507. label: '吉'
  508. },
  509. {
  510. value: '8',
  511. label: '黑'
  512. },
  513. {
  514. value: '9',
  515. label: '沪'
  516. },
  517. {
  518. value: '10',
  519. label: '苏'
  520. },
  521. {
  522. value: '11',
  523. label: '浙'
  524. },
  525. {
  526. value: '12',
  527. label: '皖'
  528. },
  529. {
  530. value: '13',
  531. label: '闽'
  532. },
  533. {
  534. value: '14',
  535. label: '赣'
  536. },
  537. {
  538. value: '15',
  539. label: '鲁'
  540. },
  541. {
  542. value: '16',
  543. label: '豫'
  544. },
  545. {
  546. value: '17',
  547. label: '鄂'
  548. },
  549. {
  550. value: '18',
  551. label: '湘'
  552. },
  553. {
  554. value: '19',
  555. label: '粤'
  556. },
  557. {
  558. value: '20',
  559. label: '桂'
  560. },
  561. {
  562. value: '21',
  563. label: '琼'
  564. }
  565. ,
  566. {
  567. value: '22',
  568. label: '渝'
  569. }
  570. ,
  571. {
  572. value: '23',
  573. label: '川'
  574. }
  575. ,
  576. {
  577. value: '24',
  578. label: '贵'
  579. }
  580. ,
  581. {
  582. value: '25',
  583. label: '云'
  584. },
  585. {
  586. value: '26',
  587. label: '藏'
  588. },
  589. {
  590. value: '27',
  591. label: '陕'
  592. },
  593. {
  594. value: '28',
  595. label: '甘'
  596. },
  597. {
  598. value: '29',
  599. label: '青'
  600. }
  601. ,
  602. {
  603. value: '30',
  604. label: '宁'
  605. }
  606. ,
  607. {
  608. value: '31',
  609. label: '新'
  610. }
  611. ],
  612. rules: {
  613. userName: [
  614. { required: true, message: '请输入名称', trigger: 'blur' },
  615. ],
  616. tel: [
  617. { required: true, message: '请输入手机号', trigger: 'blur' },
  618. { pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/, message: '请输入正确的电话' }
  619. ],
  620. carTypes: [
  621. { required: true, message: '请选择车牌类型', trigger: 'change' }
  622. ],
  623. ruleId: [
  624. { required: true, message: '请选择充值规则', trigger: 'change' }
  625. ],
  626. parkingArea: [
  627. { required: true, message: '请选择可停区域', trigger: 'change' }
  628. ],
  629. againInput: [
  630. { required: true, message: '请选择车牌', trigger: 'change' },
  631. ],
  632. againLicense: [
  633. { required: true, message: '请输入车牌号', trigger: 'change' },
  634. ]
  635. },
  636. room: [],
  637. nameParkingLot: [],
  638. nameParkingLotName: '',
  639. form: [
  640. {
  641. vehicleType: '',
  642. vehicleColor: '',
  643. vehicleColors: '',
  644. vehicleBrand: ''
  645. }
  646. ],
  647. fullCarNoStr: '',
  648. plateNoInfo: [],
  649. // 充值规则
  650. recharge: []
  651. };
  652. },
  653. methods: {
  654. // 车牌号
  655. // @input="parkingSpace()"
  656. // @blur="Setting()"
  657. parkingSpace () {
  658. // parkingSpaceSetting[scope.$index].license
  659. for (let i = 0; i < this.parkingSpaceSetting.length; i++) {
  660. console.log(this.parkingSpaceSetting[i].license);
  661. if (this.parkingSpaceSetting[i].license.length == 0) {
  662. this.formDate.againLicense = ''
  663. this.rules.againLicense[0].required = !this.formDate.parking;
  664. } else {
  665. this.formDate.againLicense = '验证'
  666. this.rules.againLicense[0].required = this.formDate.parking;
  667. this.clearValidate('againLicense');
  668. }
  669. }
  670. },
  671. Setting () {
  672. for (let i = 0; i < this.parkingSpaceSetting.length; i++) {
  673. console.log(this.parkingSpaceSetting[i].license);
  674. if (this.parkingSpaceSetting[i].license.length == 0) {
  675. this.formDate.againLicense = ''
  676. this.rules.againLicense[0].required = !this.formDate.parking;
  677. } else {
  678. this.formDate.againLicense = '验证'
  679. this.rules.againLicense[0].required = this.formDate.parking;
  680. this.clearValidate('againLicense');
  681. }
  682. }
  683. },
  684. clearValidate (formName) {
  685. this.$refs[formName].clearValidate();
  686. },
  687. resDate (val) {
  688. debugger
  689. this.formDate.resDate = val.label;
  690. this.formDate.id = val.residentId;
  691. this.formDate.idName = val.name;
  692. },
  693. parked (item) {
  694. this.areaNamed.push(item.label);
  695. this.formDate.sort = item.startDate;
  696. if (this.rules.parkingArea[0].required == true && this.formDate.parkingArea == '') {
  697. this.formDate.parkingArea = '验证'
  698. this.rules.parkingArea[0].required = this.formDate.parking;
  699. this.clearValidate('againValue');
  700. }
  701. },
  702. licenseVerification () {
  703. if (this.rules.againInput[0].required == true && this.formDate.againInput == '') {
  704. this.formDate.againInput = '验证'
  705. this.rules.againInput[0].required = this.formDate.parking;
  706. this.clearValidate('againInput');
  707. this.$refs.searchInput.focus();
  708. }
  709. },
  710. license () {
  711. this.licenseVerification();
  712. },
  713. // 充值规则
  714. rechargeRules () {
  715. this.recharge = []
  716. this.$http
  717. .get('/sc-community-web/parkingCar/queryRechargeRules', {
  718. carType: this.formDate.carTypes == '临时车' ? '0' :
  719. this.formDate.carTypes == 'VIP车' ? '1' :
  720. this.formDate.carTypes == '月租车' ? '2' :
  721. this.formDate.carTypes == '充时车' ? '3' :
  722. this.formDate.carTypes == '时租车' ? '4' :
  723. this.formDate.carTypes == '产权车' ? '5' :
  724. this.formDate.carTypes == '计次车' ? '6' :
  725. this.formDate.carTypes == '贵宾车' ? '7' :
  726. this.formDate.carTypes == '员工卡' ? '8' : this.formDate.carTypes
  727. , parkingId: this.formDate.parkId
  728. })
  729. .then(({ data, msg, status }) => {
  730. console.log('data', data);
  731. for (let i = 0; i < data.length; i++) {
  732. this.recharge.push({
  733. name: data[i].ruleName,
  734. label: data[i].ruleId
  735. })
  736. }
  737. })
  738. .catch(() => { });
  739. },
  740. parkingLotes () {
  741. if (this.nameParkingLotName.length == 0) {
  742. this.$message.error('请选择停车场');
  743. } else if (this.formDate.carTypes.length == 0) {
  744. this.$message.error('请选择车牌类型');
  745. } else {
  746. this.rechargeRules();
  747. }
  748. },
  749. parkingLot (name) {
  750. this.nameParkingLotName = name;
  751. },
  752. // 调用用户信息
  753. personnel () {
  754. if (this.formDate.tel.length == 0) {
  755. this.$message.error('请输入手机号码');
  756. } else {
  757. console.log(this.formDate.tel)
  758. this.room = [];
  759. this.$http
  760. .get('/sc-community/parkingCar/getUserInfo', { phone: this.formDate.tel })
  761. .then(({ data, msg, status }) => {
  762. for (let i = 0; i < data.houseInfos.length; i++) {
  763. debugger
  764. this.room.push({
  765. name: data.houseInfos[i].roomNumber,
  766. label: data.houseInfos[i].id,
  767. residentId: data.houseInfos[i].residentId,
  768. })
  769. }
  770. this.formDate.resDate = data.houseInfos[0].id;
  771. this.formDate.id = data.houseInfos[0].residentId;
  772. this.formDate.idName = data.houseInfos[0].roomNumber
  773. // if (this.room.length == 1) {
  774. // this.formDate.resDate = data.houseInfos[0].id;
  775. // this.formDate.id = data.houseInfos[0].residentId;
  776. // this.formDate.idName = data.houseInfos[0].roomNumber
  777. // }
  778. })
  779. .catch(() => { });
  780. }
  781. },
  782. DOMInput () {
  783. document.querySelectorAll('.is-center')[0].children[0].innerHTML = "<span style='width: 5px;color: #F56C6C; margin-right: 5px;'>*</span><span>可停区域</span>"
  784. document.querySelectorAll('.is-center')[8].children[0].innerHTML = "<span style='width: 5px;color: #F56C6C; margin-right: 5px;'>*</span><span>车牌号码</span>"
  785. },
  786. // 事件处理函数
  787. getMsgFormSon (data) {
  788. console.log('data', data);
  789. },
  790. addTime () {
  791. debugger
  792. this.tableData.push({
  793. parkingArea: '',
  794. positionInformation: ''
  795. })
  796. },
  797. addTimes () {
  798. this.parkingSpaceSetting.push({
  799. licensePlate: '',
  800. license: '',
  801. accessCredentials: '',
  802. state: '1',
  803. remarks: ''
  804. })
  805. },
  806. deleteUserByUserName (row) {
  807. // console.log(row)
  808. debugger
  809. if (this.tableData.length > 1) {
  810. this.tableData.splice(row, 1);
  811. }
  812. return;
  813. },
  814. defult (row) {
  815. if (this.parkingSpaceSetting.length > 1) {
  816. this.parkingSpaceSetting.splice(row, 1);
  817. }
  818. return;
  819. },
  820. positionInformation (id) {
  821. debugger
  822. new Promise((resolve) => {
  823. this.$store.dispatch('addPopup', {
  824. url: '/vehicleInformation/setpPage/native.vue',
  825. width: '500px',
  826. height: '400px',
  827. props: {
  828. callback: resolve,
  829. id: id,
  830. positionInformation: this.tableData[id].positionInformation,
  831. value: this.tableData[id].parkingId,
  832. },
  833. hideStar: true,
  834. title: '选择车位'
  835. });
  836. }).then((data) => {
  837. debugger
  838. var id = data[0].id;
  839. this.tableData[id].positionInformation = data[0].positionInformation;
  840. this.tableData[id].parkingId = data[0].value;
  841. });
  842. },
  843. timeToggle (e) {
  844. console.log(e);
  845. let start = '00:00:00',
  846. end = '23:59:59';
  847. if (!!e) {
  848. this.formDate.createDate = `${e} ${start}`;
  849. // this.mixins_query.endDate = `${e} ${end}`;
  850. } else {
  851. this.mixins_query.startDate = ``;
  852. // this.mixins_query.endDate = ``;
  853. }
  854. },
  855. addEdit (row) {
  856. new Promise((resolve) => {
  857. this.$store.dispatch('addPopup', {
  858. url: '/vehicleInformation/setpPage/configure.vue',
  859. width: '400px',
  860. height: '340px',
  861. props: {
  862. callback: resolve,
  863. id: row,
  864. form: this.form
  865. // positionInformation: this.tableData
  866. },
  867. hideStar: true,
  868. title: '更多配置'
  869. });
  870. }).then((data) => {
  871. var id = data.id;
  872. this.form[id].vehicleType = data.vehicleType;
  873. this.form[id].vehicleColor = data.vehicleColor;
  874. this.form[id].vehicleColors = data.vehicleColors;
  875. this.form[id].vehicleBrand = data.vehicleBrand;
  876. });
  877. },
  878. // 获取停车场名称
  879. nameParking () {
  880. this.$http.post('/sc-community-web/parkingCar/findParkInfo', { pageNum: 1, pageSize: 15 }).then(({ data, status, msg }) => {
  881. for (let i = 0; i < data.list.length; i++) {
  882. this.nameParkingLot.push({
  883. name: data.list[i].garageName,
  884. label: data.list[i].parkId
  885. })
  886. }
  887. })
  888. },
  889. // 获取可停区域
  890. parking () {
  891. if (this.formDate.parkId.length == 0) {
  892. this.$message.error('请输选择停车场');
  893. } else {
  894. // 获取可停区域
  895. this.region();
  896. }
  897. },
  898. region () {
  899. this.$http.post('/sc-community-web/parkingCar/findAreaInfo', { parkId: this.formDate.parkId }).then(({ data, status, msg }) => {
  900. this.eloption = [];
  901. for (let i = 0; i < data.length; i++) {
  902. this.eloption.push({
  903. label: data[i].areaName,
  904. value: data[i].areaCode,
  905. startDate: data[i].sort,
  906. })
  907. }
  908. });
  909. },
  910. mergeObj (arr, Obj) {
  911. return arr.map(item => {
  912. return { ...item, ...Obj }
  913. })
  914. },
  915. submit () {
  916. if (this.params.comm == 'add') {
  917. this.url = '/sc-community-web/parkingCar/updateVehicleInfor'
  918. } else {
  919. this.url = '/sc-community-web/parkingCar/addVehicleInfor'
  920. }
  921. this.$refs.formDate.validate((valid) => {
  922. console.log('valid', valid);
  923. if (valid) {
  924. var table = [];
  925. this.plateNoInfo = []
  926. console.log('333333', this.tableData);
  927. for (let i = 0; i < this.tableData.length; i++) {
  928. debugger
  929. this.tableData[i].areaName = (Array.from(new Set(this.areaNamed))).join(',');
  930. console.log(this.tableData[i]);
  931. table.push({
  932. areaId: [this.tableData[i].parkingArea],
  933. areaName: this.tableData[i].areaName,
  934. lotCount: this.num,
  935. lotName: this.tableData[i].positionInformation,
  936. parkingId: this.tableData[i].parkingId,
  937. // lotName: '',
  938. carType: '',
  939. ruleId: this.formDate.ruleId,
  940. sequence: this.formDate.sort,
  941. })
  942. this.formDate.areaName = this.tableData[i].areaName
  943. }
  944. var parkingSpace = [];
  945. for (let k = 0; k < this.parkingSpaceSetting.length; k++) {
  946. parkingSpace.push({
  947. carNo: this.parkingSpaceSetting[k].licensePlate + this.parkingSpaceSetting[k].license,
  948. cardNo: this.parkingSpaceSetting[k].accessCredentials,
  949. enable: this.parkingSpaceSetting[k].state == '启用' ? '1' : this.parkingSpaceSetting[k].state == '禁用' ? '2' : this.parkingSpaceSetting[k].state,
  950. remark: this.parkingSpaceSetting[k].remarks,
  951. carType: this.form[k].vehicleType,
  952. carNoColor: this.form[k].vehicleColor,
  953. carColor: this.form[k].vehicleColors,
  954. carBrand: this.form[k].vehicleBrand,
  955. });
  956. this.fullCarNoStr = this.parkingSpaceSetting[k].licensePlate + this.parkingSpaceSetting[k].license;
  957. this.plateNoInfo.push((this.parkingSpaceSetting[k].licensePlate + this.parkingSpaceSetting[k].license));
  958. for (let j = 0; j < table.length; j++) {
  959. table[j].carType = this.formDate.carType;
  960. }
  961. }
  962. debugger
  963. this.$http.post(this.url, {
  964. cardId: this.params.cardId != undefined ? this.params.cardId : '',
  965. cardName: this.formDate.userName,
  966. userName: this.formDate.userName,
  967. tel: this.formDate.tel,
  968. // houseId: this.formDate.residentId,
  969. houseId: this.formDate.resDate,
  970. residentId: this.formDate.id,
  971. // residentId: this.formDate.ruleId,
  972. remark: this.formDate.remark,
  973. cardType: this.formDate.carTypes == '临时车' ? '0' :
  974. this.formDate.carTypes == 'VIP车' ? '1' :
  975. this.formDate.carTypes == '月租车' ? '2' :
  976. this.formDate.carTypes == '充时车' ? '3' :
  977. this.formDate.carTypes == '时租车' ? '4' :
  978. this.formDate.carTypes == '产权车' ? '5' :
  979. this.formDate.carTypes == '计次车' ? '6' :
  980. this.formDate.carTypes == '贵宾车' ? '7' :
  981. this.formDate.carTypes == '员工卡' ? '8' : this.formDate.carTypes,
  982. beginTime: this.formDate.beginTime,
  983. parkId: this.formDate.parkId,
  984. areaName: this.formDate.areaName,
  985. ruleId: this.formDate.ruleId,
  986. idName: this.formDate.idName,
  987. carLotList: table,
  988. parkCarDetails: parkingSpace,
  989. fullCarNoStr: this.fullCarNoStr,
  990. plateNoInfo: this.plateNoInfo,
  991. }).then(({ data, status, msg }) => {
  992. if (status != 0) {
  993. this.$message.error(msg);
  994. } else if (status == 0) {
  995. this.$message.success('成功');
  996. this.params.callback();
  997. this.$emit('close');
  998. }
  999. })
  1000. } else {
  1001. return false;
  1002. }
  1003. })
  1004. },
  1005. },
  1006. mounted: function () {
  1007. this.$nextTick(function () {
  1008. this.DOMInput()
  1009. })
  1010. },
  1011. created () {
  1012. // <span style="width: 5px;color: #F56C6C; float: left; margin-right: 5px;">*</span>
  1013. this.nameParking();
  1014. if (this.params.cardId != undefined) {
  1015. this.formDate.parkingArea = '验证';
  1016. this.formDate.againInput = '验证';
  1017. this.formDate.againLicense = '验证'
  1018. this.params.cardId;
  1019. this.$http.get('/sc-community-web/parkingCar/getVehicleInfor', { id: this.params.cardId }).then(({ data, msg, status }) => {
  1020. console.log(data);
  1021. this.formDate.userName = data.userName
  1022. this.formDate.tel = data.tel
  1023. // this.personnel();
  1024. // this.formDate.resDate = '1480'
  1025. // this.formDate.resDate = '10243'
  1026. // this.formDate.resDate = val.label;
  1027. // this.personnel();
  1028. this.formDate.remark = data.remark
  1029. this.formDate.carTypes = data.cardType == 0 ? '临时车'
  1030. : data.cardType == 1 ? 'VIP车'
  1031. : data.cardType == 2 ? '月租车'
  1032. : data.cardType == 3 ? '充时车'
  1033. : data.cardType == 4 ? '时租车'
  1034. : data.cardType == 5 ? '产权车'
  1035. : data.cardType == 6 ? '计次车'
  1036. : data.cardType == 7 ? '贵宾卡'
  1037. : '员工卡'
  1038. // this.formDate.areaName = data.areaName;
  1039. this.nameParkingLotName = '1';//随便
  1040. this.formDate.beginTime = data.beginTime
  1041. this.formDate.parkId = data.parkId
  1042. var carLotStr = JSON.parse(data.carLotStr)
  1043. for (let i = 0; i < carLotStr.length; i++) {
  1044. debugger
  1045. this.formDate.areaName = carLotStr[i].areaName;
  1046. this.tableData[i].areaName = carLotStr[i].areaName
  1047. this.areaNamed.push(carLotStr[i].areaName);
  1048. this.tableData[i].carType = data.cardType
  1049. this.tableData[i].lotCount = carLotStr[i].lotCount
  1050. this.tableData[i].positionInformation = carLotStr[i].lotName
  1051. this.tableData[i].parkingId = carLotStr[i].parkingId
  1052. this.formDate.ruleId = carLotStr.ruleId
  1053. this.formDate.sort = carLotStr.sequence
  1054. }
  1055. for (let k = 0; k < data.parkCarDetails.length; k++) {
  1056. this.parkingSpaceSetting[k].licensePlate = (data.fullCarNoStr).substr(0, 1)
  1057. this.parkingSpaceSetting[k].license = (data.fullCarNoStr).substr(1)
  1058. this.parkingSpaceSetting[k].state = data.parkCarDetails[k].enable == 1 ? '启用' : '禁用'
  1059. this.parkingSpaceSetting[k].remarks = data.parkCarDetails[k].remark
  1060. }
  1061. this.personnel();
  1062. this.rechargeRules();
  1063. this.nameParking();
  1064. this.region();
  1065. // this.personnel();
  1066. for (let i = 0; i < carLotStr.length; i++) {
  1067. this.tableData[i].parkingArea = Number(carLotStr[i].areaId)
  1068. this.formDate.ruleId = carLotStr[i].ruleId
  1069. }
  1070. for (let k = 0; k < data.parkCarDetails.length; k++) {
  1071. this.formDate.carType = data.cardType;
  1072. this.form[k].vehicleType = data.parkCarDetails[k].carType;
  1073. this.form[k].vehicleColor = data.parkCarDetails[k].carNoColor
  1074. this.form[k].vehicleColors = data.parkCarDetails[k].carColor
  1075. this.form[k].vehicleBrand = data.parkCarDetails[k].carBrand
  1076. }
  1077. console.log('2222', this.tableData);
  1078. });
  1079. }
  1080. }
  1081. }
  1082. </script >
  1083. <style lang="scss" >
  1084. .el-input--small .el-input__inner {
  1085. cursor: pointer;
  1086. }
  1087. .el-row {
  1088. margin: 10px !important;
  1089. }
  1090. tr {
  1091. .el-form-item__content {
  1092. margin-left: 0 !important;
  1093. }
  1094. }
  1095. </style>