增加研究员管理

This commit is contained in:
jacky 2024-05-23 18:55:17 +08:00
parent e45d151376
commit 1af72d2bb2
2 changed files with 27 additions and 14 deletions

View File

@ -16,7 +16,7 @@
</div>
<div class="gva-table-box">
<div class="gva-btn-list">
<el-button type="primary" icon="plus" @click="handleAdd">新增院士</el-button>
<el-button type="primary" icon="plus" @click="handleAdd">新增</el-button>
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
@click="handleMultiDelete">删除</el-button>
</div>
@ -79,7 +79,7 @@
</template>
<script setup>
import { ref } from 'vue'
import { ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getAcademicianPreviewPath } from '@/utils/format'
import {
@ -90,7 +90,10 @@ import {
} from '@/api/academician'
import AcademicianEdit from '@/view/content/components/academicianEdit.vue'
import SelectArticle from '@/view/content/components/selectArticle.vue'
import { useRoute } from 'vue-router'
import { getTable } from '@/api/autoCode'
const route = useRoute()
const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
@ -105,7 +108,8 @@ const initSearchInfo = () => {
page.value = 1
}
initSearchInfo()
const getTableData = async valid => {
const getTableData = async () => {
searchInfo.value.kind = parseInt(route.params.kind)
const res = await getAcademicianList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
if (res.code === 0) {
tableData.value = res.data.list
@ -115,6 +119,13 @@ const getTableData = async valid => {
getTableData()
watch(
() => route.params.kind,
() => {
getTableData()
}
)
//
const handleResetSearch = () => {
initSearchInfo()
@ -177,7 +188,7 @@ const handleMultiDelete = () => {
}
//
const handleRowDelete = (ID) => {
ElMessageBox.confirm('此操作将删除院士, 是否继续?', '请确认', {
ElMessageBox.confirm('此操作将删除' + (route.params.kind == '1' ? '院士' : '研究员') + ', 是否继续?', '请确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@ -200,13 +211,13 @@ const elEditRef = ref(null)
const editTitle = ref('')
//
const handleAdd = () => {
editTitle.value = '添加院士'
elEditRef.value.openPage({ id: 0 })
editTitle.value = '添加' + (route.params.kind == '1' ? '院士' : '研究员')
elEditRef.value.openPage({ id: 0, kind: parseInt(route.params.kind) })
}
//
const handleRowEdit = async (ID) => {
editTitle.value = '修改院士-' + ID
elEditRef.value.openPage({ ID: ID })
editTitle.value = '修改' + (route.params.kind == '1' ? '院士' : '研究员') + '-ID:' + ID
elEditRef.value.openPage({ ID: ID, kind: parseInt(route.params.kind) })
}
//
const handlerFormSave = () => {
@ -215,7 +226,7 @@ const handlerFormSave = () => {
const selectArticleTitle = ref('')
const handleSelProject = (row) => {
selectArticleTitle.value = '关联院士项目'
selectArticleTitle.value = '关联' + (route.params.kind == '1' ? '院士' : '研究员') + '项目' + '-ID:' + row.ID
let articleIds = []
if (row.projects != '') {
articleIds = JSON.parse(row.projects)
@ -224,7 +235,7 @@ const handleSelProject = (row) => {
elSelectArticleRef.value.openPage(params, articleIds)
}
const handleSelLecture = (row) => {
selectArticleTitle.value = '关联院士讲座'
selectArticleTitle.value = '关联' + (route.params.kind == '1' ? '院士' : '研究员') + '讲座' + '-ID:' + row.ID
let articleIds = []
if (row.lectures != '') {
articleIds = JSON.parse(row.lectures)

View File

@ -3,7 +3,7 @@
:close-on-press-escape="false">
<template #header>
<div class="flex justify-between items-center">
<span class="text-lg">{{ !isEdit ? '添加' : '修改' }}院士</span>
<span class="text-lg">{{ props.title }}</span>
<div>
<el-button type="primary" @click="handleFormSubmit"> </el-button>
<el-button @click="handleFormClose"> </el-button>
@ -26,7 +26,7 @@
<el-col :span="4">
<el-form-item label="首字母" prop="headChar" style="width: 100%">
<el-input v-model="editForm.headChar" :maxlength="1" autocomplete="off" style="width: 100%"
@change="toggleCase" />
@change="toggleCase(editForm.headChar)" @blur="toggleCase(editForm.headChar)" />
</el-form-item>
</el-col>
<el-col :span="10">
@ -167,6 +167,7 @@ const emptyForm = () => {
checkFlag.value = false
editForm.value = {
ID: 0,
kind: 0,
name: '',
headChar: '',
title: '',
@ -184,8 +185,6 @@ const toggleCase = (value) => {
const newVal = value.split('').map(char => {
if (char.match(/[a-z]/)) {
return char.toUpperCase();
} else if (char.match(/[A-Z]/)) {
return char.toLowerCase();
}
return char;
}).join('');
@ -200,6 +199,7 @@ const handleFormClose = () => {
//
const handleFormSubmit = async () => {
editForm.value.kind = pageParams.value.kind
editFormRef.value.validate(async valid => {
if (!valid) {
return
@ -315,8 +315,10 @@ const uploadFailure = () => {
})
}
const pageParams = ref(null)
//
const openPage = async (params) => {
pageParams.value = params
fullscreenLoading.value = true
showDrawer.value = true
isEdit.value = false