tranManagementTransportEdit.vue 40 KB

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