Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
XieYongHong 2023-07-03 16:10:12 +08:00
commit 90a38268b9
11 changed files with 211 additions and 105 deletions

View File

@ -7,7 +7,11 @@
>
<j-tab-pane v-for="item in tab" :key="item.key">
<template #tab>
<NoticeTab :refresh="refreshObj[item.key]" :tab="item?.tab" :type="item.type" />
<NoticeTab
:refresh="refreshObj[item.key]"
:tab="item?.tab"
:type="item.type"
/>
</template>
<j-spin :spinning="loading">
<div class="content">
@ -24,7 +28,7 @@
<j-empty />
</div>
<div class="btns">
<span @click="onMore">查看更多</span>
<span @click="onMore(item.key)">查看更多</span>
</div>
</div>
</j-spin>
@ -36,6 +40,7 @@
<script setup lang="ts">
import { getList_api } from '@/api/account/notificationRecord';
import { useMenuStore } from '@/store/menu';
import { useUserInfo } from '@/store/userInfo';
import { cloneDeep } from 'lodash-es';
import NoticeItem from './NoticeItem.vue';
import NoticeTab from './NoticeTab.vue';
@ -69,16 +74,19 @@ const tab = [
];
const refreshObj = ref({
'alarm': true,
alarm: true,
'system-monitor': true,
'system-business': true
})
'system-business': true,
});
const loading = ref(false);
const total = ref(0);
const list = ref<any[]>([]);
const activeKey = ref<DataType>('alarm');
const menuStory = useMenuStore();
const route = useRoute();
const userInfo = useUserInfo();
const getData = (type: string[]) => {
loading.value = true;
@ -121,18 +129,28 @@ onMounted(() => {
});
const onRefresh = (id: string) => {
const flag = cloneDeep(refreshObj.value[id])
const flag = cloneDeep(refreshObj.value[id]);
refreshObj.value = {
...refreshObj.value,
[id]: !flag
}
}
[id]: !flag,
};
};
const onMore = () => {
menuStory.routerPush('account/center', {
tabKey: 'StationMessage',
});
emits('action')
const onMore = (key: string) => {
// /account/center
if (route.path === '/account/center') {
userInfo.tabKey = 'StationMessage';
userInfo.other.tabKey = key;
} else {
menuStory.routerPush('account/center', {
tabKey: 'StationMessage',
other: {
tabKey: key,
},
});
}
emits('action');
};
</script>

View File

@ -29,6 +29,9 @@ export const useUserInfo = defineStore('userInfo', {
alarmUpdateCount: 0,
tabKey: 'HomeView', // 个人中心的tabKey,
messageInfo: {}, // 站内信的row
other: {
tabKey: '' // 站内信的tabkey
}
}),
actions: {

View File

@ -4,8 +4,13 @@
tab-position="left"
v-if="tabs.length"
:destroyInactiveTabPane="true"
v-model:activeKey="user.other.tabKey"
>
<j-tab-pane v-for="item in tabs" :key="item.provider" :tab="item.name">
<j-tab-pane
v-for="item in tabs"
:key="item.provider"
:tab="item.name"
>
<NotificationRecord :type="item.provider" />
</j-tab-pane>
</j-tabs>
@ -17,9 +22,13 @@
import NotificationRecord from './components/NotificationRecord/index.vue';
import { initData } from '../data';
import { getAllNotice } from '@/api/account/center';
import { useRouterParams } from '@/utils/hooks/useParams';
import { useUserInfo } from '@/store/userInfo';
const tabs = ref<any[]>([]);
const router = useRouterParams();
const user = useUserInfo();
const queryTypeList = () => {
getAllNotice().then((resp: any) => {
if (resp.status === 200) {
@ -48,11 +57,21 @@ const queryTypeList = () => {
children: item.children.filter((lt: any) => lt?.id),
};
});
tabs.value = arr
if (!user.other.tabKey) {
user.other.tabKey = arr?.[0]?.provider;
}
tabs.value = arr;
}
});
};
watchEffect(() => {
if (router.params.value?.other?.tabKey) {
user.other.tabKey = router.params.value?.other?.tabKey
}
});
onMounted(() => {
queryTypeList();
});

View File

@ -182,6 +182,7 @@ watchEffect(() => {
onUnmounted(() => {
user.tabKey = 'HomeView'
user.other.tabKey = ''
})
</script>

View File

@ -43,19 +43,19 @@
<template #other>
<div class='plugin-other'>
<div class='plugin-id'>
插件ID
<div class="plugin-text">插件ID</div>
<div class='other-content'>
<Ellipsis >
<j-ellipsis>
{{ item.id }}
</Ellipsis>
</j-ellipsis>
</div>
</div>
<div class='plugin-version'>
版本号
<div class="plugin-text"> 版本号</div>
<div class='other-content'>
<Ellipsis >
<j-ellipsis>
{{ item.version }}
</Ellipsis>
</j-ellipsis>
</div>
</div>
</div>
@ -420,15 +420,19 @@ queryPlugin()
color: rgba(0, 0, 0, 0.85);
opacity: .45;
display: flex;
.plugin-text {
white-space: nowrap;
}
}
.plugin-id {
width: 50%;
.other-content {
display: flex;
width: 0;
flex-grow: 1;
}
// .other-content {
// display: flex;
// width: 0;
// flex-grow: 1;
// }
}
}

