<template>
  <el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
    <el-form ref="form" label-width="80px" :model="form" :rules="rules">
       <template >
      <el-form-item label="项目价格" prop="项目价格">
        <el-input v-model.trim="form.项目价格" autocomplete="off" />
      </el-form-item>
       </template>
       
    </el-form>
     
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="save">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import { additionalEdit } from '@/api/table'

  export default {
    name: 'TableEdit',
    data() {
      return {
          options: [{
          value: '已支付',
          label: '已支付'
        },
        ],
        form: {
          title: '',
          author: '',
          smallWow:'',
          time:'',
          author:''
        },
        rules: {
          车辆ID: [{ required: true, trigger: 'blur', message: '请输入车辆ID' }],
            小哇ID: [{ required: true, trigger: 'blur', message: '请输入小哇ID' }],
             时段ID: [{ required: true, trigger: 'blur', message: '请输入时段ID' }],
          预约日期: [{ required: true, trigger: 'blur', message: '请选择时间' }],
          订单状态: [{ required: true, trigger: 'blur', message: '请选择状态' }],
        },
        title: '',
        dialogFormVisible: false,
      }
    },
    created() {},
    methods: {
      showEdit(row) {
        if (!row) {
          this.title = '添加'
        } else {
          this.title = '编辑'
          this.form = Object.assign({}, row)
        }
        this.dialogFormVisible = true
      },
      close() {
        // this.$refs['form'].resetFields()
        // this.form = this.$options.data().form
        this.dialogFormVisible = false
        // this.$emit('fetch-data')
      },
      save() {
        // console.log(this.form,'--=')
        this.$refs['form'].validate(async (valid) => {
          if (valid) {
            const { msg } = await additionalEdit(this.form)
            this.$baseMessage(msg, 'success')
            this.$refs['form'].resetFields()
            this.$parent.fetchData();
            this.dialogFormVisible = false
            this.form = this.$options.data().form
          } else {
            return false
          }
        })
      },
    },
  }
</script>
