addDeliveryNotice.vue 16 KB

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