addDeliveryAttorney.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <!-- 添加提货委托 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="113" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div class="liulan">
  10. <el-button type="primary" class="btn" @click="onDrawer">浏览</el-button>
  11. </div>
  12. </div>
  13. <!-- 确定和取消 -->
  14. <div class="button_box">
  15. <el-button @click="cancel">取消</el-button>
  16. <el-button type="primary" @click="makeSure">确定</el-button>
  17. </div>
  18. <!-- 模态框 -->
  19. <el-drawer
  20. :visible.sync="drawer"
  21. :direction="direction"
  22. :before-close="handleClose"
  23. size="50%"
  24. >
  25. <el-input
  26. placeholder="请输入内容"
  27. v-model="input"
  28. style="margin-top: 10px; margin-left: 20px; width: 250px"
  29. clearable
  30. >
  31. </el-input>
  32. <el-button
  33. type="primary"
  34. class="btn"
  35. @click="onclick()"
  36. style="margin-bottom: 15px"
  37. >
  38. <i class="el-icon-search"></i>查询
  39. </el-button>
  40. <dilTable
  41. v-bind.sync="options"
  42. @radio-change="currentRadioChange1"
  43. ></dilTable>
  44. </el-drawer>
  45. </div>
  46. </template>
  47. <script>
  48. import PageTitle from "@/components/Page/Title";
  49. import { sjTime, isNumber } from "@/utils/sharedJsFile";
  50. import { getCookie } from "@/utils/util.js";
  51. export default {
  52. components: { PageTitle },
  53. data() {
  54. return {
  55. input: "",
  56. drawer: false,
  57. direction: "rtl",
  58. options: {
  59. requestUrl: "/api/v1/tms/getBatchListForAttorney?apiId=375",
  60. selectionType: "radio",
  61. maplist: []
  62. },
  63. batchIds: "",
  64. form1: {},
  65. value: undefined,
  66. value2: undefined
  67. };
  68. },
  69. created() {
  70. this.form1 = {
  71. downSwimPortId: 11
  72. };
  73. },
  74. mounted() {},
  75. methods: {
  76. onDrawer() {
  77. this.drawer = true;
  78. },
  79. onclick() {
  80. this.options.requestUrl =
  81. "/api/v1/tms/getBatchListForAttorney?apiId=375&con=" + this.input;
  82. },
  83. handleClose(done) {
  84. done();
  85. },
  86. currentRadioChange1(selection) {
  87. this.maplist = selection;
  88. if (JSON.stringify(this.maplist).length > 2) {
  89. this.$set(
  90. this.form1,
  91. "batchId",
  92. selection.resultForeignShipName + selection.materialName
  93. );
  94. this.batchIds = selection.batchId;
  95. }
  96. },
  97. // 确定
  98. makeSure() {
  99. // 判断用户是否输入了批次号
  100. if (this.batchIds == "" || this.batchIds == undefined) {
  101. this.$message.warning("请选择批次号");
  102. return;
  103. }
  104. let AmsshipDeliveryAttorney = {
  105. downSwimPortId: this.form1.downSwimPortId,
  106. attorenyPickupIdcard: this.form1.attorenyPickupIdcard,
  107. attorneyContactTelephone: this.form1.attorneyContactTelephone,
  108. batchId: this.batchIds,
  109. attorneyTime: sjTime(this.form1.attorneyTime),
  110. attorneyPdffile: this.form1.attorneyPdffile,
  111. noticeId: this.form1.noticeId,
  112. portId: this.form1.portId,
  113. attorneyPickupContactPerson: this.form1.attorneyPickupContactPerson,
  114. userId: getCookie("userId")
  115. // resultMemo: this.form1.resultMemo,
  116. };
  117. //身份证校验
  118. function checkCardNo() {
  119. var value3 = AmsshipDeliveryAttorney.attorenyPickupIdcard;
  120. //验证是否为数字
  121. var patrn = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
  122. // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
  123. if (patrn.exec(value3) == null || value3 == "") {
  124. return false;
  125. } else {
  126. return true;
  127. }
  128. }
  129. //判断是否为电话号码
  130. function isTelePhone() {
  131. var value2 = AmsshipDeliveryAttorney.attorneyContactTelephone;
  132. //验证是否为数字
  133. var patrn = /^1[3-9]\d{9}$/;
  134. // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
  135. if (patrn.exec(value2) == null || value2 == "") {
  136. return false;
  137. } else {
  138. return true;
  139. }
  140. }
  141. var val2 = this.value2;
  142. var val3 = this.value3;
  143. if (
  144. // AmsshipDeliveryAttorney.attorneyId==null||
  145. // AmsshipDeliveryAttorney.downSwimPortId == null ||
  146. AmsshipDeliveryAttorney.attorenyPickupIdcard == null ||
  147. AmsshipDeliveryAttorney.attorneyContactTelephone == null ||
  148. AmsshipDeliveryAttorney.attorneyPickupContactPerson == null
  149. )
  150. this.$message.error("存在空值,请核实以后再提交");
  151. else if (!isTelePhone(val2)) this.$message.warning("联系电话格式不正确");
  152. else if (!checkCardNo(val3))
  153. this.$message.warning("请输入正确的身份证格式");
  154. else
  155. this.axios
  156. .post(
  157. "/api/v1/tms/insertshipDeliveryAttorney",
  158. AmsshipDeliveryAttorney
  159. )
  160. .then(res => {
  161. this.$router.go(-1);
  162. });
  163. },
  164. // 取消
  165. cancel() {
  166. this.$router.go(-1);
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. .shipTransport {
  173. .form {
  174. display: flex;
  175. .form_box {
  176. width: 320px;
  177. margin-left: 35%;
  178. margin-top: 30px;
  179. margin-right: 20px;
  180. .el-form {
  181. .preview-group {
  182. .el-form-item {
  183. .el-form-item__label {
  184. display: inline-block;
  185. width: 70px !important;
  186. }
  187. .el-form-item__content {
  188. .el-select {
  189. width: 250px;
  190. }
  191. .el-input {
  192. width: 250px;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. .liulan {
  201. width: 120px;
  202. margin-top: 30px;
  203. .el-button {
  204. width: 100px !important;
  205. margin: auto;
  206. }
  207. .btn {
  208. margin-top: 0px;
  209. }
  210. .btn1 {
  211. margin-top: 13px;
  212. }
  213. .btn2 {
  214. margin-top: 67px;
  215. }
  216. }
  217. .button_box {
  218. margin-left: 45%;
  219. }
  220. }
  221. </style>