addContractPrice.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. },
  66. methods: {
  67. makeSure() {
  68. this.isLoading=true;
  69. if (this.form.contractNo == null ||
  70. this.form.contractNo =='' ||
  71. this.form.unitPrice =='' ||
  72. this.form.unitPrice == null ||
  73. this.form.startTime == null ||
  74. this.form.endTime == null){
  75. this.$message.error("存在空值!");
  76. this.isLoading=false;
  77. }else if(this.form.startTime>=this.form.endTime){
  78. this.$message.error("起始日期必须小于截止日期!");
  79. this.isLoading=false;
  80. }
  81. else{
  82. let map=this.form;
  83. map.startTime = sjTime(this.form.startTime);
  84. map.endTime = sjTime(this.form.endTime);
  85. this.axios.post("/api/v1/rms/insertBmsshipContractPrice",map).then(res => {
  86. if (res.data.code == 200) {
  87. this.$message({
  88. type: "success",
  89. message: "新增成功!"
  90. });
  91. this.cancel();
  92. this.isLoading=false;
  93. } else {
  94. this.$message.error(res.data.data);
  95. this.isLoading=false;
  96. }
  97. });
  98. }
  99. },
  100. // 取消
  101. cancel() {
  102. this.$router.go(-1);
  103. },
  104. //查询港口id
  105. getPorts(){
  106. this.axios.post("/api/v1/rms/getPortName?index=").then(res => {
  107. if (res.data.code == 200) {
  108. this.ports=res.data.data;
  109. console.log(this.ports);
  110. } else {
  111. this.$message.error(res.data.data);
  112. }
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. .button-box {
  120. display: flex;
  121. justify-content: center;
  122. margin: 20px;
  123. .el-button {
  124. width: 80px;
  125. margin: 10px;
  126. }
  127. }
  128. .form-box {
  129. display: flex;
  130. justify-content: center;
  131. .el-form-item {
  132. display: flex;
  133. justify-content: center;
  134. .el-form-item__label {
  135. display: flex;
  136. align-items: center;
  137. }
  138. .el-form-item__content {
  139. .el-input {
  140. .el-input__inner {
  141. width: 250px;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>