|
@@ -35,8 +35,9 @@
|
|
|
:raw-content="true"
|
|
|
placement="top"
|
|
|
>
|
|
|
- <SvgIcon name="czr_tip" size="14" class="ml-2" /> </el-tooltip
|
|
|
- ></template>
|
|
|
+ <SvgIcon name="czr_tip" size="14" class="ml-2" />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
</CzrFormColumn>
|
|
|
<CzrFormColumn
|
|
|
:span="24"
|
|
@@ -56,21 +57,80 @@
|
|
|
:limit="1"
|
|
|
:delRule="(file) => true"
|
|
|
/>
|
|
|
- <!-- <template>-->
|
|
|
<CzrFormColumn
|
|
|
- required
|
|
|
:span="24"
|
|
|
label="公开访问URL"
|
|
|
- v-model:param="state.form.name"
|
|
|
+ v-model:param="state.form.url1"
|
|
|
:disabled="true"
|
|
|
>
|
|
|
+ <template #label>
|
|
|
+ 公开访问URL
|
|
|
+ <div class="ml-auto" @click.capture.stop="onSwitchUrl">
|
|
|
+ <a-switch v-model:checked="state.form.enabled1" size="small" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #suffix>
|
|
|
- <CopyDocument class="w-4 cursor-pointer" />
|
|
|
+ <CopyDocument
|
|
|
+ class="w-4 cursor-pointer"
|
|
|
+ @click="onCopy(state.form.url1)"
|
|
|
+ />
|
|
|
</template>
|
|
|
</CzrFormColumn>
|
|
|
- <!-- </template>-->
|
|
|
+ <CzrFormColumn
|
|
|
+ :span="24"
|
|
|
+ label="后端访问API"
|
|
|
+ v-model:param="state.form.url2"
|
|
|
+ :disabled="true"
|
|
|
+ >
|
|
|
+ <template #label>
|
|
|
+ 公开访问URL
|
|
|
+ <div class="ml-auto" @click.capture.stop="onSwitchApi">
|
|
|
+ <a-switch v-model:checked="state.form.enabled2" size="small" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #suffix>
|
|
|
+ <CopyDocument
|
|
|
+ class="w-4 cursor-pointer"
|
|
|
+ @click="onCopy(state.form.url2)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </CzrFormColumn>
|
|
|
+ <div class="__czr-title_1 mb-2">
|
|
|
+ API密钥
|
|
|
+ <CzrButton title="新增" type="add" class="ml-auto" @click="onAdd" />
|
|
|
+ </div>
|
|
|
+ <div class="max-h-[300px] w-full">
|
|
|
+ <CzrTable
|
|
|
+ v-loading="state.query.loading"
|
|
|
+ :data="state.query.result.data"
|
|
|
+ :head="state.query.head"
|
|
|
+ :no-foot="true"
|
|
|
+ :full="true"
|
|
|
+ >
|
|
|
+ <template #caozuo-column-value="{ scope }">
|
|
|
+ <div class="__czr-table-operations">
|
|
|
+ <CzrButton
|
|
|
+ type="table"
|
|
|
+ title="复制"
|
|
|
+ @click="onCopy(scope.row.key)"
|
|
|
+ />
|
|
|
+ <CzrButton
|
|
|
+ type="table"
|
|
|
+ title="编辑"
|
|
|
+ @click="onEdit(scope.row)"
|
|
|
+ />
|
|
|
+ <CzrButton type="table-del" @click="onDel(scope.row)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </CzrTable>
|
|
|
+ </div>
|
|
|
</CzrForm>
|
|
|
</div>
|
|
|
+ <apiKey
|
|
|
+ v-model:show="state.apiKey.show"
|
|
|
+ :transfer="state.apiKey.transfer"
|
|
|
+ @refresh="onApi"
|
|
|
+ />
|
|
|
</CzrDialog>
|
|
|
</template>
|
|
|
|
|
@@ -87,7 +147,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { CopyDocument } from '@element-plus/icons-vue'
|
|
|
-import CzrDialog from '@/components/czr-ui/CzrDialog.vue'
|
|
|
+import { copy } from '@/utils/czr-util'
|
|
|
+import apiKey from './api-key.vue'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const AppStore = useAppStore()
|
|
@@ -103,6 +164,45 @@ const state: any = reactive({
|
|
|
loading: false,
|
|
|
form: {},
|
|
|
icon: [],
|
|
|
+ query: {
|
|
|
+ loading: false,
|
|
|
+ head: [
|
|
|
+ { value: 'p1', label: '密钥', show: true },
|
|
|
+ {
|
|
|
+ value: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ show: true,
|
|
|
+ width: 180,
|
|
|
+ datetime: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'updateTime',
|
|
|
+ label: '最后使用',
|
|
|
+ show: true,
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'p1',
|
|
|
+ label: '备注',
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'caozuo',
|
|
|
+ label: '操作',
|
|
|
+ show: true,
|
|
|
+ width: 200,
|
|
|
+ fixed: 'right',
|
|
|
+ popover: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ result: {
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ apiKey: {
|
|
|
+ show: false,
|
|
|
+ transfer: {},
|
|
|
+ },
|
|
|
})
|
|
|
const ref_form = ref()
|
|
|
const titleCpt = computed(() => {
|
|
@@ -126,11 +226,17 @@ watch(
|
|
|
(n) => {
|
|
|
if (n) {
|
|
|
initDictionary()
|
|
|
- state.form = {}
|
|
|
+ state.form = {
|
|
|
+ url1: 'http://8.130.72.63:18079/big-model-web/knowledge',
|
|
|
+ enabled1: false,
|
|
|
+ url2: 'http://8.130.72.63:18079/big-model-web/knowledge',
|
|
|
+ enabled2: true,
|
|
|
+ }
|
|
|
state.icon = []
|
|
|
if (props.transfer.mode !== 'add') {
|
|
|
initData()
|
|
|
}
|
|
|
+ onApi()
|
|
|
nextTick(() => {
|
|
|
ref_form.value.reset()
|
|
|
})
|
|
@@ -189,6 +295,64 @@ const onSubmit = () => {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
+const onCopy = (str) => {
|
|
|
+ copy(str)
|
|
|
+ ElMessage.success('复制成功!')
|
|
|
+}
|
|
|
+const onSwitchUrl = () => {
|
|
|
+ if (state.form.enabled1) {
|
|
|
+ DialogStore.confirm({
|
|
|
+ title: '停用确认',
|
|
|
+ content: `请确认是否停用公开访问URL?`,
|
|
|
+ onSubmit: () => {
|
|
|
+ ElMessage.success('停用成功!')
|
|
|
+ },
|
|
|
+ onCancel: () => {},
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ElMessage.success('启用成功!')
|
|
|
+ }
|
|
|
+}
|
|
|
+const onSwitchApi = () => {
|
|
|
+ if (state.form.enabled2) {
|
|
|
+ DialogStore.confirm({
|
|
|
+ title: '停用确认',
|
|
|
+ content: `请确认是否停用后端访问API?`,
|
|
|
+ onSubmit: () => {
|
|
|
+ ElMessage.success('停用成功!')
|
|
|
+ },
|
|
|
+ onCancel: () => {},
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ElMessage.success('启用成功!')
|
|
|
+ }
|
|
|
+}
|
|
|
+const onAdd = () => {
|
|
|
+ state.apiKey.transfer = {
|
|
|
+ mode: 'add',
|
|
|
+ }
|
|
|
+ state.apiKey.show = true
|
|
|
+}
|
|
|
+const onEdit = (row) => {
|
|
|
+ state.apiKey.transfer = {
|
|
|
+ mode: 'edit',
|
|
|
+ id: row.id,
|
|
|
+ }
|
|
|
+ state.apiKey.show = true
|
|
|
+}
|
|
|
+const onDel = (row) => {
|
|
|
+ DialogStore.confirm({
|
|
|
+ title: '删除确认',
|
|
|
+ content: `请确认是否删除密钥?`,
|
|
|
+ onSubmit: () => {
|
|
|
+ ElMessage.success('删除成功!')
|
|
|
+ },
|
|
|
+ onCancel: () => {},
|
|
|
+ })
|
|
|
+}
|
|
|
+const onApi = () => {
|
|
|
+ state.query.result.data = [{}, {}, {}]
|
|
|
+}
|
|
|
const initDictionary = () => {}
|
|
|
</script>
|
|
|
|