<template>
  <div>
    <el-button type="text" size="mini" @click="onShow">编 辑</el-button>
    <el-dialog title="编辑规则" :visible.sync="dialogFormVisible" width="500px">
      <el-form size="small" :model="form" label-position="left" label-width="140px">
        <el-form-item label="前置符">
          <el-input v-model="form.fixed" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="时间格式">
          <el-input v-model="form.timeformat" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数值长度">
          <el-input v-model="form.numlength" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="是否包含时间信息">
          <!-- <el-input v-model="form.numincludetime" autocomplete="off"></el-input> -->
          <el-checkbox :true-label="1" :false-label="0" v-model="form.numincludetime"></el-checkbox>
        </el-form-item>
      </el-form>
      <div class="dialog-footer">
        <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="warning" @click="submit" class="normal-btn-width btn-warning">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {
      dialogFormVisible:false,
      form:{}
    }
  },
  methods:{
    onShow () {
      this.dialogFormVisible = true
      this.form = Object.assign({},this.form,this.data.data)
    },
    async submit () {
      const res = await this.$api.requested({
        "classname": "webmanage.coderule.coderule",
        "method": "modify_coderule",
        "content": this.form
      })
      this.tool.showMessage(res,(e)=>{
        this.dialogFormVisible = false
        this.$emit('onSuccess')
      })
    }
  }
}

</script>
<style>
</style>