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. export default {
  28. components: { PageTitle },
  29. data() {
  30. return {
  31. input:'',
  32. restaurants: [],
  33. state: "",
  34. form: {},
  35. option: {
  36. // 表格请求数据的地址
  37. requestUrl: "/api/v1/tms/getCapacityList?apiId=138",
  38. // 控制显示当选列
  39. selectionType: "radio",
  40. rowMap:{},
  41. },
  42. };
  43. },
  44. mounted() {
  45. },
  46. methods: {
  47. currentRadioChange(row) {
  48. this.rowMap=row
  49. console.log(this.rowMap);
  50. },
  51. // 新增
  52. makeSure() {
  53. let mapVal = {
  54. resultActualInstallations: this.form.resultActualInstallations,
  55. // portId: this.form.portId,
  56. resultLoadShipDate: sjTime(
  57. this.form.resultLoadShipDate
  58. ),
  59. resultIsClear: this.form.resultIsClear,
  60. resultPortDeclarationTime: sjTime(
  61. this.form.resultPortDeclarationTime
  62. ),
  63. resultPortDeclarationName: this.form.resultPortDeclarationName,
  64. resultArrivalTime: sjTime(
  65. this.form.resultArrivalTime
  66. ),
  67. resultOutWharyName: this.form.resultOutWharyName,
  68. resultOutWharyTime: sjTime(
  69. this.form.resultOutWharyTime
  70. ),
  71. resultMemo: this.form.resultMemo,
  72. };
  73. console.log(mapVal);
  74. if (
  75. mapVal.resultActualInstallations==null||
  76. // mapVal.portId==null||
  77. mapVal.resultLoadShipDate==null||
  78. mapVal.resultIsClear==null||
  79. mapVal.resultPortDeclarationTime==null||
  80. mapVal.resultPortDeclarationName==null||
  81. mapVal.resultArrivalTime==null||
  82. mapVal.resultOutWharyName==null||
  83. mapVal.resultOutWharyTime==null||
  84. mapVal.resultMemo==null
  85. ) this.$message.error("存在空值!");
  86. else
  87. this.axios
  88. .post(
  89. "/api/v1/tms/addLoadShip",
  90. {
  91. mapVal:mapVal,
  92. rowMap:this.rowMap
  93. }
  94. )
  95. .then((res) => {
  96. if (res.data.code == 200) {
  97. this.$message({
  98. type: "success",
  99. message: "新增成功!",
  100. });
  101. // this.$refs.table.refreshData();
  102. this.$router.go(-1);
  103. } else {
  104. this.$message.error("新增失败!");
  105. }
  106. this.$refs['table'].resetField();
  107. });
  108. },
  109. handleSelect(item) {
  110. console.log(item);
  111. },
  112. onclick() {
  113. this.option.requestUrl = "/api/v1/tms/getCapacityList?apiId=138&con=" + this.input
  114. },
  115. },
  116. };
  117. </script>
  118. <style lang='scss'>
  119. .shipTransport{
  120. .form{
  121. display: flex;
  122. .form_box{
  123. width: 320px;
  124. margin-left: 35%;
  125. margin-top: 30px;
  126. margin-right: 20px;
  127. .el-form{
  128. .preview-group{
  129. .el-form-item{
  130. .el-form-item__label{
  131. display: inline-block;
  132. width: 70px !important;
  133. }
  134. .el-form-item__content{
  135. .el-select{
  136. width: 250px;
  137. }
  138. .el-input{
  139. width: 250px;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. .top {
  148. padding: 1.25rem 0.375rem;
  149. .el-input {
  150. width: 20%;
  151. margin-right: 1.25rem;
  152. }
  153. }
  154. .button_box{
  155. margin-left: 45%;
  156. }
  157. }
  158. </style>