<template>
|
<div class="notice">
|
<el-dialog
|
v-model="dialogVisible"
|
:title="title"
|
width="500px"
|
:before-close="handleClose"
|
>
|
<el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="110px" >
|
<el-form-item label="姓名:" prop="name">
|
<el-input v-model.trim="state.form.name"></el-input>
|
</el-form-item>
|
<el-form-item label="性别:" prop="sex">
|
<el-radio-group v-model="state.form.sex" >
|
<el-radio :label="0">男</el-radio>
|
<el-radio :label="1">女</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="身份证号:" prop="idCard">
|
<el-input v-model.trim="state.form.idCard"></el-input>
|
</el-form-item>
|
<!-- <el-form-item label="等级:" prop="ratingLevel">-->
|
<!-- <el-radio-group v-model="state.form.ratingLevel">-->
|
<!-- <el-radio label="1">一级</el-radio>-->
|
<!-- <el-radio label="2">二级</el-radio>-->
|
<!-- <el-radio label="3">三级</el-radio>-->
|
<!-- </el-radio-group>-->
|
<!-- </el-form-item>-->
|
<el-form-item label="专业领域:" prop="domain">
|
<el-input v-model.trim="state.form.domain"></el-input>
|
</el-form-item>
|
<el-form-item label="工作单位:" prop="companyName">
|
<el-input v-model.trim="state.form.companyName"></el-input>
|
</el-form-item>
|
<el-form-item label="职称:" prop="title">
|
<el-input v-model.trim="state.form.title"></el-input>
|
</el-form-item>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="handleClose" size="default">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
<script setup>
|
import {reactive, ref, toRefs} from 'vue'
|
import Editor from "@/components/Editor/index.vue";
|
import {ElMessage} from "element-plus";
|
import {addNotice} from "@/api/backManage/notice";
|
import {addDict, editDict, getDictDetail} from "@/api/backManage/evaluate";
|
import {verifyIdCard} from "@/utils/validate";
|
|
const dialogVisible = ref(false);
|
const title = ref("");
|
const busRef = ref();
|
const length = ref()
|
const emit = defineEmits(["getList"]);
|
let verifyId = (rule, value, callback)=>{
|
if(value === ''){
|
callback(new Error('请输入身份证号'))
|
}else{
|
if(!verifyIdCard(value)){
|
callback(new Error('身份证号格式有误'))
|
}else{
|
callback()
|
}
|
}
|
}
|
const state = reactive({
|
form: {
|
id: '',
|
name: '',
|
sex: '',
|
idCard: "",
|
ratingLevel: "10",
|
domain: "",
|
title: '',
|
companyName: ''
|
|
},
|
formRules:{
|
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
sex: [{ required: true, message: '请选择性别', trigger: 'blur' }],
|
idCard: [{ required: true, validator: verifyId, trigger: 'blur' }],
|
// ratingLevel: [{ required: true, message: '请选择等级', trigger: 'blur' }],
|
domain: [{ required: true, message: '请输入专业领域', trigger: 'blur' }],
|
title: [{ required: true, message: '请输入职称', trigger: 'blur' }],
|
companyName: [{ required: true, message: '请输入工作单位', trigger: 'blur' }],
|
},
|
type: ''
|
|
})
|
|
|
const openDialog = async (type, value) => {
|
state.type = type
|
title.value = '库外专家';
|
dialogVisible.value = true;
|
}
|
|
const onSubmit = async () => {
|
const valid = await busRef.value.validate();
|
if(valid){
|
state.form.teamLeader = state.type == 'leader' ? 1 : 0
|
state.form.selectionMode = state.type == 'leader' ? 1 : 2
|
emit("getList",state.form)
|
busRef.value.clearValidate();
|
reset();
|
dialogVisible.value = false;
|
}
|
}
|
|
const handleClose = () => {
|
busRef.value.clearValidate();
|
reset();
|
dialogVisible.value = false;
|
|
}
|
const reset = () => {
|
state.form = {
|
id: '',
|
name: '',
|
sex: '',
|
idCard: "",
|
ratingLevel: "10",
|
domain: "",
|
title: '',
|
companyName: ''
|
}
|
}
|
defineExpose({
|
openDialog
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
.notice{
|
:deep(.el-form .el-form-item__label) {
|
font-size: 15px;
|
}
|
.file {
|
display: flex;
|
flex-direction: column;
|
align-items: flex-start;
|
}
|
}
|
</style>
|