tranManagementDriverAdd.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. //添加司机
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left title">添加新司机</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="returnsales()"
  14. ><img
  15. width="6"
  16. height="10"
  17. style="vertical-align: bottom; margin-right: 3px"
  18. src="../../../public/img/lujing.png"
  19. alt=""
  20. />返回</el-button
  21. >
  22. </el-col>
  23. </el-row>
  24. <ws-form
  25. ref="deptBudgetList"
  26. :rules="mainReportAdd"
  27. :model="deptBudgetList"
  28. >
  29. <div class="flex">
  30. <div class="driver">司机信息</div>
  31. <ws-info-table>
  32. <!--司机姓名-->
  33. <ws-form-item
  34. label="姓名"
  35. span="1"
  36. prop="contractNo"
  37. class="readonly bg-right"
  38. >
  39. <ws-input
  40. v-model="deptBudgetList.driverName"
  41. placeholder="请输入司机姓名"
  42. maxlength="20"
  43. size="small"
  44. />
  45. </ws-form-item>
  46. <!--手机号-->
  47. <ws-form-item
  48. label="手机号"
  49. span="1"
  50. prop="driverPhone"
  51. class="readonly"
  52. >
  53. <ws-input
  54. v-model="deptBudgetList.driverPhone"
  55. placeholder="请输入手机号"
  56. maxlength="100"
  57. size="small"
  58. />
  59. </ws-form-item>
  60. <!--常驻城市-->
  61. <ws-form-item label="常驻城市" span="1" prop="acceptanceMethod">
  62. <el-cascader
  63. :options="options_"
  64. v-model="selectedOptions"
  65. clearable
  66. size="large"
  67. placeholder="请选择常驻城市"
  68. style="width: 200%"
  69. class="el-cascader"
  70. @change="handleChange"
  71. />
  72. </ws-form-item>
  73. <!--身份证号-->
  74. <ws-form-item
  75. label="身份证号"
  76. span="1"
  77. prop="driverNo"
  78. class="readonly"
  79. >
  80. <ws-input
  81. v-model="deptBudgetList.numberCard"
  82. placeholder="请输入身份证号"
  83. maxlength="100"
  84. size="small"
  85. />
  86. </ws-form-item>
  87. </ws-info-table>
  88. {{ age }}
  89. </div>
  90. </ws-form>
  91. <ws-form
  92. ref="deptBudgetList"
  93. :rules="mainReportAdd"
  94. :model="deptBudgetList"
  95. >
  96. <div
  97. style="width: 100%"
  98. class="flex position"
  99. v-for="(item, index) in freightspace"
  100. >
  101. <div class="flex">
  102. <div class="driver">货车信息-{{ index + 1 }}</div>
  103. <ws-info-table class="el-table">
  104. <!--车牌号-->
  105. <ws-form-item
  106. label="车牌号"
  107. span="1"
  108. prop="carNumber"
  109. class="forlist"
  110. width="400px"
  111. >
  112. <ws-input
  113. v-model="item.carNumber"
  114. placeholder="请输入车牌号"
  115. maxlength="20"
  116. size="small"
  117. />
  118. </ws-form-item>
  119. <!--车型-->
  120. <ws-form-item label="车型" span="1" prop="carModel" class="forlist">
  121. <ws-select
  122. v-model="item.carModel"
  123. placeholder=""
  124. class="typeselect"
  125. @change="selectcarModel"
  126. >
  127. <ws-option
  128. v-for="item in carModelList"
  129. :key="item.constKey"
  130. :label="item.constValue"
  131. :value="item.constValue"
  132. />
  133. </ws-select>
  134. </ws-form-item>
  135. <!--车长-->
  136. <ws-form-item
  137. label="不含车头车长(米)"
  138. span="1"
  139. prop="carLength"
  140. class="forlist"
  141. >
  142. <ws-select
  143. v-model="item.carLength"
  144. placeholder=""
  145. class="typeselect"
  146. @change="selectcarLength"
  147. >
  148. <ws-option
  149. v-for="item in carLengthList"
  150. :key="item.constKey"
  151. :label="item.constValue"
  152. :value="item.constValue"
  153. />
  154. </ws-select>
  155. </ws-form-item>
  156. <!--载重-->
  157. <ws-form-item label="载重" span="1" prop="carLoad" class="forlist">
  158. <ws-input
  159. v-model="item.carLoad"
  160. placeholder="请输入载重"
  161. maxlength="100"
  162. size="small"
  163. />
  164. </ws-form-item>
  165. <!--出厂年份-->
  166. <ws-form-item
  167. label="出厂年份"
  168. span="1"
  169. prop="yearManufacture"
  170. class="forlist"
  171. >
  172. <ws-input
  173. v-model="item.yearManufacture"
  174. placeholder="请输入年份"
  175. maxlength="100"
  176. size="small"
  177. />
  178. </ws-form-item>
  179. </ws-info-table>
  180. <img
  181. width="22"
  182. height="22"
  183. class="add"
  184. @click="add"
  185. src="../../../public/img/add.png"
  186. alt=""
  187. />
  188. <img
  189. width="22"
  190. height="22"
  191. class="del"
  192. @click="del(index)"
  193. src="../../../public/img/del.png"
  194. alt=""
  195. />
  196. </div>
  197. </div>
  198. </ws-form>
  199. <ws-form
  200. ref="deptBudgetList"
  201. :rules="mainReportAdd"
  202. :model="deptBudgetList"
  203. >
  204. <div
  205. style="width: 100%"
  206. class="flex position"
  207. v-for="(item, index) in freightspace1"
  208. >
  209. <div class="flex">
  210. <div class="driver">收款人账户信息-{{ index + 1 }}</div>
  211. <ws-info-table class="el-table">
  212. <!--账户类型-->
  213. <ws-form-item
  214. label="账户类型"
  215. span="1"
  216. prop="contractNo"
  217. class="el-car bg-right"
  218. >
  219. <el-radio v-model="item.radio" label="1">私人账号</el-radio>
  220. <el-radio v-model="item.radio" label="2">企业账户</el-radio>
  221. </ws-form-item>
  222. <!--账号-->
  223. <ws-form-item label="账号" span="1" prop="bankCard" class="el-car">
  224. <ws-input
  225. v-model="item.bankCard"
  226. placeholder="请输入账号"
  227. maxlength="100"
  228. size="small"
  229. />
  230. </ws-form-item>
  231. <!--开户行-->
  232. <ws-form-item
  233. label="开户行"
  234. span="1"
  235. prop="bankDeposit"
  236. class="el-car"
  237. >
  238. <ws-input
  239. v-model="item.bankDeposit"
  240. placeholder="请输入开户行"
  241. maxlength="100"
  242. size="small"
  243. />
  244. </ws-form-item>
  245. <!--姓名-->
  246. <ws-form-item
  247. label="姓名"
  248. v-if="item.radio == 1"
  249. span="1"
  250. prop="payeeName"
  251. class="el-car"
  252. width="150px"
  253. >
  254. <ws-input
  255. v-model="item.payeeName"
  256. placeholder="请输入姓名"
  257. maxlength="100"
  258. size="small"
  259. />
  260. </ws-form-item>
  261. <!--企业名称-->
  262. <ws-form-item
  263. label="企业名称"
  264. v-else
  265. span="1"
  266. prop="compName"
  267. class="el-car"
  268. width="150px"
  269. >
  270. <ws-input
  271. v-model="item.compName"
  272. placeholder="请输入企业名称"
  273. maxlength="100"
  274. size="small"
  275. />
  276. </ws-form-item>
  277. <!--身份证号-->
  278. <ws-form-item
  279. label="身份证号"
  280. v-if="item.radio == 1"
  281. span="1"
  282. prop="payeeNumberCard"
  283. class="el-car"
  284. >
  285. <ws-input
  286. v-model="item.payeeNumberCard"
  287. placeholder="请输入身份证号"
  288. maxlength="100"
  289. size="small"
  290. />
  291. </ws-form-item>
  292. <!--身份证附件-->
  293. <ws-form-item
  294. label="身份证附件"
  295. v-if="item.radio == 1"
  296. span="1"
  297. prop="cardAddressUrl"
  298. class="el-car"
  299. >
  300. <!-- <ws-input
  301. v-model="deptBudgetList.driverPayeeInfo.personNo"
  302. placeholder="请输入身份证附件"
  303. maxlength="100"
  304. size="small"
  305. /> -->
  306. </ws-form-item>
  307. </ws-info-table>
  308. <img
  309. width="22"
  310. height="22"
  311. class="add"
  312. @click="add1"
  313. src="../../../public/img/add.png"
  314. alt=""
  315. />
  316. <img
  317. width="22"
  318. height="22"
  319. class="del"
  320. @click="del1(index)"
  321. src="../../../public/img/del.png"
  322. alt=""
  323. />
  324. </div>
  325. </div>
  326. </ws-form>
  327. <ws-form
  328. ref="deptBudgetList"
  329. :rules="mainReportAdd"
  330. :model="deptBudgetList"
  331. >
  332. <div class="flex">
  333. <div class="driver">相关附件</div>
  334. <ws-upload
  335. ref="upload"
  336. table-name="maintain_work_order"
  337. oss-key="mainPlan"
  338. :comp-id="compId"
  339. :appendix-ids="appendixIdsAdd"
  340. :vesselId="deptBudgetList.addressUrl"
  341. :size-limit="size"
  342. @uploadSuccess="uploadSuccess"
  343. @onChange="onChange"
  344. accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  345. />
  346. </div>
  347. </ws-form>
  348. <!-- 提交 -->
  349. <div style="text-align: right; padding: 10px" class="center">
  350. <el-button
  351. class="bg-bottom"
  352. type="primary"
  353. size="small"
  354. @click="submit(deptBudgetList)"
  355. >提交</el-button
  356. >
  357. </div>
  358. </div>
  359. </template>
  360. <script>
  361. import { provinceAndCityData, CodeToText } from 'element-china-area-data'
  362. import { packList } from '@/model/contarct/index'
  363. import { addDriver } from '@/model/transport/index'
  364. import WsUpload from '@/components/WsUpload'
  365. import mapDrag from '@/components/mapdrag/mapdrag'
  366. export default {
  367. name: 'viewSpareMoney',
  368. components: {
  369. WsUpload,
  370. mapDrag,
  371. },
  372. watch: {
  373. vesselId(val) {
  374. this.getVesselData()
  375. },
  376. isShow(val) {
  377. this.showType = val
  378. },
  379. },
  380. data() {
  381. let self = this
  382. return {
  383. deptBudgetList: {
  384. totalStorage: 0,
  385. drivercarInfo: {
  386. goodsName: '',
  387. },
  388. driverPayeeInfo: {},
  389. },
  390. radio: '1',
  391. carModelList: [],
  392. carLengthList: [],
  393. options_: provinceAndCityData,
  394. heightData: '600px',
  395. zoom: 7,
  396. selectedOptions: [],
  397. center: [116.244694, 39.517344],
  398. window: '',
  399. district: null,
  400. listDate: { country: '中国', level: 'country', city: '' },
  401. citylist: [],
  402. compId: sessionStorage.getItem('ws-pf_compId'),
  403. mainReportAdd: {},
  404. appendixIdsAdd: '',
  405. size: 10,
  406. value1: '',
  407. unitList: [],
  408. freightspace: [
  409. {
  410. carNumber: '',
  411. carModel: '高栏',
  412. carModelKey: '1',
  413. carLength: '13',
  414. carLengthKey: '1',
  415. carLoad: '',
  416. yearManufacture: '',
  417. },
  418. ],
  419. freightspace1: [
  420. {
  421. account_type: '',
  422. radio: '1',
  423. payeeName: '',
  424. payeeNumberCard: '',
  425. compName: '',
  426. bankDeposit: '',
  427. bankCard: '',
  428. },
  429. ],
  430. name: '',
  431. age: '',
  432. }
  433. },
  434. activated() {
  435. this.loaddata()
  436. this.showType = this.isShow
  437. },
  438. computed: {},
  439. methods: {
  440. IdCard(UUserCard) {
  441. //获取年龄
  442. var myDate = new Date()
  443. var month = myDate.getMonth() + 1
  444. var day = myDate.getDate()
  445. var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1
  446. if (
  447. UUserCard.substring(10, 12) < month ||
  448. (UUserCard.substring(10, 12) == month &&
  449. UUserCard.substring(12, 14) <= day)
  450. ) {
  451. age++
  452. }
  453. this.age = age
  454. },
  455. loaddata() {
  456. // 车型
  457. packList({ constId: 'TRAN1' })
  458. .toPromise()
  459. .then((response) => {
  460. this.carModelList = response
  461. })
  462. // 车长
  463. packList({ constId: 'TRAN2' })
  464. .toPromise()
  465. .then((response) => {
  466. this.carLengthList = response
  467. })
  468. },
  469. confirmPositioncity() {
  470. this.listDate.level = 'city'
  471. this.listDate.country = this.name
  472. },
  473. // 关闭 dialog时 处理文件url 初始化upload组件
  474. handleClose() {
  475. this.dialogViewSpareMoney = false
  476. },
  477. add() {
  478. this.freightspace.push({
  479. carNumber: '',
  480. carModel: '高栏',
  481. carModelKey: '1',
  482. carLength: '13',
  483. carLengthKey: '1',
  484. carLoad: '',
  485. yearManufacture: '',
  486. })
  487. },
  488. del(index) {
  489. if (this.freightspace.length > 1) {
  490. this.freightspace.splice(index, 1)
  491. }
  492. },
  493. add1() {
  494. this.freightspace1.push({
  495. account_type: '',
  496. radio: '1',
  497. payeeName: '',
  498. payeeNumberCard: '',
  499. compName: '',
  500. bankDeposit: '',
  501. bankCard: '',
  502. })
  503. },
  504. del1(index) {
  505. if (this.freightspace1.length > 1) {
  506. this.freightspace1.splice(index, 1)
  507. }
  508. },
  509. handleChange(value) {
  510. this.selectedOptions = value
  511. },
  512. returnsales() {
  513. this.$router.push({ path: 'tranManagementDriver' })
  514. },
  515. // confirmPosition() {
  516. // this.draggable = false
  517. // },
  518. // 上传附件
  519. uploadSuccess(data, files, url) {
  520. console.log(data, files, url)
  521. // this.deptBudgetList.
  522. // this.formData.append('files', files)
  523. // this.feedbackObj.uploadNameAttachment = data.appendixName
  524. // this.feedbackObj.pathUploadAttachment = data.appendixPath
  525. // // this.newAppendixs = files
  526. // this.onChangeFlag = true
  527. },
  528. selectcarModel(e) {
  529. for (var i = 0; i < this.carModelList.length; i++) {
  530. if (this.carModelList[i].constValue == e) {
  531. this.deptBudgetList.carModelKey = this.carModelList[i].constKey
  532. }
  533. }
  534. },
  535. selectcarLength(e) {
  536. for (var i = 0; i < this.carLengthList.length; i++) {
  537. if (this.carLengthList[i].constValue == e) {
  538. this.deptBudgetList.carLengthKey = this.carLengthList[i].constKey
  539. }
  540. }
  541. },
  542. onChange(files) {
  543. this.fileNum = files
  544. this.$refs.upload.handleSaveBill().then((res) => {
  545. console.log(files)
  546. })
  547. },
  548. submit() {
  549. console.log(this.freightspace)
  550. this.$refs.deptBudgetList.validate((valid) => {
  551. if (valid) {
  552. this.deptBudgetList.compId = sessionStorage.getItem('ws-pf_compId')
  553. this.deptBudgetList.residentCityProvincial =
  554. CodeToText[this.selectedOptions[0]]
  555. this.deptBudgetList.residentCityMunicipal =
  556. CodeToText[this.selectedOptions[1]]
  557. this.deptBudgetList.driverCarInfoList = this.freightspace
  558. this.deptBudgetList.driverPayeeInfoList = this.freightspace1
  559. addDriver(this.deptBudgetList)
  560. .toPromise()
  561. .then((response) => {
  562. this.$message.success('添加成功')
  563. this.$router.push({ path: 'tranManagementDriver' })
  564. })
  565. } else {
  566. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  567. return false
  568. }
  569. })
  570. },
  571. resetForm(deptBudgetList) {
  572. this.$refs[deptBudgetList].resetFields()
  573. },
  574. },
  575. }
  576. </script>
  577. <style lang="scss" scoped>
  578. .position {
  579. position: relative;
  580. }
  581. .add,
  582. .del {
  583. position: absolute;
  584. right: -38px;
  585. top: 9px;
  586. cursor: pointer;
  587. }
  588. .del {
  589. right: -70px;
  590. }
  591. .amap-page-container {
  592. width: 300px;
  593. height: 300px;
  594. }
  595. .el-form {
  596. padding: 0 10%;
  597. }
  598. /deep/.ws-info-table .el-form-item {
  599. border-right: 1px solid #cdd2dc;
  600. border-bottom: 1px solid #cdd2dc;
  601. }
  602. .readonly {
  603. position: relative;
  604. }
  605. .title {
  606. position: relative;
  607. }
  608. .el-car {
  609. width: 413px;
  610. }
  611. .title::before {
  612. content: '';
  613. display: inline-block;
  614. width: 5px;
  615. height: 30px;
  616. background: #5473e8;
  617. position: absolute;
  618. left: 0;
  619. }
  620. .el-col {
  621. background: #f6f7fc;
  622. }
  623. /deep/.ws-info-table .el-form-item .el-form-item__content {
  624. padding: 0 25px;
  625. border-left: 1px solid #cdd2dc;
  626. background: #fafbfc;
  627. }
  628. /deep/.ws-info-table .el-form-item .el-form-item__label {
  629. width: 140px;
  630. text-align: center;
  631. background: #f0f2f6;
  632. // border: 1px solid #cdd2dc;
  633. }
  634. .button-container {
  635. display: flex;
  636. flex-wrap: nowrap;
  637. justify-content: space-between;
  638. align-items: center;
  639. background-color: #fff;
  640. width: 100%;
  641. height: 50px;
  642. padding: 0 10px;
  643. & > div {
  644. margin-left: 10px;
  645. display: flex;
  646. flex-wrap: nowrap;
  647. flex-direction: row;
  648. & > span {
  649. line-height: 50px;
  650. }
  651. }
  652. /deep/.auditFlow-box {
  653. position: unset;
  654. margin-left: 10px;
  655. &/deep/.auditFlow-icon {
  656. width: auto;
  657. padding-right: 30px;
  658. }
  659. &/deep/.auditFlow-main {
  660. position: absolute;
  661. }
  662. }
  663. }
  664. .box-app {
  665. display: inline-block;
  666. float: left;
  667. margin-left: 30px;
  668. line-height: 50px;
  669. }
  670. /deep/.el-dialog {
  671. .el-form-item {
  672. margin-bottom: 0 !important;
  673. .el-input--medium {
  674. textarea {
  675. min-height: 100px !important;
  676. }
  677. }
  678. }
  679. }
  680. .collapse-bottom {
  681. margin-bottom: 20px;
  682. }
  683. .input-main .textarea .el-textarea__inner {
  684. width: 100%;
  685. z-index: 1;
  686. }
  687. .bg-left {
  688. padding-left: 30px;
  689. }
  690. .bg-right {
  691. padding-right: 10px;
  692. text-align: right;
  693. }
  694. .bg-bottom {
  695. margin: 15px 0px;
  696. }
  697. .wenzi {
  698. width: 900px;
  699. margin: 0 auto;
  700. }
  701. .wenzi h3 {
  702. display: inline-block;
  703. left: 10px;
  704. }
  705. .wenzi p {
  706. display: inline-block;
  707. }
  708. .center {
  709. width: 900px;
  710. margin: 0 auto;
  711. }
  712. .el-form-item__label {
  713. text-align: center;
  714. }
  715. .el-table {
  716. width: 1240px;
  717. }
  718. .ce {
  719. width: 900px;
  720. margin: 0 auto;
  721. }
  722. .driver {
  723. width: 120px;
  724. margin-top: 10px;
  725. font-weight: bold;
  726. }
  727. // 控制select为只读的时候显示样式
  728. /deep/.ws-class-table-col {
  729. height: auto;
  730. padding: 0px 2px;
  731. /deep/.el-input__inner {
  732. padding: 0px 2px;
  733. }
  734. }
  735. .winseaview-view {
  736. padding: 0 0 20px;
  737. }
  738. .container {
  739. overflow: scroll;
  740. height: 93vh;
  741. }
  742. /deep/.ws-info-table .el-form-item .el-form-item__label {
  743. width: 80px;
  744. }
  745. /deep/.ws-info-table .el-form-item {
  746. width: 25%;
  747. }
  748. .el-textarea__inner {
  749. display: none;
  750. }
  751. .el-form {
  752. margin-top: 50px;
  753. }
  754. .readonly {
  755. width: 16%;
  756. }
  757. .el-cascader {
  758. width: 145px;
  759. }
  760. .forlist {
  761. width: 20%;
  762. }
  763. .el-form-item.forlist.is-success.el-form-item--small {
  764. width: 20%;
  765. }
  766. .el-form-item.forlist.el-form-item--small {
  767. width: 20%;
  768. }
  769. .el-form-item.readonly.is-success.el-form-item--small.showLableToopTip {
  770. width: 20%;
  771. }
  772. .el-form-item.el-car.el-form-item--small {
  773. width: 33.3%;
  774. }
  775. </style>