modifyCargoResult.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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="materialName" disabled> </el-input>
  9. <el-button class="mobutton" type="primary" @click="ondrawer(1)">浏览</el-button>
  10. </div> -->
  11. <div class="mofrom">
  12. <span class="motext">收货人</span>
  13. <el-input class="moinput" v-model="receiver" disabled> </el-input>
  14. <el-button class="mobutton" type="primary" @click="ondrawer(3)">浏览</el-button>
  15. </div>
  16. <div class="form">
  17. <div class="form_box">
  18. <dil-form :formId="137" v-model="form1"></dil-form>
  19. </div>
  20. </div>
  21. <!-- 模态框 -->
  22. <el-drawer
  23. :visible.sync="drawer"
  24. :direction="direction"
  25. size="50%"
  26. >
  27. <el-input
  28. placeholder="请输入内容"
  29. v-model="input"
  30. style="margin-top: 10px; margin-left: 20px; width:250px"
  31. clearable
  32. >
  33. </el-input>
  34. <el-button
  35. type="primary"
  36. class="btn"
  37. @click="onclick(a)"
  38. style="margin-bottom: 15px"
  39. >
  40. <i class="el-icon-search"></i>查询
  41. </el-button>
  42. <div v-show="a == 1">
  43. <dilTable
  44. v-bind.sync="second"
  45. @radio-change="currentRadioChange1"
  46. ></dilTable>
  47. </div>
  48. <div v-show="a == 2">
  49. <dilTable
  50. v-bind.sync="second1"
  51. @radio-change="currentRadioChange2"
  52. ></dilTable>
  53. </div>
  54. <div v-show="a == 3">
  55. <dilTable
  56. v-bind.sync="second2"
  57. @radio-change="currentRadioChange3"
  58. ></dilTable>
  59. </div>
  60. </el-drawer>
  61. <!-- 确定和取消 -->
  62. <div class="button_box">
  63. <el-button @click="onClickCancel">返回</el-button>
  64. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. import PageTitle from "@/components/Page/Title";
  70. export default {
  71. components: { PageTitle },
  72. data(){
  73. return {
  74. form1: {},
  75. materialName:"",
  76. receiver:"",
  77. drawer: false,
  78. direction: "rtl",
  79. input: "",
  80. second: {
  81. requestUrl: "/api/v1/uc/queryMaterialByLike?apiId=244",
  82. selectionType: "radio",
  83. mapList1: [],
  84. },
  85. second1: {
  86. requestUrl: "/api/v1/tms/selectShippeByName?apiId=215",
  87. selectionType: "radio",
  88. mapList2: [],
  89. },
  90. second2: {
  91. requestUrl: "/api/v1/tms/getGroupList?apiId=217",
  92. selectionType: "radio",
  93. mapList3: [],
  94. },
  95. }
  96. },
  97. mounted() {
  98. this.information();
  99. },
  100. methods: {
  101. onclick(a) {
  102. console.log(a);
  103. if (a == 1) {
  104. this.second.requestUrl =
  105. "/api/v1/uc/queryMaterialByLike?apiId=244&index=" + this.input;
  106. } else if (a == 2) {
  107. this.second1.requestUrl =
  108. "/api/v1/tms/selectShippeByName?apiId=215&con=" + this.input;
  109. } else {
  110. this.second2.requestUrl =
  111. "/api/v1/tms/getGroupList?apiId=217&con=" + this.input;
  112. }
  113. },
  114. ondrawer(num) {
  115. this.drawer = true;
  116. this.a = num;
  117. // 清空当前输入框中的数据
  118. this.input = "";
  119. },
  120. currentRadioChange1(selection) {
  121. (this.second.mapList1 = selection),
  122. (this.materialName = selection.materialName);
  123. },
  124. currentRadioChange2(selection) {
  125. (this.second1.mapList2 = selection), (this.cargo = selection.portName);
  126. },
  127. currentRadioChange3(selection) {
  128. (this.second2.mapList3 = selection), (this.receiver = selection.pierName);
  129. },
  130. information() {
  131. //编辑货权转移
  132. this.axios
  133. .post("/api/v1/tms/selectByCargoTranferResultId/" + this.$route.params.cargoTransferResultId)
  134. .then((res) => {
  135. console.log("res",res)
  136. this.form1 = res.data.data
  137. this.materialName = res.data.data.materialName;
  138. this.receiver = res.data.data.receiver;
  139. });
  140. },
  141. // 确认
  142. onClickConfirm() {
  143. let AmsshipCargoTransferResult = {
  144. cargoTransferResultId: this.$route.params.cargoTransferResultId,
  145. carrierId: this.form1.carrierId,
  146. groupId: this.form1.groupId,
  147. resultTelephoneFax: this.form1.resultTelephoneFax,
  148. resultContactPerson:this.form1.resultContactPerson,
  149. batchId:this.form1.batchId,
  150. resultNumberOfLoans: this.form1.resultNumberOfLoans,
  151. resultFreignForwardingInfo: this.form1.resultFreignForwardingInfo,
  152. resultMemo: this.form1.resultMemo,
  153. foreignShipName: this.form1.foreignShipName,
  154. materialId: this.second.mapList1.materialId,
  155. };
  156. //判断放货数量是否为数字
  157. function isNumber() {
  158. var value = AmsshipCargoTransferResult.resultNumberOfLoans;
  159. //验证是否为数字
  160. var patrn = /^(-)?\d+(\.\d+)?$/;
  161. if (patrn.exec(value) == null || value == "") {
  162. return false;
  163. } else {
  164. return true;
  165. }
  166. }
  167. //判断是否为电话号码
  168. function isTelePhone() {
  169. var value2 = AmsshipCargoTransferResult.resultTelephoneFax;
  170. //验证是否为数字
  171. var patrn = /^1[3-9]\d{9}$/;
  172. // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
  173. if (patrn.exec(value2) == null || value2 == "") {
  174. return false;
  175. } else {
  176. return true;
  177. }
  178. }
  179. //电话号码赋值
  180. var val2=this.value2;
  181. var val = this.value;
  182. if (
  183. AmsshipCargoTransferResult.foreignShipName == null ||
  184. AmsshipCargoTransferResult.resultNumberOfLoans == null ||
  185. AmsshipCargoTransferResult.resultContactPerson == null ||
  186. AmsshipCargoTransferResult.resultTelephoneFax == null
  187. )
  188. this.$message.error("存在空值!");
  189. else if (!isNumber(val)) this.$message.warning("放货数量必须为数字");
  190. else if (!isTelePhone(val2)) this.$message.warning("电话号码或传真格式不正确");
  191. else this.axios
  192. .post("/api/v1/tms/editCargoTransferResult" ,
  193. AmsshipCargoTransferResult
  194. )
  195. .then(() => {
  196. this.$message({
  197. type: "success",
  198. message: "修改成功!",
  199. });
  200. this.$router.go(-1);
  201. });
  202. },
  203. // 返回
  204. onClickCancel() {
  205. this.$router.go(-1);
  206. },
  207. },
  208. };
  209. </script>
  210. <style lang="scss">
  211. .shipTransport{
  212. .mofrom {
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. margin-top: 5px;
  217. margin-bottom: 20px;
  218. .motext{
  219. width: 70px;
  220. }
  221. .moinput{
  222. width: 250px;
  223. }
  224. .mobutton{
  225. margin-left: 5px;
  226. }
  227. }
  228. .form{
  229. display: flex;
  230. .form_box{
  231. width: 320px;
  232. margin-left: 35%;
  233. margin-top: 30px;
  234. margin-right: 20px;
  235. .el-form{
  236. .preview-group{
  237. .el-form-item{
  238. .el-form-item__label{
  239. display: inline-block;
  240. width: 70px !important;
  241. }
  242. .el-form-item__content{
  243. .el-select{
  244. width: 250px;
  245. }
  246. .el-input{
  247. width: 250px;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. }
  255. .button_box{
  256. margin-left: 45%;
  257. }
  258. }
  259. </style>