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