<template>
  <el-dialog
    :title="$t1('您确定要回退当前版本吗？')"
    :visible.sync="showDialog"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    :modal="false"
    custom-class="dialog-style wf-dialog formVersion-preform-dialog"
    v-el-drag-dialog
    v-el-dialog-center
    @close="closeDialog"
  >
    <el-form ref="editForm" :model="formData">
      <div id="containt">
        <table class="table-detail">
          <tbody>
            <tr>
              <th>
                <span class="t">
                  <em class="f-red">*</em>
                  {{ $t1("提交内容") }}
                </span>
              </th>
              <td>
                <el-form-item
                  prop="logContent"
                  :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                >
                  <el-input
                    type="textarea"
                    :rows="8"
                    :placeholder="$attrs.placeholder || $t1('请输入提交内容')"
                    v-model="formData.logContent"
                  ></el-input>
                </el-form-item>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" plain class="button-sty" @click="closeDialog">
        <i class="el-icon-close el-icon"></i>
        {{ $t1("取 消") }}
      </el-button>
      <el-button type="primary" @click="confirmDialog" class="button-sty">
        <i class="el-icon-check el-icon"></i>
        {{ $t1("确 定") }}
      </el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  props: ["visiable"],
  data() {
    return {
      showDialog: true,
      formData: {
        logContent: null,
      },
    };
  },
  methods: {
    closeDialog() {
      this.showDialog = false;
      this.$emit("update:visiable", false);
    },
    confirmDialog() {
      this.$refs.editForm.$baseValidate((valid) => {
        if (valid) {
          this.closeDialog();
          this.$emit("confirm", this.formData);
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
::v-deep .formVersion-preform-dialog {
  .el-dialog__header {
    text-align: left;
  }
}
</style>
