123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <!-- 添加油价信息 -->
- <div class="addWagonLoad">
- <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 class="addbtn">
- <el-button type="primary" @click="dialogVisible = true">新增油品名称</el-button>
- </div>
- </div>
- <div class="button_box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- <el-dialog
- title="新增油品名称"
- :visible.sync="dialogVisible"
- width="30%"
- >
- <el-input v-model="input" placeholder="请输入内容"></el-input>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogCancel">取 消</el-button>
- <el-button type="primary" @click="dialogMakeSure">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { isNumber } from '@/utils/sharedJsFile'
- export default {
- components: { PageTitle },
- data() {
- return {
- isagain:false,
- loading:false,
- input:null,
- dialogVisible:false,
- form1: {
- priceOilName:'',
- priceValue:'',
- priceDate:new Date(),
- enableStatus:false,
- },
- };
- },
- methods: {
- dialogCancel(){
- },
- onchang(val){
- if(val.enableStatus){
- this.$message.warning('确认启用后将停用现在正在执行的油品价格')
- }
- },
- dialogMakeSure(){
- // this.loading = true;
- // if(this.input){
- // this.axios.post('',{text:this.input}).then((res)=>{
- // if(res.data.code == "200"){
- // this.loading = false;
- // this.$message.success('新增成功')
- this.dialogVisible = false;
- // }
- // })
- // }else{
- // this.$message.warning('请输入油品名称')
- // }
- },
- makeSure() {
- this.loading = true;
- 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) => {
- if (res.data.code == "200") {
- this.loading = true;
- this.$message.success('新增成功');
- this.cancel();
- }
- });
- }else{
- this.loading = true;
- }
- },
- // 取消
- cancel() {
- this.$router.push("/oilPrice");
- },
- },
- };
- </script>
- <style lang='scss'>
- .addWagonLoad{
- .form_box{
- margin-left: 35%;
- padding-top: 30px;
- width: 470px;
- display: flex;
- .el-form{
- .el-form-item{
- display: flex;
- align-items: center;
- .el-form-item__content{
- .el-input{
- width: 250px;
- }
- .el-switch{
- margin-left: -250px;
- }
- }
- }
- }
- .addbtn{
- margin-left: 30px;
- }
- }
- .button_box{
- margin-left: 40%;
- padding-top: 30px;
- width: 310px;
- display: flex;
- justify-content: center;
- }
- }
- </style>
|