feat(data): 添加数据格式支持 更改数据写入读取
All checks were successful
构建Docker镜像 / build-and-deploy (push) Successful in 1m33s
All checks were successful
构建Docker镜像 / build-and-deploy (push) Successful in 1m33s
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
<title>dypid</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -2,6 +2,10 @@
|
||||
import {useCounterStore} from "@/stores/counter.ts";
|
||||
import {ref, watch} from 'vue'
|
||||
import axios from "@/axios.ts";
|
||||
import {useRoute} from "vue-router"
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const result = ref()
|
||||
const value = ref('')
|
||||
@@ -67,7 +71,8 @@ axios.get('/api/token').then(res => {
|
||||
|
||||
<template>
|
||||
<b>当前Token:</b>
|
||||
<el-select v-model="value" placeholder="选择Token" style="width: 240px">
|
||||
<b v-if="!useCounterStore().isAdmin">{{ route.query.token }}</b>
|
||||
<el-select v-if="useCounterStore().isAdmin" v-model="value" placeholder="选择Token" style="width: 240px">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
@@ -85,6 +90,7 @@ axios.get('/api/token').then(res => {
|
||||
border
|
||||
>
|
||||
<el-descriptions-item label="去重对象">{{ result?.dedup_object }}</el-descriptions-item>
|
||||
<el-descriptions-item label="上传数据格式">{{ result?.data_format }}</el-descriptions-item>
|
||||
<el-descriptions-item label="去重记录值">{{ result?.dedup_items_number }}</el-descriptions-item>
|
||||
<el-descriptions-item label="Redis中数据条数">{{ result?.cache_list_number }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
@@ -2,6 +2,8 @@
|
||||
import {ref} from "vue";
|
||||
import axios from "@/axios.ts";
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {useCounterStore} from "@/stores/counter.ts";
|
||||
import {useRouter} from "vue-router";
|
||||
|
||||
const tableData = ref([])
|
||||
|
||||
@@ -14,23 +16,27 @@ const value = ref('')
|
||||
const options = [
|
||||
{
|
||||
value: 'uid',
|
||||
label: 'uid',
|
||||
},
|
||||
{
|
||||
value: 'pid',
|
||||
label: 'pid',
|
||||
},
|
||||
{
|
||||
value: 'secid',
|
||||
label: 'secid',
|
||||
},
|
||||
{
|
||||
value: 'dyid',
|
||||
label: 'dyid',
|
||||
value: 'pid',
|
||||
},
|
||||
{
|
||||
value: 'comment_id',
|
||||
label: 'comment_id',
|
||||
},
|
||||
{
|
||||
value: 'dyid',
|
||||
}
|
||||
]
|
||||
|
||||
const dataFormat = ref('')
|
||||
const dataFormatOptions = [
|
||||
{
|
||||
value: 'uid----secid----pid----comment_id',
|
||||
}, {
|
||||
value: 'uid----secid',
|
||||
}
|
||||
]
|
||||
|
||||
@@ -38,7 +44,8 @@ const addToken = () => {
|
||||
axios.post('/api/token', {}, {
|
||||
params: {
|
||||
token: input.value,
|
||||
dedup_object: value.value
|
||||
dedup_object: value.value,
|
||||
data_format: dataFormat.value
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.data.result == "ok") {
|
||||
@@ -55,18 +62,18 @@ const addToken = () => {
|
||||
})
|
||||
}
|
||||
|
||||
import {useCounterStore} from "@/stores/counter.ts";
|
||||
import {useRouter} from "vue-router";
|
||||
|
||||
const router = useRouter()
|
||||
const viewDetails = (row: any) => {
|
||||
useCounterStore().token = row.token
|
||||
router.push({
|
||||
name: "TokenDetail"
|
||||
name: "TokenDetail",
|
||||
query: {token: row.token}
|
||||
})
|
||||
}
|
||||
|
||||
var rowOut: any
|
||||
|
||||
const dedupObjectVisible = ref(false)
|
||||
const dialogDedupObjectVisible = (row: any) => {
|
||||
rowOut = row
|
||||
@@ -77,7 +84,8 @@ const updateDedupObject = () => {
|
||||
axios.put('/api/token', {}, {
|
||||
params: {
|
||||
token: rowOut.token,
|
||||
dedup_object: value.value
|
||||
dedup_object: value.value,
|
||||
data_format: rowOut.data_format
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.result == "ok") {
|
||||
@@ -92,7 +100,34 @@ const updateDedupObject = () => {
|
||||
}).catch(error => {
|
||||
ElMessage.error(error.response?.data?.error)
|
||||
})
|
||||
}
|
||||
|
||||
const dataFormatVisible = ref(false)
|
||||
const dialogDataFormatVisible = (row: any) => {
|
||||
rowOut = row
|
||||
dataFormatVisible.value = true
|
||||
}
|
||||
const updateDataFormat = () => {
|
||||
dataFormatVisible.value = false
|
||||
axios.put('/api/token', {}, {
|
||||
params: {
|
||||
token: rowOut.token,
|
||||
dedup_object: rowOut.dedup_object,
|
||||
data_format: dataFormat.value
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.result == "ok") {
|
||||
ElMessage({
|
||||
message: '更改成功',
|
||||
type: 'success',
|
||||
})
|
||||
axios.get('/api/token').then(res => {
|
||||
tableData.value = res.data.result
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
ElMessage.error(error.response?.data?.error)
|
||||
})
|
||||
}
|
||||
|
||||
const deleteToken = (row: any) => {
|
||||
@@ -127,7 +162,6 @@ const checkPassword = () => {
|
||||
ElMessage.error('密码错误')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -143,12 +177,18 @@ const checkPassword = () => {
|
||||
<!--管理员-->
|
||||
<div v-if="useCounterStore().isAdmin">
|
||||
<!--添加Token-->
|
||||
<el-input v-model="input" style="width: 200px" placeholder="请输入Token名称"/>
|
||||
<el-select v-model="value" placeholder="选择去重对象" style="width: 200px">
|
||||
<el-input v-model="input" style="width: 150px" placeholder="请输入Token名称"/>
|
||||
<el-select v-model="value" placeholder="选择去重对象" style="width: 150px">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select v-model="dataFormat" placeholder="选择数据格式" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in dataFormatOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -156,12 +196,14 @@ const checkPassword = () => {
|
||||
|
||||
<!--Token列表-->
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="token" label="Token" width="180"/>
|
||||
<el-table-column prop="dedup_object" label="去重对象" width="180"/>
|
||||
<el-table-column prop="token" label="Token" width="150"/>
|
||||
<el-table-column prop="dedup_object" label="去重对象" width="150"/>
|
||||
<el-table-column prop="data_format" label="上传数据格式" width="280"/>
|
||||
<el-table-column label="操作">
|
||||
<template #default="scope">
|
||||
<el-button @click="viewDetails(scope.row)">查看详细</el-button>
|
||||
<el-button @click="dialogDedupObjectVisible(scope.row)" type="primary">更改去重对象</el-button>
|
||||
<el-button @click="dialogDataFormatVisible(scope.row)" type="primary">更改数据格式</el-button>
|
||||
<el-popconfirm
|
||||
width="180"
|
||||
title="确认删除此Token吗"
|
||||
@@ -183,7 +225,6 @@ const checkPassword = () => {
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -193,6 +234,21 @@ const checkPassword = () => {
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="dataFormatVisible" title="更改数据格式" width="400">
|
||||
<el-select v-model="dataFormat" placeholder="选择数据格式" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in dataFormatOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="updateDataFormat">
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
Reference in New Issue
Block a user