tranManagementTransportAdd.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  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. ></el-input>
  38. </el-form-item>
  39. <el-form-item prop="taskType" label="任务类型" span="1">
  40. <el-select
  41. v-model="deptBudgetList.taskType"
  42. placeholder="请输入任务类型"
  43. @change="selecttaskType"
  44. >
  45. <el-option
  46. v-for="item in taskType"
  47. :key="item.constKey"
  48. :label="item.constValue"
  49. :value="item.constValue"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item prop="contractNo" label="合同编号/移库任务编号" span="1">
  54. <el-select
  55. v-model="deptBudgetList.contractNo"
  56. placeholder="请选择编号"
  57. >
  58. <el-option
  59. v-for="item in contractNoList"
  60. :key="item.constKey"
  61. :label="item.contractNo"
  62. :value="item.contractNo"
  63. ></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item prop="goodsName" label="货名" span="1">
  67. <el-select
  68. v-model="deptBudgetList.goodsName"
  69. placeholder="请输入货名"
  70. @change="selectgoodsname"
  71. >
  72. <el-option
  73. v-for="item in goodnameList"
  74. :key="item.constKey"
  75. :label="item.constValue"
  76. :value="item.constValue"
  77. ></el-option>
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="重量(吨)" span="1" prop="weight">
  81. <el-input
  82. @input="weightchange"
  83. v-model="deptBudgetList.weight"
  84. placeholder="请输入重量"
  85. maxlength="20"
  86. size="small"
  87. ></el-input>
  88. </el-form-item>
  89. </ws-info-table>
  90. <ws-info-table class="el-table">
  91. <div class="start-address" style="width: 36%">
  92. <el-radio-group
  93. @change="warehouseTypechange"
  94. v-model="deptBudgetList.warehouseType"
  95. >
  96. <el-radio label="1">常用仓库发货</el-radio>
  97. <el-radio label="2">临时仓库发货</el-radio>
  98. </el-radio-group>
  99. <el-select
  100. @change="sendWarehousechange"
  101. v-model="deptBudgetList.sendWarehouse"
  102. placeholder="选择仓库"
  103. class="typeselect"
  104. >
  105. <el-option
  106. v-for="item in warehouseList"
  107. :key="item.constKey"
  108. :label="item.warehouseName"
  109. :value="item.warehouseName"
  110. ></el-option>
  111. </el-select>
  112. </div>
  113. <el-form-item label="始发地" span="1" class="start-address">
  114. <el-cascader
  115. :options="options_"
  116. v-model="selectedOptions"
  117. clearable
  118. size="large"
  119. placeholder="请选择始发地"
  120. @change="handleChange"
  121. />
  122. </el-form-item>
  123. <el-form-item
  124. label="始发地详细地址"
  125. span="1"
  126. prop="startDetailedAddress"
  127. style="width: 31.333%"
  128. >
  129. <el-input
  130. v-model="deptBudgetList.startDetailedAddress"
  131. placeholder="请输入始发地详细地址"
  132. maxlength="20"
  133. size="small"
  134. ></el-input>
  135. </el-form-item>
  136. <el-form-item
  137. label="收货库点"
  138. span="1"
  139. prop="contractNo"
  140. class="start-address"
  141. style="width: 36%"
  142. >
  143. <el-select
  144. @change="sendWarehousechange1"
  145. v-model="deptBudgetList.receiveWarehouse"
  146. :disabled="warehouse"
  147. placeholder="请输入收货库点"
  148. style="width: 100%"
  149. >
  150. <el-option
  151. v-for="item in warehouseList1"
  152. :key="item.constKey"
  153. :label="item.warehouseName"
  154. :value="item.warehouseName"
  155. ></el-option>
  156. </el-select>
  157. </el-form-item>
  158. <el-form-item
  159. label="终到地"
  160. span="1"
  161. prop="contractNo"
  162. class="start-address"
  163. >
  164. <el-cascader
  165. :options="options_"
  166. v-model="selectedOptions1"
  167. clearable
  168. size="large"
  169. placeholder="请选择终到地"
  170. @change="handleChange1"
  171. />
  172. </el-form-item>
  173. <el-form-item
  174. label="终到地详细地址"
  175. span="1"
  176. prop="endDetailedAddress"
  177. class="bg-right start-address"
  178. >
  179. <el-input
  180. v-model="deptBudgetList.endDetailedAddress"
  181. placeholder="请输入终到地详细地址"
  182. maxlength="20"
  183. size="small"
  184. ></el-input>
  185. </el-form-item>
  186. <div class="check-box">
  187. <span class="check-box">运输方式</span>
  188. <el-checkbox-group v-model="checkList" prop="tranType">
  189. <el-checkbox label="汽运" checked></el-checkbox>
  190. <el-checkbox label="火运"></el-checkbox>
  191. <el-checkbox label="船运"></el-checkbox>
  192. </el-checkbox-group>
  193. </div>
  194. </ws-info-table>
  195. <div
  196. style="width: 100%"
  197. class="position"
  198. v-for="(item, index) in deptBudgetList.tranProcessInfoList"
  199. :key="item.id"
  200. >
  201. <div class="driver">
  202. <span>运输阶段{{ item.key }} {{ item.processNo }}</span>
  203. <img
  204. v-if="!endflag"
  205. width="22"
  206. height="22"
  207. class="add"
  208. @click="add(index)"
  209. src="../../../public/img/add.png"
  210. alt
  211. />
  212. <img
  213. width="22"
  214. height="22"
  215. class="del"
  216. @click="del(index)"
  217. src="../../../public/img/del.png"
  218. alt
  219. />
  220. <!-- <span
  221. style="margin-left : 20px;font-size : 14px"
  222. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  223. >最终阶段</span> -->
  224. <el-checkbox
  225. @change="(val) => engflagchange(val, index)"
  226. class="endflag"
  227. true-label="1"
  228. false-label="0"
  229. v-if="index == deptBudgetList.tranProcessInfoList.length - 1"
  230. v-model="item.endFlag"
  231. :label="1"
  232. >最终阶段</el-checkbox
  233. >
  234. </div>
  235. <ws-info-table>
  236. <el-form-item label="运输方式" span="1" prop="waterContent">
  237. <el-select
  238. v-model="item.tranType"
  239. placeholder="运输方式"
  240. @change="
  241. (val) => {
  242. selecttaskwayList(val, index)
  243. }
  244. "
  245. >
  246. <el-option
  247. v-for="item in taskwayList"
  248. :key="item.constKey"
  249. :label="item.constValue"
  250. :value="item.constValue"
  251. ></el-option>
  252. </el-select>
  253. </el-form-item>
  254. <el-form-item label="发货日期" span="1" prop="impurity">
  255. <ws-date-picker
  256. v-model="item.deliveryDateStart"
  257. type="date"
  258. placeholder="请选择发货日期"
  259. value-format="yyyy-MM-dd"
  260. />
  261. </el-form-item>
  262. <el-form-item label="最晚到货日期" span="1" prop="bulkDensity">
  263. <ws-date-picker
  264. v-model="item.deliveryDateEnd"
  265. type="date"
  266. placeholder="请选择最晚到货日期"
  267. value-format="yyyy-MM-dd"
  268. />
  269. </el-form-item>
  270. <!-- 本阶段重量 -->
  271. <el-form-item
  272. label="本阶段运输重量(吨)"
  273. span="1"
  274. prop="bulkDensity"
  275. >
  276. <el-input
  277. v-model="item.weight"
  278. placeholder="请输入本阶段运输重量"
  279. size="small"
  280. ></el-input>
  281. </el-form-item>
  282. </ws-info-table>
  283. <ws-info-table>
  284. <el-form-item label="发货地区" span="1" prop="waterContent">
  285. <el-cascader
  286. :options="options_"
  287. v-model="item.selectedOptions"
  288. clearable
  289. size="large"
  290. placeholder="请选择发货地区"
  291. style="width: 200%"
  292. @change="
  293. (val) => {
  294. handleChange3(val, index)
  295. }
  296. "
  297. />
  298. </el-form-item>
  299. <el-form-item label="发货地详细地址" span="1" prop="impurity">
  300. <el-input
  301. v-model="item.sendDetailedAddress"
  302. placeholder="请输入发货地详细地址"
  303. maxlength="20"
  304. size="small"
  305. ></el-input>
  306. </el-form-item>
  307. <el-form-item label="发货人" span="1" prop="sender">
  308. <el-select
  309. v-model="item.sender"
  310. placeholder="请选择发货人"
  311. filterable
  312. :filter-method="dataFilter"
  313. @change=" (val) => {
  314. selectstaff(val, index)
  315. }"
  316. >
  317. <el-option
  318. v-for="item in options"
  319. :key="item.value"
  320. :label="item.staffName"
  321. :value="item.staffName"
  322. />
  323. </el-select>
  324. </el-form-item>
  325. <el-form-item label="发货人电话" span="1" prop="bulkDensity">
  326. <el-input
  327. v-model="item.senderPhone"
  328. placeholder="请输入发货人电话"
  329. maxlength="20"
  330. size="small"
  331. disabled
  332. ></el-input>
  333. </el-form-item>
  334. </ws-info-table>
  335. <ws-info-table>
  336. <el-form-item label="收货地区" span="1" prop="bulkDensity">
  337. <el-cascader
  338. :options="options_"
  339. v-model="item.selectedOptions1"
  340. clearable
  341. size="large"
  342. placeholder="请选择收货地区"
  343. style="width: 200%"
  344. @change="
  345. (val) => {
  346. handleChange4(val, index)
  347. }
  348. "
  349. />
  350. </el-form-item>
  351. <el-form-item label="收货地详细地址" span="1" prop="impurity">
  352. <el-input
  353. v-model="item.receiveDetailedAddress"
  354. placeholder="请输入收货地详细地址"
  355. maxlength="20"
  356. size="small"
  357. ></el-input>
  358. </el-form-item>
  359. <el-form-item label="收货人" span="1" prop="bulkDensity">
  360. <el-select
  361. v-model="item.receiver"
  362. placeholder="请选择收货人"
  363. filterable
  364. :filter-method="dataFilter"
  365. @change="(val) => {
  366. selectstaff1(val, index)
  367. }"
  368. >
  369. <el-option
  370. v-for="item in options"
  371. :key="item.value"
  372. :label="item.staffName"
  373. :value="item.staffName"
  374. />
  375. </el-select>
  376. </el-form-item>
  377. <el-form-item label="收货人电话" span="1" prop="bulkDensity">
  378. <el-input
  379. v-model="item.receiverPhone"
  380. placeholder="请输入收货人电话"
  381. maxlength="20"
  382. size="small"
  383. disabled
  384. ></el-input>
  385. </el-form-item>
  386. </ws-info-table>
  387. </div>
  388. </el-form>
  389. <!-- 提交 -->
  390. <div style="text-align: right; padding: 10px" class="center">
  391. <el-button
  392. class="bg-bottom"
  393. type="primary"
  394. size="small"
  395. @click="submit(deptBudgetList)"
  396. >提交</el-button
  397. >
  398. </div>
  399. </div>
  400. </template>
  401. <script>
  402. import { packList } from '@/model/contarct/index'
  403. import { regionData, CodeToText, TextToCode } from 'element-china-area-data'
  404. import { addtrantask, getwarehousename, xialaNo,getstaff} from '@/model/tasksport/index'
  405. import WsUpload from '@/components/WsUpload'
  406. import mapDrag from '@/components/mapdrag/mapdrag'
  407. export default {
  408. name: 'viewSpareMoney',
  409. components: {
  410. WsUpload,
  411. mapDrag,
  412. },
  413. watch: {
  414. vesselId(val) {
  415. this.getVesselData()
  416. },
  417. isShow(val) {
  418. this.showType = val
  419. },
  420. },
  421. data() {
  422. let self = this
  423. return {
  424. flag: 2,
  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 && i < 97) 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. })
  695. .toPromise()
  696. .then((response) => {
  697. this.contractNoList = response
  698. })
  699. },
  700. confirmPositioncity() {
  701. this.listDate.level = 'city'
  702. this.listDate.country = this.name
  703. },
  704. // 关闭 dialog时 处理文件url 初始化upload组件
  705. handleClose() {
  706. this.dialogViewSpareMoney = false
  707. },
  708. add(index) {
  709. this.deptBudgetList.tranProcessInfoList.push({
  710. processNo:
  711. this.deptBudgetList.taskNo +
  712. '-' +
  713. (this.deptBudgetList.tranProcessInfoList.length + 1),
  714. tranType: '汽运',
  715. tranTypeKey: '1',
  716. deliveryDateStart: '',
  717. deliveryDateEnd: '',
  718. weight:
  719. this.deptBudgetList.tranProcessInfoList[
  720. this.deptBudgetList.tranProcessInfoList.length - 1
  721. ].weight,
  722. selectedOptions: [],
  723. selectedOptions1: [],
  724. sendPrivate: '',
  725. sendCity: '',
  726. sendArea: '',
  727. receivePrivate: '',
  728. receiveCity: '',
  729. receiveArea: '',
  730. sendDetailedAddress: '',
  731. receiveDetailedAddress: '',
  732. sender: '',
  733. receiver: '',
  734. key: this.deptBudgetList.tranProcessInfoList.length,
  735. senderPhone: '',
  736. receiverPhone: '',
  737. endFlag: '0',
  738. })
  739. },
  740. del(index) {
  741. if (this.deptBudgetList.tranProcessInfoList.length > 1) {
  742. this.deptBudgetList.tranProcessInfoList.splice(index, 1)
  743. }
  744. for (let i = 0; i < this.deptBudgetList.tranProcessInfoList.length; i++) {
  745. this.$set(this.deptBudgetList.tranProcessInfoList[i], 'key', i + 1)
  746. this.$set(
  747. this.deptBudgetList.tranProcessInfoList[i],
  748. 'processNo',
  749. this.deptBudgetList.taskNo + '-' + (i + 1)
  750. )
  751. }
  752. this.$forceUpdate()
  753. },
  754. handleChange(value) {
  755. this.selectedOptions = value
  756. this.deptBudgetList.startPrivate = CodeToText[value[0]]
  757. this.deptBudgetList.startCity = CodeToText[value[1]]
  758. this.deptBudgetList.startArea = CodeToText[value[2]]
  759. },
  760. handleChange1(value) {
  761. this.selectedOptions1 = value
  762. this.deptBudgetList.endPrivate = CodeToText[value[0]]
  763. this.deptBudgetList.endCity = CodeToText[value[1]]
  764. this.deptBudgetList.endArea = CodeToText[value[2]]
  765. },
  766. handleChange3(value, index) {
  767. this.deptBudgetList.tranProcessInfoList[index].sendPrivate =
  768. CodeToText[value[0]]
  769. this.deptBudgetList.tranProcessInfoList[index].sendCity =
  770. CodeToText[value[1]]
  771. this.deptBudgetList.tranProcessInfoList[index].sendArea =
  772. CodeToText[value[2]]
  773. },
  774. handleChange4(value, index) {
  775. this.deptBudgetList.tranProcessInfoList[index].receivePrivate =
  776. CodeToText[value[0]]
  777. this.deptBudgetList.tranProcessInfoList[index].receiveCity =
  778. CodeToText[value[1]]
  779. this.deptBudgetList.tranProcessInfoList[index].receiveArea =
  780. CodeToText[value[2]]
  781. },
  782. returnsales() {
  783. this.$router.push({ path: 'tranManagementTransport' })
  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. },
  812. ],
  813. }
  814. },
  815. selecttaskType(e) {
  816. for (var i = 0; i < this.taskType.length; i++) {
  817. if (this.taskType[i].constValue == e) {
  818. this.deptBudgetList.taskTypeKey = this.taskType[i].constKey
  819. }
  820. }
  821. },
  822. selecttaskwayList(e, index) {
  823. for (var i = 0; i < this.taskwayList.length; i++) {
  824. if (this.taskwayList[i].constValue == e) {
  825. this.deptBudgetList.tranProcessInfoList[index].tranTypeKey =
  826. this.taskwayList[i].constKey
  827. }
  828. }
  829. },
  830. selectgoodsname(e) {
  831. for (var i = 0; i < this.goodnameList.length; i++) {
  832. if (this.goodnameList[i].constValue == e) {
  833. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  834. }
  835. }
  836. },
  837. onChange(files) {
  838. this.fileNum = files
  839. this.$refs.upload.handleSaveBill().then((res) => {})
  840. },
  841. submit() {
  842. if (!this.deptBudgetList.taskNo) {
  843. this.$message({
  844. message: '任务编号不能为空!',
  845. type: 'warning',
  846. })
  847. return
  848. }
  849. if (!this.deptBudgetList.taskType) {
  850. this.$message({
  851. message: '任务类型不能为空!',
  852. type: 'warning',
  853. })
  854. return
  855. }
  856. if (!this.deptBudgetList.contractNo) {
  857. this.$message({
  858. message: '合同编号/移库任务编号不能为空!',
  859. type: 'warning',
  860. })
  861. return
  862. }
  863. if (!this.deptBudgetList.goodsName) {
  864. this.$message({
  865. message: '货名不能为空!',
  866. type: 'warning',
  867. })
  868. return
  869. }
  870. if (!this.deptBudgetList.weight) {
  871. this.$message({
  872. message: '重量(吨)不能为空!',
  873. type: 'warning',
  874. })
  875. return
  876. }
  877. if (!this.deptBudgetList.sendWarehouse) {
  878. this.$message({
  879. message: '发货仓库不能为空!',
  880. type: 'warning',
  881. })
  882. return
  883. }
  884. if (this.selectedOptions.length <= 0) {
  885. this.$message({
  886. message: '始发地不能为空!',
  887. type: 'warning',
  888. })
  889. return
  890. }
  891. if (!this.deptBudgetList.startDetailedAddress) {
  892. this.$message({
  893. message: '始发地详细地址不能为空!',
  894. type: 'warning',
  895. })
  896. return
  897. }
  898. if (this.selectedOptions1.length <= 0) {
  899. this.$message({
  900. message: '终到地不能为空!',
  901. type: 'warning',
  902. })
  903. return
  904. }
  905. if (!this.deptBudgetList.endDetailedAddress) {
  906. this.$message({
  907. message: '终到地详细地址不能为空!',
  908. type: 'warning',
  909. })
  910. return
  911. }
  912. if (this.checkList.length <= 0) {
  913. this.$message({
  914. message: '运输方式多选框不能为空!',
  915. type: 'warning',
  916. })
  917. return
  918. }
  919. for (var i = 0; i < this.deptBudgetList.tranProcessInfoList.length; i++) {
  920. this.deptBudgetList.tranProcessInfoList[i].processNo =
  921. this.deptBudgetList.taskNo + (i + 1)
  922. if (
  923. new Date(
  924. this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart
  925. ).getTime() >
  926. new Date(
  927. this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd
  928. ).getTime()
  929. ) {
  930. this.$message({
  931. message: '发货日期不能大于最晚到货日期!',
  932. type: 'warning',
  933. })
  934. return
  935. }
  936. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateStart) {
  937. this.$message({
  938. message: '发货日期不能为空!',
  939. type: 'warning',
  940. })
  941. return
  942. }
  943. if (!this.deptBudgetList.tranProcessInfoList[i].deliveryDateEnd) {
  944. this.$message({
  945. message: '最晚到货日期不能为空!',
  946. type: 'warning',
  947. })
  948. return
  949. }
  950. if (!this.deptBudgetList.tranProcessInfoList[i].weight) {
  951. this.$message({
  952. message: '重量不能为空!',
  953. type: 'warning',
  954. })
  955. return
  956. }
  957. if (!this.deptBudgetList.tranProcessInfoList[i].sender) {
  958. this.$message({
  959. message: '发货人不能为空!',
  960. type: 'warning',
  961. })
  962. return
  963. }
  964. if (!this.deptBudgetList.tranProcessInfoList[i].senderPhone) {
  965. this.$message({
  966. message: '发货人电话不能为空!',
  967. type: 'warning',
  968. })
  969. return
  970. }
  971. if (!this.deptBudgetList.tranProcessInfoList[i].receiver) {
  972. this.$message({
  973. message: '收货人不能为空!',
  974. type: 'warning',
  975. })
  976. return
  977. }
  978. if (!this.deptBudgetList.tranProcessInfoList[i].receiverPhone) {
  979. this.$message({
  980. message: '收货人电话不能为空!',
  981. type: 'warning',
  982. })
  983. return
  984. }
  985. if (
  986. !this.deptBudgetList.tranProcessInfoList[i].receiveDetailedAddress
  987. ) {
  988. this.$message({
  989. message: '收获详细地址不能为空!',
  990. type: 'warning',
  991. })
  992. return
  993. }
  994. if (!this.deptBudgetList.tranProcessInfoList[i].sendDetailedAddress) {
  995. this.$message({
  996. message: '发货详细地址不能为空!',
  997. type: 'warning',
  998. })
  999. return
  1000. }
  1001. }
  1002. if (this.endflag) {
  1003. this.$confirm(`运输任务提交成功后将派发到物流部门,是否确定提交?`, {
  1004. confirmButtonText: '确定',
  1005. cancelButtonText: '取消',
  1006. type: 'warning',
  1007. })
  1008. .then(() => {
  1009. this.$refs.deptBudgetList.validate((valid) => {
  1010. if (valid) {
  1011. this.deptBudgetList.compId =
  1012. sessionStorage.getItem('ws-pf_compId')
  1013. this.deptBudgetList.tranType = this.checkList.toString()
  1014. this.deptBudgetList.startPrivate =
  1015. CodeToText[this.selectedOptions[0]]
  1016. this.deptBudgetList.startCity =
  1017. CodeToText[this.selectedOptions[1]]
  1018. this.deptBudgetList.startArea =
  1019. CodeToText[this.selectedOptions[2]]
  1020. this.deptBudgetList.tranProcessInfoList[0].sendPrivate =
  1021. CodeToText[this.selectedOptions[0]]
  1022. this.deptBudgetList.tranProcessInfoList[0].sendCity =
  1023. CodeToText[this.selectedOptions[1]]
  1024. this.deptBudgetList.tranProcessInfoList[0].sendArea =
  1025. CodeToText[this.selectedOptions[2]]
  1026. if (this.endflag) {
  1027. this.deptBudgetList.tranProcessInfoList[
  1028. this.deptBudgetList.tranProcessInfoList.length - 1
  1029. ].receivePrivate = CodeToText[this.selectedOptions1[0]]
  1030. this.deptBudgetList.tranProcessInfoList[
  1031. this.deptBudgetList.tranProcessInfoList.length - 1
  1032. ].receiveCity = CodeToText[this.selectedOptions1[1]]
  1033. this.deptBudgetList.tranProcessInfoList[
  1034. this.deptBudgetList.tranProcessInfoList.length - 1
  1035. ].receiveArea = CodeToText[this.selectedOptions1[2]]
  1036. }
  1037. if (
  1038. this.deptBudgetList.taskType != '销售出库' ||
  1039. this.deptBudgetList.taskType != '贸易服务出库' ||
  1040. this.deptBudgetList.taskType != '暂存出库'
  1041. ){
  1042. this.deptBudgetList.endPrivate = CodeToText[this.selectedOptions1[0]]
  1043. this.deptBudgetList.endCity = CodeToText[this.selectedOptions1[1]]
  1044. this.deptBudgetList.endArea = CodeToText[this.selectedOptions1[2]]
  1045. }
  1046. for (
  1047. var i = 0;
  1048. i < this.deptBudgetList.tranProcessInfoList.length;
  1049. i++
  1050. ) {
  1051. this.deptBudgetList.tranProcessInfoList[i].sort = i
  1052. }
  1053. addtrantask(this.deptBudgetList)
  1054. .toPromise()
  1055. .then((response) => {
  1056. this.$message.success('添加成功')
  1057. this.deptBudgetList = {
  1058. taskNo: '',
  1059. totalStorage: 0,
  1060. goodsName: '玉米',
  1061. goodsNameKey: 1,
  1062. warehouseType: '1',
  1063. tranProcessInfoList: [
  1064. {
  1065. processNo: '',
  1066. tranType: '汽运',
  1067. deliveryDateStart: '',
  1068. deliveryDateEnd: '',
  1069. weight: '',
  1070. selectedOptions: [],
  1071. selectedOptions1: [],
  1072. sendPrivate: '',
  1073. sendCity: '',
  1074. sendArea: '',
  1075. receivePrivate: '',
  1076. receiveCity: '',
  1077. receiveArea: '',
  1078. sendDetailedAddress: '',
  1079. receiveDetailedAddress: '',
  1080. sender: '',
  1081. receiver: '',
  1082. senderPhone: '',
  1083. receiverPhone: '',
  1084. contractNo: '',
  1085. receiveWarehouse: '',
  1086. },
  1087. ],
  1088. }
  1089. this.$router.push({ path: 'tranManagementTransport' })
  1090. })
  1091. } else {
  1092. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1093. return false
  1094. }
  1095. })
  1096. })
  1097. .catch(() => {
  1098. return false
  1099. })
  1100. } else {
  1101. this.$confirm(`您还未选择最终阶段,是否确定提交??`, {
  1102. confirmButtonText: '确定',
  1103. cancelButtonText: '取消',
  1104. type: 'warning',
  1105. })
  1106. .then(() => {
  1107. this.$refs.deptBudgetList.validate((valid) => {
  1108. if (valid) {
  1109. this.deptBudgetList.compId =
  1110. sessionStorage.getItem('ws-pf_compId')
  1111. this.deptBudgetList.tranType = this.checkList.toString()
  1112. this.deptBudgetList.startPrivate =
  1113. CodeToText[this.selectedOptions[0]]
  1114. this.deptBudgetList.startCity =
  1115. CodeToText[this.selectedOptions[1]]
  1116. this.deptBudgetList.startArea =
  1117. CodeToText[this.selectedOptions[2]]
  1118. this.deptBudgetList.tranProcessInfoList[0].sendPrivate =
  1119. CodeToText[this.selectedOptions[0]]
  1120. this.deptBudgetList.tranProcessInfoList[0].sendCity =
  1121. CodeToText[this.selectedOptions[1]]
  1122. this.deptBudgetList.tranProcessInfoList[0].sendArea =
  1123. CodeToText[this.selectedOptions[2]]
  1124. if (this.endflag) {
  1125. this.deptBudgetList.tranProcessInfoList[
  1126. this.deptBudgetList.tranProcessInfoList.length - 1
  1127. ].receivePrivate = CodeToText[this.selectedOptions1[0]]
  1128. this.deptBudgetList.tranProcessInfoList[
  1129. this.deptBudgetList.tranProcessInfoList.length - 1
  1130. ].receiveCity = CodeToText[this.selectedOptions1[1]]
  1131. this.deptBudgetList.tranProcessInfoList[
  1132. this.deptBudgetList.tranProcessInfoList.length - 1
  1133. ].receiveArea = CodeToText[this.selectedOptions1[2]]
  1134. }
  1135. if (
  1136. this.deptBudgetList.taskType != '销售出库' ||
  1137. this.deptBudgetList.taskType != '贸易服务出库' ||
  1138. this.deptBudgetList.taskType != '暂存出库'
  1139. ){
  1140. this.deptBudgetList.endPrivate = CodeToText[this.selectedOptions1[0]]
  1141. this.deptBudgetList.endCity = CodeToText[this.selectedOptions1[1]]
  1142. this.deptBudgetList.endArea = CodeToText[this.selectedOptions1[2]]
  1143. }
  1144. for (
  1145. var i = 0;
  1146. i < this.deptBudgetList.tranProcessInfoList.length;
  1147. i++
  1148. ) {
  1149. this.deptBudgetList.tranProcessInfoList[i].sort = i
  1150. }
  1151. addtrantask(this.deptBudgetList)
  1152. .toPromise()
  1153. .then((response) => {
  1154. this.$message.success('添加成功')
  1155. this.deptBudgetList = {
  1156. taskNo: '',
  1157. totalStorage: 0,
  1158. goodsName: '玉米',
  1159. goodsNameKey: 1,
  1160. warehouseType: '1',
  1161. tranProcessInfoList: [
  1162. {
  1163. processNo: '',
  1164. tranType: '汽运',
  1165. deliveryDateStart: '',
  1166. deliveryDateEnd: '',
  1167. weight: '',
  1168. selectedOptions: [],
  1169. selectedOptions1: [],
  1170. sendPrivate: '',
  1171. sendCity: '',
  1172. sendArea: '',
  1173. receivePrivate: '',
  1174. receiveCity: '',
  1175. receiveArea: '',
  1176. sendDetailedAddress: '',
  1177. receiveDetailedAddress: '',
  1178. sender: '',
  1179. receiver: '',
  1180. senderPhone: '',
  1181. receiverPhone: '',
  1182. contractNo: '',
  1183. receiveWarehouse: '',
  1184. },
  1185. ],
  1186. }
  1187. this.$router.push({ path: 'tranManagementTransport' })
  1188. })
  1189. } else {
  1190. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1191. return false
  1192. }
  1193. })
  1194. })
  1195. .catch(() => {
  1196. return false
  1197. })
  1198. }
  1199. },
  1200. resetForm(deptBudgetList) {
  1201. this.$refs[deptBudgetList].resetFields()
  1202. },
  1203. },
  1204. }
  1205. </script>
  1206. <style lang="scss" scoped>
  1207. .position {
  1208. position: relative;
  1209. border: 1px solid #5473e8;
  1210. border-radius: 4px;
  1211. margin-top: 20px;
  1212. background: #f6f7fc;
  1213. border-left: 5px solid #5473e8;
  1214. }
  1215. /deep/.position .ws-info-table .el-form-item {
  1216. width: 25%;
  1217. height: 50px;
  1218. }
  1219. /deep/.position .el-select,
  1220. /deep/.el-select {
  1221. width: 100%;
  1222. }
  1223. /deep/.position .ws-info-table .el-form-item .el-form-item__label,
  1224. /deep/.position .ws-info-table .el-form-item .el-form-item__content {
  1225. background: #f6f7fc;
  1226. font-size: 14px;
  1227. color: #8890b1;
  1228. }
  1229. .typeselect {
  1230. width: 42%;
  1231. margin-left: 32px;
  1232. }
  1233. .del,
  1234. .add {
  1235. cursor: pointer;
  1236. margin-left: 10px;
  1237. }
  1238. .el-checkbox-group {
  1239. font-size: 0;
  1240. float: right;
  1241. margin-left: 25px;
  1242. }
  1243. .check-box {
  1244. float: left;
  1245. font-size: 14px;
  1246. color: #8890b1;
  1247. }
  1248. .el-checkbox__label {
  1249. color: #8890b1;
  1250. }
  1251. .el-form {
  1252. padding: 0 10%;
  1253. }
  1254. .ws-info-table {
  1255. border: none;
  1256. }
  1257. /deep/.ws-info-table .el-form-item {
  1258. border-right: 1px solid #cdd2dc;
  1259. border-bottom: 1px solid #cdd2dc;
  1260. }
  1261. .readonly {
  1262. position: relative;
  1263. }
  1264. .title {
  1265. position: relative;
  1266. }
  1267. .title::before {
  1268. content: '';
  1269. display: inline-block;
  1270. width: 5px;
  1271. height: 30px;
  1272. background: #5473e8;
  1273. position: absolute;
  1274. left: 0;
  1275. }
  1276. //去边框
  1277. /deep/.el-form-item {
  1278. border-right: 0px;
  1279. border-bottom: 0px;
  1280. }
  1281. .el-form {
  1282. margin-top: 50px;
  1283. }
  1284. .endflag {
  1285. vertical-align: top;
  1286. }
  1287. .el-col {
  1288. background: #f6f7fc;
  1289. }
  1290. .bg-left {
  1291. padding-left: 30px;
  1292. }
  1293. .bg-right {
  1294. padding-right: 10px;
  1295. text-align: right;
  1296. }
  1297. .bg-bottom {
  1298. margin: 15px 0px;
  1299. }
  1300. .el-radio,
  1301. .el-radio__input {
  1302. margin-top: 11px;
  1303. margin-left: 11px;
  1304. width: 93px;
  1305. }
  1306. .driver {
  1307. margin-top: 10px;
  1308. font-weight: bold;
  1309. margin-left: 20px;
  1310. color: #5473e8;
  1311. font-size: 16px;
  1312. }
  1313. /deep/.nei {
  1314. .ws-info-table {
  1315. border: none;
  1316. }
  1317. .el-form-item {
  1318. width: 33.3333%;
  1319. border: none;
  1320. .el-form-item__label {
  1321. background: transparent;
  1322. border: none;
  1323. }
  1324. .el-form-item__content {
  1325. border: none;
  1326. }
  1327. }
  1328. }
  1329. /deep/.el-table--border:after,
  1330. /deep/.el-table--group:after,
  1331. /deep/.el-table:before {
  1332. background: transparent;
  1333. }
  1334. //输入框标题
  1335. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1336. background: #ffffff;
  1337. width: min-content;
  1338. font-size: 14px;
  1339. color: #8890b1;
  1340. }
  1341. //表单子项
  1342. /deep/.ws-info-table .el-form-item {
  1343. width: 20%;
  1344. border: none;
  1345. height: 50px;
  1346. }
  1347. //输入框
  1348. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1349. border: none;
  1350. font-size: 14px;
  1351. color: #8890b1;
  1352. }
  1353. /deep/ .el-input--small .el-input__inner {
  1354. font-size: 14px;
  1355. color: #8890b1;
  1356. }
  1357. .el-form-item.start-address.el-form-item--small {
  1358. width: 31.9%;
  1359. }
  1360. .el-cascader {
  1361. width: 100%;
  1362. }
  1363. .el-form {
  1364. height: 73vh;
  1365. overflow: scroll;
  1366. }
  1367. </style>