|
@@ -17,19 +17,6 @@
|
|
</div>
|
|
</div>
|
|
<div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过20M</div>
|
|
<div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过20M</div>
|
|
</template>
|
|
</template>
|
|
- <template #organizationList>
|
|
|
|
- <div class="pa-5 mb-3" style="width: 100%; border: 1px dashed #ccc; border-radius: 4px;">
|
|
|
|
- <p class="color-999 font-size-14 mb-3">
|
|
|
|
- <span class="color-error">*</span>
|
|
|
|
- 负责院系
|
|
|
|
- </p>
|
|
|
|
- <div v-for="(k, index) in departmentList" :key="index" class="d-flex align-center mb-5">
|
|
|
|
- <TextInput v-model="k.name" :item="textItem" />
|
|
|
|
- <v-icon v-if="index > 0" class="ml-3 cursor-pointer" @click="handleDeleteDepartment(index)" color="error">mdi-close-circle</v-icon>
|
|
|
|
- </div>
|
|
|
|
- <v-btn class="mt-3" color="primary" prepend-icon="mdi-plus" size="small" @click="handleAddDepartment">添加院系</v-btn>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
</CtForm>
|
|
</CtForm>
|
|
<v-btn class="buttons my-10" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
|
|
<v-btn class="buttons my-10" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
|
|
</div>
|
|
</div>
|
|
@@ -47,19 +34,10 @@ import { useI18n } from '@/hooks/web/useI18n'
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
import { uploadFile } from '@/api/common'
|
|
import { uploadFile } from '@/api/common'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
-import { updateTeacherInfo } from '@/api/school'
|
|
|
|
|
|
+import { updateTeacherInfo, getOrganizationList } from '@/api/school'
|
|
|
|
|
|
const showIcon = ref(false)
|
|
const showIcon = ref(false)
|
|
const CtFormRef = ref()
|
|
const CtFormRef = ref()
|
|
-const departmentList = ref([{ name: '' }])
|
|
|
|
-const textItem = {
|
|
|
|
- type: 'text',
|
|
|
|
- key: 'name',
|
|
|
|
- width: 450,
|
|
|
|
- label: '院系名称 *',
|
|
|
|
- hideDetails: true,
|
|
|
|
- rules: [v => !!v || '请输入您负责的院系名称']
|
|
|
|
-}
|
|
|
|
const formItems = ref({
|
|
const formItems = ref({
|
|
options: [
|
|
options: [
|
|
{
|
|
{
|
|
@@ -100,11 +78,16 @@ const formItems = ref({
|
|
label: '电子邮箱'
|
|
label: '电子邮箱'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- slotName: 'organizationList',
|
|
|
|
|
|
+ type: 'autocomplete',
|
|
key: 'organizationList',
|
|
key: 'organizationList',
|
|
- noParam: true,
|
|
|
|
|
|
+ value: [],
|
|
label: '负责院系 *',
|
|
label: '负责院系 *',
|
|
- rules: [v => !!v || '请填写您在学校负责的院系']
|
|
|
|
|
|
+ itemText: 'name',
|
|
|
|
+ itemValue: 'id',
|
|
|
|
+ multiple: true,
|
|
|
|
+ returnObject: true,
|
|
|
|
+ rules: [v => !!v || '请选择您在学校负责的院系'],
|
|
|
|
+ items: []
|
|
}
|
|
}
|
|
]
|
|
]
|
|
})
|
|
})
|
|
@@ -117,8 +100,15 @@ userStore.$subscribe((mutation, state) => {
|
|
schoolInfo.value = state.schoolInfo
|
|
schoolInfo.value = state.schoolInfo
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+// 院系列表
|
|
|
|
+const getSchoolOrganizationList = async () => {
|
|
|
|
+ const data = await getOrganizationList({ schoolId: schoolInfo.value.schoolId })
|
|
|
|
+ formItems.value.options.find(e => e.key === 'organizationList').items = data || []
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
await userStore.getSchoolInfo()
|
|
await userStore.getSchoolInfo()
|
|
|
|
+ await getSchoolOrganizationList()
|
|
|
|
|
|
// 获取性别字典数据
|
|
// 获取性别字典数据
|
|
const sexItem = formItems.value.options.find(e => e.key === 'sex')
|
|
const sexItem = formItems.value.options.find(e => e.key === 'sex')
|
|
@@ -127,21 +117,10 @@ onMounted(async () => {
|
|
sexItem.items = data || []
|
|
sexItem.items = data || []
|
|
|
|
|
|
formItems.value.options.forEach(item => {
|
|
formItems.value.options.forEach(item => {
|
|
- if (!item.noParam) item.value = schoolInfo.value[item.key] || item.defaultValue
|
|
|
|
- else {
|
|
|
|
- departmentList.value = schoolInfo.value?.organizationList && schoolInfo.value.organizationList.length ? schoolInfo.value.organizationList : [{ name: '' }]
|
|
|
|
- }
|
|
|
|
|
|
+ item.value = schoolInfo.value[item.key] || item.defaultValue
|
|
})
|
|
})
|
|
})
|
|
})
|
|
|
|
|
|
-// 添加院系
|
|
|
|
-const handleAddDepartment = () => {
|
|
|
|
- departmentList.value.push({ name: '' })
|
|
|
|
-}
|
|
|
|
-// 删除院系
|
|
|
|
-const handleDeleteDepartment = (index) => {
|
|
|
|
- departmentList.value.splice(index, 1)
|
|
|
|
-}
|
|
|
|
|
|
|
|
// 图片裁剪
|
|
// 图片裁剪
|
|
const overlay = ref(false)
|
|
const overlay = ref(false)
|
|
@@ -203,18 +182,11 @@ const handleHideCopper = (data) => {
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
const { valid } = await CtFormRef.value.formRef.validate()
|
|
const { valid } = await CtFormRef.value.formRef.validate()
|
|
if (!valid) return
|
|
if (!valid) return
|
|
-
|
|
|
|
- const isCheck = departmentList.value.every(item => item.name)
|
|
|
|
- if (!isCheck) return Snackbar.warning('请将院系信息填写完整')
|
|
|
|
-
|
|
|
|
overlay.value = true
|
|
overlay.value = true
|
|
-
|
|
|
|
let obj = {
|
|
let obj = {
|
|
- id: schoolInfo.value.id,
|
|
|
|
- organizationList: departmentList.value?.length ? departmentList.value.map(e => { return { name: e.name } }) : []
|
|
|
|
|
|
+ id: schoolInfo.value.id
|
|
}
|
|
}
|
|
formItems.value.options.forEach(item => {
|
|
formItems.value.options.forEach(item => {
|
|
- if (item.noParam) return
|
|
|
|
obj[item.key] = item.value
|
|
obj[item.key] = item.value
|
|
})
|
|
})
|
|
|
|
|