tranManagementTransportAdd.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  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. >
  15. <img
  16. width="6"
  17. height="10"
  18. style="vertical-align: bottom; margin-right: 3px"
  19. src="../../../public/img/lujing.png"
  20. alt
  21. />返回
  22. </el-button>
  23. </el-col>
  24. </el-row>
  25. <el-form
  26. ref="deptBudgetList"
  27. :rules="mainReportAdd"
  28. :model="deptBudgetList"
  29. >
  30. <ws-info-table class="el-table">
  31. <el-form-item label="任务编号" span="1" prop="taskNo" class="forlist">
  32. <el-input
  33. v-model="deptBudgetList.taskNo"
  34. placeholder="请输入任务编号"
  35. maxlength="20"
  36. size="small"
  37. ></el-input>
  38. </el-form-item>
  39. <el-form-item prop="taskType" label="任务类型" span="1">
  40. <el-select
  41. v-model="deptBudgetList.taskType"
  42. placeholder="请输入任务类型"
  43. @change="selecttaskType"
  44. >
  45. <el-option
  46. v-for="item in taskType"
  47. :key="item.constKey"
  48. :label="item.constValue"
  49. :value="item.constValue"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item prop="contractNo" label="合同编号/移库任务编号" span="1">
  54. <el-select
  55. v-model="deptBudgetList.contractNo"
  56. placeholder="请选择编号"
  57. >
  58. <el-option
  59. v-for="item in contractNoList"
  60. :key="item.constKey"
  61. :label="item.contractNo"
  62. :value="item.contractNo"
  63. ></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item prop="goodsName" label="货名" span="1">
  67. <el-select
  68. v-model="deptBudgetList.goodsName"
  69. placeholder="请输入货名"
  70. @change="selectgoodsname"
  71. >
  72. <el-option
  73. v-for="item in goodnameList"
  74. :key="item.constKey"
  75. :label="item.constValue"
  76. :value="item.constValue"
  77. ></el-option>
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="重量(吨)" span="1" prop="weight">
  81. <el-input
  82. @input="weightchange"
  83. v-model="deptBudgetList.weight"
  84. placeholder="请输入重量"
  85. maxlength="20"
  86. size="small"
  87. ></el-input>
  88. </el-form-item>
  89. </ws-info-table>
  90. <ws-info-table class="el-table">
  91. <div class="start-address" style="width: 36%">
  92. <el-radio-group
  93. @change="warehouseTypechange"
  94. v-model="deptBudgetList.warehouseType"
  95. >
  96. <el-radio label="1">常用仓库发货</el-radio>
  97. <el-radio label="2">临时仓库发货</el-radio>
  98. </el-radio-group>
  99. <el-select
  100. @change="sendWarehousechange"
  101. v-model="deptBudgetList.sendWarehouse"
  102. placeholder="选择仓库"
  103. class="typeselect"
  104. >
  105. <el-option
  106. v-for="item in warehouseList"
  107. :key="item.constKey"
  108. :label="item.warehouseName"
  109. :value="item.warehouseName"
  110. ></el-option>
  111. </el-select>
  112. </div>
  113. <el-form-item label="始发地" span="1" class="start-address">
  114. <el-cascader
  115. :options="options_"
  116. v-model="selectedOptions"
  117. clearable
  118. size="large"
  119. placeholder="请选择始发地"
  120. @change="handleChange"
  121. />
  122. </el-form-item>
  123. <el-form-item
  124. label="始发地详细地址"
  125. span="1"
  126. prop="startDetailedAddress"
  127. style="width: 31.333%"
  128. >
  129. <el-input
  130. v-model="deptBudgetList.startDetailedAddress"
  131. placeholder="请输入始发地详细地址"
  132. maxlength="20"
  133. size="small"
  134. ></el-input>
  135. </el-form-item>
  136. <el-form-item
  137. label="收货库点"
  138. span="1"
  139. prop="contractNo"
  140. class="start-address"
  141. style="width: 36%"
  142. >
  143. <el-select
  144. @change="sendWarehousechange1"
  145. v-model="deptBudgetList.receiveWarehouse"
  146. :disabled="warehouse"
  147. placeholder="请输入收货库点"
  148. style="width: 100%"
  149. >
  150. <el-option
  151. v-for="item in warehouseList1"
  152. :key="item.constKey"
  153. :label="item.warehouseName"
  154. :value="item.warehouseName"
  155. ></el-option>
  156. </el-select>
  157. </el-form-item>
  158. <el-form-item
  159. label="终到地"
  160. span="1"
  161. prop="contractNo"
  162. class="start-address"
  163. >
  164. <el-cascader
  165. :options="options_"
  166. v-model="selectedOptions1"
  167. clearable
  168. size="large"
  169. placeholder="请选择终到地"
  170. @change="handleChange1"
  171. />
  172. </el-form-item>
  173. <el-form-item
  174. label="终到地详细地址"
  175. span="1"
  176. prop="endDetailedAddress"
  177. class="bg-right start-address"
  178. >
  179. <el-input
  180. v-model="deptBudgetList.endDetailedAddress"
  181. placeholder="请输入终到地详细地址"
  182. maxlength="20"
  183. size="small"
  184. ></el-input>
  185. </el-form-item>
  186. <div class="check-box">
  187. <span class="check-box">运输方式</span>
  188. <el-checkbox-group v-model="checkList" prop="tranType">
  189. <el-checkbox label="汽运" checked></el-checkbox>
  190. <el-checkbox label="火运"></el-checkbox>
  191. <el-checkbox label="船运"></el-checkbox>
  192. </el-checkbox-group>
  193. </div>
  194. </ws-info-table>
  195. <div
  196. style="width: 100%"
  197. class="position"
  198. v-for="(item, index) in deptBudgetList.tranProcessInfoList"
  199. :key="index"
  200. >
  201. <div class="driver">
  202. <span>运输阶段{{ index + 1 }} {{ item.processNo }}</span>
  203. <img
  204. v-if="!endflag"
  205. width="22"
  206. height="22"
  207. class="add"
  208. @click="add(index)"
  209. src="../../../public/img/add.png"
  210. alt
  211. />
  212. <img
  213. width="22"
  214. height="22"
  215. class="del"
  216. @click="del(index)"
  217. src="../../../public/img/del.png"
  218. alt
  219. />
  220. <!-- <span
  221. style="margin-left : 20px;font-size : 14px"
  222. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  223. >最终阶段</span> -->
  224. <el-checkbox
  225. @change="(val) => engflagchange(val,index)"
  226. class="endflag"
  227. true-label="1"
  228. false-label="0"
  229. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  230. v-model="item.endFlag"
  231. :label="1"
  232. >最终阶段</el-checkbox
  233. >
  234. </div>
  235. <ws-info-table>
  236. <el-form-item label="运输方式" span="1" prop="waterContent">
  237. <el-select
  238. v-model="item.tranType"
  239. placeholder="运输方式"
  240. @change="
  241. (val) => {
  242. selecttaskwayList(val, index)
  243. }
  244. "
  245. >
  246. <el-option
  247. v-for="item in taskwayList"
  248. :key="item.constKey"
  249. :label="item.constValue"
  250. :value="item.constValue"
  251. ></el-option>
  252. </el-select>
  253. </el-form-item>
  254. <el-form-item label="发货日期" span="1" prop="impurity">
  255. <ws-date-picker
  256. v-model="item.deliveryDateStart"
  257. type="date"
  258. placeholder="请选择发货日期"
  259. value-format="yyyy-MM-dd"
  260. />
  261. </el-form-item>
  262. <el-form-item label="最晚到货日期" span="1" prop="bulkDensity">
  263. <ws-date-picker
  264. v-model="item.deliveryDateEnd"
  265. type="date"
  266. placeholder="请选择最晚到货日期"
  267. value-format="yyyy-MM-dd"
  268. />
  269. </el-form-item>
  270. <!-- 本阶段重量 -->
  271. <el-form-item
  272. label="本阶段运输重量(吨)"
  273. span="1"
  274. prop="bulkDensity"
  275. >
  276. <el-input
  277. v-model="item.weight"
  278. placeholder="请输入本阶段运输重量"
  279. size="small"
  280. ></el-input>
  281. </el-form-item>
  282. </ws-info-table>
  283. <ws-info-table>
  284. <el-form-item label="发货地区" span="1" prop="waterContent">
  285. <el-cascader
  286. :options="options_"
  287. v-model="item.selectedOptions"
  288. clearable
  289. size="large"
  290. placeholder="请选择发货地区"
  291. style="width: 200%"
  292. @change="
  293. (val) => {
  294. handleChange3(val, index)
  295. }
  296. "
  297. />
  298. </el-form-item>
  299. <el-form-item label="发货地详细地址" span="1" prop="impurity">
  300. <el-input
  301. v-model="item.sendDetailedAddress"
  302. placeholder="请输入发货地详细地址"
  303. maxlength="20"
  304. size="small"
  305. ></el-input>
  306. </el-form-item>
  307. <el-form-item label="发货人" span="1" prop="bulkDensity">
  308. <el-input
  309. v-model="item.sender"
  310. placeholder="请输入发货人"
  311. maxlength="20"
  312. size="small"
  313. ></el-input>
  314. </el-form-item>
  315. <el-form-item label="发货人电话" span="1" prop="bulkDensity">
  316. <el-input
  317. v-model="item.senderPhone"
  318. placeholder="请输入发货人电话"
  319. maxlength="20"
  320. size="small"
  321. ></el-input>
  322. </el-form-item>
  323. </ws-info-table>
  324. <ws-info-table>
  325. <el-form-item label="收货地区" span="1" prop="bulkDensity">
  326. <el-cascader
  327. :options="options_"
  328. v-model="item.selectedOptions1"
  329. clearable
  330. size="large"
  331. placeholder="请选择收货地区"
  332. style="width: 200%"
  333. @change="
  334. (val) => {
  335. handleChange4(val, index)
  336. }
  337. "
  338. />
  339. </el-form-item>
  340. <el-form-item label="收货地详细地址" span="1" prop="impurity">
  341. <el-input
  342. v-model="item.receiveDetailedAddress"
  343. placeholder="请输入收货地详细地址"
  344. maxlength="20"
  345. size="small"
  346. ></el-input>
  347. </el-form-item>
  348. <el-form-item label="收货人" span="1" prop="bulkDensity">
  349. <el-input
  350. v-model="item.receiver"
  351. placeholder="请输入收货人"
  352. maxlength="20"
  353. size="small"
  354. ></el-input>
  355. </el-form-item>
  356. <el-form-item label="收货人电话" span="1" prop="bulkDensity">
  357. <el-input
  358. v-model="item.receiverPhone"
  359. placeholder="请输入收货人电话"
  360. maxlength="20"
  361. size="small"
  362. ></el-input>
  363. </el-form-item>
  364. </ws-info-table>
  365. </div>
  366. </el-form>
  367. <!-- 提交 -->
  368. <div style="text-align: right; padding: 10px" class="center">
  369. <el-button
  370. class="bg-bottom"
  371. type="primary"
  372. size="small"
  373. @click="submit(deptBudgetList)"
  374. >提交</el-button
  375. >
  376. </div>
  377. </div>
  378. </template>
  379. <script>
  380. import { packList } from '@/model/contarct/index'
  381. import { regionData, CodeToText, TextToCode } from 'element-china-area-data'
  382. import { addtrantask, getwarehousename, xialaNo } from '@/model/tasksport/index'
  383. import WsUpload from '@/components/WsUpload'
  384. import mapDrag from '@/components/mapdrag/mapdrag'
  385. export default {
  386. name: 'viewSpareMoney',
  387. components: {
  388. WsUpload,
  389. mapDrag,
  390. },
  391. watch: {
  392. vesselId(val) {
  393. this.getVesselData()
  394. },
  395. isShow(val) {
  396. this.showType = val
  397. },
  398. },
  399. data() {
  400. let self = this
  401. return {
  402. flag: 2,
  403. checkList: [],
  404. deptBudgetList: {
  405. taskNo: '',
  406. totalStorage: 0,
  407. goodsName: '玉米',
  408. goodsNameKey: 1,
  409. warehouseType: '1',
  410. tranProcessInfoList: [
  411. {
  412. sort: 0,
  413. processNo: '',
  414. tranType: '汽运',
  415. tranTypeKey: '1',
  416. deliveryDateStart: '',
  417. deliveryDateEnd: '',
  418. weight: '',
  419. selectedOptions: [],
  420. selectedOptions1: [],
  421. sendPrivate: '',
  422. sendCity: '',
  423. sendArea: '',
  424. receivePrivate: '',
  425. receiveCity: '',
  426. receiveArea: '',
  427. sendDetailedAddress: '',
  428. receiveDetailedAddress: '',
  429. sender: '',
  430. receiver: '',
  431. senderPhone: '',
  432. receiverPhone: '',
  433. endFlag: '0',
  434. },
  435. ],
  436. },
  437. radio: '1',
  438. options_: regionData,
  439. heightData: '600px',
  440. zoom: 7,
  441. endflag: false,
  442. selectedOptions: [],
  443. selectedOptions1: [],
  444. window: '',
  445. district: null,
  446. goodnameList: [],
  447. listDate: { country: '中国', level: 'country', city: '' },
  448. citylist: [],
  449. taskType: [],
  450. taskwayList: [],
  451. contractNoList: [],
  452. compId: sessionStorage.getItem('ws-pf_compId'),
  453. mainReportAdd: {},
  454. appendixIdsAdd: '',
  455. warehouseList: [],
  456. warehouseList1: [],
  457. size: 10,
  458. value1: '',
  459. unitList: [],
  460. name: '',
  461. age: '',
  462. number: 2,
  463. }
  464. },
  465. activated() {
  466. this.loaddata()
  467. this.showType = this.isShow
  468. },
  469. computed: {
  470. warehouse: function () {
  471. if (
  472. this.deptBudgetList.taskType == '销售出库' ||
  473. this.deptBudgetList.taskType == '贸易服务出库' ||
  474. this.deptBudgetList.taskType == '暂存出库'
  475. ) {
  476. return true
  477. } else {
  478. return false
  479. }
  480. },
  481. },
  482. methods: {
  483. sendWarehousechange(e) {
  484. for (let i = 0; i < this.warehouseList.length; i++) {
  485. if (this.warehouseList[i].warehouseName == e) {
  486. var tmp = []
  487. tmp[0] = TextToCode[this.warehouseList[i].warehousePrivate].code
  488. tmp[1] =
  489. TextToCode[this.warehouseList[i].warehousePrivate][
  490. this.warehouseList[i].warehouseCity
  491. ].code
  492. tmp[2] =
  493. TextToCode[this.warehouseList[i].warehousePrivate][
  494. this.warehouseList[i].warehouseCity
  495. ][this.warehouseList[i].warehouseArea].code
  496. this.selectedOptions = tmp
  497. this.deptBudgetList.tranProcessInfoList[0].selectedOptions = tmp
  498. this.$set(
  499. this.deptBudgetList,
  500. 'startDetailedAddress',
  501. this.warehouseList[i].detailedAddress
  502. )
  503. this.$set(
  504. this.deptBudgetList.tranProcessInfoList[0],
  505. 'sendDetailedAddress',
  506. this.deptBudgetList.startDetailedAddress
  507. )
  508. }
  509. }
  510. },
  511. sendWarehousechange1(e) {
  512. for (let i = 0; i < this.warehouseList1.length; i++) {
  513. if (this.warehouseList1[i].warehouseName == e) {
  514. var tmp = []
  515. tmp[0] = TextToCode[this.warehouseList1[i].warehousePrivate].code
  516. tmp[1] =
  517. TextToCode[this.warehouseList1[i].warehousePrivate][
  518. this.warehouseList1[i].warehouseCity
  519. ].code
  520. tmp[2] =
  521. TextToCode[this.warehouseList1[i].warehousePrivate][
  522. this.warehouseList1[i].warehouseCity
  523. ][this.warehouseList1[i].warehouseArea].code
  524. this.selectedOptions1 = tmp
  525. this.$set(
  526. this.deptBudgetList,
  527. 'endDetailedAddress',
  528. this.warehouseList1[i].detailedAddress
  529. )
  530. }
  531. }
  532. },
  533. warehouseTypechange() {
  534. getwarehousename({
  535. compId: this.compId,
  536. warehouseType: this.deptBudgetList.warehouseType,
  537. })
  538. .toPromise()
  539. .then((response) => {
  540. this.warehouseList = response
  541. })
  542. },
  543. weightchange(e) {
  544. this.deptBudgetList.tranProcessInfoList[0].weight = e
  545. },
  546. engflagchange(e) {
  547. this.endflag = e
  548. if (this.endflag) {
  549. this.deptBudgetList.tranProcessInfoList[
  550. this.deptBudgetList.tranProcessInfoList.length - 1
  551. ].selectedOptions1 = this.selectedOptions1
  552. this.deptBudgetList.tranProcessInfoList[
  553. this.deptBudgetList.tranProcessInfoList.length - 1
  554. ].receiveDetailedAddress = this.deptBudgetList.endDetailedAddress
  555. } else {
  556. this.deptBudgetList.tranProcessInfoList[
  557. this.deptBudgetList.tranProcessInfoList.length - 1
  558. ].selectedOptions1 = []
  559. this.deptBudgetList.tranProcessInfoList[
  560. this.deptBudgetList.tranProcessInfoList.length - 1
  561. ].receiveDetailedAddress = ''
  562. }
  563. },
  564. // 获取当前年月日
  565. getdate() {
  566. var date = new Date()
  567. var year = date.getFullYear() //获取完整的年份(4位)
  568. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  569. var datetime = date.getDate() //获取当前日(1-31)
  570. if (mouth < 10) {
  571. mouth = '0' + mouth
  572. }
  573. if (datetime < 10) {
  574. datetime = '0' + datetime
  575. }
  576. return year + mouth + datetime
  577. },
  578. // 随机验证码
  579. verifyinit() {
  580. var arr = []
  581. for (var i = 48; i < 123; i++) {
  582. if (i > 57 && i < 65) continue
  583. if (i > 90 && i < 97) continue
  584. arr.push(String.fromCharCode(i))
  585. }
  586. arr.sort(function () {
  587. return Math.random() - 0.5
  588. })
  589. arr.length = 4
  590. return arr.join('')
  591. },
  592. loaddata() {
  593. this.deptBudgetList.taskNo = 'YS' + this.getdate() + this.verifyinit()
  594. this.deptBudgetList.tranProcessInfoList[0].processNo =
  595. this.deptBudgetList.taskNo + '-1'
  596. // 货名
  597. packList({ constId: 'CON2' })
  598. .toPromise()
  599. .then((response) => {
  600. this.goodnameList = response
  601. })
  602. // 任务类型
  603. packList({ constId: 'TRAN3' })
  604. .toPromise()
  605. .then((response) => {
  606. this.taskType = response
  607. })
  608. // 运输方式
  609. packList({ constId: 'TRAN6' })
  610. .toPromise()
  611. .then((response) => {
  612. this.taskwayList = response
  613. })
  614. getwarehousename({
  615. compId: this.compId,
  616. warehouseType: this.deptBudgetList.warehouseType,
  617. })
  618. .toPromise()
  619. .then((response) => {
  620. this.warehouseList = response
  621. })
  622. getwarehousename({
  623. compId: this.compId,
  624. warehouseType: 1,
  625. })
  626. .toPromise()
  627. .then((response) => {
  628. this.warehouseList1 = response
  629. })
  630. xialaNo({
  631. compId: this.compId,
  632. })
  633. .toPromise()
  634. .then((response) => {
  635. this.contractNoList = response
  636. })
  637. },
  638. confirmPositioncity() {
  639. this.listDate.level = 'city'
  640. this.listDate.country = this.name
  641. },
  642. // 关闭 dialog时 处理文件url 初始化upload组件
  643. handleClose() {
  644. this.dialogViewSpareMoney = false
  645. },
  646. add(index) {
  647. this.deptBudgetList.tranProcessInfoList.push({
  648. processNo: this.deptBudgetList.taskNo + '-' + this.number,
  649. tranType: '汽运',
  650. tranTypeKey: '1',
  651. deliveryDateStart: '',
  652. deliveryDateEnd: '',
  653. weight:
  654. this.deptBudgetList.tranProcessInfoList[
  655. this.deptBudgetList.tranProcessInfoList.length - 1
  656. ].weight,
  657. selectedOptions: [],
  658. selectedOptions1: [],
  659. sendPrivate: '',
  660. sendCity: '',
  661. sendArea: '',
  662. receivePrivate: '',
  663. receiveCity: '',
  664. receiveArea: '',
  665. sendDetailedAddress: '',
  666. receiveDetailedAddress: '',
  667. sender: '',
  668. receiver: '',
  669. senderPhone: '',
  670. receiverPhone: '',
  671. endFlag: '0',
  672. })
  673. this.number++
  674. },
  675. del(index) {
  676. if (this.deptBudgetList.tranProcessInfoList.length > 1) {
  677. this.deptBudgetList.tranProcessInfoList.splice(index, 1)
  678. }
  679. this.number--
  680. },
  681. handleChange(value) {
  682. this.selectedOptions = value
  683. this.deptBudgetList.startPrivate = CodeToText[value[0]]
  684. this.deptBudgetList.startCity = CodeToText[value[1]]
  685. this.deptBudgetList.startArea = CodeToText[value[2]]
  686. },
  687. handleChange1(value) {
  688. this.selectedOptions1 = value
  689. this.deptBudgetList.endPrivate = CodeToText[value[0]]
  690. this.deptBudgetList.endCity = CodeToText[value[1]]
  691. this.deptBudgetList.endArea = CodeToText[value[2]]
  692. },
  693. handleChange3(value, index) {
  694. this.deptBudgetList.tranProcessInfoList[index].sendPrivate =
  695. CodeToText[value[0]]
  696. this.deptBudgetList.tranProcessInfoList[index].sendCity =
  697. CodeToText[value[1]]
  698. this.deptBudgetList.tranProcessInfoList[index].sendArea =
  699. CodeToText[value[2]]
  700. },
  701. handleChange4(value, index) {
  702. this.deptBudgetList.tranProcessInfoList[index].receivePrivate =
  703. CodeToText[value[0]]
  704. this.deptBudgetList.tranProcessInfoList[index].receiveCity =
  705. CodeToText[value[1]]
  706. this.deptBudgetList.tranProcessInfoList[index].receiveArea =
  707. CodeToText[value[2]]
  708. },
  709. returnsales() {
  710. this.$router.push({ path: 'tranManagementTransport' })
  711. this.deptBudgetList = {
  712. taskNo: '',
  713. totalStorage: 0,
  714. goodsName: '玉米',
  715. goodsNameKey: 1,
  716. warehouseType: '1',
  717. tranProcessInfoList: [
  718. {
  719. processNo: '',
  720. tranType: '汽运',
  721. deliveryDateStart: '',
  722. deliveryDateEnd: '',
  723. weight: '',
  724. selectedOptions: [],
  725. selectedOptions1: [],
  726. sendPrivate: '',
  727. sendCity: '',
  728. sendArea: '',
  729. receivePrivate: '',
  730. receiveCity: '',
  731. receiveArea: '',
  732. sendDetailedAddress: '',
  733. receiveDetailedAddress: '',
  734. sender: '',
  735. receiver: '',
  736. senderPhone: '',
  737. receiverPhone: '',
  738. },
  739. ],
  740. }
  741. },
  742. selecttaskType(e) {
  743. for (var i = 0; i < this.taskType.length; i++) {
  744. if (this.taskType[i].constValue == e) {
  745. this.deptBudgetList.taskTypeKey = this.taskType[i].constKey
  746. }
  747. }
  748. },
  749. selecttaskwayList(e, index) {
  750. for (var i = 0; i < this.taskwayList.length; i++) {
  751. if (this.taskwayList[i].constValue == e) {
  752. this.deptBudgetList.tranProcessInfoList[index].tranTypeKey =
  753. this.taskwayList[i].constKey
  754. }
  755. }
  756. },
  757. selectgoodsname(e) {
  758. for (var i = 0; i < this.goodnameList.length; i++) {
  759. if (this.goodnameList[i].constValue == e) {
  760. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  761. }
  762. }
  763. },
  764. onChange(files) {
  765. this.fileNum = files
  766. this.$refs.upload.handleSaveBill().then((res) => {})
  767. },
  768. submit() {
  769. if (!this.deptBudgetList.taskNo) {
  770. this.$message({
  771. message: '任务编号不能为空!',
  772. type: 'warning',
  773. })
  774. return
  775. }
  776. if (!this.deptBudgetList.taskType) {
  777. this.$message({
  778. message: '任务类型不能为空!',
  779. type: 'warning',
  780. })
  781. return
  782. }
  783. if (!this.deptBudgetList.contractNo) {
  784. this.$message({
  785. message: '合同编号/移库任务编号不能为空!',
  786. type: 'warning',
  787. })
  788. return
  789. }
  790. if (!this.deptBudgetList.goodsName) {
  791. this.$message({
  792. message: '货名不能为空!',
  793. type: 'warning',
  794. })
  795. return
  796. }
  797. if (!this.deptBudgetList.weight) {
  798. this.$message({
  799. message: '重量(吨)不能为空!',
  800. type: 'warning',
  801. })
  802. return
  803. }
  804. if (!this.deptBudgetList.sendWarehouse) {
  805. this.$message({
  806. message: '发货仓库不能为空!',
  807. type: 'warning',
  808. })
  809. return
  810. }
  811. if (this.selectedOptions.length <= 0) {
  812. this.$message({
  813. message: '始发地不能为空!',
  814. type: 'warning',
  815. })
  816. return
  817. }
  818. if (!this.deptBudgetList.startDetailedAddress) {
  819. this.$message({
  820. message: '始发地详细地址不能为空!',
  821. type: 'warning',
  822. })
  823. return
  824. }
  825. if (this.selectedOptions1.length <= 0) {
  826. this.$message({
  827. message: '终到地不能为空!',
  828. type: 'warning',
  829. })
  830. return
  831. }
  832. if (!this.deptBudgetList.endDetailedAddress) {
  833. this.$message({
  834. message: '终到地详细地址不能为空!',
  835. type: 'warning',
  836. })
  837. return
  838. }
  839. if (this.checkList.length <= 0) {
  840. this.$message({
  841. message: '运输方式多选框不能为空!',
  842. type: 'warning',
  843. })
  844. return
  845. }
  846. for (var i = 0; i < this.deptBudgetList.tranProcessInfoList.length; i++) {
  847. this.deptBudgetList.tranProcessInfoList[i].processNo =
  848. this.deptBudgetList.taskNo + (i + 1)
  849. if (
  850. new Date(
  851. this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart
  852. ).getTime() >
  853. new Date(
  854. this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd
  855. ).getTime()
  856. ) {
  857. this.$message({
  858. message: '发货日期不能大于最晚到货日期!',
  859. type: 'warning',
  860. })
  861. return
  862. }
  863. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart) {
  864. this.$message({
  865. message: '发货日期不能为空!',
  866. type: 'warning',
  867. })
  868. return
  869. }
  870. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd) {
  871. this.$message({
  872. message: '最晚到货日期不能为空!',
  873. type: 'warning',
  874. })
  875. return
  876. }
  877. if (!this.deptBudgetList.tranProcessInfoList[i].weight) {
  878. this.$message({
  879. message: '重量不能为空!',
  880. type: 'warning',
  881. })
  882. return
  883. }
  884. if (!this.deptBudgetList.tranProcessInfoList[i].sender) {
  885. this.$message({
  886. message: '发货人不能为空!',
  887. type: 'warning',
  888. })
  889. return
  890. }
  891. if (!this.deptBudgetList.tranProcessInfoList[i].senderPhone) {
  892. this.$message({
  893. message: '发货人电话不能为空!',
  894. type: 'warning',
  895. })
  896. return
  897. }
  898. if (!this.deptBudgetList.tranProcessInfoList[i].receiver) {
  899. this.$message({
  900. message: '收货人不能为空!',
  901. type: 'warning',
  902. })
  903. return
  904. }
  905. if (!this.deptBudgetList.tranProcessInfoList[i].receiverPhone) {
  906. this.$message({
  907. message: '收货人电话不能为空!',
  908. type: 'warning',
  909. })
  910. return
  911. }
  912. if (
  913. !this.deptBudgetList.tranProcessInfoList[i].receiveDetailedAddress
  914. ) {
  915. this.$message({
  916. message: '收获详细地址不能为空!',
  917. type: 'warning',
  918. })
  919. return
  920. }
  921. if (!this.deptBudgetList.tranProcessInfoList[i].sendDetailedAddress) {
  922. this.$message({
  923. message: '发货详细地址不能为空!',
  924. type: 'warning',
  925. })
  926. return
  927. }
  928. }
  929. this.$confirm(`运输任务提交成功后将派发到物流部门,是否确定提交?`, {
  930. confirmButtonText: '确定',
  931. cancelButtonText: '取消',
  932. type: 'warning',
  933. })
  934. .then(() => {
  935. this.$refs.deptBudgetList.validate((valid) => {
  936. if (valid) {
  937. this.deptBudgetList.compId =
  938. sessionStorage.getItem('ws-pf_compId')
  939. this.deptBudgetList.tranType = this.checkList.toString()
  940. this.deptBudgetList.startPrivate =
  941. CodeToText[this.selectedOptions[0]]
  942. this.deptBudgetList.startCity =
  943. CodeToText[this.selectedOptions[1]]
  944. this.deptBudgetList.startArea =
  945. CodeToText[this.selectedOptions[2]]
  946. this.deptBudgetList.tranProcessInfoList[0].sendPrivate =
  947. CodeToText[this.selectedOptions[0]]
  948. this.deptBudgetList.tranProcessInfoList[0].sendCity =
  949. CodeToText[this.selectedOptions[1]]
  950. this.deptBudgetList.tranProcessInfoList[0].sendArea =
  951. CodeToText[this.selectedOptions[2]]
  952. if (this.endflag) {
  953. this.deptBudgetList.tranProcessInfoList[
  954. this.deptBudgetList.tranProcessInfoList.length - 1
  955. ].receivePrivate = CodeToText[this.selectedOptions1[0]]
  956. this.deptBudgetList.tranProcessInfoList[
  957. this.deptBudgetList.tranProcessInfoList.length - 1
  958. ].receiveCity = CodeToText[this.selectedOptions1[1]]
  959. this.deptBudgetList.tranProcessInfoList[
  960. this.deptBudgetList.tranProcessInfoList.length - 1
  961. ].receiveArea = CodeToText[this.selectedOptions1[2]]
  962. }
  963. for (
  964. var i = 0;
  965. i < this.deptBudgetList.tranProcessInfoList.length;
  966. i++
  967. ) {
  968. this.deptBudgetList.tranProcessInfoList[i].sort = i
  969. }
  970. addtrantask(this.deptBudgetList)
  971. .toPromise()
  972. .then((response) => {
  973. this.$message.success('添加成功')
  974. this.deptBudgetList = {
  975. taskNo: '',
  976. totalStorage: 0,
  977. goodsName: '玉米',
  978. goodsNameKey: 1,
  979. warehouseType: '1',
  980. tranProcessInfoList: [
  981. {
  982. processNo: '',
  983. tranType: '汽运',
  984. deliveryDateStart: '',
  985. deliveryDateEnd: '',
  986. weight: '',
  987. selectedOptions: [],
  988. selectedOptions1: [],
  989. sendPrivate: '',
  990. sendCity: '',
  991. sendArea: '',
  992. receivePrivate: '',
  993. receiveCity: '',
  994. receiveArea: '',
  995. sendDetailedAddress: '',
  996. receiveDetailedAddress: '',
  997. sender: '',
  998. receiver: '',
  999. senderPhone: '',
  1000. receiverPhone: '',
  1001. contractNo: '',
  1002. receiveWarehouse: '',
  1003. },
  1004. ],
  1005. }
  1006. this.$router.push({ path: 'tranManagementTransport' })
  1007. })
  1008. } else {
  1009. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1010. return false
  1011. }
  1012. })
  1013. })
  1014. .catch(() => {
  1015. return false
  1016. })
  1017. },
  1018. resetForm(deptBudgetList) {
  1019. this.$refs[deptBudgetList].resetFields()
  1020. },
  1021. },
  1022. }
  1023. </script>
  1024. <style lang="scss" scoped>
  1025. .position {
  1026. position: relative;
  1027. border: 1px solid #5473e8;
  1028. border-radius: 4px;
  1029. margin-top: 20px;
  1030. background: #f6f7fc;
  1031. border-left: 5px solid #5473e8;
  1032. }
  1033. /deep/.position .ws-info-table .el-form-item {
  1034. width: 25%;
  1035. height: 50px;
  1036. }
  1037. /deep/.position .el-select,
  1038. /deep/.el-select {
  1039. width: 100%;
  1040. }
  1041. /deep/.position .ws-info-table .el-form-item .el-form-item__label,
  1042. /deep/.position .ws-info-table .el-form-item .el-form-item__content {
  1043. background: #f6f7fc;
  1044. font-size: 14px;
  1045. color: #8890b1;
  1046. }
  1047. .typeselect {
  1048. width: 42%;
  1049. margin-left: 32px;
  1050. }
  1051. .del,
  1052. .add {
  1053. cursor: pointer;
  1054. margin-left: 10px;
  1055. }
  1056. .el-checkbox-group {
  1057. font-size: 0;
  1058. float: right;
  1059. margin-left: 25px;
  1060. }
  1061. .check-box {
  1062. float: left;
  1063. font-size: 14px;
  1064. color: #8890b1;
  1065. }
  1066. .el-checkbox__label {
  1067. color: #8890b1;
  1068. }
  1069. .el-form {
  1070. padding: 0 10%;
  1071. }
  1072. .ws-info-table {
  1073. border: none;
  1074. }
  1075. /deep/.ws-info-table .el-form-item {
  1076. border-right: 1px solid #cdd2dc;
  1077. border-bottom: 1px solid #cdd2dc;
  1078. }
  1079. .readonly {
  1080. position: relative;
  1081. }
  1082. .title {
  1083. position: relative;
  1084. }
  1085. .title::before {
  1086. content: '';
  1087. display: inline-block;
  1088. width: 5px;
  1089. height: 30px;
  1090. background: #5473e8;
  1091. position: absolute;
  1092. left: 0;
  1093. }
  1094. //去边框
  1095. /deep/.el-form-item {
  1096. border-right: 0px;
  1097. border-bottom: 0px;
  1098. }
  1099. .el-form {
  1100. margin-top: 50px;
  1101. }
  1102. .endflag {
  1103. vertical-align: top;
  1104. }
  1105. .el-col {
  1106. background: #f6f7fc;
  1107. }
  1108. .bg-left {
  1109. padding-left: 30px;
  1110. }
  1111. .bg-right {
  1112. padding-right: 10px;
  1113. text-align: right;
  1114. }
  1115. .bg-bottom {
  1116. margin: 15px 0px;
  1117. }
  1118. .el-radio,
  1119. .el-radio__input {
  1120. margin-top: 11px;
  1121. margin-left: 11px;
  1122. width: 93px;
  1123. }
  1124. .driver {
  1125. margin-top: 10px;
  1126. font-weight: bold;
  1127. margin-left: 20px;
  1128. color: #5473e8;
  1129. font-size: 16px;
  1130. }
  1131. /deep/.nei {
  1132. .ws-info-table {
  1133. border: none;
  1134. }
  1135. .el-form-item {
  1136. width: 33.3333%;
  1137. border: none;
  1138. .el-form-item__label {
  1139. background: transparent;
  1140. border: none;
  1141. }
  1142. .el-form-item__content {
  1143. border: none;
  1144. }
  1145. }
  1146. }
  1147. /deep/.el-table--border:after,
  1148. /deep/.el-table--group:after,
  1149. /deep/.el-table:before {
  1150. background: transparent;
  1151. }
  1152. //输入框标题
  1153. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1154. background: #ffffff;
  1155. width: min-content;
  1156. font-size: 14px;
  1157. color: #8890b1;
  1158. }
  1159. //表单子项
  1160. /deep/.ws-info-table .el-form-item {
  1161. width: 20%;
  1162. border: none;
  1163. height: 50px;
  1164. }
  1165. //输入框
  1166. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1167. border: none;
  1168. font-size: 14px;
  1169. color: #8890b1;
  1170. }
  1171. /deep/ .el-input--small .el-input__inner {
  1172. font-size: 14px;
  1173. color: #8890b1;
  1174. }
  1175. .el-form-item.start-address.el-form-item--small {
  1176. width: 31.9%;
  1177. }
  1178. .el-cascader {
  1179. width: 100%;
  1180. }
  1181. .el-form {
  1182. height: 73vh;
  1183. overflow: scroll;
  1184. }
  1185. </style>