modifyDeliveryAttroney.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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"></dil-form>
  8. <el-form>
  9. <div class="preview-group">
  10. <el-form-item label="承运单位:">
  11. <el-select
  12. v-model="carrierId"
  13. filterable >
  14. <el-option
  15. v-for="carrier in carriers"
  16. :key="carrier.id"
  17. :label="carrier.label"
  18. :value="carrier.id">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="提货单位:">
  23. <el-select
  24. v-model="downSwimPortId"
  25. filterable >
  26. <el-option
  27. v-for="carrier in carriers"
  28. :key="carrier.id"
  29. :label="carrier.label"
  30. :value="carrier.id">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="到达港:">
  35. <el-select
  36. v-model="portId"
  37. filterable >
  38. <el-option
  39. v-for="port in ports"
  40. :key="port.portId"
  41. :label="port.portName"
  42. :value="port.portId">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. </div>
  47. </el-form>
  48. </div>
  49. </div>
  50. <!-- 确定和取消 -->
  51. <div class="button_box">
  52. <el-button @click="onClickCancel">返回</el-button>
  53. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import PageTitle from "@/components/Page/Title";
  59. import { sjTime } from '@/utils/sharedJsFile'
  60. export default {
  61. components: { PageTitle },
  62. data() {
  63. return {
  64. form1: {},
  65. carrierId:"",//承运单位id
  66. carriers:[],
  67. downSwimPortId:"",//提货单位id
  68. downSwimPorts:[],
  69. portId:"",//到达港id
  70. ports:[],
  71. value2: undefined,
  72. value3: undefined,
  73. batchInfactoryId:null,
  74. };
  75. },
  76. mounted() {
  77. this.getCarriers();
  78. this.getPorts();
  79. this.information();
  80. },
  81. methods: {
  82. //查询所有承运单位和提货单位
  83. getCarriers(){
  84. this.axios.get("/api/v1/tms/getPortName").then((res) => {
  85. if (res.data.code == 200) {
  86. //赋值
  87. this.carriers=res.data.data;
  88. this.downSwimPorts=res.data.data;
  89. } else {
  90. this.$message({
  91. type: "warning",
  92. message: res.data.data,
  93. });
  94. }
  95. });
  96. },
  97. //查询所有港口
  98. getPorts(){
  99. this.axios.post("/api/v1/rms/getPortName?index=").then((res) => {
  100. if (res.data.code == 200) {
  101. //赋值
  102. this.ports=res.data.data;
  103. } else {
  104. this.$message({
  105. type: "warning",
  106. message: res.data.data,
  107. });
  108. }
  109. });
  110. },
  111. information() {
  112. //编辑请车作业
  113. this.axios
  114. .post(
  115. "/api/v1/tms/getDeliveryAttorneyId/" + this.$route.params.attorneyId
  116. )
  117. .then((res) => {
  118. res.data.data.forEach((e) => {
  119. this.batchInfactoryId=e.batchInfactoryId;
  120. this.form1 = e;
  121. this.carrierId=e.carrierId;
  122. this.downSwimPortId=e.downSwimPortId;
  123. this.portId = e.portId;
  124. console.log(this.form1.batchId);
  125. });
  126. });
  127. },
  128. // 返回
  129. onClickCancel() {
  130. this.$router.go(-1);
  131. },
  132. // 确认
  133. onClickConfirm() {
  134. let AmsshipDeliveryAttorney = {
  135. resultId: this.$route.params.attorneyId,
  136. portId: this.portId,
  137. batchId:this.batchInfactoryId,
  138. attorneyContactTelephone:this.form1.attorneyContactTelephone,
  139. realForeignShipName:this.form1.realForeignShipName,
  140. attorenyPickupIdcard: this.form1.attorenyPickupIdcard,
  141. attorneyPickupContactPerson: this.form1.attorneyPickupContactPerson,
  142. downSwimPortId: this.downSwimPortId,
  143. attorneyTime: sjTime(this.form1.attorneyTime),
  144. carrierId:this.carrierId,
  145. requesterGroupId:this.form1.requesterGroupId
  146. };
  147. //校验下游港口,不能为万州港
  148. try {
  149. let downSwim=this.carriers.find(e=>{
  150. return e.id==this.downSwimPortId
  151. })
  152. if(downSwim.label=='万州港'){
  153. this.$message.warning("提货单位不能是万州港!");
  154. return;
  155. }
  156. } catch (error) {
  157. }
  158. //身份证校验
  159. function checkCardNo() {
  160. var value3 = AmsshipDeliveryAttorney.attorenyPickupIdcard;
  161. //验证是否为数字
  162. var patrn =
  163. /^[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)$/;
  164. if (patrn.exec(value3) == null || value3 == "") {
  165. return false;
  166. } else {
  167. return true;
  168. }
  169. }
  170. //判断是否为电话号码
  171. function isTelePhone() {
  172. var value2 = AmsshipDeliveryAttorney.attorneyContactTelephone;
  173. //验证是否为数字
  174. var patrn = /^1[3-9]\d{9}$/;
  175. // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
  176. if (patrn.exec(value2) == null || value2 == "") {
  177. return false;
  178. } else {
  179. return true;
  180. }
  181. }
  182. var val2 = this.value2;
  183. var val3 = this.value3;
  184. if (
  185. AmsshipDeliveryAttorney.attorneyTime == null ||
  186. AmsshipDeliveryAttorney.attorenyPickupIdcard == null ||
  187. AmsshipDeliveryAttorney.attorneyContactTelephone == null ||
  188. AmsshipDeliveryAttorney.attorneyPickupContactPerson == null
  189. )
  190. this.$message.error("存在空值,请核实以后再提交");
  191. else if (!isTelePhone(val2)) this.$message.warning("联系电话格式不正确");
  192. else if (!checkCardNo(val3)) this.$message.warning("请输入正确的身份证格式");
  193. else
  194. this.axios
  195. .post("/api/v1/tms/editDeliveryAttroney", AmsshipDeliveryAttorney)
  196. .then((res) => {
  197. if (res.data.code == 200) {
  198. this.$message({
  199. type: "success",
  200. message: "修改成功!",
  201. });
  202. }
  203. this.$router.go(-1);
  204. });
  205. },
  206. },
  207. };
  208. </script>
  209. <style lang="scss">
  210. .shipTransport {
  211. .form {
  212. display: flex;
  213. .form_box {
  214. width: 320px;
  215. margin-left: 35%;
  216. margin-top: 30px;
  217. margin-right: 20px;
  218. .el-form {
  219. .preview-group {
  220. .el-form-item {
  221. .el-form-item__label {
  222. display: inline-block;
  223. width: 70px !important;
  224. }
  225. .el-form-item__content {
  226. .el-select {
  227. width: 250px;
  228. }
  229. .el-input {
  230. width: 250px;
  231. }
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. .button_box {
  239. margin-left: 45%;
  240. }
  241. }
  242. </style>