tranManagementTransportAdd.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  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. class="bg-right start-address"
  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="汽运"></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. }
  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. },
  486. // 获取当前年月日
  487. getdate() {
  488. var date = new Date()
  489. var year = date.getFullYear() //获取完整的年份(4位)
  490. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  491. var datetime = date.getDate() //获取当前日(1-31)
  492. if (mouth < 10) {
  493. mouth = '0' + mouth
  494. }
  495. if (datetime < 10) {
  496. datetime = '0' + datetime
  497. }
  498. return year + mouth + datetime
  499. },
  500. // 随机验证码
  501. verifyinit() {
  502. var arr = []
  503. for (var i = 48; i < 123; i++) {
  504. if (i > 57 && i < 65) continue
  505. if (i > 90 && i < 97) continue
  506. arr.push(String.fromCharCode(i))
  507. }
  508. arr.sort(function() {
  509. return Math.random() - 0.5
  510. })
  511. arr.length = 4
  512. return arr.join('')
  513. },
  514. loaddata() {
  515. this.deptBudgetList.taskNo = 'YS' + this.getdate() + this.verifyinit()
  516. this.deptBudgetList.tranProcessInfoList[0].processNo=this.deptBudgetList.taskNo+'-1'
  517. // 货名
  518. packList({ constId: 'CON2' })
  519. .toPromise()
  520. .then(response => {
  521. this.goodnameList = response
  522. })
  523. // 任务类型
  524. packList({ constId: 'TRAN3' })
  525. .toPromise()
  526. .then(response => {
  527. this.taskType = response
  528. })
  529. // 运输方式
  530. packList({ constId: 'TRAN6' })
  531. .toPromise()
  532. .then(response => {
  533. this.taskwayList = response
  534. })
  535. getwarehousename({
  536. compId: this.compId,
  537. warehouseType: this.deptBudgetList.warehouseType
  538. })
  539. .toPromise()
  540. .then(response => {
  541. this.warehouseList = response
  542. })
  543. getwarehousename({
  544. compId: this.compId,
  545. warehouseType: 1
  546. })
  547. .toPromise()
  548. .then(response => {
  549. this.warehouseList1 = response
  550. })
  551. xialaNo({
  552. compId: this.compId
  553. })
  554. .toPromise()
  555. .then(response => {
  556. this.contractNoList = response
  557. })
  558. },
  559. confirmPositioncity() {
  560. this.listDate.level = 'city'
  561. this.listDate.country = this.name
  562. },
  563. // 关闭 dialog时 处理文件url 初始化upload组件
  564. handleClose() {
  565. this.dialogViewSpareMoney = false
  566. },
  567. add(index) {
  568. console.log(index)
  569. this.deptBudgetList.tranProcessInfoList.push({
  570. processNo: this.deptBudgetList.taskNo+'-'+(index+2),
  571. tranType: '汽运',
  572. tranTypeKey: '1',
  573. deliveryDateStart: '',
  574. deliveryDateEnd: '',
  575. weight: this.deptBudgetList.tranProcessInfoList[this.deptBudgetList.tranProcessInfoList.length-1].weight,
  576. selectedOptions: [],
  577. selectedOptions1: [],
  578. sendPrivate: '',
  579. sendCity: '',
  580. sendArea: '',
  581. receivePrivate: '',
  582. receiveCity: '',
  583. receiveArea: '',
  584. sendDetailedAddress: '',
  585. receiveDetailedAddress: '',
  586. sender: '',
  587. receiver: '',
  588. senderPhone: '',
  589. receiverPhone: '',
  590. endFlag: '0'
  591. })
  592. },
  593. del(index) {
  594. if (this.deptBudgetList.tranProcessInfoList.length > 1) {
  595. this.deptBudgetList.tranProcessInfoList.splice(index, 1)
  596. }
  597. },
  598. handleChange(value) {
  599. this.selectedOptions = value
  600. this.deptBudgetList.startPrivate = CodeToText[value[0]]
  601. this.deptBudgetList.startCity = CodeToText[value[1]]
  602. this.deptBudgetList.startArea = CodeToText[value[2]]
  603. },
  604. handleChange1(value) {
  605. this.selectedOptions1 = value
  606. this.deptBudgetList.endPrivate = CodeToText[value[0]]
  607. this.deptBudgetList.endCity = CodeToText[value[1]]
  608. this.deptBudgetList.endArea = CodeToText[value[2]]
  609. },
  610. handleChange3(value, index) {
  611. this.deptBudgetList.tranProcessInfoList[index].sendPrivate =
  612. CodeToText[value[0]]
  613. this.deptBudgetList.tranProcessInfoList[index].sendCity =
  614. CodeToText[value[1]]
  615. this.deptBudgetList.tranProcessInfoList[index].sendArea =
  616. CodeToText[value[2]]
  617. },
  618. handleChange4(value, index) {
  619. this.deptBudgetList.tranProcessInfoList[index].receivePrivate =
  620. CodeToText[value[0]]
  621. this.deptBudgetList.tranProcessInfoList[index].receiveCity =
  622. CodeToText[value[1]]
  623. this.deptBudgetList.tranProcessInfoList[index].receiveArea =
  624. CodeToText[value[2]]
  625. },
  626. returnsales() {
  627. this.$router.push({ path: 'tranManagementTransport' })
  628. this.deptBudgetList = {
  629. taskNo: '',
  630. totalStorage: 0,
  631. goodsName: '玉米',
  632. goodsNameKey: 1,
  633. warehouseType: '1',
  634. tranProcessInfoList: [
  635. {
  636. processNo: '',
  637. tranType: '汽运',
  638. deliveryDateStart: '',
  639. deliveryDateEnd: '',
  640. weight: '',
  641. selectedOptions: [],
  642. selectedOptions1: [],
  643. sendPrivate: '',
  644. sendCity: '',
  645. sendArea: '',
  646. receivePrivate: '',
  647. receiveCity: '',
  648. receiveArea: '',
  649. sendDetailedAddress: '',
  650. receiveDetailedAddress: '',
  651. sender: '',
  652. receiver: '',
  653. senderPhone: '',
  654. receiverPhone: '',
  655. },
  656. ],
  657. }
  658. },
  659. selecttaskType(e) {
  660. for (var i = 0; i < this.taskType.length; i++) {
  661. if (this.taskType[i].constValue == e) {
  662. this.deptBudgetList.taskTypeKey = this.taskType[i].constKey
  663. }
  664. }
  665. },
  666. selecttaskwayList(e, index) {
  667. for (var i = 0; i < this.taskwayList.length; i++) {
  668. if (this.taskwayList[i].constValue == e) {
  669. this.deptBudgetList.tranProcessInfoList[
  670. index
  671. ].tranTypeKey = this.taskwayList[i].constKey
  672. }
  673. }
  674. },
  675. selectgoodsname(e) {
  676. for (var i = 0; i < this.goodnameList.length; i++) {
  677. if (this.goodnameList[i].constValue == e) {
  678. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  679. }
  680. }
  681. },
  682. onChange(files) {
  683. this.fileNum = files
  684. this.$refs.upload.handleSaveBill().then(res => {
  685. console.log(files)
  686. })
  687. },
  688. submit() {
  689. this.$refs.deptBudgetList.validate(valid => {
  690. if (valid) {
  691. for (
  692. var i = 0;
  693. i < this.deptBudgetList.tranProcessInfoList.length;
  694. i++
  695. ) {
  696. this.deptBudgetList.tranProcessInfoList[i].processNo =
  697. this.deptBudgetList.taskNo + (i + 1)
  698. if (
  699. new Date(
  700. this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart
  701. ).getTime() >
  702. new Date(
  703. this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd
  704. ).getTime()
  705. ) {
  706. this.$message({
  707. message: '发货日期不能大于最晚到货日期',
  708. type: 'warning'
  709. })
  710. return
  711. }
  712. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart) {
  713. this.$message({
  714. message:'发货日期不能为空',
  715. type:'warning'
  716. })
  717. return
  718. }
  719. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd) {
  720. this.$message({
  721. message:'最晚到货日期不能为空',
  722. type:'warning'
  723. })
  724. return
  725. }
  726. if (!this.deptBudgetList.tranProcessInfoList[i].weight) {
  727. this.$message({
  728. message: '重量不能为空',
  729. type: 'warning'
  730. })
  731. return
  732. }
  733. if (!this.deptBudgetList.tranProcessInfoList[i].sender) {
  734. this.$message({
  735. message: '发货人不能为空',
  736. type: 'warning'
  737. })
  738. return
  739. }
  740. if (!this.deptBudgetList.tranProcessInfoList[i].senderPhone) {
  741. this.$message({
  742. message: '发货人电话不能为空',
  743. type: 'warning'
  744. })
  745. return
  746. }
  747. if (!this.deptBudgetList.tranProcessInfoList[i].receiver) {
  748. this.$message({
  749. message: '收货人不能为空',
  750. type: 'warning'
  751. })
  752. return
  753. }
  754. if (!this.deptBudgetList.tranProcessInfoList[i].receiverPhone) {
  755. this.$message({
  756. message: '收货人电话不能为空',
  757. type: 'warning'
  758. })
  759. return
  760. }
  761. if (
  762. !this.deptBudgetList.tranProcessInfoList[i].receiveDetailedAddress
  763. ) {
  764. this.$message({
  765. message: '收获详细地址不能为空',
  766. type: 'warning'
  767. })
  768. return
  769. }
  770. if (
  771. !this.deptBudgetList.tranProcessInfoList[i].sendDetailedAddress
  772. ) {
  773. this.$message({
  774. message: '发货详细地址不能为空',
  775. type: 'warning'
  776. })
  777. return
  778. }
  779. }
  780. this.deptBudgetList.compId = sessionStorage.getItem('ws-pf_compId')
  781. this.deptBudgetList.tranType = this.checkList.toString()
  782. for(var i = 0 ; i < this.deptBudgetList.tranProcessInfoList.length ; i++){
  783. this.deptBudgetList.tranProcessInfoList[i].sort = i
  784. }
  785. console.log(this.deptBudgetList.tranProcessInfoList,"数组111")
  786. addtrantask(this.deptBudgetList)
  787. .toPromise()
  788. .then(response => {
  789. this.$message.success('添加成功')
  790. this.deptBudgetList = {
  791. taskNo: '',
  792. totalStorage: 0,
  793. goodsName: '玉米',
  794. goodsNameKey: 1,
  795. warehouseType: '1',
  796. tranProcessInfoList: [
  797. {
  798. processNo: '',
  799. tranType: '汽运',
  800. deliveryDateStart: '',
  801. deliveryDateEnd: '',
  802. weight: '',
  803. selectedOptions: [],
  804. selectedOptions1: [],
  805. sendPrivate: '',
  806. sendCity: '',
  807. sendArea: '',
  808. receivePrivate: '',
  809. receiveCity: '',
  810. receiveArea: '',
  811. sendDetailedAddress: '',
  812. receiveDetailedAddress: '',
  813. sender: '',
  814. receiver: '',
  815. senderPhone: '',
  816. receiverPhone: '',
  817. contractNo:'',
  818. receiveWarehouse:''
  819. }
  820. ]
  821. }
  822. this.$router.push({ path: 'tranManagementTransport' })
  823. })
  824. } else {
  825. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  826. return false
  827. }
  828. })
  829. },
  830. resetForm(deptBudgetList) {
  831. this.$refs[deptBudgetList].resetFields()
  832. }
  833. }
  834. }
  835. </script>
  836. <style lang="scss" scoped>
  837. .position {
  838. position: relative;
  839. border: 1px solid #5473e8;
  840. border-radius: 4px;
  841. margin-top: 20px;
  842. background: #f6f7fc;
  843. border-left: 5px solid #5473e8;
  844. }
  845. /deep/.position .ws-info-table .el-form-item {
  846. width: 25%;
  847. height: 50px;
  848. }
  849. /deep/.position .el-select, /deep/.el-select {
  850. width: 100%;
  851. }
  852. /deep/.position .ws-info-table .el-form-item .el-form-item__label,
  853. /deep/.position .ws-info-table .el-form-item .el-form-item__content {
  854. background: #f6f7fc;
  855. font-size: 14px;
  856. color: #8890b1;
  857. }
  858. .typeselect{
  859. width:42%;
  860. margin-left:32px;
  861. }
  862. .del,
  863. .add {
  864. cursor: pointer;
  865. margin-left: 10px;
  866. }
  867. .el-checkbox-group {
  868. font-size: 0;
  869. float: right;
  870. margin-left: 25px;
  871. }
  872. .check-box {
  873. float: left;
  874. font-size: 14px;
  875. color: #8890b1;
  876. }
  877. .el-checkbox__label {
  878. color: #8890b1;
  879. }
  880. .el-form {
  881. padding: 0 10%;
  882. }
  883. .ws-info-table {
  884. border: none;
  885. }
  886. /deep/.ws-info-table .el-form-item {
  887. border-right: 1px solid #cdd2dc;
  888. border-bottom: 1px solid #cdd2dc;
  889. }
  890. .readonly {
  891. position: relative;
  892. }
  893. .title {
  894. position: relative;
  895. }
  896. .title::before {
  897. content: '';
  898. display: inline-block;
  899. width: 5px;
  900. height: 30px;
  901. background: #5473e8;
  902. position: absolute;
  903. left: 0;
  904. }
  905. //去边框
  906. /deep/.el-form-item {
  907. border-right: 0px;
  908. border-bottom: 0px;
  909. }
  910. .el-form {
  911. margin-top: 50px;
  912. }
  913. .endflag{
  914. vertical-align: top;
  915. }
  916. .el-col {
  917. background: #f6f7fc;
  918. }
  919. .bg-left {
  920. padding-left: 30px;
  921. }
  922. .bg-right {
  923. padding-right: 10px;
  924. text-align: right;
  925. }
  926. .bg-bottom {
  927. margin: 15px 0px;
  928. }
  929. .el-radio,
  930. .el-radio__input {
  931. margin-top: 11px;
  932. margin-left: 11px;
  933. width: 93px;
  934. }
  935. .driver {
  936. margin-top: 10px;
  937. font-weight: bold;
  938. margin-left: 20px;
  939. color: #5473e8;
  940. font-size: 16px;
  941. }
  942. /deep/.nei {
  943. .ws-info-table {
  944. border: none;
  945. }
  946. .el-form-item {
  947. width: 33.3333%;
  948. border: none;
  949. .el-form-item__label {
  950. background: transparent;
  951. border: none;
  952. }
  953. .el-form-item__content {
  954. border: none;
  955. }
  956. }
  957. }
  958. /deep/.el-table--border:after, /deep/.el-table--group:after, /deep/.el-table:before {
  959. background:transparent;
  960. }
  961. //输入框标题
  962. /deep/.ws-info-table .el-form-item .el-form-item__label {
  963. background: #ffffff;
  964. width: min-content;
  965. font-size: 14px;
  966. color: #8890b1;
  967. }
  968. //表单子项
  969. /deep/.ws-info-table .el-form-item {
  970. width: 20%;
  971. border: none;
  972. height: 50px;
  973. }
  974. //输入框
  975. /deep/.ws-info-table .el-form-item .el-form-item__content {
  976. border: none;
  977. font-size: 14px;
  978. color: #8890b1;
  979. }
  980. /deep/ .el-input--small .el-input__inner {
  981. font-size: 14px;
  982. color: #8890b1;
  983. }
  984. .el-form-item.start-address.el-form-item--small {
  985. width: 31.9%;
  986. }
  987. .el-cascader {
  988. width: 100%;
  989. }
  990. .el-form{
  991. height: 73vh;
  992. overflow: scroll;
  993. }
  994. </style>