tranManagementTransportAdd.vue 29 KB

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