addDeliveryNotice.vue 14 KB

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