editContractPrice.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <!-- 修改合同单价信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <div class="form-box">
  6. <!-- <dil-form :formId="271" v-model="form1" ref="from1"></dil-form> -->
  7. <el-form v-model="form">
  8. <div class="preview-group">
  9. <el-form-item label="合同号">
  10. <el-input v-model="form.contractNo"></el-input>
  11. </el-form-item>
  12. <el-form-item label="单价">
  13. <el-input v-model="form.unitPrice" type="number"></el-input>
  14. </el-form-item>
  15. <el-form-item label="起始日期">
  16. <el-date-picker
  17. v-model="form.startTime"
  18. type="datetime"
  19. placeholder="选择日期">
  20. </el-date-picker>
  21. </el-form-item>
  22. <el-form-item label="截止日期">
  23. <el-date-picker
  24. v-model="form.endTime"
  25. type="datetime"
  26. placeholder="选择日期">
  27. </el-date-picker>
  28. </el-form-item>
  29. <!-- <el-form-item label="港口:">
  30. <el-select filterable v-model="portId">
  31. <el-option v-for="item in ports" :value="item.portId" :key="item.portId" :label="item.portName"></el-option>
  32. </el-select>
  33. </el-form-item> -->
  34. </div>
  35. </el-form>
  36. </div>
  37. <div class="button-box">
  38. <el-button @click="cancel">取消</el-button>
  39. <el-button type="primary" @click="makeSure" :loading="isLoading">确定</el-button>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import PageTitle from "@/components/Page/Title";
  45. import { sjTime } from "@/utils/sharedJsFile";
  46. import { getCookie } from "@/utils/util.js";
  47. export default {
  48. components: { PageTitle },
  49. data() {
  50. return {
  51. form: {
  52. contractNo:null,
  53. unitPrice:null,
  54. startTime:null,
  55. endTime:null,
  56. userId:getCookie("userId")
  57. },
  58. portId:null,
  59. ports:[],
  60. isLoading:false
  61. };
  62. },
  63. mounted() {
  64. //this.getPorts();
  65. this.information();
  66. },
  67. methods: {
  68. //渲染界面
  69. information() {
  70. console.log("resultId",this.$route.params.resultId);
  71. this.axios
  72. .post(
  73. "/api/v1/rms/selectBmsshipPriceList/" +
  74. this.$route.params.resultId
  75. )
  76. .then((res) => {
  77. console.log(res)
  78. res.data.data.forEach((e) => {
  79. this.form = e;
  80. console.log(e);
  81. });
  82. });
  83. },
  84. makeSure() {
  85. this.isLoading=true;
  86. console.log(this.form);
  87. let map=this.form;
  88. map={
  89. resultId:this.form.resultId,
  90. contractNo:this.form.contractNo,
  91. unitPrice:this.form.unitPrice,
  92. startTime: sjTime(this.form.startTime),
  93. endTime:sjTime(this.form.endTime),
  94. userId:getCookie("userId")
  95. }
  96. if (map.contractNo == null ||
  97. map.contractNo =='' ||
  98. map.unitPrice =='' ||
  99. map.unitPrice == null ||
  100. map.startTime == null ||
  101. map.endTime == null){
  102. this.$message.error("存在空值!");
  103. this.isLoading=false;
  104. }else if(map.startTime>=map.endTime){
  105. this.$message.error("起始日期必须小于截止日期!");
  106. this.isLoading=false;
  107. }else{
  108. this.axios.post("/api/v1/rms/updateBmsshipContractPrice",map).then(res => {
  109. if (res.data.code == 200) {
  110. this.$message({
  111. type: "success",
  112. message: "修改成功!"
  113. });
  114. this.cancel();
  115. this.isLoading=false;
  116. } else {
  117. this.$message.error(res.data.data);
  118. this.isLoading=false;
  119. }
  120. });
  121. }
  122. },
  123. // 取消
  124. cancel() {
  125. this.$router.go(-1);
  126. },
  127. //查询港口id
  128. getPorts(){
  129. this.axios.post("/api/v1/rms/getPortName?index=").then(res => {
  130. if (res.data.code == 200) {
  131. this.ports=res.data.data;
  132. console.log(this.ports);
  133. } else {
  134. this.$message.error(res.data.data);
  135. }
  136. });
  137. }
  138. }
  139. };
  140. </script>
  141. <style lang="scss">
  142. .button-box {
  143. display: flex;
  144. justify-content: center;
  145. margin: 20px;
  146. .el-button {
  147. width: 80px;
  148. margin: 10px;
  149. }
  150. }
  151. .form-box {
  152. display: flex;
  153. justify-content: center;
  154. .el-form-item {
  155. display: flex;
  156. justify-content: center;
  157. .el-form-item__label {
  158. display: flex;
  159. align-items: center;
  160. }
  161. .el-form-item__content {
  162. .el-input {
  163. .el-input__inner {
  164. width: 250px;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. </style>