View File

@ -12,7 +12,7 @@
<j-select
v-model:value="formData.type"
placeholder="请选择通知方式"
:disabled="!!formData.id"
:disabled="_disabled"
@change="handleTypeChange"
>
<j-select-option
@ -39,6 +39,7 @@
:options="msgType"
v-model="formData.provider"
@change="handleProviderChange"
:disabled="route.query.provider"
/>
</j-form-item>
<!-- 钉钉 -->
@ -197,7 +198,7 @@
v-model:value="
formData.configuration.sender
"
placeholder="请输入发件人"
placeholder="username@domain.com"
/>
</j-form-item>
<j-form-item
@ -473,6 +474,10 @@ const handleTypeChange = () => {
}, 0);
};
const _disabled = computed(() => {
return !!formData.value?.id || route.query?.notifyType
})
/**
* 通知类型改变
*/
@ -545,7 +550,13 @@ const handleSubmit = () => {
}
if (res?.success) {
message.success('保存成功');
router.back();
if (route.query.notifyType) {
// @ts-ignore
window?.onTabSaveSuccess(res.result);
setTimeout(() => window.close(), 300);
} else {
router.back();
}
}
})
.catch((err) => {
@ -555,4 +566,13 @@ const handleSubmit = () => {
btnLoading.value = false;
});
};
watchEffect(() => {
if(route.query?.notifyType) {
formData.value.type = route.query.notifyType as string
}
if(route.query?.provider) {
formData.value.provider = route.query.provider as string
}
})
</script>

View File

