addDeliveryNotice.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <!-- 添加发货通知 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <!-- <div class="mofrom">
  6. <span class="motext">物资</span>
  7. <el-input class="moinput" v-model="materialName" disabled> </el-input>
  8. <el-button class="mobutton" type="primary" @click="ondrawer(1)"
  9. >浏览</el-button
  10. >
  11. </div> -->
  12. <!-- 货权转移送达单位
  13. <div class="mofrom">
  14. <span class="motext">货权转移送达单位</span>
  15. <el-input class="moinput" v-model="cargo" disabled> </el-input>
  16. <el-button class="mobutton" type="primary" @click="ondrawer(2)"
  17. >浏览</el-button
  18. >
  19. </div>-->
  20. <!--大品类 -->
  21. <div class="mofrom">
  22. <span class="motext">大品类</span>
  23. <el-input class="moinput" v-model="materialType" disabled> </el-input>
  24. <el-button class="mobutton" type="primary" @click="ondrawer(4)"
  25. >浏览</el-button
  26. >
  27. </div>
  28. <!-- 货权转移送达单位 -->
  29. <div class="mofrom">
  30. <span class="motext">收货人</span>
  31. <el-input class="moinput" v-model="receiver" disabled> </el-input>
  32. <el-button class="mobutton" type="primary" @click="ondrawer(3)"
  33. >浏览</el-button
  34. >
  35. </div>
  36. <!-- 批次 -->
  37. <div class="mofrom">
  38. <span class="motext">批次</span>
  39. <el-input class="moinput" v-model="batchIds" disabled> </el-input>
  40. <el-button class="mobutton" type="primary" @click="ondrawer(5)"
  41. >浏览</el-button
  42. >
  43. </div>
  44. <div class="form">
  45. <div class="form_box">
  46. <el-form>
  47. <div class="preview-group">
  48. <el-form-item label="发货港口:">
  49. <el-select
  50. v-model="portId"
  51. filterable >
  52. <el-option
  53. v-for="port in ports"
  54. :key="port.portId"
  55. :label="port.portName"
  56. :value="port.portId">
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. </div>
  61. </el-form>
  62. <dil-form
  63. :formId="112"
  64. v-model="form1"
  65. ref="from1"
  66. @change="onchange"
  67. ></dil-form>
  68. </div>
  69. <!-- <div class="liulan">
  70. <el-button type="primary" class="btn" @click="ondrawer(4)">浏览</el-button>
  71. </div> -->
  72. </div>
  73. <!-- 模态框 -->
  74. <el-drawer
  75. :visible.sync="drawer"
  76. :direction="direction"
  77. :before-close="handleClose"
  78. size="50%"
  79. >
  80. <el-input
  81. placeholder="请输入内容"
  82. v-model="input"
  83. style="margin-top: 10px; margin-left: 20px; width: 250px"
  84. clearable
  85. >
  86. </el-input>
  87. <el-button
  88. type="primary"
  89. class="btn"
  90. @click="onclick(a)"
  91. style="margin-bottom: 15px"
  92. >
  93. <i class="el-icon-search"></i>查询
  94. </el-button>
  95. <!-- <div v-show="a == 4">
  96. <dilTable v-bind.sync="options" @radio-change="currentRadioChange6"></dilTable>
  97. </div> -->
  98. <!-- <div v-show="a == 1">
  99. <dilTable
  100. v-bind.sync="second"
  101. @radio-change="currentRadioChange1"
  102. ></dilTable>
  103. </div> -->
  104. <div v-show="a == 2">
  105. <dilTable
  106. v-bind.sync="second1"
  107. @radio-change="currentRadioChange2"
  108. ></dilTable>
  109. </div>
  110. <div v-show="a == 3">
  111. <dilTable
  112. v-bind.sync="second2"
  113. @radio-change="currentRadioChange3"
  114. ></dilTable>
  115. </div>
  116. <div v-show="a == 4">
  117. <dilTable
  118. v-bind.sync="second3"
  119. @radio-change="currentRadioChange4"
  120. ></dilTable>
  121. </div>
  122. <div v-show="a == 5">
  123. <dilTable
  124. v-bind.sync="second5"
  125. @radio-change="currentRadioChange5"
  126. ></dilTable>
  127. </div>
  128. </el-drawer>
  129. <el-form
  130. :inline="true"
  131. class="demo-form-inline"
  132. label-width="80px"
  133. style="margin-left: 450px; display: flex"
  134. >
  135. <el-form-item label="上传货权转移附件">
  136. <el-upload
  137. class="upload-demo"
  138. style="width: 270px"
  139. ref="upload1"
  140. accept=".pdf , .jpg, .png, .jpeg, .tif, .gif, .pcx, .tga, .exif, .fpx, .svg , .bmp"
  141. action="/api/v1/tms/uploadCargoPic"
  142. :before-upload="beforeUpload"
  143. :multiple="false"
  144. list-type="picture"
  145. :show-file-list="false"
  146. :on-success="handleAvatarSuccess"
  147. :on-error="onError(1)"
  148. >
  149. <span class="span"></span>
  150. <el-input
  151. class="shippingCertificate"
  152. style="width: 270px; display: flex"
  153. placeholder="请选择货权附件(必填项)"
  154. v-model="shippingCertificate"
  155. disabled
  156. >
  157. </el-input>
  158. <el-button
  159. size="small"
  160. type="primary"
  161. style="
  162. width: 115px;
  163. height: 35px;
  164. margin-left: 275px;
  165. margin-top: -35px;
  166. display: flex;
  167. "
  168. @click="upCLick(1)"
  169. >
  170. 点击上传附件</el-button
  171. >
  172. </el-upload>
  173. </el-form-item>
  174. </el-form>
  175. <!-- 确定和取消 -->
  176. <div class="button_box">
  177. <el-button @click="cancel">取消</el-button>
  178. <el-button type="primary" @click="makeSure" :loading="isLoading">确定</el-button>
  179. </div>
  180. </div>
  181. </template>
  182. <script>
  183. import PageTitle from "@/components/Page/Title";
  184. import { sjTime, isNumber } from "@/utils/sharedJsFile";
  185. import { getCookie } from "@/utils/util.js";
  186. export default {
  187. components: { PageTitle },
  188. data() {
  189. return {
  190. isLoading:false,
  191. a: 1,
  192. cargoPictureUrl: "",
  193. shippingCertificate: "",
  194. portId:null,
  195. ports:[],
  196. materialType: "",
  197. receiver: "",
  198. input: "",
  199. drawer: false,
  200. direction: "rtl",
  201. batchId: null,
  202. form1: {},
  203. second1: {
  204. requestUrl: "/api/v1/tms/selectShippeByName?apiId=215",
  205. selectionType: "radio",
  206. mapList2: [],
  207. },
  208. second2: {
  209. requestUrl: "/api/v1/tms/getGroupList?apiId=217",
  210. selectionType: "radio",
  211. mapList3: [],
  212. },
  213. second3: {
  214. requestUrl: "/api/v1/rms/getMaterialTypeList?apiId=376",
  215. selectionType: "radio",
  216. mapList4: [],
  217. },
  218. second5: {
  219. requestUrl: "/api/v1/tms/getBatchIdByForeign?apiId=489",
  220. selectionType: "radio",
  221. mapList5: [],
  222. },
  223. value: undefined,
  224. value2: undefined,
  225. value4: undefined,
  226. value5: undefined,
  227. value6: undefined,
  228. value7: undefined,
  229. value8: undefined,
  230. batchIds:null,
  231. };
  232. },
  233. mounted() {
  234. // this.$set(this.form1, "requesterGroupId", 1); //委托单位(requesterGroupId)承运单位(carrierId)转移到提货委托
  235. // this.$set(this.form1, "carrierId", 11);
  236. this.getPorts();
  237. },
  238. methods: {
  239. //查询所有港口
  240. getPorts(){
  241. this.axios.post("/api/v1/rms/getPortName?index=").then((res) => {
  242. if (res.data.code == 200) {
  243. //赋值
  244. this.ports=res.data.data;
  245. } else {
  246. this.$message({
  247. type: "warning",
  248. message: res.data.data,
  249. });
  250. }
  251. });
  252. },
  253. upCLick(val) {
  254. this.num = val;
  255. },
  256. beforeUpload(file) {
  257. this.upBool = true;
  258. const isLt2M = file.size < 1024 * 1024 * 0.5;
  259. if (!isLt2M) {
  260. this.$message.error("上传文件大小不能超过500kb!");
  261. } else {
  262. let size = file.size / 1024;
  263. let _URL = window.URL || window.webkitURL;
  264. let img = new Image();
  265. img.src = _URL.createObjectURL(file);
  266. }
  267. return isLt2M;
  268. },
  269. onError(err) {
  270. if (this.upBool) {
  271. if (this.num == 1) {
  272. this.shippingCertificate = null;
  273. this.cargoPictureUrl = null;
  274. // this.$message.error("上传失败");
  275. }
  276. }
  277. },
  278. handleAvatarSuccess(res, file) {
  279. if (res.code) {
  280. this.upBool = false;
  281. if (this.num == 1) {
  282. this.cargoPictureUrl = res.data;
  283. this.shippingCertificate = file.name;
  284. }
  285. this.$message.success("上传成功");
  286. }
  287. },
  288. currentRadioChange() {
  289. console.log(1);
  290. },
  291. ondrawer(num) {
  292. this.drawer = true;
  293. this.a = num;
  294. // 清空当前输入框中的数据
  295. this.input = "";
  296. },
  297. // currentRadioChange1(selection) {
  298. // (this.second.mapList1 = selection),
  299. // (this.materialName = selection.materialName);
  300. // },
  301. currentRadioChange2(selection) {
  302. (this.second1.mapList2 = selection), (this.cargo = selection.cargoName);
  303. },
  304. currentRadioChange3(selection) {
  305. (this.second2.mapList3 = selection), (this.receiver = selection.pierName);
  306. },
  307. currentRadioChange4(selection) {
  308. (this.second3.mapList4 = selection),
  309. (this.materialType = selection.materialTypeName);
  310. },
  311. currentRadioChange5(selection) {
  312. (this.second5.mapList5 = selection),
  313. (this.batchIds = selection.foreignShipName+""+selection.materialName);
  314. },
  315. onchange(val) {},
  316. onclick(a) {
  317. if (a == 2) {
  318. this.second1.requestUrl =
  319. "/api/v1/tms/selectShippeByName?apiId=215&con=" + this.input;
  320. } else if (a == 3) {
  321. this.second2.requestUrl =
  322. "/api/v1/tms/getGroupList?apiId=217&con=" + this.input;
  323. } else if (a == 4) {
  324. // console.log("aaaa");
  325. this.second3.requestUrl =
  326. "/api/v1/rms/getMaterialTypeList?apiId=376&con=" + this.input;
  327. }else if(a==5){
  328. this.second5.requestUrl =
  329. "/api/v1/tms/getBatchIdByForeign?apiId=489&con=" + this.input;
  330. }
  331. },
  332. handleClose(done) {
  333. done();
  334. },
  335. makeSure() {
  336. // if (this.second.mapList1.length == 0) {
  337. // this.$message.warning("请选择物资");
  338. // return;
  339. // }
  340. // if (this.second1.mapList2.length == 0) {
  341. // this.$message.warning("请选择送达单位");
  342. // return;
  343. // }
  344. this.isLoading=true;
  345. if (this.second2.mapList3.length == 0) {
  346. this.$message.warning("请选择收货人");
  347. this.isLoading=false;
  348. return;
  349. }
  350. if (this.second3.mapList4.length == 0) {
  351. this.$message.warning("请选择物资品类");
  352. this.isLoading=false;
  353. return;
  354. }
  355. if (this.second5.mapList5.length == 0) {
  356. this.$message.warning("请选择批次");
  357. this.isLoading=false;
  358. return;
  359. }
  360. //判断是否为电话号码
  361. function isTelePhone() {
  362. var value2 = map.resultTelephoneFax;
  363. //验证是否为数字
  364. var patrn = /^1[3-9]\d{9}$/;
  365. // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
  366. if (patrn.exec(value2) == null || value2 == "") {
  367. return false;
  368. } else {
  369. return true;
  370. }
  371. }
  372. //电话号码赋值
  373. var val2 = this.value2;
  374. let map = {
  375. // carrierId: this.form1.carrierId, //委托单位(requesterGroupId)承运单位(carrierId)转移到提货委托
  376. // requesterGroupId: this.form1.requesterGroupId,
  377. noticeCommerceMethod: this.form1.noticeCommerceMethod,
  378. noticeHandoverMethod: this.form1.noticeHandoverMethod,
  379. portId: this.portId,
  380. noticePortConstructionFee: this.form1.noticePortConstructionFee,
  381. noticeDeliveryTime: sjTime(this.form1.noticeDeliveryTime),
  382. noticePileFreeDays: this.form1.noticePileFreeDays,
  383. batchIds:this.second5.mapList5.batchId,
  384. purchaseContractUnitPrice: this.form1.purchaseContractUnitPrice,
  385. purchaseContractMoisture: this.form1.purchaseContractMoisture,
  386. //微元素含量
  387. tfeContent: this.form1.tfeContent,
  388. silicaContent: this.form1.silicaContent,
  389. aluminaContent: this.form1.aluminaContent,
  390. phosphorusContent: this.form1.phosphorusContent,
  391. manganeseContent: this.form1.manganeseContent,
  392. resultContactPerson: this.form1.resultContactPerson,
  393. resultTelephoneFax: this.form1.resultTelephoneFax,
  394. resultFreightForwardingInfo: this.form1.resultFreightForwardingInfo,
  395. resultMemo: this.form1.resultMemo,
  396. resultNumberOfLoans: this.form1.resultNumberOfLoans,
  397. cargoId: this.second1.mapList2.cargoId,
  398. groupId: this.second2.mapList3.id,
  399. inFactoryShipName: this.form1.inFactoryShipName,
  400. foreignShipName: this.second5.mapList5.foreignShipName,
  401. materialId: this.second5.mapList5.materialId,
  402. materialTypeId: this.second3.mapList4.materialTypeId,
  403. isNeedPortDisCharge: this.form1.isNeedPortDisCharge,
  404. isNeedPortFee: this.form1.isNeedPortFee,
  405. isNeedBonded: this.form1.isNeedBonded,
  406. cargoPictureUrl: this.cargoPictureUrl,
  407. userId: getCookie("userId"),
  408. };
  409. console.log(map);
  410. //判断放货数量是否为数字
  411. if (
  412. map.noticeCommerceMethod == null ||
  413. map.noticeHandoverMethod == null ||
  414. map.noticePortConstructionFee == null ||
  415. map.noticeDeliveryTime == null ||
  416. map.noticePileFreeDays == null ||
  417. map.purchaseContractUnitPrice == null ||
  418. map.purchaseContractMoisture == null ||
  419. map.tfeContent == null ||
  420. map.silicaContent == null ||
  421. map.aluminaContent == null ||
  422. map.phosphorusContent == null ||
  423. map.manganeseContent == null ||
  424. map.resultContactPerson == null ||
  425. map.resultTelephoneFax == null ||
  426. map.resultNumberOfLoans == null ||
  427. map.portId == null ||
  428. map.groupId == null ||
  429. map.inFactoryShipName == null ||
  430. map.isNeedPortDisCharge == null ||
  431. map.isNeedPortFee == null ||
  432. map.isNeedBonded == null
  433. // map.foreignShipName==null||
  434. // map.materialId==null
  435. ) {
  436. this.$message.error("存在空值!");
  437. this.isLoading=false;
  438. return;
  439. }
  440. if (!isTelePhone(val2)) {
  441. this.$message.warning("电话号码或传真格式不正确");
  442. this.isLoading=false;
  443. return;
  444. }
  445. if (
  446. typeof map.noticePortConstructionFee != "undefined" &&
  447. !isNumber(map.noticePortConstructionFee)
  448. ) {
  449. this.$message.error("港建费金额得为数字");
  450. this.isLoading=false;
  451. return;
  452. }
  453. if (
  454. typeof map.purchaseContractMoisture != "undefined" &&
  455. !isNumber(map.purchaseContractMoisture)
  456. ) {
  457. this.$message.error("合同水分得为数字");
  458. this.isLoading=false;
  459. return;
  460. }
  461. if (
  462. typeof map.noticePortConstructionFee != "undefined" &&
  463. !isNumber(map.noticePortConstructionFee)
  464. ) {
  465. this.$message.error("港建费金额得为数字");
  466. this.isLoading=false;
  467. return;
  468. }
  469. if (
  470. typeof map.noticePileFreeDays != "undefined" &&
  471. !isNumber(map.noticePileFreeDays)
  472. ) {
  473. this.$message.error("免堆天数得为数字");
  474. this.isLoading=false;
  475. return;
  476. }
  477. if (
  478. typeof map.purchaseContractUnitPrice != "undefined" &&
  479. !isNumber(map.purchaseContractUnitPrice)
  480. ) {
  481. this.$message.error("单价得为数字");
  482. this.isLoading=false;
  483. return;
  484. }
  485. if (typeof map.tfeContent != "undefined" && !isNumber(map.tfeContent)) {
  486. this.$message.error("tfe含量得为数字");
  487. this.isLoading=false;
  488. return;
  489. }
  490. if (
  491. typeof map.silicaContent != "undefined" &&
  492. !isNumber(map.silicaContent)
  493. ) {
  494. this.$message.error("二氧化硅含量得为数字");
  495. this.isLoading=false;
  496. return;
  497. }
  498. if (
  499. typeof map.aluminaContent != "undefined" &&
  500. !isNumber(map.aluminaContent)
  501. ) {
  502. this.$message.error("氧化铝含量得为数字");
  503. this.isLoading=false;
  504. return;
  505. }
  506. if (
  507. typeof map.phosphorusContent != "undefined" &&
  508. !isNumber(map.phosphorusContent)
  509. ) {
  510. this.$message.error("含磷量得为数字");
  511. this.isLoading=false;
  512. return;
  513. }
  514. if (
  515. typeof map.resultNumberOfLoans != "undefined" &&
  516. !isNumber(map.resultNumberOfLoans)
  517. ) {
  518. this.$message.error("放货数量得为数字");
  519. this.isLoading=false;
  520. return;
  521. } else
  522. this.axios.post("/api/v1/tms/insertDeliveryNotice", map).then((res) => {
  523. if (res.data.code == 200) {
  524. this.$message({
  525. type: "success",
  526. message: "新增成功",
  527. });
  528. this.cancel();
  529. } else {
  530. this.$message({
  531. type: "warning",
  532. message: res.data.data,
  533. });
  534. }
  535. }).then(()=>{
  536. this.isLoading=false;
  537. });
  538. },
  539. // 取消
  540. cancel() {
  541. this.$router.go(-1);
  542. },
  543. },
  544. };
  545. </script>
  546. <style lang="scss">
  547. .shipTransport {
  548. .form {
  549. display: flex;
  550. .form_box {
  551. width: 320px;
  552. margin-left: 35%;
  553. margin-top: 30px;
  554. margin-right: 20px;
  555. .el-form {
  556. .preview-group {
  557. .el-form-item {
  558. .el-form-item__label {
  559. display: inline-block;
  560. width: 70px !important;
  561. }
  562. .el-form-item__content {
  563. .el-select {
  564. width: 250px;
  565. }
  566. .el-input {
  567. width: 250px;
  568. }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. }
  575. .mofrom {
  576. display: flex;
  577. align-items: center;
  578. justify-content: center;
  579. margin-top: 5px;
  580. margin-right: 10px;
  581. .motext {
  582. width: 70px;
  583. }
  584. .moinput {
  585. width: 250px;
  586. }
  587. .mobutton {
  588. margin-left: 6px;
  589. }
  590. }
  591. .button_box {
  592. margin-left: 35%;
  593. }
  594. .liulan {
  595. margin-left: -4px;
  596. width: 120px;
  597. margin-top: 30px;
  598. .el-button {
  599. margin: auto;
  600. }
  601. .btn {
  602. margin-top: 0px;
  603. }
  604. .btn1 {
  605. margin-top: 13px;
  606. }
  607. .btn2 {
  608. margin-top: 67px;
  609. }
  610. }
  611. .button_box {
  612. margin-left: 45%;
  613. }
  614. }
  615. </style>