<template>

    <el-col :span="8" v-if="flag">
        <el-form-item label="创建人" prop="create_user">
            <el-input v-model="formData.create_user" clearable placeholder="请输入填表人" />
        </el-form-item>
    </el-col>
    <el-col :span="8" v-if="flag">
        <el-form-item label="创建时间" prop="create_time">
            <el-date-picker class="flex-1 !flex" v-model="formData.create_time" clearable type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择创建时间">
            </el-date-picker>
        </el-form-item>
    </el-col>

    <el-form-item label="创建人" prop="create_user" v-if="!flag">
        <el-input v-model="formData.create_user" clearable placeholder="请输入填表人" />
    </el-form-item>

    <el-form-item label="创建时间" prop="create_time" v-if="!flag">
        <el-date-picker class="flex-1 !flex" v-model="formData.create_time" clearable type="datetime"
            value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择创建时间">
        </el-date-picker>
    </el-form-item>
</template>



<script lang="ts" setup name="createUserLable">
import { defineProps } from "vue"
import { timeFormat } from '@/utils/util'
import useUserStore from "@/stores/modules/user";

let props = defineProps({
    flag: Boolean,
    formData: Object
})

const userStore = useUserStore().userInfo;
props.formData.create_user = props.formData.create_user || userStore.account
props.formData.create_time = props.formData.create_time || timeFormat('', 'yyyy-mm-dd hh:MM:ss')

</script>