addLoadShip.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <!-- 新增装船作业 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <!-- 第一部分 -->
  6. <div class="top">
  7. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  8. <el-button type="primary" class="btn" @click="onclick()">
  9. <i class="el-icon-search"></i>查询
  10. </el-button>
  11. </div>
  12. <dilTable v-bind.sync="option" @radio-change="currentRadioChange">
  13. </dilTable>
  14. <div class="form">
  15. <!-- 第二部分 -->
  16. <div class="form_box">
  17. <dil-form :formId="120" v-model="form"></dil-form>
  18. </div>
  19. </div>
  20. <div class="button_box">
  21. <el-button type="primary" @click="makeSure">新增装船作业</el-button>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import PageTitle from "@/components/Page/Title";
  27. import { sjTime } from "@/utils/sharedJsFile";
  28. export default {
  29. components: { PageTitle },
  30. data() {
  31. return {
  32. input:'',
  33. restaurants: [],
  34. state: "",
  35. form: {},
  36. option: {
  37. // 表格请求数据的地址
  38. requestUrl: "/api/v1/tms/getCapacityList?apiId=138",
  39. // 控制显示当选列
  40. selectionType: "radio",
  41. rowMap:{},
  42. },
  43. };
  44. },
  45. mounted() {
  46. },
  47. methods: {
  48. currentRadioChange(row) {
  49. this.rowMap=row
  50. console.log(this.rowMap);
  51. },
  52. // 新增
  53. makeSure() {
  54. let mapVal = {
  55. resultActualInstallations: this.form.resultActualInstallations,
  56. // portId: this.form.portId,
  57. resultLoadShipDate: sjTime(
  58. this.form.resultLoadShipDate
  59. ),
  60. resultIsClear: this.form.resultIsClear,
  61. resultPortDeclarationTime: sjTime(
  62. this.form.resultPortDeclarationTime
  63. ),
  64. resultPortDeclarationName: this.form.resultPortDeclarationName,
  65. resultArrivalTime: sjTime(
  66. this.form.resultArrivalTime
  67. ),
  68. resultOutWharyName: this.form.resultOutWharyName,
  69. resultOutWharyTime: sjTime(
  70. this.form.resultOutWharyTime
  71. ),
  72. resultMemo: this.form.resultMemo,
  73. };
  74. console.log(mapVal);
  75. if (
  76. mapVal.resultActualInstallations==null||
  77. // mapVal.portId==null||
  78. mapVal.resultLoadShipDate==null||
  79. mapVal.resultIsClear==null||
  80. mapVal.resultPortDeclarationTime==null||
  81. mapVal.resultPortDeclarationName==null||
  82. mapVal.resultArrivalTime==null||
  83. mapVal.resultOutWharyName==null||
  84. mapVal.resultOutWharyTime==null||
  85. mapVal.resultMemo==null
  86. ) this.$message.error("存在空值!");
  87. else
  88. this.axios
  89. .post(
  90. "/api/v1/tms/addLoadShip",
  91. {
  92. mapVal:mapVal,
  93. rowMap:this.rowMap
  94. }
  95. )
  96. .then((res) => {
  97. if (res.data.code == 200) {
  98. this.$message({
  99. type: "success",
  100. message: "新增成功!",
  101. });
  102. // this.$refs.table.refreshData();
  103. this.$router.go(-1);
  104. } else {
  105. this.$message.error("新增失败!");
  106. }
  107. this.$refs['table'].resetField();
  108. });
  109. },
  110. handleSelect(item) {
  111. console.log(item);
  112. },
  113. onclick() {
  114. this.option.requestUrl = "/api/v1/tms/getCapacityList?apiId=138&con=" + this.input
  115. },
  116. },
  117. };
  118. </script>
  119. <style lang='scss'>
  120. .shipTransport{
  121. .form{
  122. display: flex;
  123. .form_box{
  124. width: 320px;
  125. margin-left: 35%;
  126. margin-top: 30px;
  127. margin-right: 20px;
  128. .el-form{
  129. .preview-group{
  130. .el-form-item{
  131. .el-form-item__label{
  132. display: inline-block;
  133. width: 70px !important;
  134. }
  135. .el-form-item__content{
  136. .el-select{
  137. width: 250px;
  138. }
  139. .el-input{
  140. width: 250px;
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. }
  148. .top {
  149. padding: 1.25rem 0.375rem;
  150. .el-input {
  151. width: 20%;
  152. margin-right: 1.25rem;
  153. }
  154. }
  155. .button_box{
  156. margin-left: 45%;
  157. }
  158. }
  159. </style>