95 lines
2.3 KiB
Vue
95 lines
2.3 KiB
Vue
<template>
|
|
<div class="edit-popup">
|
|
<popup
|
|
ref="popupRef"
|
|
:async="true"
|
|
width="550px"
|
|
:clickModalClose="true"
|
|
@confirm="handleSubmit"
|
|
@close="handleClose"
|
|
>
|
|
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
|
<el-form-item label="拒绝原因" prop="reason">
|
|
<el-input
|
|
v-model="formData.reason"
|
|
placeholder="请输入拒绝原因"
|
|
type="textarea"
|
|
:autosize="{ minRows: 4, maxRows: 6 }"
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
</popup>
|
|
</div>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import type { FormInstance } from 'element-plus'
|
|
import type { PropType } from 'vue'
|
|
|
|
import { stuRegistrationDetail, stuRegistrationRegistration } from '@/api/stuRegistration'
|
|
import Popup from '@/components/popup/index.vue'
|
|
defineProps({
|
|
dictData: {
|
|
type: Object as PropType<Record<string, any[]>>,
|
|
default: () => ({})
|
|
}
|
|
})
|
|
const emit = defineEmits(['success', 'close'])
|
|
const formRef = shallowRef<FormInstance>()
|
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
|
|
|
const formData = reactive({
|
|
id: [] as number[],
|
|
operation: 2,
|
|
reason: ''
|
|
})
|
|
|
|
const formRules = {
|
|
id: [
|
|
{
|
|
required: true,
|
|
message: '请输入主键ID',
|
|
trigger: ['blur']
|
|
}
|
|
]
|
|
}
|
|
|
|
const handleSubmit = async () => {
|
|
await formRef.value?.validate()
|
|
const data: any = { ...formData }
|
|
await stuRegistrationRegistration(data)
|
|
popupRef.value?.close()
|
|
emit('success')
|
|
}
|
|
|
|
const open = () => {
|
|
popupRef.value?.open()
|
|
}
|
|
|
|
const setFormData = async (data: Record<string, any>) => {
|
|
for (const key in formData) {
|
|
if (data[key] != null && data[key] != undefined) {
|
|
//@ts-ignore
|
|
formData.id = [data.id]
|
|
formData['reason'] = data['reason']
|
|
}
|
|
}
|
|
}
|
|
|
|
const getDetail = async (row: Record<string, any>) => {
|
|
const data = await stuRegistrationDetail({
|
|
id: row.id
|
|
})
|
|
setFormData(data)
|
|
}
|
|
|
|
const handleClose = () => {
|
|
emit('close')
|
|
}
|
|
|
|
defineExpose({
|
|
open,
|
|
setFormData,
|
|
getDetail
|
|
})
|
|
</script>
|