addCargoResult.vue 7.7 KB

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