增加研究员管理
This commit is contained in:
parent
e45d151376
commit
1af72d2bb2
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="gva-table-box">
|
<div class="gva-table-box">
|
||||||
<div class="gva-btn-list">
|
<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"
|
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||||
@click="handleMultiDelete">删除</el-button>
|
@click="handleMultiDelete">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { getAcademicianPreviewPath } from '@/utils/format'
|
import { getAcademicianPreviewPath } from '@/utils/format'
|
||||||
import {
|
import {
|
||||||
|
|
@ -90,7 +90,10 @@ import {
|
||||||
} from '@/api/academician'
|
} from '@/api/academician'
|
||||||
import AcademicianEdit from '@/view/content/components/academicianEdit.vue'
|
import AcademicianEdit from '@/view/content/components/academicianEdit.vue'
|
||||||
import SelectArticle from '@/view/content/components/selectArticle.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 page = ref(1)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
|
|
@ -105,7 +108,8 @@ const initSearchInfo = () => {
|
||||||
page.value = 1
|
page.value = 1
|
||||||
}
|
}
|
||||||
initSearchInfo()
|
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 })
|
const res = await getAcademicianList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
tableData.value = res.data.list
|
tableData.value = res.data.list
|
||||||
|
|
@ -115,6 +119,13 @@ const getTableData = async valid => {
|
||||||
|
|
||||||
getTableData()
|
getTableData()
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.params.kind,
|
||||||
|
() => {
|
||||||
|
getTableData()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// 重置
|
// 重置
|
||||||
const handleResetSearch = () => {
|
const handleResetSearch = () => {
|
||||||
initSearchInfo()
|
initSearchInfo()
|
||||||
|
|
@ -177,7 +188,7 @@ const handleMultiDelete = () => {
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
const handleRowDelete = (ID) => {
|
const handleRowDelete = (ID) => {
|
||||||
ElMessageBox.confirm('此操作将删除院士, 是否继续?', '请确认', {
|
ElMessageBox.confirm('此操作将删除' + (route.params.kind == '1' ? '院士' : '研究员') + ', 是否继续?', '请确认', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
|
|
@ -200,13 +211,13 @@ const elEditRef = ref(null)
|
||||||
const editTitle = ref('')
|
const editTitle = ref('')
|
||||||
// 添加
|
// 添加
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
editTitle.value = '添加院士'
|
editTitle.value = '添加' + (route.params.kind == '1' ? '院士' : '研究员')
|
||||||
elEditRef.value.openPage({ id: 0 })
|
elEditRef.value.openPage({ id: 0, kind: parseInt(route.params.kind) })
|
||||||
}
|
}
|
||||||
// 修改
|
// 修改
|
||||||
const handleRowEdit = async (ID) => {
|
const handleRowEdit = async (ID) => {
|
||||||
editTitle.value = '修改院士-' + ID
|
editTitle.value = '修改' + (route.params.kind == '1' ? '院士' : '研究员') + '-ID:' + ID
|
||||||
elEditRef.value.openPage({ ID: ID })
|
elEditRef.value.openPage({ ID: ID, kind: parseInt(route.params.kind) })
|
||||||
}
|
}
|
||||||
// 保存后
|
// 保存后
|
||||||
const handlerFormSave = () => {
|
const handlerFormSave = () => {
|
||||||
|
|
@ -215,7 +226,7 @@ const handlerFormSave = () => {
|
||||||
|
|
||||||
const selectArticleTitle = ref('')
|
const selectArticleTitle = ref('')
|
||||||
const handleSelProject = (row) => {
|
const handleSelProject = (row) => {
|
||||||
selectArticleTitle.value = '关联院士项目'
|
selectArticleTitle.value = '关联' + (route.params.kind == '1' ? '院士' : '研究员') + '项目' + '-ID:' + row.ID
|
||||||
let articleIds = []
|
let articleIds = []
|
||||||
if (row.projects != '') {
|
if (row.projects != '') {
|
||||||
articleIds = JSON.parse(row.projects)
|
articleIds = JSON.parse(row.projects)
|
||||||
|
|
@ -224,7 +235,7 @@ const handleSelProject = (row) => {
|
||||||
elSelectArticleRef.value.openPage(params, articleIds)
|
elSelectArticleRef.value.openPage(params, articleIds)
|
||||||
}
|
}
|
||||||
const handleSelLecture = (row) => {
|
const handleSelLecture = (row) => {
|
||||||
selectArticleTitle.value = '关联院士讲座'
|
selectArticleTitle.value = '关联' + (route.params.kind == '1' ? '院士' : '研究员') + '讲座' + '-ID:' + row.ID
|
||||||
let articleIds = []
|
let articleIds = []
|
||||||
if (row.lectures != '') {
|
if (row.lectures != '') {
|
||||||
articleIds = JSON.parse(row.lectures)
|
articleIds = JSON.parse(row.lectures)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
:close-on-press-escape="false">
|
:close-on-press-escape="false">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<span class="text-lg">{{ !isEdit ? '添加' : '修改' }}院士</span>
|
<span class="text-lg">{{ props.title }}</span>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="handleFormSubmit">确 定</el-button>
|
<el-button type="primary" @click="handleFormSubmit">确 定</el-button>
|
||||||
<el-button @click="handleFormClose">取 消</el-button>
|
<el-button @click="handleFormClose">取 消</el-button>
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-form-item label="首字母" prop="headChar" style="width: 100%">
|
<el-form-item label="首字母" prop="headChar" style="width: 100%">
|
||||||
<el-input v-model="editForm.headChar" :maxlength="1" autocomplete="off" 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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
|
|
@ -167,6 +167,7 @@ const emptyForm = () => {
|
||||||
checkFlag.value = false
|
checkFlag.value = false
|
||||||
editForm.value = {
|
editForm.value = {
|
||||||
ID: 0,
|
ID: 0,
|
||||||
|
kind: 0,
|
||||||
name: '',
|
name: '',
|
||||||
headChar: '',
|
headChar: '',
|
||||||
title: '',
|
title: '',
|
||||||
|
|
@ -184,8 +185,6 @@ const toggleCase = (value) => {
|
||||||
const newVal = value.split('').map(char => {
|
const newVal = value.split('').map(char => {
|
||||||
if (char.match(/[a-z]/)) {
|
if (char.match(/[a-z]/)) {
|
||||||
return char.toUpperCase();
|
return char.toUpperCase();
|
||||||
} else if (char.match(/[A-Z]/)) {
|
|
||||||
return char.toLowerCase();
|
|
||||||
}
|
}
|
||||||
return char;
|
return char;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
@ -200,6 +199,7 @@ const handleFormClose = () => {
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const handleFormSubmit = async () => {
|
const handleFormSubmit = async () => {
|
||||||
|
editForm.value.kind = pageParams.value.kind
|
||||||
editFormRef.value.validate(async valid => {
|
editFormRef.value.validate(async valid => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return
|
return
|
||||||
|
|
@ -315,8 +315,10 @@ const uploadFailure = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pageParams = ref(null)
|
||||||
// 初始化方法
|
// 初始化方法
|
||||||
const openPage = async (params) => {
|
const openPage = async (params) => {
|
||||||
|
pageParams.value = params
|
||||||
fullscreenLoading.value = true
|
fullscreenLoading.value = true
|
||||||
showDrawer.value = true
|
showDrawer.value = true
|
||||||
isEdit.value = false
|
isEdit.value = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue