details.vue 36 KB

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