<template>
  <div>
    <el-button size="mini" type="text" @click="editBtn">编 辑</el-button>
    <el-dialog title="新 增" append-to-body :visible.sync="dialogFormVisible" width="30%">
      <div slot="title" style="font-size: 15px">
        新增价格调整单
      </div>
      <el-row :gutter="20">
        <el-form :model="form" :rules="rules" ref="form" label-width="120px" label-position="left" size="mini">
          <el-col :span="24">
            <el-form-item label="备注" prop="remarks">
              <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="dialog-footer">
        <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "add",
  components:{},
  props:['data'],
  inject:[],
  data(){
    return {
      dialogFormVisible:false,
      projectAddress:[],
      form:{
        "sa_itempriceadjustid": 0,
        "remarks":""
      },
      rules:{
        remarks:[
          { required: true, message: '请填写备注', trigger: 'blur'},
        ]
      }
    }
  },
  created () {
  },
  methods:{
    editBtn () {
      this.dialogFormVisible = true
      this.form = Object.assign({},this.form,this.data)
    },
    onSubmit(){
      this.$refs['form'].validate(async (valid) => {
        if (!valid) return false
        const res = await this.$api.requested({
          "id": "20221024163804",
          "version":1,
          "content": this.form
        })
        this.tool.showMessage(res,()=>{
          this.$emit('onSuccess')
          this.$refs['form'].resetFields();
          this.dialogFormVisible = false
        })
      })
    },
  }
}
</script>

<style scoped>
/deep/.el-select {
  height: 28px !important;
  width: 100%;
}
/deep/.el-input__inner {
  height: 28px !important;
}
</style>