From 7d180983fb25828a8e75420ae33b902ea5ba5592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Sun, 5 Dec 2021 23:46:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90vue3=E7=9A=84=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=E6=94=B9=E6=9F=A5=E7=A4=BA=E4=BE=8B=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/layout/components/TagsView/ScrollPane.vue | 4 +- src/views/system/client/index.vue | 114 +++++++++++++++++- 3 files changed, 111 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index e6af5653..163417bf 100644 --- a/.env.development +++ b/.env.development @@ -4,5 +4,5 @@ NODE_ENV='development' VITE_APP_TITLE = '管理系统' -VITE_APP_PORT = 4396 +VITE_APP_PORT = 9527 VITE_APP_BASE_API = '/dev-api' diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index ca7a6510..b9130c7d 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -63,11 +63,11 @@ export default defineComponent({ } onMounted(() => { - scrollWrapper.value.addEventListener('scroll', emitScroll, true) + //scrollWrapper.value.addEventListener('scroll', emitScroll, true) }) onBeforeUnmount(() => { - scrollWrapper.value.removeEventListener('scroll', emitScroll) + //scrollWrapper.value.removeEventListener('scroll', emitScroll) }) return { diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index fc61aaa9..44ee4907 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -1,6 +1,6 @@ @@ -83,6 +117,7 @@ import {list, detail, update, add, del} from '@/api/system/client' import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons' import {onMounted, reactive, toRefs, ref, unref} from 'vue' +import {ElForm, ElMessage,ElMessageBox} from "element-plus"; const state = reactive({ loading: true, @@ -99,7 +134,7 @@ const state = reactive({ pageList: [], total: 0, dialog: { - title: undefined, + title: '', visible: false, type: 'create' }, @@ -146,15 +181,82 @@ function handleSelectionChange(selection: any) { } function handleAdd() { - + resetForm() + state.dialog = { + title: '添加客户端', + visible: true, + type: 'create' + } } function handleUpdate(row: any) { - + resetForm() + state.dialog = { + title: '修改客户端', + visible: true, + type: 'edit' + } + const clientId = row.clientId || state.ids + detail(clientId).then(response => { + state.formData = response.data + }) } -function submitForm() { +const dataForm = ref(ElForm) +function submitForm() { + const form = unref(dataForm) + form.validate((valid: any) => { + if (valid) { + if (state.dialog.type == 'edit') { + update(state.formData.clientId as any, state.formData).then(response => { + ElMessage.success('修改成功') + state.dialog.visible = false + handleQuery() + }) + } else { + add(state.formData).then(response => { + ElMessage.success('新增成功') + state.dialog.visible = false + handleQuery() + }) + } + } + }) +} + +function cancel() { + state.dialog.visible=false +} + +function resetForm() { + state.formData = { + authorizedGrantTypes: [], + clientSecret: undefined, + clientId: undefined, + accessTokenValidity: undefined, + refreshTokenValidity: undefined, + webServerRedirectUri: undefined, + authorities: undefined, + additionalInformation: undefined, + autoapprove: 'false' + } +} + +function handleDelete(row:any) { + const clientIds=[row.clientId|| state.ids].join(',') + ElMessageBox.confirm('确认删除已选中的数据项?','警告',{ + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + del(clientIds).then(() => { + ElMessage.success('删除成功') + handleQuery() + }) + }).catch(() => + ElMessage.info('已取消删除') + ) } onMounted(() => {