|
@@ -1,11 +1,11 @@
|
|
<template>
|
|
<template>
|
|
<!-- 添加油价信息 -->
|
|
<!-- 添加油价信息 -->
|
|
<div class="addWagonLoad">
|
|
<div class="addWagonLoad">
|
|
- <PageTitle>返回</PageTitle>
|
|
|
|
- <div class="form-box" style="margin-right: 10rem">
|
|
|
|
- <dil-form :formId="357" v-model="form1" ref="from1"></dil-form>
|
|
|
|
|
|
+ <page-title>返回</page-title>
|
|
|
|
+ <div class="form_box" style="margin-right: 10rem">
|
|
|
|
+ <dil-form :formId="357" v-model="form1" ref="from1" @change="onchang"></dil-form>
|
|
</div>
|
|
</div>
|
|
- <div class="button-box">
|
|
|
|
|
|
+ <div class="button_box">
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button type="primary" @click="makeSure">确定</el-button>
|
|
<el-button type="primary" @click="makeSure">确定</el-button>
|
|
</div>
|
|
</div>
|
|
@@ -14,82 +14,82 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import PageTitle from "@/components/Page/Title";
|
|
import PageTitle from "@/components/Page/Title";
|
|
-
|
|
|
|
|
|
+import { isNumber } from '@/utils/sharedJsFile'
|
|
export default {
|
|
export default {
|
|
components: { PageTitle },
|
|
components: { PageTitle },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- form1: {},
|
|
|
|
- value: undefined,
|
|
|
|
|
|
+ form1: {
|
|
|
|
+ priceOilName:'',
|
|
|
|
+ priceValue:'',
|
|
|
|
+ priceDate:new Date(),
|
|
|
|
+ enableStatus:false,
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- mounted() {},
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onchang(val){
|
|
|
|
+ if(val.enableStatus){
|
|
|
|
+ this.$message.warning('确认启用后将停用现在正在执行的油品价格')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
makeSure() {
|
|
makeSure() {
|
|
- console.log(this.form1);
|
|
|
|
- let RmsOilPrice = {
|
|
|
|
- priceOilName:this.form1.priceOilName,
|
|
|
|
- priceId:this.form1.priceId,
|
|
|
|
- priceDate:this.form1.priceDate,
|
|
|
|
- priceValue:this.form1.priceValue,
|
|
|
|
- };
|
|
|
|
- if(
|
|
|
|
- RmsOilPrice.priceOilName ==null ||
|
|
|
|
- RmsOilPrice.priceDate ==null ||
|
|
|
|
- RmsOilPrice.priceValue ==null
|
|
|
|
- )this.$message.error("存在空值!");
|
|
|
|
- else
|
|
|
|
- this.axios
|
|
|
|
- .post(
|
|
|
|
- "/api/v1/rms/insertOilPrice" , RmsOilPrice
|
|
|
|
- )
|
|
|
|
|
|
+ console.log(!isNumber(this.form1.priceValue));
|
|
|
|
+ let state = false;
|
|
|
|
+ if(!this.form1.priceOilName){
|
|
|
|
+ this.$message.warning('请填写油品名称')
|
|
|
|
+ }else if(!this.form1.priceValue){
|
|
|
|
+ this.$message.warning('请填写油品价格')
|
|
|
|
+ }else if(!isNumber(this.form1.priceValue)){
|
|
|
|
+ this.$message.warning('油品价格必修为整数或者小数')
|
|
|
|
+ }else{
|
|
|
|
+ // state = true;
|
|
|
|
+ }
|
|
|
|
+ if(state){
|
|
|
|
+ let RmsOilPrice = this.form1;
|
|
|
|
+ this.axios.post("/api/v1/rms/insertOilPrice" , RmsOilPrice)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
- if (res.data.code == 200) {
|
|
|
|
- this.$message({
|
|
|
|
- type: "success",
|
|
|
|
- message: "新增成功!",
|
|
|
|
- });
|
|
|
|
- // this.$refs.table.refreshData();
|
|
|
|
- this.$router.go(-1);
|
|
|
|
- } else {
|
|
|
|
- this.$message.error("新增失败,可能存在重复!");
|
|
|
|
|
|
+ if (res.data.code == "200") {
|
|
|
|
+ this.$message.success('新增成功');
|
|
|
|
+ this.cancel();
|
|
}
|
|
}
|
|
- // this.$refs['table'].resetField();
|
|
|
|
});
|
|
});
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 取消
|
|
// 取消
|
|
cancel() {
|
|
cancel() {
|
|
- this.$router.go(-1);
|
|
|
|
|
|
+ this.$router.push("/oilPrice");
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-<style lang='scss' >
|
|
|
|
- .button-box{
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: center;
|
|
|
|
- .el-button{
|
|
|
|
- width: 80px;
|
|
|
|
- margin-right: 10px;
|
|
|
|
|
|
+<style lang='scss'>
|
|
|
|
+.addWagonLoad{
|
|
|
|
+ .form_box{
|
|
|
|
+ margin-left: 40%;
|
|
|
|
+ padding-top: 30px;
|
|
|
|
+ width: 310px;
|
|
|
|
+ .el-form{
|
|
|
|
+ .el-form-item{
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ .el-form-item__content{
|
|
|
|
+ .el-input{
|
|
|
|
+ width: 250px;
|
|
|
|
+ }
|
|
|
|
+ .el-switch{
|
|
|
|
+ margin-left: -250px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-.form-box{
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: center;
|
|
|
|
- .el-form-item{
|
|
|
|
|
|
+ .button_box{
|
|
|
|
+ margin-left: 40%;
|
|
|
|
+ padding-top: 30px;
|
|
|
|
+ width: 310px;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
- .el-form-item__label{
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- }
|
|
|
|
- .el-form-item__content{
|
|
|
|
- .el-input{
|
|
|
|
- .el-input__inner{
|
|
|
|
- width: 250px;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|