tranManagementTransportEdit.vue 39 KB

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