diff --git a/activitylink/src/api/manage/gift.js b/activitylink/src/api/manage/gift.js index 63723cc..285e498 100644 --- a/activitylink/src/api/manage/gift.js +++ b/activitylink/src/api/manage/gift.js @@ -92,7 +92,29 @@ export function deleteUsers(ids) { export function getFixUserList(data) { return request({ url: '/admin/user/list/fix', - method: 'get', + method: 'post', + data: data, + headers: { + 'Content-Type': 'application/json' + } + }) +} +// 内定用户删除 +export function deleteFixUser(id) { + return request({ + url: '/admin/user/delete/fix', + method: 'post', + params: { id }, + headers:{ + 'Content-Type': 'application/json' + } + }) +} +// 内定用户新增 +export function addFixUser(data) { + return request({ + url: '/admin/prize/addFixUser', + method: 'post', data: data, headers: { 'Content-Type': 'application/json' diff --git a/activitylink/src/views/zhongchou/gift/importFixedList/index.vue b/activitylink/src/views/zhongchou/gift/importFixedList/index.vue index 7660359..af4e0a6 100644 --- a/activitylink/src/views/zhongchou/gift/importFixedList/index.vue +++ b/activitylink/src/views/zhongchou/gift/importFixedList/index.vue @@ -6,62 +6,54 @@ - 姓名: - - - 精网号: - - 搜索 + 姓名: + 精网号: + 搜索 - 添加用户 + 添加用户 导入Excel - - + + + {{ pagination.pageSize * (pagination.pageNum - 1) + scope.$index + 1 }} + + + - 删除 + 删除 批量删除 - - 共{{ total }}条 - - - - - - - - 前往 + + - - - - + + + z - + @@ -73,10 +65,15 @@ import { ref, computed, onMounted } from 'vue' import { useRouter } from 'vue-router' import { usegiftFixedListStone } from '@/stone/giftFixedListStone'; -import { getFixUserList } from '@/api/manage/gift' +import { getFixUserList, addFixUser, deleteFixUser } from '@/api/manage/gift' +import { ElMessage, ElMessageBox } from 'element-plus' const giftStore = usegiftFixedListStone(); const router = useRouter() - +const addObj = ref({ + username:'', + jwcode:'', + gradeId:'' +}) const addVisible = ref(false) const tableData = ref([]) const pagination = ref({ @@ -89,6 +86,10 @@ const searchObj = ref({ username: '', jwcode: '', }) +const openAdd = () => { + addObj.value = {} + addVisible.value = true +} // 查全部 const getFixUsers = async () => { try { @@ -110,17 +111,69 @@ const getFixUsers = async () => { ElMessage.error('请求失败,请重试') } } -// 跳转到指定页 -const goToPage = () => { - const page = parseInt(jumpPage.value) - if (!isNaN(page) && page > 0 && page <= Math.ceil(total.value / pageSize.value)) { - currentPage.value = page +// 添加内定用户 +const submitAdd = async () => { + if (!addObj.value.username || addObj.value.jwcode === '') { + ElMessage.error('请填写完整信息') + return } - jumpPage.value = '' + try { + const data = { + username: addObj.value.username, + jwcode: addObj.value.jwcode, + gradeId: addObj.value.gradeId + } + console.log('看看添加参数',data) + const response = await addFixUser(data) + if (response.code === 200) { + ElMessage.success('添加成功') + addVisible.value = false + getFixUsers() + } else { + ElMessage.error(response.message || '添加失败') + } + } catch (error) { + console.error('添加等级失败:', error) + ElMessage.error('添加失败,请重试') + } +} +// 删除内定用户 +const delUser = (row) => { + ElMessageBox.confirm('确定要删除该用户吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + try { + const id = String(row.id) + console.log('删除等级的id是:', id) + const response = await deleteFixUser(id) + if (response.code === 200) { + ElMessage.success('删除成功') + getFixUsers() + } else { + ElMessage.error(response.message || '删除失败') + } + } catch (error) { + console.error('删除失败:', error) + ElMessage.error('删除失败,请重试') + } + }).catch(() => { + ElMessage.info('已取消删除') + }) } const trimJwcode = (value) => { searchObj.value.jwcode = value.replace(/\D/g, '') } +const handleSizeChange = (val) => { + pagination.value.pageSize = val + pagination.value.pageNum = 1 + getFixUsers() +} +const handleCurrentChange = (val) => { + pagination.value.pageNum = val + getFixUsers() +} // 返回上一页 const goBack = () => { router.back() diff --git a/activitylink/src/views/zhongchou/gift/importuser/index.vue b/activitylink/src/views/zhongchou/gift/importuser/index.vue index e39de54..0d19c44 100644 --- a/activitylink/src/views/zhongchou/gift/importuser/index.vue +++ b/activitylink/src/views/zhongchou/gift/importuser/index.vue @@ -18,7 +18,11 @@ - + + + {{ pagination.pageSize * (pagination.pageNum - 1) + scope.$index + 1 }} + + @@ -38,9 +42,10 @@ - - - 前往 + + @@ -67,6 +72,7 @@ import { ref, computed, onMounted } from 'vue' import { useRouter } from 'vue-router' import { getUserList, addUser, deleteUser, deleteUsers } from '@/api/manage/gift'; import { ElMessage, ElMessageBox } from 'element-plus' +import { pa } from 'element-plus/es/locales.mjs'; const router = useRouter() const addVisible = ref(false) const tableData = ref([]) @@ -197,17 +203,20 @@ const batchDelete = async () => { const goBack = () => { router.back() } -// 跳转到指定页 -const goToPage = () => { - const page = parseInt(jumpPage.value) - if (!isNaN(page) && page > 0 && page <= Math.ceil(total.value / pageSize.value)) { - currentPage.value = page - } - jumpPage.value = '' -} + const handleSelectionChange = (selection) => { // 提取选中行的id组成数组 selectedIds.value = selection.map(row => row.id) + console.log('选中的id们是:', selectedIds.value) +} +const handleSizeChange = (val) => { + pagination.value.pageSize = val + pagination.value.pageNum = 1 + getUsers() +} +const handleCurrentChange = (val) => { + pagination.value.pageNum = val + getUsers() } const trimJwcode = (value) => { searchObj.value.jwcode = value.replace(/\D/g, '') diff --git a/activitylink/src/views/zhongchou/gift/index.vue b/activitylink/src/views/zhongchou/gift/index.vue index 62bb986..425f3ee 100644 --- a/activitylink/src/views/zhongchou/gift/index.vue +++ b/activitylink/src/views/zhongchou/gift/index.vue @@ -366,10 +366,12 @@ const beforeUpload = (file) => { const handleSizeChange = (val) => { pagination.value.pageSize = val pagination.value.pageNum = 1 + getPrizes() } const handleCurrentChange = (val) => { pagination.value.pageNum = val + getPrizes() } onMounted(() => { diff --git a/activitylink/vite.config.js b/activitylink/vite.config.js index a4770a6..de6f40f 100644 --- a/activitylink/vite.config.js +++ b/activitylink/vite.config.js @@ -12,7 +12,8 @@ export default defineConfig({ server: { proxy: { '/admin': { - target: 'http://localhost:12699', // 后端基础地址https://dbqb.nfdxy.net/devLotApi + target: 'https://dbqb.nfdxy.net/devLotApi', // 后端基础地址 + //http://localhost:12699 changeOrigin: true, rewrite: (path) => path // 或者更精确的重写(根据后端路径调整):.replace(/^\/api/, '')