modifyDeliveryNotice.vue 16 KB

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