tranManagementTransportAdd.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379
  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
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="returnsales()"
  14. >
  15. <img
  16. width="6"
  17. height="10"
  18. style="vertical-align: bottom; margin-right: 3px"
  19. src="../../../public/img/lujing.png"
  20. alt
  21. />返回
  22. </el-button>
  23. </el-col>
  24. </el-row>
  25. <el-form
  26. ref="deptBudgetList"
  27. :rules="mainReportAdd"
  28. :model="deptBudgetList"
  29. >
  30. <ws-info-table class="el-table">
  31. <el-form-item label="任务编号" span="1" prop="taskNo" class="forlist">
  32. <el-input
  33. v-model="deptBudgetList.taskNo"
  34. placeholder="请输入任务编号"
  35. maxlength="20"
  36. size="small"
  37. disabled
  38. ></el-input>
  39. </el-form-item>
  40. <el-form-item prop="taskType" label="任务类型" span="1">
  41. <el-select
  42. v-model="deptBudgetList.taskType"
  43. placeholder="请输入任务类型"
  44. @change="selecttaskType"
  45. >
  46. <el-option
  47. v-for="item in taskType"
  48. :key="item.constKey"
  49. :label="item.constValue"
  50. :value="item.constValue"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item prop="contractNo" label="合同编号/移库任务编号" span="1">
  55. <el-select
  56. v-model="deptBudgetList.contractNo"
  57. placeholder="请选择编号"
  58. >
  59. <el-option
  60. v-for="item in contractNoList"
  61. :key="item.constKey"
  62. :label="item.contractNo"
  63. :value="item.contractNo"
  64. ></el-option>
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item prop="goodsName" label="货名" span="1">
  68. <el-select
  69. v-model="deptBudgetList.goodsName"
  70. placeholder="请输入货名"
  71. @change="selectgoodsname"
  72. >
  73. <el-option
  74. v-for="item in goodnameList"
  75. :key="item.constKey"
  76. :label="item.constValue"
  77. :value="item.constValue"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item label="重量(吨)" span="1" prop="weight">
  82. <el-input
  83. @input="weightchange"
  84. v-model="deptBudgetList.weight"
  85. placeholder="请输入重量"
  86. maxlength="20"
  87. size="small"
  88. ></el-input>
  89. </el-form-item>
  90. </ws-info-table>
  91. <ws-info-table class="el-table">
  92. <div class="start-address" style="width: 36%">
  93. <el-radio-group
  94. @change="warehouseTypechange"
  95. v-model="deptBudgetList.warehouseType"
  96. >
  97. <el-radio label="1">常用仓库发货</el-radio>
  98. <el-radio label="2">临时仓库发货</el-radio>
  99. </el-radio-group>
  100. <el-select
  101. @change="sendWarehousechange"
  102. v-model="deptBudgetList.sendWarehouse"
  103. placeholder="选择仓库"
  104. class="typeselect"
  105. >
  106. <el-option
  107. v-for="item in warehouseList"
  108. :key="item.constKey"
  109. :label="item.warehouseName"
  110. :value="item.warehouseName"
  111. ></el-option>
  112. </el-select>
  113. </div>
  114. <el-form-item label="始发地" span="1" class="start-address">
  115. <el-cascader
  116. :options="options_"
  117. v-model="selectedOptions"
  118. clearable
  119. size="large"
  120. placeholder="请选择始发地"
  121. @change="handleChange"
  122. />
  123. </el-form-item>
  124. <el-form-item
  125. label="始发地详细地址"
  126. span="1"
  127. prop="startDetailedAddress"
  128. style="width: 31.333%"
  129. >
  130. <el-input
  131. v-model="deptBudgetList.startDetailedAddress"
  132. placeholder="请输入始发地详细地址"
  133. maxlength="20"
  134. size="small"
  135. ></el-input>
  136. </el-form-item>
  137. <el-form-item
  138. label="收货库点"
  139. span="1"
  140. prop="contractNo"
  141. class="start-address"
  142. style="width: 36%"
  143. >
  144. <el-select
  145. @change="sendWarehousechange1"
  146. v-model="deptBudgetList.receiveWarehouse"
  147. :disabled="warehouse"
  148. placeholder="请输入收货库点"
  149. style="width: 100%"
  150. >
  151. <el-option
  152. v-for="item in warehouseList1"
  153. :key="item.constKey"
  154. :label="item.warehouseName"
  155. :value="item.warehouseName"
  156. ></el-option>
  157. </el-select>
  158. </el-form-item>
  159. <el-form-item
  160. label="终到地"
  161. span="1"
  162. prop="contractNo"
  163. class="start-address"
  164. >
  165. <el-cascader
  166. :options="options_"
  167. v-model="selectedOptions1"
  168. clearable
  169. size="large"
  170. placeholder="请选择终到地"
  171. @change="handleChange1"
  172. />
  173. </el-form-item>
  174. <el-form-item
  175. label="终到地详细地址"
  176. span="1"
  177. prop="endDetailedAddress"
  178. class="bg-right start-address"
  179. >
  180. <el-input
  181. v-model="deptBudgetList.endDetailedAddress"
  182. placeholder="请输入终到地详细地址"
  183. maxlength="20"
  184. size="small"
  185. ></el-input>
  186. </el-form-item>
  187. <div class="check-box">
  188. <span class="check-box">运输方式</span>
  189. <el-checkbox-group v-model="checkList" prop="tranType">
  190. <el-checkbox label="汽运" checked></el-checkbox>
  191. <el-checkbox label="火运"></el-checkbox>
  192. <el-checkbox label="船运"></el-checkbox>
  193. </el-checkbox-group>
  194. </div>
  195. </ws-info-table>
  196. <div
  197. style="width: 100%"
  198. class="position"
  199. v-for="(item, index) in deptBudgetList.tranProcessInfoList"
  200. :key="item.id"
  201. >
  202. <div class="driver">
  203. <span>运输阶段{{ item.key }} {{ item.processNo }}</span>
  204. <img
  205. v-if="endflag == '0' "
  206. width="22"
  207. height="22"
  208. class="add"
  209. @click="add(index)"
  210. src="../../../public/img/add.png"
  211. alt
  212. />
  213. <img
  214. width="22"
  215. height="22"
  216. class="del"
  217. @click="del(index)"
  218. src="../../../public/img/del.png"
  219. alt
  220. />
  221. <!-- <span
  222. style="margin-left : 20px;font-size : 14px"
  223. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  224. >最终阶段</span> -->
  225. <el-checkbox
  226. @change="(val) => engflagchange(val, index)"
  227. class="endflag"
  228. true-label="1"
  229. false-label="0"
  230. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  231. v-model="item.endFlag"
  232. :label="1"
  233. >最终阶段</el-checkbox
  234. >
  235. </div>
  236. <ws-info-table>
  237. <el-form-item label="运输方式" span="1" prop="waterContent">
  238. <el-select
  239. v-model="item.tranType"
  240. placeholder="运输方式"
  241. @change="
  242. (val) => {
  243. selecttaskwayList(val, index)
  244. }
  245. "
  246. >
  247. <el-option
  248. v-for="item in taskwayList"
  249. :key="item.constKey"
  250. :label="item.constValue"
  251. :value="item.constValue"
  252. ></el-option>
  253. </el-select>
  254. </el-form-item>
  255. <el-form-item label="发货日期" span="1" prop="impurity">
  256. <ws-date-picker
  257. v-model="item.deliveryDateStart"
  258. type="date"
  259. placeholder="请选择发货日期"
  260. value-format="yyyy-MM-dd"
  261. />
  262. </el-form-item>
  263. <el-form-item label="最晚到货日期" span="1" prop="bulkDensity">
  264. <ws-date-picker
  265. v-model="item.deliveryDateEnd"
  266. type="date"
  267. placeholder="请选择最晚到货日期"
  268. value-format="yyyy-MM-dd"
  269. />
  270. </el-form-item>
  271. <!-- 本阶段重量 -->
  272. <el-form-item
  273. label="本阶段运输重量(吨)"
  274. span="1"
  275. prop="bulkDensity"
  276. >
  277. <el-input
  278. v-model="item.weight"
  279. placeholder="请输入本阶段运输重量"
  280. size="small"
  281. ></el-input>
  282. </el-form-item>
  283. </ws-info-table>
  284. <ws-info-table>
  285. <el-form-item label="发货地区" span="1" prop="waterContent">
  286. <el-cascader
  287. :options="options_"
  288. v-model="item.selectedOptions"
  289. clearable
  290. size="large"
  291. placeholder="请选择发货地区"
  292. style="width: 200%"
  293. @change="
  294. (val) => {
  295. handleChange3(val, index)
  296. }
  297. "
  298. />
  299. </el-form-item>
  300. <el-form-item label="发货地详细地址" span="1" prop="impurity">
  301. <el-input
  302. v-model="item.sendDetailedAddress"
  303. placeholder="请输入发货地详细地址"
  304. maxlength="20"
  305. size="small"
  306. ></el-input>
  307. </el-form-item>
  308. <el-form-item label="发货人" span="1" prop="sender">
  309. <el-select
  310. v-model="item.sender"
  311. placeholder="请选择发货人"
  312. filterable
  313. :filter-method="dataFilter"
  314. @change=" (val) => {
  315. selectstaff(val, index)
  316. }"
  317. >
  318. <el-option
  319. v-for="item in options"
  320. :key="item.value"
  321. :label="item.staffName"
  322. :value="item.staffName"
  323. />
  324. </el-select>
  325. </el-form-item>
  326. <el-form-item label="发货人电话" span="1" prop="bulkDensity">
  327. <el-input
  328. v-model="item.senderPhone"
  329. placeholder="请输入发货人电话"
  330. maxlength="20"
  331. size="small"
  332. disabled
  333. ></el-input>
  334. </el-form-item>
  335. </ws-info-table>
  336. <ws-info-table>
  337. <el-form-item label="收货地区" span="1" prop="bulkDensity">
  338. <el-cascader
  339. :options="options_"
  340. v-model="item.selectedOptions1"
  341. clearable
  342. size="large"
  343. placeholder="请选择收货地区"
  344. style="width: 200%"
  345. @change="
  346. (val) => {
  347. handleChange4(val, index)
  348. }
  349. "
  350. />
  351. </el-form-item>
  352. <el-form-item label="收货地详细地址" span="1" prop="impurity">
  353. <el-input
  354. v-model="item.receiveDetailedAddress"
  355. placeholder="请输入收货地详细地址"
  356. maxlength="20"
  357. size="small"
  358. ></el-input>
  359. </el-form-item>
  360. <el-form-item label="收货人" span="1" prop="bulkDensity">
  361. <el-select
  362. v-model="item.receiver"
  363. placeholder="请选择收货人"
  364. filterable
  365. :filter-method="dataFilter"
  366. @change="(val) => {
  367. selectstaff1(val, index)
  368. }"
  369. >
  370. <el-option
  371. v-for="item in options"
  372. :key="item.value"
  373. :label="item.staffName"
  374. :value="item.staffName"
  375. />
  376. </el-select>
  377. </el-form-item>
  378. <el-form-item label="收货人电话" span="1" prop="bulkDensity">
  379. <el-input
  380. v-model="item.receiverPhone"
  381. placeholder="请输入收货人电话"
  382. maxlength="20"
  383. size="small"
  384. disabled
  385. ></el-input>
  386. </el-form-item>
  387. </ws-info-table>
  388. </div>
  389. </el-form>
  390. <!-- 提交 -->
  391. <div style="text-align: right; padding: 10px" class="center">
  392. <el-button
  393. class="bg-bottom"
  394. type="primary"
  395. size="small"
  396. @click="submit(deptBudgetList)"
  397. >提交</el-button
  398. >
  399. </div>
  400. </div>
  401. </template>
  402. <script>
  403. import { packList } from '@/model/contarct/index'
  404. import { regionData, CodeToText, TextToCode } from 'element-china-area-data'
  405. import { addtrantask, getwarehousename, xialaNo,getstaff} from '@/model/tasksport/index'
  406. import WsUpload from '@/components/WsUpload'
  407. import mapDrag from '@/components/mapdrag/mapdrag'
  408. export default {
  409. name: 'viewSpareMoney',
  410. components: {
  411. WsUpload,
  412. mapDrag,
  413. },
  414. watch: {
  415. vesselId(val) {
  416. this.getVesselData()
  417. },
  418. isShow(val) {
  419. this.showType = val
  420. },
  421. },
  422. data() {
  423. let self = this
  424. return {
  425. checkList: [],
  426. deptBudgetList: {
  427. taskNo: '',
  428. totalStorage: 0,
  429. goodsName: '玉米',
  430. goodsNameKey: 1,
  431. warehouseType: '1',
  432. tranProcessInfoList: [
  433. {
  434. sort: 0,
  435. processNo: '',
  436. tranType: '汽运',
  437. tranTypeKey: '1',
  438. deliveryDateStart: '',
  439. deliveryDateEnd: '',
  440. weight: '',
  441. selectedOptions: [],
  442. selectedOptions1: [],
  443. sendPrivate: '',
  444. sendCity: '',
  445. sendArea: '',
  446. receivePrivate: '',
  447. receiveCity: '',
  448. receiveArea: '',
  449. sendDetailedAddress: '',
  450. receiveDetailedAddress: '',
  451. sender: '',
  452. receiver: '',
  453. key: 1,
  454. senderPhone: '',
  455. receiverPhone: '',
  456. endFlag: '0',
  457. },
  458. ],
  459. },
  460. radio: '1',
  461. options_: regionData,
  462. heightData: '600px',
  463. zoom: 7,
  464. options: [],
  465. endflag: false,
  466. selectedOptions: [],
  467. selectedOptions1: [],
  468. window: '',
  469. district: null,
  470. goodnameList: [],
  471. listDate: { country: '中国', level: 'country', city: '' },
  472. citylist: [],
  473. taskType: [],
  474. taskwayList: [],
  475. contractNoList: [],
  476. compId: sessionStorage.getItem('ws-pf_compId'),
  477. mainReportAdd: {},
  478. appendixIdsAdd: '',
  479. warehouseList: [],
  480. warehouseList1: [],
  481. size: 10,
  482. value1: '',
  483. unitList: [],
  484. name: '',
  485. age: '',
  486. number: 2,
  487. }
  488. },
  489. activated() {
  490. this.loaddata()
  491. this.showType = this.isShow
  492. },
  493. computed: {
  494. warehouse: function () {
  495. if (
  496. this.deptBudgetList.taskType == '销售出库' ||
  497. this.deptBudgetList.taskType == '贸易服务出库' ||
  498. this.deptBudgetList.taskType == '暂存出库'
  499. ) {
  500. return true
  501. } else {
  502. return false
  503. }
  504. },
  505. },
  506. methods: {
  507. sendWarehousechange(e) {
  508. for (let i = 0; i < this.warehouseList.length; i++) {
  509. if (this.warehouseList[i].warehouseName == e) {
  510. var tmp = []
  511. tmp[0] = TextToCode[this.warehouseList[i].warehousePrivate].code
  512. tmp[1] =
  513. TextToCode[this.warehouseList[i].warehousePrivate][
  514. this.warehouseList[i].warehouseCity
  515. ].code
  516. tmp[2] =
  517. TextToCode[this.warehouseList[i].warehousePrivate][
  518. this.warehouseList[i].warehouseCity
  519. ][this.warehouseList[i].warehouseArea].code
  520. this.selectedOptions = tmp
  521. this.deptBudgetList.tranProcessInfoList[0].selectedOptions = tmp
  522. this.$set(
  523. this.deptBudgetList,
  524. 'startDetailedAddress',
  525. this.warehouseList[i].detailedAddress
  526. )
  527. this.$set(
  528. this.deptBudgetList.tranProcessInfoList[0],
  529. 'sendDetailedAddress',
  530. this.deptBudgetList.startDetailedAddress
  531. )
  532. }
  533. }
  534. },
  535. dataFilter(val) {
  536. this.deptBudgetList.personCharge = val
  537. if (val) {
  538. console.log(val)
  539. this.options = this.staffList.filter((item) => {
  540. if (
  541. !!~item.staffName.indexOf(val) ||
  542. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  543. ) {
  544. return true
  545. }
  546. })
  547. } else {
  548. this.options = this.staffList
  549. }
  550. },
  551. selectstaff(val, index) {
  552. for (var i = 0; i < this.staffList.length; i++) {
  553. if (this.staffList[i].staffName == val) {
  554. this.deptBudgetList.tranProcessInfoList[index].senderPhone = this.staffList[i].staffMobilePhone
  555. }
  556. }
  557. },
  558. selectstaff1(val, index) {
  559. for (var i = 0; i < this.staffList.length; i++) {
  560. if (this.staffList[i].staffName == val) {
  561. this.deptBudgetList.tranProcessInfoList[index].receiverPhone = this.staffList[i].staffMobilePhone
  562. }
  563. }
  564. },
  565. sendWarehousechange1(e) {
  566. for (let i = 0; i < this.warehouseList1.length; i++) {
  567. if (this.warehouseList1[i].warehouseName == e) {
  568. var tmp = []
  569. tmp[0] = TextToCode[this.warehouseList1[i].warehousePrivate].code
  570. tmp[1] =
  571. TextToCode[this.warehouseList1[i].warehousePrivate][
  572. this.warehouseList1[i].warehouseCity
  573. ].code
  574. tmp[2] =
  575. TextToCode[this.warehouseList1[i].warehousePrivate][
  576. this.warehouseList1[i].warehouseCity
  577. ][this.warehouseList1[i].warehouseArea].code
  578. this.selectedOptions1 = tmp
  579. this.$set(
  580. this.deptBudgetList,
  581. 'endDetailedAddress',
  582. this.warehouseList1[i].detailedAddress
  583. )
  584. }
  585. }
  586. },
  587. warehouseTypechange() {
  588. getwarehousename({
  589. compId: this.compId,
  590. warehouseType: this.deptBudgetList.warehouseType,
  591. })
  592. .toPromise()
  593. .then((response) => {
  594. this.warehouseList = response
  595. })
  596. },
  597. weightchange(e) {
  598. this.deptBudgetList.tranProcessInfoList[0].weight = e
  599. },
  600. engflagchange(e) {
  601. this.endflag = e
  602. if (this.endflag) {
  603. this.deptBudgetList.tranProcessInfoList[
  604. this.deptBudgetList.tranProcessInfoList.length - 1
  605. ].selectedOptions1 = this.selectedOptions1
  606. this.deptBudgetList.tranProcessInfoList[
  607. this.deptBudgetList.tranProcessInfoList.length - 1
  608. ].receiveDetailedAddress = this.deptBudgetList.endDetailedAddress
  609. } else {
  610. this.deptBudgetList.tranProcessInfoList[
  611. this.deptBudgetList.tranProcessInfoList.length - 1
  612. ].selectedOptions1 = []
  613. this.deptBudgetList.tranProcessInfoList[
  614. this.deptBudgetList.tranProcessInfoList.length - 1
  615. ].receiveDetailedAddress = ''
  616. }
  617. },
  618. // 获取当前年月日
  619. getdate() {
  620. var date = new Date()
  621. var year = date.getFullYear() //获取完整的年份(4位)
  622. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  623. var datetime = date.getDate() //获取当前日(1-31)
  624. if (mouth < 10) {
  625. mouth = '0' + mouth
  626. }
  627. if (datetime < 10) {
  628. datetime = '0' + datetime
  629. }
  630. return year +'' + mouth + datetime
  631. },
  632. // 随机验证码
  633. verifyinit() {
  634. var arr = []
  635. for (var i = 48; i < 123; i++) {
  636. if (i > 57 && i < 65) continue
  637. if (i > 90 ) continue
  638. arr.push(String.fromCharCode(i))
  639. }
  640. arr.sort(function () {
  641. return Math.random() - 0.5
  642. })
  643. arr.length = 4
  644. return arr.join('')
  645. },
  646. loaddata() {
  647. this.deptBudgetList.taskNo = 'YS' + this.getdate() + this.verifyinit()
  648. this.deptBudgetList.tranProcessInfoList[0].processNo =
  649. this.deptBudgetList.taskNo + '-1'
  650. // 货名
  651. packList({ constId: 'CON2' })
  652. .toPromise()
  653. .then((response) => {
  654. this.goodnameList = response
  655. })
  656. // 任务类型
  657. packList({ constId: 'TRAN3' })
  658. .toPromise()
  659. .then((response) => {
  660. this.taskType = response
  661. })
  662. // 运输方式
  663. packList({ constId: 'TRAN6' })
  664. .toPromise()
  665. .then((response) => {
  666. this.taskwayList = response
  667. })
  668. getwarehousename({
  669. compId: this.compId,
  670. warehouseType: this.deptBudgetList.warehouseType,
  671. })
  672. .toPromise()
  673. .then((response) => {
  674. this.warehouseList = response
  675. })
  676. getwarehousename({
  677. compId: this.compId,
  678. warehouseType: 1,
  679. })
  680. .toPromise()
  681. .then((response) => {
  682. this.warehouseList1 = response
  683. })
  684. getstaff({ compId: sessionStorage.getItem('ws-pf_compId') })
  685. .toPromise()
  686. .then((response) => {
  687. // this.agent = response
  688. this.options = response
  689. this.staffList = response
  690. this.sender = response
  691. })
  692. xialaNo({
  693. compId: this.compId,
  694. flag: 8,
  695. })
  696. .toPromise()
  697. .then((response) => {
  698. this.contractNoList = response
  699. })
  700. },
  701. confirmPositioncity() {
  702. this.listDate.level = 'city'
  703. this.listDate.country = this.name
  704. },
  705. // 关闭 dialog时 处理文件url 初始化upload组件
  706. handleClose() {
  707. this.dialogViewSpareMoney = false
  708. },
  709. add(index) {
  710. this.deptBudgetList.tranProcessInfoList.push({
  711. processNo:
  712. this.deptBudgetList.taskNo +
  713. '-' +
  714. (this.deptBudgetList.tranProcessInfoList.length + 1),
  715. tranType: '汽运',
  716. tranTypeKey: '1',
  717. deliveryDateStart: '',
  718. deliveryDateEnd: '',
  719. weight:
  720. this.deptBudgetList.tranProcessInfoList[
  721. this.deptBudgetList.tranProcessInfoList.length - 1
  722. ].weight,
  723. selectedOptions: [],
  724. selectedOptions1: [],
  725. sendPrivate: '',
  726. sendCity: '',
  727. sendArea: '',
  728. receivePrivate: '',
  729. receiveCity: '',
  730. receiveArea: '',
  731. sendDetailedAddress: '',
  732. receiveDetailedAddress: '',
  733. sender: '',
  734. receiver: '',
  735. key: this.deptBudgetList.tranProcessInfoList.length + 1,
  736. senderPhone: '',
  737. receiverPhone: '',
  738. endFlag: '0',
  739. })
  740. },
  741. del(index) {
  742. if (this.deptBudgetList.tranProcessInfoList.length > 1) {
  743. this.deptBudgetList.tranProcessInfoList.splice(index, 1)
  744. }
  745. for (let i = 0; i < this.deptBudgetList.tranProcessInfoList.length; i++) {
  746. this.$set(this.deptBudgetList.tranProcessInfoList[i], 'key', i + 1)
  747. this.$set(
  748. this.deptBudgetList.tranProcessInfoList[i],
  749. 'processNo',
  750. this.deptBudgetList.taskNo + '-' + (i + 1)
  751. )
  752. }
  753. this.$forceUpdate()
  754. },
  755. handleChange(value) {
  756. this.selectedOptions = value
  757. this.deptBudgetList.startPrivate = CodeToText[value[0]]
  758. this.deptBudgetList.startCity = CodeToText[value[1]]
  759. this.deptBudgetList.startArea = CodeToText[value[2]]
  760. },
  761. handleChange1(value) {
  762. this.selectedOptions1 = value
  763. this.deptBudgetList.endPrivate = CodeToText[value[0]]
  764. this.deptBudgetList.endCity = CodeToText[value[1]]
  765. this.deptBudgetList.endArea = CodeToText[value[2]]
  766. },
  767. handleChange3(value, index) {
  768. this.deptBudgetList.tranProcessInfoList[index].sendPrivate =
  769. CodeToText[value[0]]
  770. this.deptBudgetList.tranProcessInfoList[index].sendCity =
  771. CodeToText[value[1]]
  772. this.deptBudgetList.tranProcessInfoList[index].sendArea =
  773. CodeToText[value[2]]
  774. },
  775. handleChange4(value, index) {
  776. this.deptBudgetList.tranProcessInfoList[index].receivePrivate =
  777. CodeToText[value[0]]
  778. this.deptBudgetList.tranProcessInfoList[index].receiveCity =
  779. CodeToText[value[1]]
  780. this.deptBudgetList.tranProcessInfoList[index].receiveArea =
  781. CodeToText[value[2]]
  782. },
  783. returnsales() {
  784. this.$router.push({ path: 'tranManagementTransport' })
  785. this.deptBudgetList = {
  786. taskNo: '',
  787. totalStorage: 0,
  788. goodsName: '玉米',
  789. goodsNameKey: 1,
  790. warehouseType: '1',
  791. tranProcessInfoList: [
  792. {
  793. processNo: '',
  794. tranType: '汽运',
  795. deliveryDateStart: '',
  796. deliveryDateEnd: '',
  797. weight: '',
  798. selectedOptions: [],
  799. selectedOptions1: [],
  800. sendPrivate: '',
  801. sendCity: '',
  802. sendArea: '',
  803. receivePrivate: '',
  804. receiveCity: '',
  805. receiveArea: '',
  806. sendDetailedAddress: '',
  807. receiveDetailedAddress: '',
  808. sender: '',
  809. receiver: '',
  810. senderPhone: '',
  811. receiverPhone: '',
  812. },
  813. ],
  814. }
  815. },
  816. selecttaskType(e) {
  817. for (var i = 0; i < this.taskType.length; i++) {
  818. if (this.taskType[i].constValue == e) {
  819. this.deptBudgetList.taskTypeKey = this.taskType[i].constKey
  820. }
  821. }
  822. },
  823. selecttaskwayList(e, index) {
  824. for (var i = 0; i < this.taskwayList.length; i++) {
  825. if (this.taskwayList[i].constValue == e) {
  826. this.deptBudgetList.tranProcessInfoList[index].tranTypeKey =
  827. this.taskwayList[i].constKey
  828. }
  829. }
  830. },
  831. selectgoodsname(e) {
  832. for (var i = 0; i < this.goodnameList.length; i++) {
  833. if (this.goodnameList[i].constValue == e) {
  834. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  835. }
  836. }
  837. },
  838. onChange(files) {
  839. this.fileNum = files
  840. this.$refs.upload.handleSaveBill().then((res) => {})
  841. },
  842. submit() {
  843. if (!this.deptBudgetList.taskNo) {
  844. this.$message({
  845. message: '任务编号不能为空!',
  846. type: 'warning',
  847. })
  848. return
  849. }
  850. if (!this.deptBudgetList.taskType) {
  851. this.$message({
  852. message: '任务类型不能为空!',
  853. type: 'warning',
  854. })
  855. return
  856. }
  857. if (!this.deptBudgetList.contractNo) {
  858. this.$message({
  859. message: '合同编号/移库任务编号不能为空!',
  860. type: 'warning',
  861. })
  862. return
  863. }
  864. if (!this.deptBudgetList.goodsName) {
  865. this.$message({
  866. message: '货名不能为空!',
  867. type: 'warning',
  868. })
  869. return
  870. }
  871. if (!this.deptBudgetList.weight) {
  872. this.$message({
  873. message: '重量(吨)不能为空!',
  874. type: 'warning',
  875. })
  876. return
  877. }
  878. if (!this.deptBudgetList.sendWarehouse) {
  879. this.$message({
  880. message: '发货仓库不能为空!',
  881. type: 'warning',
  882. })
  883. return
  884. }
  885. if (this.selectedOptions.length <= 0) {
  886. this.$message({
  887. message: '始发地不能为空!',
  888. type: 'warning',
  889. })
  890. return
  891. }
  892. if (!this.deptBudgetList.startDetailedAddress) {
  893. this.$message({
  894. message: '始发地详细地址不能为空!',
  895. type: 'warning',
  896. })
  897. return
  898. }
  899. if (this.selectedOptions1.length <= 0) {
  900. this.$message({
  901. message: '终到地不能为空!',
  902. type: 'warning',
  903. })
  904. return
  905. }
  906. if (!this.deptBudgetList.endDetailedAddress) {
  907. this.$message({
  908. message: '终到地详细地址不能为空!',
  909. type: 'warning',
  910. })
  911. return
  912. }
  913. if (this.checkList.length <= 0) {
  914. this.$message({
  915. message: '运输方式多选框不能为空!',
  916. type: 'warning',
  917. })
  918. return
  919. }
  920. for (var i = 0; i < this.deptBudgetList.tranProcessInfoList.length; i++) {
  921. this.deptBudgetList.tranProcessInfoList[i].processNo =
  922. this.deptBudgetList.taskNo + (i + 1)
  923. if (
  924. new Date(
  925. this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart
  926. ).getTime() >
  927. new Date(
  928. this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd
  929. ).getTime()
  930. ) {
  931. this.$message({
  932. message: '发货日期不能大于最晚到货日期!',
  933. type: 'warning',
  934. })
  935. return
  936. }
  937. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart) {
  938. this.$message({
  939. message: '发货日期不能为空!',
  940. type: 'warning',
  941. })
  942. return
  943. }
  944. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd) {
  945. this.$message({
  946. message: '最晚到货日期不能为空!',
  947. type: 'warning',
  948. })
  949. return
  950. }
  951. if (!this.deptBudgetList.tranProcessInfoList[i].weight) {
  952. this.$message({
  953. message: '重量不能为空!',
  954. type: 'warning',
  955. })
  956. return
  957. }
  958. if (!this.deptBudgetList.tranProcessInfoList[i].sender) {
  959. this.$message({
  960. message: '发货人不能为空!',
  961. type: 'warning',
  962. })
  963. return
  964. }
  965. if (!this.deptBudgetList.tranProcessInfoList[i].senderPhone) {
  966. this.$message({
  967. message: '发货人电话不能为空!',
  968. type: 'warning',
  969. })
  970. return
  971. }
  972. if (!this.deptBudgetList.tranProcessInfoList[i].receiver) {
  973. this.$message({
  974. message: '收货人不能为空!',
  975. type: 'warning',
  976. })
  977. return
  978. }
  979. if (!this.deptBudgetList.tranProcessInfoList[i].receiverPhone) {
  980. this.$message({
  981. message: '收货人电话不能为空!',
  982. type: 'warning',
  983. })
  984. return
  985. }
  986. if (
  987. !this.deptBudgetList.tranProcessInfoList[i].receiveDetailedAddress
  988. ) {
  989. this.$message({
  990. message: '收获详细地址不能为空!',
  991. type: 'warning',
  992. })
  993. return
  994. }
  995. if (!this.deptBudgetList.tranProcessInfoList[i].sendDetailedAddress) {
  996. this.$message({
  997. message: '发货详细地址不能为空!',
  998. type: 'warning',
  999. })
  1000. return
  1001. }
  1002. }
  1003. if (this.endflag) {
  1004. this.$confirm(`运输任务提交成功后将派发到物流部门,是否确定提交?`, {
  1005. confirmButtonText: '确定',
  1006. cancelButtonText: '取消',
  1007. type: 'warning',
  1008. })
  1009. .then(() => {
  1010. this.$refs.deptBudgetList.validate((valid) => {
  1011. if (valid) {
  1012. this.deptBudgetList.compId =
  1013. sessionStorage.getItem('ws-pf_compId')
  1014. console.log()
  1015. this.deptBudgetList.tranType = this.checkList.toString()
  1016. this.deptBudgetList.startPrivate =
  1017. CodeToText[this.selectedOptions[0]]
  1018. this.deptBudgetList.startCity =
  1019. CodeToText[this.selectedOptions[1]]
  1020. this.deptBudgetList.startArea =
  1021. CodeToText[this.selectedOptions[2]]
  1022. this.deptBudgetList.tranProcessInfoList[0].sendPrivate =
  1023. CodeToText[this.selectedOptions[0]]
  1024. this.deptBudgetList.tranProcessInfoList[0].sendCity =
  1025. CodeToText[this.selectedOptions[1]]
  1026. this.deptBudgetList.tranProcessInfoList[0].sendArea =
  1027. CodeToText[this.selectedOptions[2]]
  1028. if (this.endflag) {
  1029. this.deptBudgetList.tranProcessInfoList[
  1030. this.deptBudgetList.tranProcessInfoList.length - 1
  1031. ].receivePrivate = CodeToText[this.selectedOptions1[0]]
  1032. this.deptBudgetList.tranProcessInfoList[
  1033. this.deptBudgetList.tranProcessInfoList.length - 1
  1034. ].receiveCity = CodeToText[this.selectedOptions1[1]]
  1035. this.deptBudgetList.tranProcessInfoList[
  1036. this.deptBudgetList.tranProcessInfoList.length - 1
  1037. ].receiveArea = CodeToText[this.selectedOptions1[2]]
  1038. }
  1039. if (
  1040. this.deptBudgetList.taskType != '销售出库' ||
  1041. this.deptBudgetList.taskType != '贸易服务出库' ||
  1042. this.deptBudgetList.taskType != '暂存出库'
  1043. ){
  1044. this.deptBudgetList.endPrivate = CodeToText[this.selectedOptions1[0]]
  1045. this.deptBudgetList.endCity = CodeToText[this.selectedOptions1[1]]
  1046. this.deptBudgetList.endArea = CodeToText[this.selectedOptions1[2]]
  1047. }
  1048. for (
  1049. var i = 0;
  1050. i < this.deptBudgetList.tranProcessInfoList.length;
  1051. i++
  1052. ) {
  1053. this.deptBudgetList.tranProcessInfoList[i].sort = i
  1054. }
  1055. addtrantask(this.deptBudgetList)
  1056. .toPromise()
  1057. .then((response) => {
  1058. this.$message.success('添加成功')
  1059. this.deptBudgetList = {
  1060. taskNo: '',
  1061. totalStorage: 0,
  1062. goodsName: '玉米',
  1063. goodsNameKey: 1,
  1064. warehouseType: '1',
  1065. tranProcessInfoList: [
  1066. {
  1067. processNo: '',
  1068. tranType: '汽运',
  1069. deliveryDateStart: '',
  1070. deliveryDateEnd: '',
  1071. weight: '',
  1072. selectedOptions: [],
  1073. selectedOptions1: [],
  1074. sendPrivate: '',
  1075. sendCity: '',
  1076. sendArea: '',
  1077. receivePrivate: '',
  1078. receiveCity: '',
  1079. receiveArea: '',
  1080. sendDetailedAddress: '',
  1081. receiveDetailedAddress: '',
  1082. sender: '',
  1083. receiver: '',
  1084. senderPhone: '',
  1085. receiverPhone: '',
  1086. contractNo: '',
  1087. receiveWarehouse: '',
  1088. },
  1089. ],
  1090. }
  1091. this.$router.push({ path: 'tranManagementTransport' })
  1092. })
  1093. } else {
  1094. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1095. return false
  1096. }
  1097. })
  1098. })
  1099. .catch(() => {
  1100. return false
  1101. })
  1102. } else {
  1103. this.$confirm(`您还未选择最终阶段,是否确定提交??`, {
  1104. confirmButtonText: '确定',
  1105. cancelButtonText: '取消',
  1106. type: 'warning',
  1107. })
  1108. .then(() => {
  1109. this.$refs.deptBudgetList.validate((valid) => {
  1110. if (valid) {
  1111. this.deptBudgetList.compId =
  1112. sessionStorage.getItem('ws-pf_compId')
  1113. console.log(this.checkList.toString())
  1114. this.deptBudgetList.tranType = this.checkList.toString()
  1115. this.deptBudgetList.startPrivate =
  1116. CodeToText[this.selectedOptions[0]]
  1117. this.deptBudgetList.startCity =
  1118. CodeToText[this.selectedOptions[1]]
  1119. this.deptBudgetList.startArea =
  1120. CodeToText[this.selectedOptions[2]]
  1121. this.deptBudgetList.tranProcessInfoList[0].sendPrivate =
  1122. CodeToText[this.selectedOptions[0]]
  1123. this.deptBudgetList.tranProcessInfoList[0].sendCity =
  1124. CodeToText[this.selectedOptions[1]]
  1125. this.deptBudgetList.tranProcessInfoList[0].sendArea =
  1126. CodeToText[this.selectedOptions[2]]
  1127. if (this.endflag) {
  1128. this.deptBudgetList.tranProcessInfoList[
  1129. this.deptBudgetList.tranProcessInfoList.length - 1
  1130. ].receivePrivate = CodeToText[this.selectedOptions1[0]]
  1131. this.deptBudgetList.tranProcessInfoList[
  1132. this.deptBudgetList.tranProcessInfoList.length - 1
  1133. ].receiveCity = CodeToText[this.selectedOptions1[1]]
  1134. this.deptBudgetList.tranProcessInfoList[
  1135. this.deptBudgetList.tranProcessInfoList.length - 1
  1136. ].receiveArea = CodeToText[this.selectedOptions1[2]]
  1137. }
  1138. if (
  1139. this.deptBudgetList.taskType != '销售出库' ||
  1140. this.deptBudgetList.taskType != '贸易服务出库' ||
  1141. this.deptBudgetList.taskType != '暂存出库'
  1142. ){
  1143. this.deptBudgetList.endPrivate = CodeToText[this.selectedOptions1[0]]
  1144. this.deptBudgetList.endCity = CodeToText[this.selectedOptions1[1]]
  1145. this.deptBudgetList.endArea = CodeToText[this.selectedOptions1[2]]
  1146. }
  1147. for (
  1148. var i = 0;
  1149. i < this.deptBudgetList.tranProcessInfoList.length;
  1150. i++
  1151. ) {
  1152. this.deptBudgetList.tranProcessInfoList[i].sort = i
  1153. }
  1154. addtrantask(this.deptBudgetList)
  1155. .toPromise()
  1156. .then((response) => {
  1157. this.$message.success('添加成功')
  1158. this.deptBudgetList = {
  1159. taskNo: '',
  1160. totalStorage: 0,
  1161. goodsName: '玉米',
  1162. goodsNameKey: 1,
  1163. warehouseType: '1',
  1164. tranProcessInfoList: [
  1165. {
  1166. processNo: '',
  1167. tranType: '汽运',
  1168. deliveryDateStart: '',
  1169. deliveryDateEnd: '',
  1170. weight: '',
  1171. selectedOptions: [],
  1172. selectedOptions1: [],
  1173. sendPrivate: '',
  1174. sendCity: '',
  1175. sendArea: '',
  1176. receivePrivate: '',
  1177. receiveCity: '',
  1178. receiveArea: '',
  1179. sendDetailedAddress: '',
  1180. receiveDetailedAddress: '',
  1181. sender: '',
  1182. receiver: '',
  1183. senderPhone: '',
  1184. receiverPhone: '',
  1185. contractNo: '',
  1186. receiveWarehouse: '',
  1187. },
  1188. ],
  1189. }
  1190. this.$router.push({ path: 'tranManagementTransport' })
  1191. })
  1192. } else {
  1193. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1194. return false
  1195. }
  1196. })
  1197. })
  1198. .catch(() => {
  1199. return false
  1200. })
  1201. }
  1202. },
  1203. resetForm(deptBudgetList) {
  1204. this.$refs[deptBudgetList].resetFields()
  1205. },
  1206. },
  1207. }
  1208. </script>
  1209. <style lang="scss" scoped>
  1210. .position {
  1211. position: relative;
  1212. border: 1px solid #5473e8;
  1213. border-radius: 4px;
  1214. margin-top: 20px;
  1215. background: #f6f7fc;
  1216. border-left: 5px solid #5473e8;
  1217. }
  1218. /deep/.position .ws-info-table .el-form-item {
  1219. width: 25%;
  1220. height: 50px;
  1221. }
  1222. /deep/.position .el-select,
  1223. /deep/.el-select {
  1224. width: 100%;
  1225. }
  1226. /deep/.position .ws-info-table .el-form-item .el-form-item__label,
  1227. /deep/.position .ws-info-table .el-form-item .el-form-item__content {
  1228. background: #f6f7fc;
  1229. font-size: 14px;
  1230. color: #8890b1;
  1231. }
  1232. .typeselect {
  1233. width: 42%;
  1234. margin-left: 32px;
  1235. }
  1236. .del,
  1237. .add {
  1238. cursor: pointer;
  1239. margin-left: 10px;
  1240. }
  1241. .el-checkbox-group {
  1242. font-size: 0;
  1243. float: right;
  1244. margin-left: 25px;
  1245. }
  1246. .check-box {
  1247. float: left;
  1248. font-size: 14px;
  1249. color: #8890b1;
  1250. }
  1251. .el-checkbox__label {
  1252. color: #8890b1;
  1253. }
  1254. .el-form {
  1255. padding: 0 10%;
  1256. }
  1257. .ws-info-table {
  1258. border: none;
  1259. }
  1260. /deep/.ws-info-table .el-form-item {
  1261. border-right: 1px solid #cdd2dc;
  1262. border-bottom: 1px solid #cdd2dc;
  1263. }
  1264. .readonly {
  1265. position: relative;
  1266. }
  1267. .title {
  1268. position: relative;
  1269. }
  1270. .title::before {
  1271. content: '';
  1272. display: inline-block;
  1273. width: 5px;
  1274. height: 30px;
  1275. background: #5473e8;
  1276. position: absolute;
  1277. left: 0;
  1278. }
  1279. //去边框
  1280. /deep/.el-form-item {
  1281. border-right: 0px;
  1282. border-bottom: 0px;
  1283. }
  1284. .el-form {
  1285. margin-top: 50px;
  1286. }
  1287. .endflag {
  1288. vertical-align: top;
  1289. }
  1290. .el-col {
  1291. background: #f6f7fc;
  1292. }
  1293. .bg-left {
  1294. padding-left: 30px;
  1295. }
  1296. .bg-right {
  1297. padding-right: 10px;
  1298. text-align: right;
  1299. }
  1300. .bg-bottom {
  1301. margin: 15px 0px;
  1302. }
  1303. .el-radio,
  1304. .el-radio__input {
  1305. margin-top: 11px;
  1306. margin-left: 11px;
  1307. width: 93px;
  1308. }
  1309. .driver {
  1310. margin-top: 10px;
  1311. font-weight: bold;
  1312. margin-left: 20px;
  1313. color: #5473e8;
  1314. font-size: 16px;
  1315. }
  1316. /deep/.nei {
  1317. .ws-info-table {
  1318. border: none;
  1319. }
  1320. .el-form-item {
  1321. width: 33.3333%;
  1322. border: none;
  1323. .el-form-item__label {
  1324. background: transparent;
  1325. border: none;
  1326. }
  1327. .el-form-item__content {
  1328. border: none;
  1329. }
  1330. }
  1331. }
  1332. /deep/.el-table--border:after,
  1333. /deep/.el-table--group:after,
  1334. /deep/.el-table:before {
  1335. background: transparent;
  1336. }
  1337. //输入框标题
  1338. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1339. background: #ffffff;
  1340. width: min-content;
  1341. font-size: 14px;
  1342. color: #8890b1;
  1343. }
  1344. //表单子项
  1345. /deep/.ws-info-table .el-form-item {
  1346. width: 20%;
  1347. border: none;
  1348. height: 50px;
  1349. }
  1350. //输入框
  1351. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1352. border: none;
  1353. font-size: 14px;
  1354. color: #8890b1;
  1355. }
  1356. /deep/ .el-input--small .el-input__inner {
  1357. font-size: 14px;
  1358. color: #8890b1;
  1359. }
  1360. .el-form-item.start-address.el-form-item--small {
  1361. width: 31.9%;
  1362. }
  1363. .el-cascader {
  1364. width: 100%;
  1365. }
  1366. .el-form {
  1367. height: 73vh;
  1368. overflow: scroll;
  1369. }
  1370. </style>