<script setup lang="ts" name="AddValue">
import { onMounted, reactive, ref, toRefs, watch } from "vue";

const props = defineProps<{
  modelValue: boolean;
  type: string;
}>();

const emit = defineEmits(["update:modelValue", 'cancel','confirm']);

const data = reactive({
  rules: {},
});

const { rules } = toRefs(data);

// 取消
const cancel = () => { 
  if (props.type === 'edit') { 
    
  }else if (props.type === 'add') { 
    
  }
  emit('cancel')
}

const confirm = () => {
  if (props.type === 'edit') { 
    
  }else if (props.type === 'add') { 
    
  }
  emit('confirm')
}


</script>

<template>
  <div>
    <el-form ref="formRef" :model="modelValue" label-width="70px" :disabled="readOnly">
      <el-form-item label="字典分类">
        <el-select v-model="modelValue.name" v-if="!readOnly" placeholder="请选择字典分类">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
      </el-form-item>
      <el-form-item label="值" required>
        <el-input v-model="modelValue.name" placeholder="请输入值"></el-input>
      </el-form-item>
      <el-form-item label="名称" required>
        <el-input v-model="modelValue.name" placeholder="请输入名称"></el-input>
      </el-form-item>
      <el-form-item label="父值" required>
        <el-input v-model="modelValue.name" placeholder="请输入父值"></el-input>
      </el-form-item>
    </el-form>
    <div class="btn">
      <el-button type="info" style="width: 150px;" @click="cancel">取消</el-button>
      <el-button type="primary" style="width: 150px;" @click="confirm">确认</el-button>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.btn {
  padding: 20px;
  display: flex;
  justify-content: center;
}
</style>