@ -1554,8 +1554,7 @@ const paramsValidator = () => {
paramsValid.value ? resolve('') : reject('请输入完整的请求参数');
});
};
onMounted(() => {
const getType = () => {
queryType().then((resp: any) => {
if (resp.status === 200) {
const arr = resp.result.map((item: any) => ({
@ -1571,6 +1570,16 @@ onMounted(() => {
typeOptions.value = arr;
}
});
}
onMounted(() => {
getType();
getRoleIdList();
getOrgIdList();
if (routeQuery.id) {
getInfo(routeQuery.id as string);
}
});
//
@ -1586,64 +1595,55 @@ const dialog = reactive({
current: {},
});
init();
watch(
() => form.data.provider,
(n) => {
if (!form.data.id) {
// , ,
form.data.page.baseUrl = '';
form.data.apiClient.baseUrl = '';
form.data.page.parameters = [];
form.data.apiClient.parameters = [];
form.data.apiClient.authConfig.oauth2.authorizationUrl = '';
form.data.sso.configuration.oauth2.authorizationUrl = '';
form.data.apiClient.authConfig.oauth2.clientId = '';
form.data.sso.configuration.oauth2.clientId = '';
form.data.apiClient.authConfig.oauth2.clientSecret = '';
form.data.sso.configuration.oauth2.clientSecret = '';
form.data.apiClient.headers = [];
form.data.apiServer.roleIdList = [];
form.data.apiServer.orgIdList = [];
form.data.description = '';
form.data.apiServer.redirectUri = '';
form.data.sso.configuration.appSecret = '';
function init() {
getRoleIdList();
getOrgIdList();
// formRef.value?.resetFields();
}
emit('changeApplyType', n);
if (routeQuery.id) return;
if (
[
'wechat-webapp',
'dingtalk-ent-app',
'wechat-miniapp',
].includes(n)
) {
form.data.integrationModes = ['ssoClient'];
// form.integrationModesISO = ['ssoClient'];
} else form.data.integrationModes = [];
},
{ immediate: true },
);
watch(
() => form.data.integrationModes,
(n, o) => {
o.forEach((key) => {
if (!n.includes(key)) form.errorNumInfo[key].clear();
});
if (routeQuery.id) getInfo(routeQuery.id as string);
watch(
() => form.data.provider,
(n) => {
if (!form.data.id) {
// , ,
form.data.page.baseUrl = '';
form.data.apiClient.baseUrl = '';
form.data.page.parameters = [];
form.data.apiClient.parameters = [];
form.data.apiClient.authConfig.oauth2.authorizationUrl = '';
form.data.sso.configuration.oauth2.authorizationUrl = '';
form.data.apiClient.authConfig.oauth2.clientId = '';
form.data.sso.configuration.oauth2.clientId = '';
form.data.apiClient.authConfig.oauth2.clientSecret = '';
form.data.sso.configuration.oauth2.clientSecret = '';
form.data.apiClient.headers = [];
form.data.apiServer.roleIdList = [];
form.data.apiServer.orgIdList = [];
form.data.description = '';
form.data.apiServer.redirectUri = '';
form.data.sso.configuration.appSecret = '';
// formRef.value?.resetFields();
}
emit('changeApplyType', n);
if (routeQuery.id) return;
if (
[
'wechat-webapp',
'dingtalk-ent-app',
'wechat-miniapp',
].includes(n)
) {
form.data.integrationModes = ['ssoClient'];
// form.integrationModesISO = ['ssoClient'];
} else form.data.integrationModes = [];
},
{ immediate: true },
);
watch(
() => form.data.integrationModes,
(n, o) => {
o.forEach((key) => {
if (!n.includes(key)) form.errorNumInfo[key].clear();
});
// form.integrationModesISO = [...n];
},
);
}
// form.integrationModesISO = [...n];
},
);
function getInfo(id: string) {
getAppInfo_api(id).then((resp: any) => {

View File

@ -6,6 +6,19 @@
@search="handleSearch"
class="action-search"
/>
<div class="header">
<div class="alert">
<AIcon type="InfoCircleOutlined" />
钉钉群机器人类型的配置在当前页面将被过滤
</div>
<!-- <PermissionButton
@click="onAdd"
type="primary"
:hasPermission="['notice/Config:add']"
>
新增
</PermissionButton> -->
</div>
<div style="height: 400px; overflow-y: auto">
<JProTable
:columns="columns"
@ -14,7 +27,7 @@
:bodyStyle="{
padding: 0,
}"
:alertRender='false'
:alertRender="false"
:params="params"
:gridColumn="2"
:rowSelection="{
@ -143,7 +156,7 @@ const query = (e: Record<string, any>) =>
column: 'provider',
type: 'and',
value: 'dingTalkRobotWebHook',
}
},
],
},
],
@ -173,6 +186,13 @@ const handleClick = (dt: any) => {
}
};
const onAdd = () => {
const tab: any = window.open(`${origin}/#/iot/notice/Config/detail/:id?notifyType=${noticeType.get(props.notifyType)}&provider=${props.notifyType === 'notifier-dingTalk' ? 'dingTalkRobotWebHook' : ''}`);
tab.onTabSaveSuccess = (value: any) => {
console.log(value)
};
};
watch(
() => props.value,
(newValue) => {
@ -198,4 +218,18 @@ watch(
width: 88px;
height: 88px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
}
.alert {
height: 40px;
padding: 0 20px 0 10px;
margin-bottom: 10px;
color: rgba(0, 0, 0, 0.55);
line-height: 40px;
background-color: #f6f6f6;
}
</style>

View File

@ -209,9 +209,14 @@ watch(
width: 88px;
height: 88px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
}
.alert {
height: 40px;
padding-left: 10px;
padding: 0 20px 0 10px;
margin-bottom: 10px;
color: rgba(0, 0, 0, 0.55);
line-height: 40px;

View File

@ -8,13 +8,13 @@
<j-form-item
:name="`${item?.id}`"
:label="item?.name"
v-for="(item) in variableDefinitions"
v-for="item in variableDefinitions"
:key="item.id"
:required="getType(item) !== 'file' ? true : false"
:rules="[
{
required: getType(item) !== 'file' ? true : false,
validator: (_rule, value) => checkValue(_rule, value, item),
trigger: ['blur', 'change'],
trigger: ['change'],
},
]"
>
@ -80,12 +80,11 @@ const getType = (item: any) => {
};
const checkValue = (_rule: any, value: any, item: any) => {
if(!value){
return Promise.resolve();
}
const type = item.expands?.businessType || item?.type;
if (type === 'file') {
return Promise.resolve();
} else if (type === 'string' && !value) {
return Promise.reject(new Error('请输入' + item.name));
} else if (type === 'link') {
if (!value) {
return Promise.reject(new Error('请输入' + item.name));
@ -128,11 +127,14 @@ const checkValue = (_rule: any, value: any, item: any) => {
const onSave = () =>
new Promise((resolve, reject) => {
formRef.value?.validate().then((_data: any) => {
resolve(_data);
}).catch(() => {
reject(false)
})
formRef.value
?.validate()
.then((_data: any) => {
resolve(_data);
})
.catch(() => {
reject(false);
});
});
defineExpose({ onSave });

View File

@ -151,11 +151,11 @@ const save = async () => {
} else if (props.mode === 'appManger') {
const removeItems = removeKeys.map((key) => ({
id: key,
permissions: props.changedApis[key]?.security,
permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[],
}));
const addItems = addKeys.map((key) => ({
id: key,
permissions: props.changedApis[key]?.security,
permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[],
}));
Promise.all([
updateOperations_api(code, '_delete', { operations: removeItems }),