123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <!-- 添加合同单价信息 -->
- <div class="addWagonLoad">
- <PageTitle>返回</PageTitle>
- <div class="form-box">
- <!-- <dil-form :formId="271" v-model="form1" ref="from1"></dil-form> -->
- <el-form v-model="form">
- <div class="preview-group">
- <el-form-item label="合同号">
- <el-input v-model="form.contractNo"></el-input>
- </el-form-item>
- <el-form-item label="单价">
- <el-input v-model="form.unitPrice" type="number"></el-input>
- </el-form-item>
- <el-form-item label="起始日期">
- <el-date-picker
- v-model="form.startTime"
- type="datetime"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="截止日期">
- <el-date-picker
- v-model="form.endTime"
- type="datetime"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- <!-- <el-form-item label="港口:">
- <el-select filterable v-model="portId">
- <el-option v-for="item in ports" :value="item.portId" :key="item.portId" :label="item.portName"></el-option>
- </el-select>
- </el-form-item> -->
- </div>
- </el-form>
- </div>
- <div class="button-box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure" :loading="isLoading">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { sjTime } from "@/utils/sharedJsFile";
- import { getCookie } from "@/utils/util.js";
- export default {
- components: { PageTitle },
- data() {
- return {
- form: {
- contractNo:null,
- unitPrice:null,
- startTime:null,
- endTime:null,
- userId:getCookie("userId")
- },
- portId:null,
- ports:[],
- isLoading:false
- };
- },
- mounted() {
- //this.getPorts();
- },
- methods: {
- makeSure() {
-
- this.isLoading=true;
- if (this.form.contractNo == null ||
- this.form.contractNo =='' ||
- this.form.unitPrice =='' ||
- this.form.unitPrice == null ||
- this.form.startTime == null ||
- this.form.endTime == null){
- this.$message.error("存在空值!");
- this.isLoading=false;
- }else if(this.form.startTime>=this.form.endTime){
- this.$message.error("起始日期必须小于截止日期!");
- this.isLoading=false;
- }
- else{
- let map=this.form;
- map.startTime = sjTime(this.form.startTime);
- map.endTime = sjTime(this.form.endTime);
- this.axios.post("/api/v1/rms/insertBmsshipContractPrice",map).then(res => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "新增成功!"
- });
- this.cancel();
- this.isLoading=false;
- } else {
- this.$message.error(res.data.data);
- this.isLoading=false;
- }
- });
- }
-
- },
- // 取消
- cancel() {
- this.$router.go(-1);
- },
- //查询港口id
- getPorts(){
- this.axios.post("/api/v1/rms/getPortName?index=").then(res => {
- if (res.data.code == 200) {
- this.ports=res.data.data;
- console.log(this.ports);
- } else {
- this.$message.error(res.data.data);
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .button-box {
- display: flex;
- justify-content: center;
- margin: 20px;
- .el-button {
- width: 80px;
- margin: 10px;
- }
- }
- .form-box {
- display: flex;
- justify-content: center;
- .el-form-item {
- display: flex;
- justify-content: center;
- .el-form-item__label {
- display: flex;
- align-items: center;
- }
- .el-form-item__content {
- .el-input {
- .el-input__inner {
- width: 250px;
- }
- }
- }
- }
- }
- </style>
|