<script setup lang="ts">
import { useReviewProcess } from "/@/hooks";
import { REMARK_MAX_LENGTH } from "/@/utils/global";
const status = {
  fail: "3",
  success: "2"
};

const emit = defineEmits(["changeStatus"]);

const { formData, formRules, formRef, handleChangeStatus } = useReviewProcess({
  callback: () => emit("changeStatus", formData),
  failStatus: status.fail
});
</script>

<template>
  <el-form
    inline
    :rules="formRules"
    :model="formData"
    ref="formRef"
    label-width="100px"
    flex
    justify-between
  >
    <div flex flex-col style="width: 50%">
      <el-form-item label="审核状态" prop="status">
        <el-select placeholder="请选择审核状态" v-model="formData.status">
          <el-option :value="status.success" label="通过" />
          <el-option :value="status.fail" label="不通过" />
        </el-select>
      </el-form-item>

      <el-form-item label="备注" prop="remark">
        <el-input
          type="textarea"
          :maxlength="2000"
          :rows="5"
          placeholder="请输入备注"
          v-model="formData.remark"
          v-bind="REMARK_MAX_LENGTH"
        />
      </el-form-item>
    </div>

    <el-button type="primary" @click="handleChangeStatus"
      >提交审核结果</el-button
    >
  </el-form>
</template>
