tranManagementTransportEdit.vue 38 KB

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