<template>
  <div>
    <el-button size="mini" type="primary" @click="dialogFormVisible = true">新 建</el-button>
    <el-dialog title="新建调整单" width="30%" append-to-body :visible.sync="dialogFormVisible">
        <el-row :gutter="20">
          <el-form :model="form" :rules="rules" ref="form" label-width="90px" label-position="right" size="mini">
            <el-col :span="24">
              <el-form-item label="备注" prop="remarks">
                <el-input v-model="form.remarks" type="textarea" 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">确 定</el-button>
        </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  components:{},
  data () {
    return {
      dialogFormVisible:false,
      form:{
        sa_creditbillid:0,
        remarks:''
      },
      rules:{
      },
      params: {
        "id": "20221008164103",
        "version":1,
        "content": {
          "pageSize":20,
          "pageNumber":1,
          "where":{
              "condition":""
          }
        }
      },
    }
  },
  components:{},
  methods:{
    onSubmit () {
      this.$refs['form'].validate(async (valid) => {
        if (!valid) return false
        const res = await this.$api.requested({
        "id": "20221008155003",
        "version":1,
        "content": this.form
        })
        this.tool.showMessage(res,()=>{
          this.$emit('onSuccess')
          this.$refs['form'].resetFields();
          this.dialogFormVisible = false
          this.$router.push({path:'/creditbilladjDetail',query:{id:res.data.sa_creditbillid,rowindex:res.data.rowindex}})
          this.$store.dispatch('changeDetailDrawer',true)
        })
      })
      
    },
  },
  created() {
  },
  mounted () {
  }
}

</script>
<style scoped>
/deep/.el-select {
  width: 100%!important;
}
</style>