tranManagementTransportAdd.vue 30 KB

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