<template>
  <el-dialog v-model="props.modelValue" title="心愿单详情" width="900px" @closed="closeDialog" @open="openDialog">
    <el-form ref="formRef" :model="formData" :disabled="true">
      <el-row>


        <el-col :span="12">
          <el-form-item :label-width="labelWidth" label="心愿名称" prop="wish_list_name">
            <el-input v-model='formData.wish_list_name' type="text" placeholder='请输入心愿名称'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item :label-width="labelWidth" label="作者" prop="wish_list_author">
            <el-input v-model='formData.wish_list_author' type="text" placeholder='请输入作者'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='12'>
          <el-form-item :label-width='labelWidth' label='完成状态' prop='wish_list_status'>
            <el-switch v-model='formData.wish_list_status' class='mt-2' inline-prompt :inactive-value=1 :active-value=2
              style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949' />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item :label-width="labelWidth" label="完成日期" prop="wish_list_complete_date">
            <el-date-picker :disabled="formData.wish_list_status === 1" v-model="formData.wish_list_complete_date" type="date" value-format="YYYY-MM-DD"
              placeholder="完成日期" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item :label-width="labelWidth" label="排序" prop="wish_list_sort">
            <el-input-number v-model='formData.wish_list_sort' controls-position='right' :min='1'></el-input-number>
          </el-form-item>
        </el-col>

      </el-row>
    </el-form>
  </el-dialog>
</template>

<script setup>
import { reactive, ref, watch } from "vue";
import { isEmptyObject } from "~/utils/index";
import { getDictionary } from '~/service/wish_list';

// --业务参数



// --业务方法

// 字典获取
const complete_status = ref([]);
async function get_complete_status() {
  await getDictionary({ dictionary_value: 'complete_status' }).then((res) => {
    complete_status.value = res
  })
}



// --基础参数
const formRef = ref();
const labelWidth = 100;

const props = defineProps({
  modelValue: Boolean,
  data: Object,
  done: Function,
});
const emits = defineEmits(["update:modelValue"]);
const formData = ref({
  ...props.data,
});


// --基础方法
watch(props, (v) => {
  formData.value = v.data;


});

// 打开弹窗时执行
const openDialog = () => {

  get_complete_status()

};

const closeDialog = () => {
  emits("update:modelValue", false);
};
</script>

<style lang="less" scoped></style>
