Commit 3c4b33a9 by linjinhong

系统配置页面提交

parent 3168c917
...@@ -36,6 +36,12 @@ export function deleteExternalAuthorisationApi(ids: string) { ...@@ -36,6 +36,12 @@ export function deleteExternalAuthorisationApi(ids: string) {
`factory/baseExternalAccount/delete?ids=${ids}`, `factory/baseExternalAccount/delete?ids=${ids}`,
) )
} }
export function baseExternalAccountLogsApi(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>(
`factory/baseExternalAccount/logs`,
{ params },
)
}
export function addExternalAuthorisationApi( export function addExternalAuthorisationApi(
url: string, url: string,
data: ExternalAuthListData, data: ExternalAuthListData,
......
...@@ -8,15 +8,12 @@ import './styles/index.scss' ...@@ -8,15 +8,12 @@ import './styles/index.scss'
import VxeUITable from 'vxe-table' import VxeUITable from 'vxe-table'
import 'vxe-table/lib/style.css' import 'vxe-table/lib/style.css'
import { isPermissionBtn } from '@/utils/index' import { isPermissionBtn } from '@/utils/index'
import { createPinia } from 'pinia'
const pinia = createPinia()
// 确保在渲染用户提供的HTML内容时,不会执行任何潜在的恶意脚本,从而提高应用的安全性 // 确保在渲染用户提供的HTML内容时,不会执行任何潜在的恶意脚本,从而提高应用的安全性
import vueDomPurifyHTMLPlugin from 'vue-dompurify-html' import vueDomPurifyHTMLPlugin from 'vue-dompurify-html'
const app = createApp(App) const app = createApp(App)
app.use(pinia)
app app
.use(vueDomPurifyHTMLPlugin) .use(vueDomPurifyHTMLPlugin)
.use(router) .use(router)
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
<div class="card-header"> <div class="card-header">
<span>系统配置</span> <span>系统配置</span>
</div> </div>
<div class="cardBox" shadow="never"> <div class="cardBox">
<div v-for="(item, index) in formList" style="width: 600px" :key="index"> <div v-for="(item, index) in formList" style="width: 600px" :key="index">
<el-form <el-form
v-if="item.type === 'RIIN'" v-if="item.type === 'RIIN'"
class="form" class="form"
ref="formRef" ref="formRef"
label-width="auto" label-width="120"
:model="item" :model="item"
> >
<div class="formBox"> <div class="formBox">
...@@ -50,20 +50,19 @@ ...@@ -50,20 +50,19 @@
/></el-form-item> /></el-form-item>
</div> </div>
</div> </div>
<el-form-item style="margin-bottom: 20px">
<ElButton <ElButton
class="btn" class="btn"
color="#42b983" color="#42b983"
@click="saveConfiguration(item, index)" @click="saveConfiguration(item, index)"
>保存配置</ElButton >保存配置</ElButton
> >
</el-form-item>
</el-form> </el-form>
<el-form <el-form
v-if="item.type === 'TRACK'" v-if="item.type === 'TRACK'"
class="form" class="form"
ref="formRef" ref="formRef"
label-width="auto" label-width="120"
:model="item" :model="item"
> >
<div class="formBox"> <div class="formBox">
...@@ -89,7 +88,7 @@ ...@@ -89,7 +88,7 @@
/></el-form-item> /></el-form-item>
<el-form-item <el-form-item
label="账号Token" label="账号Token"
prop="appSecret" prop="token"
:rules="[{ required: true, message: '请输入账号Token' }]" :rules="[{ required: true, message: '请输入账号Token' }]"
> >
<ElInput <ElInput
...@@ -101,17 +100,20 @@ ...@@ -101,17 +100,20 @@
/></el-form-item> /></el-form-item>
</div> </div>
</div> </div>
<el-form-item>
<ElButton <ElButton
class="btn" class="btn"
color="#42b983" color="#42b983"
@click="saveConfiguration(item, index)" @click="saveConfiguration(item, index)"
>保存配置</ElButton >保存配置</ElButton
> >
</el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="logBox">
<div>操作日志</div>
<LogList :log-list="logList" style="font-size: 14px; height: 100%" />
</div>
</div> </div>
</template> </template>
...@@ -119,6 +121,7 @@ ...@@ -119,6 +121,7 @@
import { import {
addExternalAuthorisationApi, addExternalAuthorisationApi,
getExternalAuthorisationListApi, getExternalAuthorisationListApi,
baseExternalAccountLogsApi,
} from '@/api/externalAuth' } from '@/api/externalAuth'
import { ExternalAuthListData } from '@/types/api/externalAuth' import { ExternalAuthListData } from '@/types/api/externalAuth'
...@@ -132,6 +135,7 @@ interface formType { ...@@ -132,6 +135,7 @@ interface formType {
const formRef = ref() const formRef = ref()
const logList = ref([])
async function saveConfiguration(item: formType, index: number) { async function saveConfiguration(item: formType, index: number) {
let loading let loading
try { try {
...@@ -154,7 +158,8 @@ async function saveConfiguration(item: formType, index: number) { ...@@ -154,7 +158,8 @@ async function saveConfiguration(item: formType, index: number) {
showCancelButton: false, showCancelButton: false,
type: 'success', type: 'success',
}) })
getDetail() await getDetail()
handleClick()
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} finally { } finally {
...@@ -164,24 +169,63 @@ async function saveConfiguration(item: formType, index: number) { ...@@ -164,24 +169,63 @@ async function saveConfiguration(item: formType, index: number) {
const formList = ref<ExternalAuthListData[]>([]) const formList = ref<ExternalAuthListData[]>([])
async function getDetail() { async function getDetail() {
let loading
try {
loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const res = await getExternalAuthorisationListApi({}, 1, 100) const res = await getExternalAuthorisationListApi({}, 1, 100)
const newArr = [...res.data.records.filter((el) => el.type)] const records = res.data.records || []
const boolRIIN = newArr.every((el) => el.type == 'RIIN')
const boolTRACK = newArr.every((el) => el.type == 'TRACK') const newArr = records.filter((el) => el.type)
if (!newArr.length) { const typeSet = new Set(newArr.map((el) => el.type))
const hasRIIN = typeSet.has('RIIN')
const hasTRACK = typeSet.has('TRACK')
if (newArr.length === 0) {
formList.value = [{ type: 'RIIN' }, { type: 'TRACK' }] formList.value = [{ type: 'RIIN' }, { type: 'TRACK' }]
} else if (!boolRIIN) {
formList.value = [...newArr, { type: 'RIIN' }]
} else if (!boolTRACK) {
formList.value = [...newArr, { type: 'TRACK' }]
} else { } else {
formList.value = [...newArr] const result = [...newArr]
if (!hasRIIN) result.push({ type: 'RIIN' })
if (!hasTRACK) result.push({ type: 'TRACK' })
formList.value = result
}
console.log('Form list:', formList.value)
} catch (error) {
console.error('Failed to get external authorizations:', error)
} finally {
loading?.close()
}
}
async function handleClick() {
try {
let ids = ''
const idList = formList.value.map((el) => el.id).filter((el) => el)
console.log(222, idList)
if (idList.length) {
ids = idList.join(',')
}
console.log(205, ids)
const res = await baseExternalAccountLogsApi({
ids,
})
logList.value = res.data
console.log(res)
} catch (error) {
console.log(error)
} }
console.log(152, formList.value)
} }
onMounted(() => { onMounted(async () => {
getDetail() await getDetail()
handleClick()
}) })
</script> </script>
...@@ -192,15 +236,20 @@ onMounted(() => { ...@@ -192,15 +236,20 @@ onMounted(() => {
margin-bottom: 20px; margin-bottom: 20px;
} }
:deep() { :deep() {
.demo-tabs {
height: calc(100% - 60px);
}
.cardBox { .cardBox {
flex: 3;
overflow-y: scroll; overflow-y: scroll;
height: 100%;
.el-card__footer { .el-card__footer {
border: none !important; border: none !important;
} }
.formBox { .formBox {
width: 100%; width: 100%;
margin-bottom: 20px; margin-bottom: 15px;
padding: 20px; padding: 20px;
border: 1px solid #ebebeb; border: 1px solid #ebebeb;
border-radius: 8px; border-radius: 8px;
...@@ -220,5 +269,13 @@ onMounted(() => { ...@@ -220,5 +269,13 @@ onMounted(() => {
color: #fff; color: #fff;
} }
} }
.logBox {
border-top: 1px solid #ebebeb;
padding-top: 10px;
height: 150px;
}
.form {
margin-bottom: 15px;
}
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment