<template>
    <el-dialog draggable v-model="dialogVisible" :title="title" style="width: 800px" :before-close="handleClose">
        <el-form :model="form" class="form-two" label-width="auto" :rules="rules">
            <el-form-item label="单据编号:" prop="billNo">
                <el-input v-model="form.billNo" placeholder="请输入单据编号" clearable></el-input>
            </el-form-item>
            <el-form-item label="单据名称:" prop="billName">
                <el-input v-model="form.billName" placeholder="请输入单据名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="单据类别:" prop="billType">
                <el-select v-model="form.billType" clearable placeholder="请选择单据类别" filterable>
                    <el-option
                        v-for="item in Categories"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="编制单位名称:" prop="createrOrgName">
                <el-input v-model="form.createrOrgName" placeholder="请输入编制单位名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="所属专业:" prop="specialityType">
                <el-select v-model="form.specialityType" clearable placeholder="请选择所属专业" filterable>
                    <el-option v-for="item in Major" :key="item.id" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="责任单位名称:" prop="orgName">
                <el-input v-model="form.orgName" placeholder="请输入责任单位名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="接收人名称:" prop="receiveUserId">
                <el-select v-model="form.receiveUserId" clearable placeholder="请选择接收人名称" filterable>
                    <el-option
                        v-for="item in ImplementationPeople"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="编制时间:" prop="createrTime">
                <el-date-picker
                    v-model="form.createrTime"
                    type="date"
                    value-format="YYYY-MM-DD"
                    placeholder="选择日期"
                ></el-date-picker>
            </el-form-item>
            <el-form-item label="主管部门名称:" prop="managerDeptName">
                <el-input v-model="form.managerDeptName" placeholder="请输入主管部门名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="主送单位名称:" prop="mainSenderName">
                <el-input v-model="form.mainSenderName" placeholder="请输入主送单位名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="抄送单位名称:" prop="copySenderName">
                <el-input v-model="form.copySenderName" placeholder="请输入抄送单位名称" clearable></el-input>
            </el-form-item>
            <el-form-item label="处理建议:" prop="dealAdvise">
                <el-input
                    v-model="form.dealAdvise"
                    type="textarea"
                    autosize
                    placeholder="请输入处理建议"
                    clearable
                ></el-input>
            </el-form-item>
            <el-form-item label="依据标准:" prop="techSupvBasis">
                <el-input v-model="form.techSupvBasis" type="textarea" autosize placeholder="请输入依据标准"></el-input>
            </el-form-item>
            <el-form-item label="问题描述:" prop="problemDesc">
                <el-input v-model="form.problemDesc" type="textarea" autosize placeholder="请输入问题描述"></el-input>
            </el-form-item>
        </el-form>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="handleClose">取消</el-button>
                <el-button type="primary" @click="submit">确认</el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useDictData } from '@/stores/dictData'

import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'

import { genFileId, ElMessage } from 'element-plus'
const emit = defineEmits(['onsubmit'])
const dictData = useDictData()
const manufactorList = dictData.getBasicData('Dev_Manufacturers')
const dialogVisible = ref(false)
const title: any = ref('')
const ImplementationPeople = ref([])
const Categories = ref([])
const Major = ref([])
const form: any = ref({
    billName: '',
    billNo: '',
    billType: '',
    copySenderId: '',
    copySenderName: '',
    createrOrgId: '',
    createrOrgName: '',
    createrTime: '',
    dealAdvise: '',
    mainSenderId: '',
    mainSenderName: '',
    managerDeptId: '',
    managerDeptName: '',
    orgId: '',
    orgName: '',
    problemDesc: '',
    receiveUserName: '',
    receiveUserId: '',
    specialityType: '',
    techSupvBasis: ''
})
const elform = ref()
const uploadRef = ref()
const rules = {
    billNo: [{ required: true, message: '请输入单据编号', trigger: 'blur' }],
    billName: [{ required: true, message: '请输入单据名称', trigger: 'blur' }],
    billType: [{ required: true, message: '请选择单据类别', trigger: 'change' }],
    createrOrgName: [{ required: true, message: '请选择编制单位', trigger: 'change' }],
    specialityType: [{ required: true, message: '请选择所属专业', trigger: 'change' }],
    orgName: [{ required: true, message: '请选择责任单位', trigger: 'change' }],
    createrTime: [{ required: true, message: '选择日期', trigger: 'change' }],
    managerDeptName: [{ required: true, message: '请选择主管部门名称', trigger: 'change' }],
    techSupvBasis: [{ required: true, message: '请输入依据标准', trigger: 'blur' }],
    problemDesc: [{ required: true, message: '请输入问题描述', trigger: 'blur' }],
    dealAdvise: [{ required: true, message: '请输入处理建议', trigger: 'blur' }],
    treatmentMeasures: [{ required: true, message: '请输入采取措施', trigger: 'blur' }],
    fillUserId: [{ required: true, message: '请选择接收人名称', trigger: 'change' }],
    completeTime: [{ required: true, message: '选择日期', trigger: 'change' }]
}
const submit = () => {
    handleClose()
}

const open = (text: any) => {
    dialogVisible.value = true
    title.value = text
}

const handleClose = () => {
    // elform.value.resetFields()
    dialogVisible.value = false
}

defineExpose({ open })
</script>
<style lang="scss" scoped>
:deep(.el-upload-list__item) {
    width: 400px;
}
</style>
