tranManagementTransportAdd.vue 30 KB

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