<template>
  <el-dialog
    width="30%"
    :title="
      props.recommendation == 'aso_success' ? '同意': '驳回'
    "
    v-model="dialogShow"
    @close="handleCloses"
  >
    <el-form :model="form">
      <el-row>
        <el-col :span="24">
          <el-form-item label="操作类型">
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-input
            clearable
            v-model="form.comment"
            type="textarea"
            :autosize="{ minRows: 4, maxRows: 8 }"
            placeholder="审批意见"
          />
        </el-col>
        <el-col :span="24">
          <div v-if="props.recommendation != 'aso_success'"> </div>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="submit"> 提交 </el-button>
        <el-button @click="handleCloses">取消</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref, watch } from 'vue'

const props = defineProps(['show', 'recommendation'])
const emit = defineEmits(['clone', 'submit', 'reject'])
let dialogShow = ref(false)
let form = ref({})
let QuickSuggestions = ref('')
watch(
  () => props.show,
  () => {
    console.log(props.show + '1')

    dialogShow.value = props.show
  },
  { deep: true }
)
watch(
  () => props.recommendation,
  () => {
    QuickSuggestions.value = props.recommendation
  },
  { deep: true }
)
const handleCloses = () => {
  emit('clone')
}
const changeComment = () => {
  form.value.comment = form.value.option
}
const submit = () => {
  console.log('22222222', props.recommendation)
  if (props.recommendation == 'aso_success') {
    emit('submit', form.value.comment)
    form.value = {}
  } else {
    emit('reject', form.value.comment)
    form.value = {}
  }
}
</script>

<style scoped></style>
