diff --git a/src/api/link/certificate.ts b/src/api/link/certificate.ts
index 9ed5f5e1..3f6b0a31 100644
--- a/src/api/link/certificate.ts
+++ b/src/api/link/certificate.ts
@@ -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 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}`);
+
diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx
index c580070d..1a21e6ff 100644
--- a/src/components/AIcon/index.tsx
+++ b/src/components/AIcon/index.tsx
@@ -44,6 +44,7 @@ const iconKeys = [
'QuestionCircleOutlined',
'InfoCircleOutlined',
'SearchOutlined',
+ 'EllipsisOutlined',
]
const Icon = (props: {type: string}) => {
diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx
index 7c43d1f7..1a37be86 100644
--- a/src/components/Table/index.tsx
+++ b/src/components/Table/index.tsx
@@ -37,6 +37,7 @@ export interface ActionsType {
tooltip?: TooltipProps;
popConfirm?: PopconfirmProps;
icon?: string;
+ children?: ActionsType[];
}
export interface JColumnProps extends ColumnProps{
diff --git a/src/router/menu.ts b/src/router/menu.ts
index fd304be9..234bcabf 100644
--- a/src/router/menu.ts
+++ b/src/router/menu.ts
@@ -87,7 +87,7 @@ export default [
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')
},
{
diff --git a/src/views/device/components/Metadata/Cat/index.vue b/src/views/device/components/Metadata/Cat/index.vue
index 5936eb0d..e0292159 100644
--- a/src/views/device/components/Metadata/Cat/index.vue
+++ b/src/views/device/components/Metadata/Cat/index.vue
@@ -16,9 +16,10 @@
-
+
+ {{ value }}
@@ -120,25 +121,29 @@ watch(
{ immediate: true }
)
-watchEffect(() => {
- if (props.visible) {
- loading.value = true
- const { id } = route.params
- if (props.type === 'device') {
- detail(id as string).then((resp) => {
- loading.value = false
- instanceStore.setCurrent(resp.result)
- value.value = resp.result.metadata
- });
- } else {
- productDetail(id as string).then((resp) => {
- loading.value = false
- // productStore.setCurrent(resp.result)
- value.value = resp.result.metadata
- });
+watch(
+ [props.visible, props.type],
+ () => {
+ if (props.visible) {
+ loading.value = true
+ const { id } = route.params
+ if (props.type === 'device') {
+ detail(id as string).then((resp) => {
+ loading.value = false
+ instanceStore.setCurrent(resp.result)
+ value.value = resp.result.metadata
+ });
+ } else {
+ productDetail(id as string).then((resp) => {
+ loading.value = false
+ // productStore.setCurrent(resp.result)
+ value.value = resp.result.metadata
+ });
+ }
}
- }
-})
+ },
+ { immediate: true }
+)
diff --git a/src/views/link/Certificate/Detail/index.vue b/src/views/link/Certificate/Detail/index.vue
index 410bd10c..e8857baf 100644
--- a/src/views/link/Certificate/Detail/index.vue
+++ b/src/views/link/Certificate/Detail/index.vue
@@ -60,6 +60,7 @@
({
type: 'common',
name: '',
configs: {
@@ -137,9 +142,10 @@ const { resetFields, validate, validateInfos } = useForm(
const onSubmit = () => {
validate()
.then(async (res) => {
- const params = toRaw(formData);
+ const params = toRaw(formData.value);
loading.value = true;
- const response = await save(params);
+ const response =
+ type === 'edit' ? await update(params) : await save(params);
if (response.status === 200) {
message.success('操作成功');
router.push('/link/certificate');
@@ -156,10 +162,28 @@ const handleChange = (info: UploadChangeParam) => {
if (info.file.status === 'done') {
message.success('上传成功!');
const result = info.file.response?.result;
- formData.configs.cert = result;
+ formData.value.configs.cert = result;
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);
diff --git a/src/views/link/Certificate/type.d.ts b/src/views/link/Certificate/type.d.ts
new file mode 100644
index 00000000..eb38e3e6
--- /dev/null
+++ b/src/views/link/Certificate/type.d.ts
@@ -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;
+};
diff --git a/src/views/notice/Config/index.vue b/src/views/notice/Config/index.vue
index 801f8b39..6a2af067 100644
--- a/src/views/notice/Config/index.vue
+++ b/src/views/notice/Config/index.vue
@@ -77,20 +77,35 @@
v-bind="item.tooltip"
:title="item.disabled && item.tooltip.title"
>
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+ {{ o.text }}
+
+
+
+
+
-
-
-
- {{ item.text }}
-
+
@@ -98,14 +113,8 @@
:disabled="item.disabled"
@click="item.onClick"
>
-
-
-
- {{ item.text }}
-
+
+ {{ item.text }}
@@ -351,29 +360,35 @@ const getActions = (
currentConfig.value = data;
},
},
- {
- 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: '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: '删除',
@@ -392,9 +407,55 @@ const getActions = (
icon: 'DeleteOutlined',
},
];
- if (data.provider === 'dingTalkMessage' || data.provider === 'corpMessage')
+
+ const others: ActionsType = {
+ key: 'others',
+ text: '其他',
+ icon: 'EllipsisOutlined',
+ 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;
+ },
+ },
+ ],
+ };
+
+ if (type === 'card') {
+ if (
+ data.provider !== 'dingTalkMessage' &&
+ data.provider !== 'corpMessage'
+ )
+ others.children.splice(1, 1);
+ actions.splice(actions.length - 1, 0, others);
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;
+ }
};