carManage-add-or-update.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  1. <template>
  2. <el-dialog
  3. v-dialogDrag
  4. :fullscreen="dialogFull"
  5. :title="!dataForm.Id ? '车辆注册' : '修改'"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"
  8. width="80%"
  9. >
  10. <template slot="title">
  11. <div class="avue-crud__dialog__header">
  12. <span class="el-dialog__title">
  13. <span
  14. style="
  15. display: inline-block;
  16. width: 3px;
  17. height: 20px;
  18. margin-right: 5px;
  19. float: left;
  20. margin-top: 2px;
  21. "
  22. ></span>
  23. 车辆注册
  24. </span>
  25. <div class="avue-crud__dialog__menu enlarge" @click="full">
  26. <i
  27. style="
  28. cursor: pointer;
  29. display: block;
  30. width: 12px;
  31. height: 12px;
  32. border: 1px solid #909399;
  33. border-top: 3px solid #909399;
  34. margin-top: -3px;
  35. "
  36. ></i>
  37. </div>
  38. </div>
  39. </template>
  40. <el-form
  41. :model="dataFormD"
  42. :rules="dataRule"
  43. ref="dataFormD"
  44. @keyup.enter.native="dataFormSubmit()"
  45. label-width="125px"
  46. >
  47. <el-form-item label="车队名称" prop="fleetCompanyId" style="width: 325px">
  48. <el-select
  49. v-model="dataFormD.fleetCompanyId"
  50. :disabled="doNot"
  51. placeholder="请选择"
  52. @change="changeCar(dataFormD.fleetCompanyId)"
  53. >
  54. <el-option
  55. v-for="item in optionsProjectTypeItem"
  56. :key="item.fId"
  57. :label="item.fName"
  58. :value="item.fId"
  59. >
  60. </el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item label="车牌号" prop="carNum" style="width: 325px">
  64. <el-input
  65. v-model="dataFormD.carNum"
  66. style="width: 200px"
  67. :disabled="doNot"
  68. placeholder="车牌号"
  69. ></el-input>
  70. </el-form-item>
  71. <el-form-item label="驾驶员" prop="driverId" style="width: 325px">
  72. <el-select
  73. v-model="dataFormD.driverId"
  74. :disabled="doNot"
  75. placeholder="驾驶员"
  76. @change="changeDriverId"
  77. style="width: 200px"
  78. >
  79. <el-option
  80. v-for="item in driverMans"
  81. :key="item.fId"
  82. :label="item.fName"
  83. :value="item.fId"
  84. >
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="挂号" prop="hangNum" style="width: 325px">
  89. <el-input
  90. v-model="dataFormD.hangNum"
  91. style="width: 200px"
  92. :disabled="doNot"
  93. placeholder="挂号"
  94. ></el-input>
  95. </el-form-item>
  96. <el-form-item label="燃油类型" prop="fuelType" style="width: 325px">
  97. <el-input
  98. v-model="dataFormD.fuelType"
  99. style="width: 200px"
  100. :disabled="doNot"
  101. placeholder="燃油类型"
  102. ></el-input>
  103. </el-form-item>
  104. <el-form-item label="车辆类型" prop="carType" style="width: 325px">
  105. <el-input
  106. v-model="dataFormD.carType"
  107. style="width: 200px"
  108. :disabled="doNot"
  109. placeholder="车辆类型"
  110. ></el-input>
  111. </el-form-item>
  112. <el-form-item label="车辆名称" prop="carName" style="width: 325px">
  113. <el-input
  114. v-model="dataFormD.carName"
  115. style="width: 200px"
  116. :disabled="doNot"
  117. placeholder="车辆名称"
  118. ></el-input>
  119. </el-form-item>
  120. <el-form-item label="车辆品牌" prop="carBrand" style="width: 325px">
  121. <el-input
  122. v-model="dataFormD.carBrand"
  123. style="width: 200px"
  124. :disabled="doNot"
  125. placeholder="车辆品牌"
  126. ></el-input>
  127. </el-form-item>
  128. <el-form-item
  129. label="制造单位"
  130. prop="manufactureUnit"
  131. style="width: 325px"
  132. >
  133. <el-input
  134. v-model="dataFormD.manufactureUnit"
  135. style="width: 200px"
  136. :disabled="doNot"
  137. placeholder="制造单位"
  138. ></el-input>
  139. </el-form-item>
  140. <el-form-item
  141. label="发证机关"
  142. prop="officeOfCertificate"
  143. style="width: 325px"
  144. >
  145. <el-input
  146. v-model="dataFormD.officeOfCertificate"
  147. style="width: 200px"
  148. :disabled="doNot"
  149. placeholder="发证机关"
  150. ></el-input>
  151. </el-form-item>
  152. <el-form-item
  153. label="牵引车辆型号"
  154. prop="pullCarType"
  155. style="width: 325px"
  156. >
  157. <el-input
  158. v-model="dataFormD.pullCarType"
  159. style="width: 200px"
  160. :disabled="doNot"
  161. placeholder="牵引车辆型号"
  162. ></el-input>
  163. </el-form-item>
  164. <el-form-item
  165. label="牵引车车架号"
  166. prop="pullCarShelfNum"
  167. style="width: 325px"
  168. >
  169. <el-input
  170. v-model="dataFormD.pullCarShelfNum"
  171. style="width: 200px"
  172. :disabled="doNot"
  173. placeholder="牵引车车架号"
  174. ></el-input>
  175. </el-form-item>
  176. <el-form-item label="挂车型号" prop="mountCarType" style="width: 325px">
  177. <el-input
  178. v-model="dataFormD.mountCarType"
  179. style="width: 200px"
  180. :disabled="doNot"
  181. placeholder="挂车型号"
  182. ></el-input>
  183. </el-form-item>
  184. <el-form-item label="挂车车架号" prop="mountCarNum" style="width: 325px">
  185. <el-input
  186. v-model="dataFormD.mountCarNum"
  187. style="width: 200px"
  188. :disabled="doNot"
  189. placeholder="挂车车架号"
  190. ></el-input>
  191. </el-form-item>
  192. <el-form-item label="发动机型号" prop="engine" style="width: 325px">
  193. <el-input
  194. v-model="dataFormD.engine"
  195. style="width: 200px"
  196. :disabled="doNot"
  197. placeholder="发动机型号"
  198. ></el-input>
  199. </el-form-item>
  200. <el-form-item label="核载人数" prop="carLoadPersion" style="width: 325px">
  201. <el-input
  202. v-model="dataFormD.carLoadPersion"
  203. style="width: 200px"
  204. :disabled="doNot"
  205. placeholder="核载人数"
  206. ></el-input>
  207. </el-form-item>
  208. <el-form-item label="购车日期" prop="buyCarDate" style="width: 325px">
  209. <!-- <el-input v-model="dataForm.buyCarDate" placeholder="购车日期"></el-input>-->
  210. <el-date-picker
  211. style="width: 200px"
  212. value-format="yyyy-MM-dd HH:mm:ss"
  213. v-model="dataFormD.buyCarDate"
  214. type="date"
  215. :disabled="doNot"
  216. placeholder="创建时间"
  217. >
  218. </el-date-picker>
  219. </el-form-item>
  220. <el-form-item label="注册日期" prop="regiestDate" style="width: 325px">
  221. <!-- <el-input v-model="dataForm.regiestDate" placeholder="注册日期"></el-input>-->
  222. <el-date-picker
  223. style="width: 200px"
  224. value-format="yyyy-MM-dd HH:mm:ss"
  225. v-model="dataFormD.regiestDate"
  226. type="date"
  227. :disabled="doNot"
  228. placeholder="创建时间"
  229. >
  230. </el-date-picker>
  231. </el-form-item>
  232. <el-form-item label="报废日期" prop="abandonDate" style="width: 325px">
  233. <!-- <el-input v-model="dataForm.abandonDate" placeholder="报废日期"></el-input>-->
  234. <el-date-picker
  235. style="width: 200px"
  236. value-format="yyyy-MM-dd HH:mm:ss"
  237. v-model="dataFormD.abandonDate"
  238. type="date"
  239. :disabled="doNot"
  240. placeholder="创建时间"
  241. >
  242. </el-date-picker>
  243. </el-form-item>
  244. <el-form-item label="外阔尺寸mm" prop="outerSize" style="width: 325px">
  245. <el-input
  246. v-model="dataFormD.outerSize"
  247. style="width: 200px"
  248. :disabled="doNot"
  249. placeholder="外阔尺寸mm"
  250. ></el-input>
  251. </el-form-item>
  252. <el-form-item label="总重量kg" prop="sumWeight" style="width: 325px">
  253. <el-input
  254. v-model="dataFormD.sumWeight"
  255. style="width: 200px"
  256. :disabled="doNot"
  257. placeholder="总重量kg"
  258. ></el-input>
  259. </el-form-item>
  260. <el-form-item label="核定重量kg" prop="vouchWeight" style="width: 325px">
  261. <el-input
  262. v-model="dataFormD.vouchWeight"
  263. style="width: 200px"
  264. :disabled="doNot"
  265. placeholder="核定重量kg"
  266. ></el-input>
  267. </el-form-item>
  268. <el-form-item label="装备质量kg" prop="equipWeight" style="width: 325px">
  269. <el-input
  270. v-model="dataFormD.equipWeight"
  271. style="width: 200px"
  272. :disabled="doNot"
  273. placeholder="装备质量kg"
  274. ></el-input>
  275. </el-form-item>
  276. </el-form>
  277. <el-collapse accordion>
  278. <el-form label-width="200px">
  279. <el-collapse-item title="图片上传">
  280. <div style="width: 50%; float: left">
  281. <el-form-item label="行驶证头图片" style="width: 100%">
  282. <el-upload
  283. style="width: 300px; float: left"
  284. :action="uploadImgUrl"
  285. :on-preview="handlePreview"
  286. :on-remove="
  287. (res, file) => {
  288. handleRemove(0, res, file);
  289. }
  290. "
  291. :before-remove="beforeRemove"
  292. :on-success="
  293. (res, file) => {
  294. handleAvatarSuccess(1, res, file);
  295. }
  296. "
  297. multiple
  298. :disabled="doNot"
  299. :limit="1"
  300. :headers="headers"
  301. :on-exceed="handleExceed"
  302. >
  303. <el-button size="small" :disabled="doNot" type="primary"
  304. >点击上传</el-button
  305. >
  306. <el-button
  307. size="small"
  308. :disabled="doNot"
  309. type="primary"
  310. v-if="fTmsorderbillsattachs[0].attachUrl"
  311. @click="preview(0)"
  312. >预览</el-button
  313. >
  314. </el-upload>
  315. </el-form-item>
  316. <el-form-item label="运营证头图片" style="width: 100%">
  317. <el-upload
  318. style="width: 300px"
  319. :action="uploadImgUrl"
  320. :on-preview="handlePreview"
  321. :on-remove="
  322. (res, file) => {
  323. handleRemove(2, res, file);
  324. }
  325. "
  326. :before-remove="beforeRemove"
  327. :on-success="
  328. (res, file) => {
  329. handleAvatarSuccess(3, res, file);
  330. }
  331. "
  332. multiple
  333. :disabled="doNot"
  334. :limit="1"
  335. :headers="headers"
  336. :on-exceed="handleExceed"
  337. >
  338. <el-button size="small" :disabled="doNot" type="primary"
  339. >点击上传</el-button
  340. >
  341. <el-button
  342. size="small"
  343. :disabled="doNot"
  344. type="primary"
  345. v-if="fTmsorderbillsattachs[2].attachUrl"
  346. @click="preview(2)"
  347. >预览</el-button
  348. >
  349. </el-upload>
  350. </el-form-item>
  351. <el-form-item label="营运挂载图片" style="width: 100%">
  352. <el-upload
  353. style="width: 300px"
  354. :action="uploadImgUrl"
  355. :on-preview="handlePreview"
  356. :on-remove="
  357. (res, file) => {
  358. handleRemove(4, res, file);
  359. }
  360. "
  361. :before-remove="beforeRemove"
  362. :on-success="
  363. (res, file) => {
  364. handleAvatarSuccess(5, res, file);
  365. }
  366. "
  367. multiple
  368. :disabled="doNot"
  369. :limit="1"
  370. :headers="headers"
  371. :on-exceed="handleExceed"
  372. >
  373. <el-button size="small" :disabled="doNot" type="primary"
  374. >点击上传</el-button
  375. >
  376. <el-button
  377. size="small"
  378. :disabled="doNot"
  379. type="primary"
  380. v-if="fTmsorderbillsattachs[4].attachUrl"
  381. @click="preview(4)"
  382. >预览</el-button
  383. >
  384. </el-upload>
  385. </el-form-item>
  386. <el-form-item label="二级维护图片" style="width: 100%">
  387. <el-upload
  388. style="width: 300px"
  389. :action="uploadImgUrl"
  390. :on-preview="handlePreview"
  391. :on-remove="
  392. (res, file) => {
  393. handleRemove(6, res, file);
  394. }
  395. "
  396. :before-remove="beforeRemove"
  397. :on-success="
  398. (res, file) => {
  399. handleAvatarSuccess(7, res, file);
  400. }
  401. "
  402. multiple
  403. :disabled="doNot"
  404. :limit="1"
  405. :headers="headers"
  406. :on-exceed="handleExceed"
  407. >
  408. <el-button size="small" :disabled="doNot" type="primary"
  409. >点击上传</el-button
  410. >
  411. <el-button
  412. size="small"
  413. :disabled="doNot"
  414. type="primary"
  415. v-if="fTmsorderbillsattachs[6].attachUrl"
  416. @click="preview(6)"
  417. >预览</el-button
  418. >
  419. </el-upload>
  420. </el-form-item>
  421. <el-form-item label="承运人保险图片" style="width: 100%">
  422. <el-upload
  423. style="width: 300px"
  424. :action="uploadImgUrl"
  425. :on-preview="handlePreview"
  426. :on-remove="
  427. (res, file) => {
  428. handleRemove(8, res, file);
  429. }
  430. "
  431. :before-remove="beforeRemove"
  432. :on-success="
  433. (res, file) => {
  434. handleAvatarSuccess(9, res, file);
  435. }
  436. "
  437. multiple
  438. :disabled="doNot"
  439. :limit="1"
  440. :headers="headers"
  441. :on-exceed="handleExceed"
  442. >
  443. <el-button size="small" :disabled="doNot" type="primary"
  444. >点击上传</el-button
  445. >
  446. <el-button
  447. size="small"
  448. :disabled="doNot"
  449. type="primary"
  450. v-if="fTmsorderbillsattachs[8].attachUrl"
  451. @click="preview(8)"
  452. >预览</el-button
  453. >
  454. </el-upload>
  455. </el-form-item>
  456. </div>
  457. <div style="width: 50%; float: left">
  458. <el-form-item label="行驶证挂件图片" style="width: 100%">
  459. <el-upload
  460. style="width: 300px"
  461. :action="uploadImgUrl"
  462. :on-preview="handlePreview"
  463. :on-remove="
  464. (res, file) => {
  465. handleRemove(1, res, file);
  466. }
  467. "
  468. :before-remove="beforeRemove"
  469. :on-success="
  470. (res, file) => {
  471. handleAvatarSuccess(2, res, file);
  472. }
  473. "
  474. multiple
  475. :disabled="doNot"
  476. :limit="1"
  477. :headers="headers"
  478. :on-exceed="handleExceed"
  479. >
  480. <el-button size="small" :disabled="doNot" type="primary"
  481. >点击上传</el-button
  482. >
  483. <el-button
  484. size="small"
  485. :disabled="doNot"
  486. type="primary"
  487. v-if="fTmsorderbillsattachs[1].attachUrl"
  488. @click="preview(1)"
  489. >预览</el-button
  490. >
  491. </el-upload>
  492. </el-form-item>
  493. <el-form-item label="技术评定证书图片" style="width: 100%">
  494. <el-upload
  495. style="width: 300px"
  496. :action="uploadImgUrl"
  497. :on-preview="handlePreview"
  498. :on-remove="
  499. (res, file) => {
  500. handleRemove(3, res, file);
  501. }
  502. "
  503. :before-remove="beforeRemove"
  504. :on-success="
  505. (res, file) => {
  506. handleAvatarSuccess(4, res, file);
  507. }
  508. "
  509. multiple
  510. :disabled="doNot"
  511. :limit="1"
  512. :headers="headers"
  513. :on-exceed="handleExceed"
  514. >
  515. <el-button size="small" :disabled="doNot" type="primary"
  516. >点击上传</el-button
  517. >
  518. <el-button
  519. size="small"
  520. :disabled="doNot"
  521. type="primary"
  522. v-if="fTmsorderbillsattachs[3].attachUrl"
  523. @click="preview(3)"
  524. >预览</el-button
  525. >
  526. </el-upload>
  527. </el-form-item>
  528. <el-form-item label="二级维护图片" style="width: 100%">
  529. <el-upload
  530. style="width: 300px"
  531. :action="uploadImgUrl"
  532. :on-preview="handlePreview"
  533. :on-remove="
  534. (res, file) => {
  535. handleRemove(5, res, file);
  536. }
  537. "
  538. :before-remove="beforeRemove"
  539. :on-success="
  540. (res, file) => {
  541. handleAvatarSuccess(6, res, file);
  542. }
  543. "
  544. multiple
  545. :disabled="doNot"
  546. :limit="1"
  547. :headers="headers"
  548. :on-exceed="handleExceed"
  549. >
  550. <el-button size="small" :disabled="doNot" type="primary"
  551. >点击上传</el-button
  552. >
  553. <el-button
  554. size="small"
  555. :disabled="doNot"
  556. type="primary"
  557. v-if="fTmsorderbillsattachs[5].attachUrl"
  558. @click="preview(5)"
  559. >预览</el-button
  560. >
  561. </el-upload>
  562. </el-form-item>
  563. <el-form-item label="商业保险图片1" style="width: 100%">
  564. <el-upload
  565. style="width: 300px"
  566. :action="uploadImgUrl"
  567. :on-preview="handlePreview"
  568. :on-remove="
  569. (res, file) => {
  570. handleRemove(7, res, file);
  571. }
  572. "
  573. :before-remove="beforeRemove"
  574. :on-success="
  575. (res, file) => {
  576. handleAvatarSuccess(8, res, file);
  577. }
  578. "
  579. multiple
  580. :disabled="doNot"
  581. :limit="1"
  582. :headers="headers"
  583. :on-exceed="handleExceed"
  584. >
  585. <el-button size="small" :disabled="doNot" type="primary"
  586. >点击上传</el-button
  587. >
  588. <el-button
  589. size="small"
  590. :disabled="doNot"
  591. type="primary"
  592. v-if="fTmsorderbillsattachs[7].attachUrl"
  593. @click="preview(7)"
  594. >预览</el-button
  595. >
  596. </el-upload>
  597. </el-form-item>
  598. </div>
  599. </el-collapse-item>
  600. </el-form>
  601. </el-collapse>
  602. <span slot="footer" class="dialog-footer">
  603. <el-button type="info" @click="handleUpdata" v-if="hide">修改</el-button>
  604. <el-button @click="visible = false">取消</el-button>
  605. <el-button type="primary" :disabled="doNot" @click="dataFormSubmit"
  606. >确定</el-button
  607. >
  608. </span>
  609. </el-dialog>
  610. </template>
  611. <script>
  612. import {
  613. preservation,
  614. company,
  615. lookOver,
  616. driverMsglist,
  617. } from "@/api/fleet/carManage";
  618. import { getToken } from "@/utils/auth";
  619. import Vue from "vue";
  620. Vue.directive("dialogDrag", {
  621. bind(el, binding, vnode, oldVnode) {
  622. const dialogHeaderEl = el.querySelector(".el-dialog__header");
  623. const dragDom = el.querySelector(".el-dialog");
  624. const enlarge = el.querySelector(".enlarge");
  625. dialogHeaderEl.style.cursor = "move";
  626. // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
  627. const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
  628. if (enlarge) {
  629. enlarge.onclick = (e) => {
  630. dragDom.style.top = "0px";
  631. dragDom.style.left = "0px";
  632. };
  633. }
  634. dialogHeaderEl.onmousedown = (e) => {
  635. // 鼠标按下,计算当前元素距离可视区的距离
  636. const disX = e.clientX - dialogHeaderEl.offsetLeft;
  637. const disY = e.clientY - dialogHeaderEl.offsetTop;
  638. // 获取到的值带px 正则匹配替换
  639. let styL, styT;
  640. // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
  641. if (sty.left.includes("%")) {
  642. styL =
  643. +document.body.clientWidth * (+sty.left.replace(/\%/g, "") / 100);
  644. styT =
  645. +document.body.clientHeight * (+sty.top.replace(/\%/g, "") / 100);
  646. } else {
  647. styL = +sty.left.replace(/\px/g, "");
  648. styT = +sty.top.replace(/\px/g, "");
  649. }
  650. document.onmousemove = function (e) {
  651. // 通过事件委托,计算移动的距离
  652. const l = e.clientX - disX;
  653. const t = e.clientY - disY;
  654. // 移动当前元素
  655. if (t + styT >= 0) {
  656. dragDom.style.top = `${t + styT}px`;
  657. }
  658. dragDom.style.left = `${l + styL}px`;
  659. // 将此时的位置传出去
  660. // binding.value({x:e.pageX,y:e.pageY})
  661. };
  662. document.onmouseup = function (e) {
  663. document.onmousemove = null;
  664. document.onmouseup = null;
  665. };
  666. };
  667. },
  668. });
  669. export default {
  670. props: {
  671. dataForm: {
  672. type: Object,
  673. require: false,
  674. },
  675. },
  676. data() {
  677. return {
  678. hide: false,
  679. dialogFull: false,
  680. driverMans: [],
  681. fTmsorderbillsattachs: [
  682. { attachUrl: "", attachName: "", actId: "" },
  683. { attachUrl: "", attachName: "", actId: "" },
  684. { attachUrl: "", attachName: "", actId: "" },
  685. { attachUrl: "", attachName: "", actId: "" },
  686. { attachUrl: "", attachName: "", actId: "" },
  687. { attachUrl: "", attachName: "", actId: "" },
  688. { attachUrl: "", attachName: "", actId: "" },
  689. { attachUrl: "", attachName: "", actId: "" },
  690. { attachUrl: "", attachName: "", actId: "" },
  691. ],
  692. doNot: true,
  693. imageUrl: "",
  694. dataFormD: {},
  695. visible: false,
  696. msg: "",
  697. uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
  698. headers: {
  699. Authorization: "Bearer " + getToken(),
  700. },
  701. dataRule: {
  702. fleetCompanyId: [
  703. { required: true, message: "请输入车队id", trigger: "blur" },
  704. ],
  705. carNum: [{ required: true, message: "请输入车牌号", trigger: "blur" }],
  706. },
  707. optionsProjectTypeItem: [],
  708. };
  709. },
  710. created() {
  711. this.handleSelect();
  712. },
  713. methods: {
  714. changeCar(id) {
  715. driverMsglist({ fPid: id, fStatus: 0 }).then((data) => {
  716. this.driverMans = data;
  717. });
  718. this.dataFormD.driverId=null
  719. },
  720. full() {
  721. this.dialogFull = !this.dialogFull;
  722. },
  723. // 选择司机时
  724. changeDriverId (val) {
  725. for (let driver in this.driverMans) {
  726. if (this.driverMans[driver].fId == val) {
  727. this.dataFormD.driverTel = this.driverMans[driver].fTel
  728. this.dataFormD.driverName = this.driverMans[driver].fName
  729. }
  730. }
  731. },
  732. handleUpdata() {
  733. this.doNot = false;
  734. },
  735. handleAvatarSuccess(actid, res, file) {
  736. switch (actid) {
  737. case 1:
  738. this.simplification(actid - 1, res);
  739. break;
  740. case 2:
  741. this.simplification(actid - 1, res);
  742. break;
  743. case 3:
  744. this.simplification(actid - 1, res);
  745. break;
  746. case 4:
  747. this.simplification(actid - 1, res);
  748. break;
  749. case 5:
  750. this.simplification(actid - 1, res);
  751. break;
  752. case 6:
  753. this.simplification(actid - 1, res);
  754. break;
  755. case 7:
  756. this.simplification(actid - 1, res);
  757. break;
  758. case 8:
  759. this.simplification(actid - 1, res);
  760. break;
  761. case 9:
  762. this.simplification(actid - 1, res);
  763. break;
  764. default:
  765. this.$message.error("未知错误,请稍后再试");
  766. }
  767. },
  768. simplification(index, res) {
  769. console.log(index);
  770. this.fTmsorderbillsattachs[index].actId = Number(index + 1);
  771. this.fTmsorderbillsattachs[index].attachUrl = res.url;
  772. this.fTmsorderbillsattachs[index].attachName = res.fileName;
  773. },
  774. handleRemove(actid, file, fileList) {
  775. this.fTmsorderbillsattachs[actid].attachUrl = "";
  776. this.fTmsorderbillsattachs[actid].attachName = "";
  777. this.fTmsorderbillsattachs[actid].actId = "";
  778. },
  779. handlePreview(file) {
  780. this.$message.success("如需预览请点击预览");
  781. },
  782. handleExceed(files, fileList) {
  783. this.$message.warning(`当前限制选择 1 个文件件`);
  784. },
  785. beforeRemove(file, fileList) {
  786. return this.$confirm(`确定移除 ${file.name}?`);
  787. },
  788. init() {
  789. this.hide = true;
  790. this.visible = true;
  791. this.changeCar();
  792. this.handleSelect();
  793. if (this.dataForm.Id) {
  794. lookOver(this.dataForm.Id).then((data) => {
  795. this.doNot = true;
  796. this.dataFormD = data.data.fleetCarManage;
  797. if (data.data.fTmsorderbillsattachs) {
  798. this.fTmsorderbillsattachs = data.data.fTmsorderbillsattachs;
  799. }
  800. // this.optionsProjectTypeItem = data.data.fleetCompanyMsg;
  801. // if (data.data.fleetCompanyMsg){
  802. // this.handleSelect()
  803. // }
  804. });
  805. } else {
  806. this.dataFormD = {
  807. fleetCompanyId: "",
  808. carNum: "",
  809. driverId:"",
  810. driverName: "",
  811. driverTel:"",
  812. hangNum: "",
  813. fuelType: "",
  814. carType: "",
  815. carName: "",
  816. carBrand: "",
  817. manufactureUnit: "",
  818. officeOfCertificate: "",
  819. pullCarType: "",
  820. pullCarShelfNum: "",
  821. mountCarType: "",
  822. mountCarNum: "",
  823. engine: "",
  824. carLoadPersion: "",
  825. buyCarDate: "",
  826. regiestDate: "",
  827. abandonDate: "",
  828. outerSize: "",
  829. sumWeight: "",
  830. vouchWeight: "",
  831. equipWeight: "",
  832. };
  833. this.fTmsorderbillsattachs = [
  834. { attachUrl: "", attachName: "", actId: "" },
  835. { attachUrl: "", attachName: "", actId: "" },
  836. { attachUrl: "", attachName: "", actId: "" },
  837. { attachUrl: "", attachName: "", actId: "" },
  838. { attachUrl: "", attachName: "", actId: "" },
  839. { attachUrl: "", attachName: "", actId: "" },
  840. { attachUrl: "", attachName: "", actId: "" },
  841. { attachUrl: "", attachName: "", actId: "" },
  842. { attachUrl: "", attachName: "", actId: "" },
  843. ];
  844. this.hide = false;
  845. this.doNot = false;
  846. }
  847. },
  848. preview(actid) {
  849. console.log(this.fTmsorderbillsattachs);
  850. window.open(this.fTmsorderbillsattachs[actid].attachUrl);
  851. },
  852. handleSelect(query) {
  853. company(query).then((data) => {
  854. this.optionsProjectTypeItem = data.rows;
  855. });
  856. },
  857. // 表单提交
  858. dataFormSubmit() {
  859. this.$refs["dataFormD"].validate((valid) => {
  860. if (valid) {
  861. let formDatae = new window.FormData();
  862. formDatae.append(
  863. "fTmsorderbillsattachs",
  864. JSON.stringify(this.fTmsorderbillsattachs)
  865. );
  866. formDatae.append("fleetCarManage", JSON.stringify(this.dataFormD));
  867. preservation(formDatae).then((data) => {
  868. if (data && data.code === 200) {
  869. this.$message({
  870. message: "操作成功",
  871. type: "success",
  872. duration: 1500,
  873. onClose: () => {
  874. this.visible = false;
  875. this.$emit("refreshDataList");
  876. },
  877. });
  878. } else {
  879. this.$message.error(data.msg);
  880. }
  881. });
  882. }
  883. });
  884. },
  885. },
  886. };
  887. </script>
  888. <style scoped>
  889. .el-form-item {
  890. width: 49%;
  891. margin-bottom: 20px;
  892. display: inline-block;
  893. }
  894. .el-select {
  895. display: block;
  896. }
  897. .upload-demo {
  898. margin-left: 50px;
  899. }
  900. .avatar-uploader .el-upload {
  901. border: 1px dashed #d9d9d9;
  902. border-radius: 6px;
  903. cursor: pointer;
  904. position: relative;
  905. overflow: hidden;
  906. }
  907. .avatar-uploader .el-upload:hover {
  908. border-color: #409eff;
  909. }
  910. .avatar-uploader-icon {
  911. font-size: 28px;
  912. color: #8c939d;
  913. width: 178px;
  914. height: 178px;
  915. line-height: 178px;
  916. text-align: center;
  917. }
  918. .avatar {
  919. width: 178px;
  920. height: 178px;
  921. display: block;
  922. }
  923. </style>
  924. <style lang="scss">
  925. .avue-crud__dialog__header {
  926. display: -webkit-box;
  927. display: -ms-flexbox;
  928. display: flex;
  929. -webkit-box-align: center;
  930. -ms-flex-align: center;
  931. align-items: center;
  932. -webkit-box-pack: justify;
  933. -ms-flex-pack: justify;
  934. justify-content: space-between;
  935. }
  936. .el-dialog__title {
  937. color: rgba(0, 0, 0, 0.85);
  938. font-weight: 500;
  939. word-wrap: break-word;
  940. }
  941. .avue-crud__dialog__menu {
  942. padding-right: 20px;
  943. float: left;
  944. }
  945. </style>