tranManagementTransportAdd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  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. v-model="deptBudgetList.receiveWarehouse"
  137. :disabled="warehouse"
  138. placeholder="请输入收货库点"
  139. style="width: 100%"
  140. >
  141. <el-option
  142. v-for="item in warehouseList"
  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="汽运"></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. processNo: '',
  367. tranType: '汽运',
  368. tranTypeKey: '1',
  369. deliveryDateStart: '',
  370. deliveryDateEnd: '',
  371. weight: '',
  372. selectedOptions: [],
  373. selectedOptions1: [],
  374. sendPrivate: '',
  375. sendCity: '',
  376. sendArea: '',
  377. receivePrivate: '',
  378. receiveCity: '',
  379. receiveArea: '',
  380. sendDetailedAddress: '',
  381. receiveDetailedAddress: '',
  382. sender: '',
  383. receiver: '',
  384. senderPhone: '',
  385. receiverPhone: '',
  386. endFlag: '0'
  387. }
  388. ]
  389. },
  390. radio: '1',
  391. options_: regionData,
  392. heightData: '600px',
  393. zoom: 7,
  394. endflag:false,
  395. selectedOptions: [],
  396. selectedOptions1: [],
  397. window: '',
  398. district: null,
  399. goodnameList: [],
  400. listDate: { country: '中国', level: 'country', city: '' },
  401. citylist: [],
  402. taskType: [],
  403. taskwayList: [],
  404. contractNoList: [],
  405. compId: sessionStorage.getItem('ws-pf_compId'),
  406. mainReportAdd: {},
  407. appendixIdsAdd: '',
  408. warehouseList: [],
  409. size: 10,
  410. value1: '',
  411. unitList: [],
  412. name: '',
  413. age: ''
  414. }
  415. },
  416. activated() {
  417. this.loaddata()
  418. this.showType = this.isShow
  419. },
  420. computed: {
  421. // weight:function(){
  422. // var maxStorage = 0
  423. // for(var i =0 ; i<this.deptBudgetList.tranProcessInfoList.length;i++){
  424. // maxStorage += Number(this.deptBudgetList.tranProcessInfoList[i].weight)
  425. // }
  426. // return maxStorage
  427. // },
  428. warehouse: function() {
  429. if (
  430. this.deptBudgetList.taskType == '销售出库' ||
  431. this.deptBudgetList.taskType == '贸易服务出库' ||
  432. this.deptBudgetList.taskType == '暂存出库'
  433. ) {
  434. return true
  435. } else {
  436. return false
  437. }
  438. }
  439. },
  440. methods: {
  441. sendWarehousechange(e){
  442. for (let i = 0; i < this.warehouseList.length; i++) {
  443. if(this.warehouseList[i].warehouseName==e){
  444. var tmp=[]
  445. tmp[0]=TextToCode[this.warehouseList[i].warehousePrivate].code
  446. tmp[1]=TextToCode[this.warehouseList[i].warehousePrivate][this.warehouseList[i].warehouseCity].code
  447. tmp[2]=TextToCode[this.warehouseList[i].warehousePrivate][this.warehouseList[i].warehouseCity][this.warehouseList[i].warehouseArea].code
  448. this.selectedOptions=tmp
  449. this.deptBudgetList.tranProcessInfoList[0].selectedOptions=tmp
  450. this.deptBudgetList.startDetailedAddress=this.warehouseList[i].detailedAddress
  451. }
  452. }
  453. },
  454. warehouseTypechange(){
  455. getwarehousename({
  456. compId: this.compId,
  457. warehouseType: this.deptBudgetList.warehouseType,
  458. })
  459. .toPromise()
  460. .then((response) => {
  461. this.warehouseList = response
  462. })
  463. },
  464. weightchange(e){
  465. this.deptBudgetList.tranProcessInfoList[0].weight=e
  466. },
  467. engflagchange(e){
  468. this.endflag=e
  469. },
  470. // 获取当前年月日
  471. getdate() {
  472. var date = new Date()
  473. var year = date.getFullYear() //获取完整的年份(4位)
  474. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  475. var datetime = date.getDate() //获取当前日(1-31)
  476. if (mouth < 10) {
  477. mouth = '0' + mouth
  478. }
  479. if (datetime < 10) {
  480. datetime = '0' + datetime
  481. }
  482. return year + mouth + datetime
  483. },
  484. // 随机验证码
  485. verifyinit() {
  486. var arr = []
  487. for (var i = 48; i < 123; i++) {
  488. if (i > 57 && i < 65) continue
  489. if (i > 90 && i < 97) continue
  490. arr.push(String.fromCharCode(i))
  491. }
  492. arr.sort(function() {
  493. return Math.random() - 0.5
  494. })
  495. arr.length = 4
  496. return arr.join('')
  497. },
  498. loaddata() {
  499. this.deptBudgetList.taskNo = 'YS' + this.getdate() + this.verifyinit()
  500. this.deptBudgetList.tranProcessInfoList[0].processNo=this.deptBudgetList.taskNo+'-1'
  501. // 货名
  502. packList({ constId: 'CON2' })
  503. .toPromise()
  504. .then(response => {
  505. this.goodnameList = response
  506. })
  507. // 任务类型
  508. packList({ constId: 'TRAN3' })
  509. .toPromise()
  510. .then(response => {
  511. this.taskType = response
  512. })
  513. // 运输方式
  514. packList({ constId: 'TRAN6' })
  515. .toPromise()
  516. .then(response => {
  517. this.taskwayList = response
  518. })
  519. getwarehousename({
  520. compId: this.compId,
  521. warehouseType: this.deptBudgetList.warehouseType
  522. })
  523. .toPromise()
  524. .then(response => {
  525. this.warehouseList = response
  526. })
  527. xialaNo({
  528. compId: this.compId
  529. })
  530. .toPromise()
  531. .then(response => {
  532. this.contractNoList = response
  533. })
  534. },
  535. confirmPositioncity() {
  536. this.listDate.level = 'city'
  537. this.listDate.country = this.name
  538. },
  539. // 关闭 dialog时 处理文件url 初始化upload组件
  540. handleClose() {
  541. this.dialogViewSpareMoney = false
  542. },
  543. add(index) {
  544. console.log(index)
  545. this.deptBudgetList.tranProcessInfoList.push({
  546. processNo: this.deptBudgetList.taskNo+'-'+(index+2),
  547. tranType: '汽运',
  548. tranTypeKey: '1',
  549. deliveryDateStart: '',
  550. deliveryDateEnd: '',
  551. weight: this.deptBudgetList.tranProcessInfoList[this.deptBudgetList.tranProcessInfoList.length-1].weight,
  552. selectedOptions: [],
  553. selectedOptions1: [],
  554. sendPrivate: '',
  555. sendCity: '',
  556. sendArea: '',
  557. receivePrivate: '',
  558. receiveCity: '',
  559. receiveArea: '',
  560. sendDetailedAddress: '',
  561. receiveDetailedAddress: '',
  562. sender: '',
  563. receiver: '',
  564. senderPhone: '',
  565. receiverPhone: '',
  566. endFlag: '0'
  567. })
  568. },
  569. del(index) {
  570. if (this.deptBudgetList.tranProcessInfoList.length > 1) {
  571. this.deptBudgetList.tranProcessInfoList.splice(index, 1)
  572. }
  573. },
  574. handleChange(value) {
  575. this.selectedOptions = value
  576. this.deptBudgetList.startPrivate = CodeToText[value[0]]
  577. this.deptBudgetList.startCity = CodeToText[value[1]]
  578. this.deptBudgetList.startArea = CodeToText[value[2]]
  579. },
  580. handleChange1(value) {
  581. this.selectedOptions1 = value
  582. this.deptBudgetList.endPrivate = CodeToText[value[0]]
  583. this.deptBudgetList.endCity = CodeToText[value[1]]
  584. this.deptBudgetList.endArea = CodeToText[value[2]]
  585. },
  586. handleChange3(value, index) {
  587. this.deptBudgetList.tranProcessInfoList[index].sendPrivate =
  588. CodeToText[value[0]]
  589. this.deptBudgetList.tranProcessInfoList[index].sendCity =
  590. CodeToText[value[1]]
  591. this.deptBudgetList.tranProcessInfoList[index].sendArea =
  592. CodeToText[value[2]]
  593. },
  594. handleChange4(value, index) {
  595. this.deptBudgetList.tranProcessInfoList[index].receivePrivate =
  596. CodeToText[value[0]]
  597. this.deptBudgetList.tranProcessInfoList[index].receiveCity =
  598. CodeToText[value[1]]
  599. this.deptBudgetList.tranProcessInfoList[index].receiveArea =
  600. CodeToText[value[2]]
  601. },
  602. returnsales() {
  603. this.$router.push({ path: 'tranManagementTransport' })
  604. this.deptBudgetList = {
  605. taskNo: '',
  606. totalStorage: 0,
  607. goodsName: '玉米',
  608. goodsNameKey: 1,
  609. warehouseType: '1',
  610. tranProcessInfoList: [
  611. {
  612. processNo: '',
  613. tranType: '汽运',
  614. deliveryDateStart: '',
  615. deliveryDateEnd: '',
  616. weight: '',
  617. selectedOptions: [],
  618. selectedOptions1: [],
  619. sendPrivate: '',
  620. sendCity: '',
  621. sendArea: '',
  622. receivePrivate: '',
  623. receiveCity: '',
  624. receiveArea: '',
  625. sendDetailedAddress: '',
  626. receiveDetailedAddress: '',
  627. sender: '',
  628. receiver: '',
  629. senderPhone: '',
  630. receiverPhone: '',
  631. },
  632. ],
  633. }
  634. },
  635. selecttaskType(e) {
  636. for (var i = 0; i < this.taskType.length; i++) {
  637. if (this.taskType[i].constValue == e) {
  638. this.deptBudgetList.taskTypeKey = this.taskType[i].constKey
  639. }
  640. }
  641. },
  642. selecttaskwayList(e, index) {
  643. for (var i = 0; i < this.taskwayList.length; i++) {
  644. if (this.taskwayList[i].constValue == e) {
  645. this.deptBudgetList.tranProcessInfoList[
  646. index
  647. ].tranTypeKey = this.taskwayList[i].constKey
  648. }
  649. }
  650. },
  651. selectgoodsname(e) {
  652. for (var i = 0; i < this.goodnameList.length; i++) {
  653. if (this.goodnameList[i].constValue == e) {
  654. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  655. }
  656. }
  657. },
  658. onChange(files) {
  659. this.fileNum = files
  660. this.$refs.upload.handleSaveBill().then(res => {
  661. console.log(files)
  662. })
  663. },
  664. submit() {
  665. this.$refs.deptBudgetList.validate(valid => {
  666. if (valid) {
  667. for (
  668. var i = 0;
  669. i < this.deptBudgetList.tranProcessInfoList.length;
  670. i++
  671. ) {
  672. this.deptBudgetList.tranProcessInfoList[i].processNo =
  673. this.deptBudgetList.taskNo + (i + 1)
  674. if (
  675. new Date(
  676. this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart
  677. ).getTime() >
  678. new Date(
  679. this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd
  680. ).getTime()
  681. ) {
  682. this.$message({
  683. message: '发货日期不能大于最晚到货日期',
  684. type: 'warning'
  685. })
  686. return
  687. }
  688. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart) {
  689. this.$message({
  690. message:'发货日期不能为空',
  691. type:'warning'
  692. })
  693. return
  694. }
  695. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd) {
  696. this.$message({
  697. message:'最晚到货日期不能为空',
  698. type:'warning'
  699. })
  700. return
  701. }
  702. if (!this.deptBudgetList.tranProcessInfoList[i].weight) {
  703. this.$message({
  704. message: '重量不能为空',
  705. type: 'warning'
  706. })
  707. return
  708. }
  709. if (!this.deptBudgetList.tranProcessInfoList[i].sender) {
  710. this.$message({
  711. message: '发货人不能为空',
  712. type: 'warning'
  713. })
  714. return
  715. }
  716. if (!this.deptBudgetList.tranProcessInfoList[i].senderPhone) {
  717. this.$message({
  718. message: '发货人电话不能为空',
  719. type: 'warning'
  720. })
  721. return
  722. }
  723. if (!this.deptBudgetList.tranProcessInfoList[i].receiver) {
  724. this.$message({
  725. message: '收货人不能为空',
  726. type: 'warning'
  727. })
  728. return
  729. }
  730. if (!this.deptBudgetList.tranProcessInfoList[i].receiverPhone) {
  731. this.$message({
  732. message: '收货人电话不能为空',
  733. type: 'warning'
  734. })
  735. return
  736. }
  737. if (
  738. !this.deptBudgetList.tranProcessInfoList[i].receiveDetailedAddress
  739. ) {
  740. this.$message({
  741. message: '收获详细地址不能为空',
  742. type: 'warning'
  743. })
  744. return
  745. }
  746. if (
  747. !this.deptBudgetList.tranProcessInfoList[i].sendDetailedAddress
  748. ) {
  749. this.$message({
  750. message: '发货详细地址不能为空',
  751. type: 'warning'
  752. })
  753. return
  754. }
  755. }
  756. this.deptBudgetList.compId = sessionStorage.getItem('ws-pf_compId')
  757. this.deptBudgetList.tranType = this.checkList.toString()
  758. addtrantask(this.deptBudgetList)
  759. .toPromise()
  760. .then(response => {
  761. this.$message.success('添加成功')
  762. this.deptBudgetList = {
  763. taskNo: '',
  764. totalStorage: 0,
  765. goodsName: '玉米',
  766. goodsNameKey: 1,
  767. warehouseType: '1',
  768. tranProcessInfoList: [
  769. {
  770. processNo: '',
  771. tranType: '汽运',
  772. deliveryDateStart: '',
  773. deliveryDateEnd: '',
  774. weight: '',
  775. selectedOptions: [],
  776. selectedOptions1: [],
  777. sendPrivate: '',
  778. sendCity: '',
  779. sendArea: '',
  780. receivePrivate: '',
  781. receiveCity: '',
  782. receiveArea: '',
  783. sendDetailedAddress: '',
  784. receiveDetailedAddress: '',
  785. sender: '',
  786. receiver: '',
  787. senderPhone: '',
  788. receiverPhone: '',
  789. contractNo:'',
  790. receiveWarehouse:''
  791. }
  792. ]
  793. }
  794. this.$router.push({ path: 'tranManagementTransport' })
  795. })
  796. } else {
  797. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  798. return false
  799. }
  800. })
  801. },
  802. resetForm(deptBudgetList) {
  803. this.$refs[deptBudgetList].resetFields()
  804. }
  805. }
  806. }
  807. </script>
  808. <style lang="scss" scoped>
  809. .position {
  810. position: relative;
  811. border: 1px solid #5473e8;
  812. border-radius: 4px;
  813. margin-top: 20px;
  814. background: #f6f7fc;
  815. border-left: 5px solid #5473e8;
  816. }
  817. /deep/.position .ws-info-table .el-form-item {
  818. width: 25%;
  819. height: 50px;
  820. }
  821. /deep/.position .el-select {
  822. width: 100%;
  823. }
  824. /deep/.position .ws-info-table .el-form-item .el-form-item__label,
  825. /deep/.position .ws-info-table .el-form-item .el-form-item__content {
  826. background: #f6f7fc;
  827. font-size: 14px;
  828. color: #8890b1;
  829. }
  830. .typeselect{
  831. width:42%;
  832. margin-left:32px;
  833. }
  834. .del,
  835. .add {
  836. cursor: pointer;
  837. margin-left: 10px;
  838. }
  839. .el-checkbox-group {
  840. font-size: 0;
  841. float: right;
  842. margin-left: 25px;
  843. }
  844. .check-box {
  845. float: left;
  846. font-size: 14px;
  847. color: #8890b1;
  848. }
  849. .el-checkbox__label {
  850. color: #8890b1;
  851. }
  852. .el-form {
  853. padding: 0 10%;
  854. }
  855. .ws-info-table {
  856. border: none;
  857. }
  858. /deep/.ws-info-table .el-form-item {
  859. border-right: 1px solid #cdd2dc;
  860. border-bottom: 1px solid #cdd2dc;
  861. }
  862. .readonly {
  863. position: relative;
  864. }
  865. .title {
  866. position: relative;
  867. }
  868. .title::before {
  869. content: '';
  870. display: inline-block;
  871. width: 5px;
  872. height: 30px;
  873. background: #5473e8;
  874. position: absolute;
  875. left: 0;
  876. }
  877. //去边框
  878. /deep/.el-form-item {
  879. border-right: 0px;
  880. border-bottom: 0px;
  881. }
  882. .el-form {
  883. margin-top: 50px;
  884. }
  885. .endflag{
  886. vertical-align: top;
  887. }
  888. .el-col {
  889. background: #f6f7fc;
  890. }
  891. .bg-left {
  892. padding-left: 30px;
  893. }
  894. .bg-right {
  895. padding-right: 10px;
  896. text-align: right;
  897. }
  898. .bg-bottom {
  899. margin: 15px 0px;
  900. }
  901. .el-radio,
  902. .el-radio__input {
  903. margin-top: 11px;
  904. margin-left: 11px;
  905. width: 93px;
  906. }
  907. .driver {
  908. margin-top: 10px;
  909. font-weight: bold;
  910. margin-left: 20px;
  911. color: #5473e8;
  912. font-size: 16px;
  913. }
  914. /deep/.nei {
  915. .ws-info-table {
  916. border: none;
  917. }
  918. .el-form-item {
  919. width: 33.3333%;
  920. border: none;
  921. .el-form-item__label {
  922. background: transparent;
  923. border: none;
  924. }
  925. .el-form-item__content {
  926. border: none;
  927. }
  928. }
  929. }
  930. /deep/.el-table--border:after, /deep/.el-table--group:after, /deep/.el-table:before {
  931. background:transparent;
  932. }
  933. //输入框标题
  934. /deep/.ws-info-table .el-form-item .el-form-item__label {
  935. background: #ffffff;
  936. width: min-content;
  937. font-size: 14px;
  938. color: #8890b1;
  939. }
  940. //表单子项
  941. /deep/.ws-info-table .el-form-item {
  942. width: 20%;
  943. border: none;
  944. height: 50px;
  945. }
  946. //输入框
  947. /deep/.ws-info-table .el-form-item .el-form-item__content {
  948. border: none;
  949. font-size: 14px;
  950. color: #8890b1;
  951. }
  952. /deep/ .el-input--small .el-input__inner {
  953. font-size: 14px;
  954. color: #8890b1;
  955. }
  956. .el-form-item.start-address.el-form-item--small {
  957. width: 31.9%;
  958. }
  959. .el-cascader {
  960. width: 100%;
  961. }
  962. .el-form{
  963. height: 73vh;
  964. overflow: scroll;
  965. }
  966. </style>