tranManagementTransportAdd.vue 33 KB

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