addDeliveryNotice.vue 20 KB

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