Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
e3183975c3
|
@ -5,3 +5,12 @@ export const NETWORK_CERTIFICATE_UPLOAD = `${BASE_API_PATH}/network/certificate/
|
||||||
|
|
||||||
|
|
||||||
export const save = (data: object) => server.post(`/network/certificate`, data);
|
export const save = (data: object) => server.post(`/network/certificate`, data);
|
||||||
|
|
||||||
|
export const update = (data: object) => server.patch(`/network/certificate`, data);
|
||||||
|
|
||||||
|
export const query = (data: object) => server.post(`/network/certificate/_query`, data);
|
||||||
|
|
||||||
|
export const queryDetail = (id: string) => server.get(`/network/certificate/${id}`);
|
||||||
|
|
||||||
|
export const remove = (id: string) => server.remove(`/network/certificate/${id}`);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ const iconKeys = [
|
||||||
'QuestionCircleOutlined',
|
'QuestionCircleOutlined',
|
||||||
'InfoCircleOutlined',
|
'InfoCircleOutlined',
|
||||||
'SearchOutlined',
|
'SearchOutlined',
|
||||||
|
'EllipsisOutlined',
|
||||||
]
|
]
|
||||||
|
|
||||||
const Icon = (props: {type: string}) => {
|
const Icon = (props: {type: string}) => {
|
||||||
|
|
|
@ -37,6 +37,7 @@ export interface ActionsType {
|
||||||
tooltip?: TooltipProps;
|
tooltip?: TooltipProps;
|
||||||
popConfirm?: PopconfirmProps;
|
popConfirm?: PopconfirmProps;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
|
children?: ActionsType[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JColumnProps extends ColumnProps{
|
export interface JColumnProps extends ColumnProps{
|
||||||
|
|
|
@ -87,7 +87,7 @@ export default [
|
||||||
component: () => import('@/views/link/Certificate/index.vue')
|
component: () => import('@/views/link/Certificate/index.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/link/certificate/detail/add',
|
path: '/link/certificate/detail/:type/:id',
|
||||||
component: () => import('@/views/link/Certificate/Detail/index.vue')
|
component: () => import('@/views/link/Certificate/Detail/index.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a-tabs @change="handleConvertMetadata">
|
<a-tabs @change="handleConvertMetadata">
|
||||||
<a-tab-pane v-for="item in codecs" :tab-key="item.id" :key="item.id">
|
<a-tab-pane v-for="item in codecs" :key="item.id" :tab="item.name">
|
||||||
<div class="cat-panel">
|
<div class="cat-panel">
|
||||||
<!-- TODO 代码编辑器 -->
|
<!-- TODO 代码编辑器 -->
|
||||||
|
{{ value }}
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
|
@ -120,7 +121,9 @@ watch(
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
watchEffect(() => {
|
watch(
|
||||||
|
[props.visible, props.type],
|
||||||
|
() => {
|
||||||
if (props.visible) {
|
if (props.visible) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const { id } = route.params
|
const { id } = route.params
|
||||||
|
@ -138,7 +141,9 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.cat-content {
|
.cat-content {
|
||||||
|
|
|
@ -1,8 +1,328 @@
|
||||||
<template>
|
<template>
|
||||||
<a-button type="primary" @click="handlAdd">新增</a-button>
|
<div class="page-container">
|
||||||
|
<a-card style="margin-bottom: 20px">
|
||||||
|
<Search :columns="columns" target="search" @search="handleSearch" />
|
||||||
|
</a-card>
|
||||||
|
<a-card>
|
||||||
|
<JTable
|
||||||
|
ref="tableRef"
|
||||||
|
model="CARD"
|
||||||
|
:columns="columns"
|
||||||
|
:request="list"
|
||||||
|
:defaultParams="{
|
||||||
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
|
}"
|
||||||
|
:params="params"
|
||||||
|
>
|
||||||
|
<template #headerTitle>
|
||||||
|
<a-button type="primary" @click="handlAdd"
|
||||||
|
><plus-outlined />新增</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template #card="slotProps">
|
||||||
|
<CardBox
|
||||||
|
:showStatus="true"
|
||||||
|
:value="slotProps"
|
||||||
|
:actions="getActions(slotProps)"
|
||||||
|
v-bind="slotProps"
|
||||||
|
:class="
|
||||||
|
slotProps.state.value === 'disabled'
|
||||||
|
? 'tableCardDisabled'
|
||||||
|
: 'tableCardEnabled'
|
||||||
|
"
|
||||||
|
:status="slotProps.state.value"
|
||||||
|
:statusText="slotProps.state.text"
|
||||||
|
:statusNames="{
|
||||||
|
enabled: 'success',
|
||||||
|
disabled: 'error',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #img>
|
||||||
|
<slot name="img">
|
||||||
|
<img :src="getImage('/device-access.png')" />
|
||||||
|
</slot>
|
||||||
|
</template>
|
||||||
|
<template #content>
|
||||||
|
<div class="card-item-content">
|
||||||
|
<h3 class="card-item-content-title">
|
||||||
|
<a href="">{{ slotProps.name }}</a>
|
||||||
|
</h3>
|
||||||
|
<a-row class="card-item-content-box">
|
||||||
|
<a-col
|
||||||
|
:span="12"
|
||||||
|
v-if="slotProps.channelInfo"
|
||||||
|
class="card-item-content-text"
|
||||||
|
>
|
||||||
|
<div class="card-item-content-text">
|
||||||
|
{{ slotProps.channelInfo.name }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="card-item-content-text"
|
||||||
|
v-if="
|
||||||
|
slotProps.channelInfo.addresses
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-badge
|
||||||
|
:status="
|
||||||
|
slotProps.channelInfo
|
||||||
|
.addresses[0].health ===
|
||||||
|
-1
|
||||||
|
? 'error'
|
||||||
|
: 'success'
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>{{
|
||||||
|
slotProps.channelInfo
|
||||||
|
.addresses[0].address
|
||||||
|
}}</template>
|
||||||
|
{{
|
||||||
|
slotProps.channelInfo
|
||||||
|
.addresses[0].address
|
||||||
|
}}
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col
|
||||||
|
:span="12"
|
||||||
|
v-if="slotProps.protocolDetail"
|
||||||
|
>
|
||||||
|
<div class="card-item-content-text">
|
||||||
|
协议
|
||||||
|
</div>
|
||||||
|
<div class="card-item-content-text">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>{{
|
||||||
|
slotProps.protocolDetail
|
||||||
|
.name
|
||||||
|
}}</template>
|
||||||
|
{{
|
||||||
|
slotProps.protocolDetail
|
||||||
|
.name
|
||||||
|
}}
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<div class="card-item-content-text">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>
|
||||||
|
{{
|
||||||
|
providersList.find(
|
||||||
|
(item) =>
|
||||||
|
item.id ===
|
||||||
|
slotProps.provider,
|
||||||
|
)?.description
|
||||||
|
}}</template
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
providersList.find(
|
||||||
|
(item) =>
|
||||||
|
item.id ===
|
||||||
|
slotProps.provider,
|
||||||
|
)?.description
|
||||||
|
}}
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #actions="item">
|
||||||
|
<a-tooltip
|
||||||
|
v-bind="item.tooltip"
|
||||||
|
:title="item.disabled && item.tooltip.title"
|
||||||
|
>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="item.popConfirm"
|
||||||
|
v-bind="item.popConfirm"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
>
|
||||||
|
<a-button :disabled="item.disabled">
|
||||||
|
<AIcon
|
||||||
|
type="DeleteOutlined"
|
||||||
|
v-if="item.key === 'delete'"
|
||||||
|
/>
|
||||||
|
<template v-else>
|
||||||
|
<AIcon :type="item.icon" />
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
<template v-else>
|
||||||
|
<a-button
|
||||||
|
:disabled="item.disabled"
|
||||||
|
@click="item.onClick"
|
||||||
|
>
|
||||||
|
<AIcon
|
||||||
|
type="DeleteOutlined"
|
||||||
|
v-if="item.key === 'delete'"
|
||||||
|
/>
|
||||||
|
<template v-else>
|
||||||
|
<AIcon :type="item.icon" />
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
</CardBox>
|
||||||
|
</template>
|
||||||
|
<template #state="slotProps">
|
||||||
|
<a-badge
|
||||||
|
:text="slotProps.state.text"
|
||||||
|
:status="statusMap.get(slotProps.state.value)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</JTable>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="AccessConfigPage">
|
<script lang="ts" setup name="AccessConfigPage">
|
||||||
|
import type { ActionsType } from '@/components/Table/index.vue';
|
||||||
|
import { getImage } from '@/utils/comm';
|
||||||
|
import { list, getProviders } from '@/api/link/accessConfig';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const tableRef = ref<Record<string, any>>({});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const params = ref<Record<string, any>>({});
|
||||||
|
|
||||||
|
let providersList = ref([]);
|
||||||
|
|
||||||
|
const statusMap = new Map();
|
||||||
|
statusMap.set('enabled', 'success');
|
||||||
|
statusMap.set('disabled', 'error');
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
// scopedSlots: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '网关类型',
|
||||||
|
dataIndex: 'provider',
|
||||||
|
key: 'provider',
|
||||||
|
search: {
|
||||||
|
type: 'select',
|
||||||
|
// options: providersList,
|
||||||
|
// options: getProvidersList
|
||||||
|
options: async () => {
|
||||||
|
const res = await getProviders();
|
||||||
|
return (res?.result || []).map((item) => ({
|
||||||
|
lable: item.name,
|
||||||
|
value: item.id,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'state',
|
||||||
|
key: 'state',
|
||||||
|
search: {
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '禁用',
|
||||||
|
value: 'disabled',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '正常',
|
||||||
|
value: 'enabled',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '说明',
|
||||||
|
dataIndex: 'description',
|
||||||
|
key: 'description',
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 200,
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
|
if (!data) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
key: 'edit',
|
||||||
|
text: '编辑',
|
||||||
|
tooltip: {
|
||||||
|
title: '编辑',
|
||||||
|
},
|
||||||
|
icon: 'EditOutlined',
|
||||||
|
onClick: async () => {
|
||||||
|
handlEdit(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
text: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '确认删除?',
|
||||||
|
okText: ' 确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
onConfirm: async () => {
|
||||||
|
handlDelete(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icon: 'DeleteOutlined',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getProvidersList = async () => {
|
||||||
|
const res = await getProviders();
|
||||||
|
providersList = res.result;
|
||||||
|
};
|
||||||
|
getProvidersList();
|
||||||
|
|
||||||
|
const handlAdd = () => {
|
||||||
|
router.push('/link/accessConfig/detail/add');
|
||||||
|
|
||||||
|
// router.push('/link/certificate/detail/add/new');
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlEdit = (id: string) => {
|
||||||
|
router.push(`/link/certificate/detail/edit/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlDelete = async (id: string) => {
|
||||||
|
const res = await remove(id);
|
||||||
|
if (res.success) {
|
||||||
|
message.success('操作成功');
|
||||||
|
tableRef.value.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
const handleSearch = (e: any) => {
|
||||||
|
params.value = e;
|
||||||
|
};
|
||||||
|
|
||||||
// const handlAdd = () => {
|
// const handlAdd = () => {
|
||||||
// router.push({
|
// router.push({
|
||||||
|
@ -12,7 +332,39 @@ const router = useRouter();
|
||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
const handlAdd = () => {
|
// const handlAdd = () => {
|
||||||
router.push('/link/accessConfig/detail/add');
|
// router.push('/link/accessConfig/detail/add');
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.page-container {
|
||||||
|
background: #f0f2f5;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.tableCardDisabled {
|
||||||
|
width: 100%;
|
||||||
|
background: url('/images/access-config-diaabled.png') no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableCardEnabled {
|
||||||
|
width: 100%;
|
||||||
|
background: url('/images/access-config-enabled.png') no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-item-content {
|
||||||
|
min-height: 100px;
|
||||||
|
|
||||||
|
.card-item-content-box {
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
.card-item-content-text {
|
||||||
|
color: rgba(0, 0, 0, 0.75);
|
||||||
|
font-size: 12px;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button
|
<a-button
|
||||||
|
v-if="type !== 'view'"
|
||||||
class="form-submit"
|
class="form-submit"
|
||||||
html-type="submit"
|
html-type="submit"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -97,16 +98,20 @@ import { message, Form } from 'ant-design-vue';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import CertificateFile from './CertificateFile.vue';
|
import CertificateFile from './CertificateFile.vue';
|
||||||
import type { UploadChangeParam } from 'ant-design-vue';
|
import type { UploadChangeParam } from 'ant-design-vue';
|
||||||
import { save } from '@/api/link/certificate';
|
import { save, update, queryDetail } from '@/api/link/certificate';
|
||||||
|
import { FormDataType, TypeObjType } from '../type';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const type = route.params.type as string;
|
||||||
|
const id = route.params.id as string;
|
||||||
|
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
|
|
||||||
const fileLoading = ref(false);
|
const fileLoading = ref(false);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = ref<FormDataType>({
|
||||||
type: 'common',
|
type: 'common',
|
||||||
name: '',
|
name: '',
|
||||||
configs: {
|
configs: {
|
||||||
|
@ -137,9 +142,10 @@ const { resetFields, validate, validateInfos } = useForm(
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
validate()
|
validate()
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const params = toRaw(formData);
|
const params = toRaw(formData.value);
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const response = await save(params);
|
const response =
|
||||||
|
type === 'edit' ? await update(params) : await save(params);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
message.success('操作成功');
|
message.success('操作成功');
|
||||||
router.push('/link/certificate');
|
router.push('/link/certificate');
|
||||||
|
@ -156,10 +162,28 @@ const handleChange = (info: UploadChangeParam) => {
|
||||||
if (info.file.status === 'done') {
|
if (info.file.status === 'done') {
|
||||||
message.success('上传成功!');
|
message.success('上传成功!');
|
||||||
const result = info.file.response?.result;
|
const result = info.file.response?.result;
|
||||||
formData.configs.cert = result;
|
formData.value.configs.cert = result;
|
||||||
fileLoading.value = false;
|
fileLoading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const detail = async (id: string) => {
|
||||||
|
if (type !== 'add') {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await queryDetail(id);
|
||||||
|
if (res.success) {
|
||||||
|
const result = res.result as FormDataType;
|
||||||
|
const type = result.type.value as TypeObjType;
|
||||||
|
formData.value = {
|
||||||
|
...result,
|
||||||
|
type,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
detail(id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -1,14 +1,196 @@
|
||||||
<template>
|
<template>
|
||||||
<a-button type="primary" @click="handlAdd">新增</a-button>
|
<div class="page-container">
|
||||||
|
<a-card style="margin-bottom: 20px">
|
||||||
|
<Search
|
||||||
|
:columns="columns"
|
||||||
|
target="search"
|
||||||
|
@search="handleSearch"
|
||||||
|
/>
|
||||||
|
</a-card>
|
||||||
|
<a-card>
|
||||||
|
<JTable
|
||||||
|
ref="tableRef"
|
||||||
|
model="TABLE"
|
||||||
|
:columns="columns"
|
||||||
|
:request="query"
|
||||||
|
:defaultParams="{
|
||||||
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
|
}"
|
||||||
|
:params="params"
|
||||||
|
>
|
||||||
|
<template #headerTitle>
|
||||||
|
<a-button type="primary" @click="handlAdd"
|
||||||
|
><plus-outlined />新增</a-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template #type="slotProps">
|
||||||
|
<span>{{ slotProps.type.text }}</span>
|
||||||
|
</template>
|
||||||
|
<template #action="slotProps">
|
||||||
|
<a-space :size="16">
|
||||||
|
<a-tooltip
|
||||||
|
v-for="i in getActions(slotProps)"
|
||||||
|
:key="i.key"
|
||||||
|
v-bind="i.tooltip"
|
||||||
|
>
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="i.popConfirm"
|
||||||
|
v-bind="i.popConfirm"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
:disabled="i.disabled"
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
><AIcon :type="i.icon"
|
||||||
|
/></a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-button
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
v-else
|
||||||
|
@click="i.onClick && i.onClick(slotProps)"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
:disabled="i.disabled"
|
||||||
|
style="padding: 0"
|
||||||
|
type="link"
|
||||||
|
><AIcon :type="i.icon"
|
||||||
|
/></a-button>
|
||||||
|
</a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</JTable>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="CertificatePage">
|
<script lang="ts" setup name="CertificatePage">
|
||||||
|
import type { ActionsType } from '@/components/Table/index.vue';
|
||||||
|
import { save, query, remove } from '@/api/link/certificate';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const tableRef = ref<Record<string, any>>({});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const params = ref<Record<string, any>>({});
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '证书标准',
|
||||||
|
dataIndex: 'type',
|
||||||
|
key: 'type',
|
||||||
|
search: {
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '证书标准',
|
||||||
|
value: 'common',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '证书名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '说明',
|
||||||
|
dataIndex: 'description',
|
||||||
|
key: 'description',
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 200,
|
||||||
|
scopedSlots: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
|
if (!data) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
key: 'eye',
|
||||||
|
text: '查看',
|
||||||
|
tooltip: {
|
||||||
|
title: '查看',
|
||||||
|
},
|
||||||
|
icon: 'EyeOutlined',
|
||||||
|
onClick: async () => {
|
||||||
|
handlEye(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'edit',
|
||||||
|
text: '编辑',
|
||||||
|
tooltip: {
|
||||||
|
title: '编辑',
|
||||||
|
},
|
||||||
|
icon: 'EditOutlined',
|
||||||
|
onClick: async () => {
|
||||||
|
handlEdit(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
text: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '确认删除?',
|
||||||
|
okText: ' 确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
onConfirm: async () => {
|
||||||
|
handlDelete(data.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icon: 'DeleteOutlined',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
const handlAdd = () => {
|
const handlAdd = () => {
|
||||||
router.push('/link/certificate/detail/add');
|
router.push('/link/certificate/detail/add/new');
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlEye = (id: string) => {
|
||||||
|
router.push(`/link/certificate/detail/view/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlEdit = (id: string) => {
|
||||||
|
router.push(`/link/certificate/detail/edit/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlDelete = async (id: string) => {
|
||||||
|
const res = await remove(id);
|
||||||
|
if (res.success) {
|
||||||
|
message.success('操作成功');
|
||||||
|
tableRef.value.reload();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
const handleSearch = (e: any) => {
|
||||||
|
console.log(1211, e);
|
||||||
|
|
||||||
|
params.value = e;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.page-container {
|
||||||
|
background: #f0f2f5;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
export interface TypeObjType = {
|
||||||
|
text: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
export type FormDataType = {
|
||||||
|
description: string;
|
||||||
|
name: string;
|
||||||
|
type: string | TypeObjType;
|
||||||
|
configs: {
|
||||||
|
cert: string;
|
||||||
|
key: string;
|
||||||
|
};
|
||||||
|
id?: string;
|
||||||
|
format?: string;
|
||||||
|
mode?: object;
|
||||||
|
creatorId?: string;
|
||||||
|
createTime?: number;
|
||||||
|
};
|
|
@ -77,20 +77,35 @@
|
||||||
v-bind="item.tooltip"
|
v-bind="item.tooltip"
|
||||||
:title="item.disabled && item.tooltip.title"
|
:title="item.disabled && item.tooltip.title"
|
||||||
>
|
>
|
||||||
|
<a-dropdown
|
||||||
|
placement="bottomRight"
|
||||||
|
v-if="item.key === 'others'"
|
||||||
|
>
|
||||||
|
<a-button>
|
||||||
|
<AIcon :type="item.icon" />
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
</a-button>
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item
|
||||||
|
v-for="(o, i) in item.children"
|
||||||
|
:key="i"
|
||||||
|
>
|
||||||
|
<a-button type="link" @click="o.onClick">
|
||||||
|
<AIcon :type="o.icon" />
|
||||||
|
<span>{{ o.text }}</span>
|
||||||
|
</a-button>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-if="item.popConfirm"
|
v-else-if="item.key === 'delete'"
|
||||||
v-bind="item.popConfirm"
|
v-bind="item.popConfirm"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
>
|
>
|
||||||
<a-button :disabled="item.disabled">
|
<a-button :disabled="item.disabled">
|
||||||
<AIcon
|
<AIcon type="DeleteOutlined" />
|
||||||
type="DeleteOutlined"
|
|
||||||
v-if="item.key === 'delete'"
|
|
||||||
/>
|
|
||||||
<template v-else>
|
|
||||||
<AIcon :type="item.icon" />
|
|
||||||
<span>{{ item.text }}</span>
|
|
||||||
</template>
|
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -98,14 +113,8 @@
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
@click="item.onClick"
|
@click="item.onClick"
|
||||||
>
|
>
|
||||||
<AIcon
|
|
||||||
type="DeleteOutlined"
|
|
||||||
v-if="item.key === 'delete'"
|
|
||||||
/>
|
|
||||||
<template v-else>
|
|
||||||
<AIcon :type="item.icon" />
|
<AIcon :type="item.icon" />
|
||||||
<span>{{ item.text }}</span>
|
<span>{{ item.text }}</span>
|
||||||
</template>
|
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
@ -351,6 +360,59 @@ const getActions = (
|
||||||
currentConfig.value = data;
|
currentConfig.value = data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// key: 'others',
|
||||||
|
// text: '其他',
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// key: 'debug',
|
||||||
|
// text: '导出',
|
||||||
|
// tooltip: {
|
||||||
|
// title: '导出',
|
||||||
|
// },
|
||||||
|
// icon: 'ArrowDownOutlined',
|
||||||
|
// onClick: () => {
|
||||||
|
// downloadObject(data, `通知配置`);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: 'sync',
|
||||||
|
// text: '同步用户',
|
||||||
|
// tooltip: {
|
||||||
|
// title: '同步用户',
|
||||||
|
// },
|
||||||
|
// icon: 'TeamOutlined',
|
||||||
|
// onClick: () => {
|
||||||
|
// syncVis.value = true;
|
||||||
|
// currentConfig.value = data;
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
text: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '确认删除?',
|
||||||
|
onConfirm: async () => {
|
||||||
|
const resp = await ConfigApi.del(data.id);
|
||||||
|
if (resp.status === 200) {
|
||||||
|
message.success('操作成功!');
|
||||||
|
configRef.value?.reload();
|
||||||
|
} else {
|
||||||
|
message.error('操作失败!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icon: 'DeleteOutlined',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const others: ActionsType = {
|
||||||
|
key: 'others',
|
||||||
|
text: '其他',
|
||||||
|
icon: 'EllipsisOutlined',
|
||||||
|
children: [
|
||||||
{
|
{
|
||||||
key: 'debug',
|
key: 'debug',
|
||||||
text: '导出',
|
text: '导出',
|
||||||
|
@ -374,27 +436,26 @@ const getActions = (
|
||||||
currentConfig.value = data;
|
currentConfig.value = data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
key: 'delete',
|
};
|
||||||
text: '删除',
|
|
||||||
popConfirm: {
|
if (type === 'card') {
|
||||||
title: '确认删除?',
|
if (
|
||||||
onConfirm: async () => {
|
data.provider !== 'dingTalkMessage' &&
|
||||||
const resp = await ConfigApi.del(data.id);
|
data.provider !== 'corpMessage'
|
||||||
if (resp.status === 200) {
|
)
|
||||||
message.success('操作成功!');
|
others.children.splice(1, 1);
|
||||||
configRef.value?.reload();
|
actions.splice(actions.length - 1, 0, others);
|
||||||
} else {
|
|
||||||
message.error('操作失败!');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
icon: 'DeleteOutlined',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
if (data.provider === 'dingTalkMessage' || data.provider === 'corpMessage')
|
|
||||||
return actions;
|
return actions;
|
||||||
return actions.filter((i: ActionsType) => i.key !== 'sync');
|
} else {
|
||||||
|
if (
|
||||||
|
data.provider !== 'dingTalkMessage' &&
|
||||||
|
data.provider !== 'corpMessage'
|
||||||
|
)
|
||||||
|
others.children.splice(1, 1);
|
||||||
|
actions.splice(actions.length - 1, 0, ...others.children);
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
Loading…
Reference in New Issue