Merge branch 'dev' into dev-hub

This commit is contained in:
jackhoo_98 2023-03-27 15:27:01 +08:00
commit 414a9987d2
18 changed files with 141 additions and 108 deletions

View File

@ -31,6 +31,10 @@ export const getTargetTypes = () => server.get('/alarm/config/target-type/suppor
*
*/
export const save = (data:any) =>server.post('/alarm/config',data);
/**
*
*/
export const updata = (data:any) => server.patch('/alarm/config',data);
/**
*
*/

View File

@ -11,7 +11,7 @@ export const delApply_api = (id: string) => server.remove(`/application/${id}`)
// 获取组织列表
export const getDepartmentList_api = () => server.get(`/organization/_all/tree`);
export const getDepartmentList_api = (params: any) => server.get(`/organization/_all/tree`, params);
// 获取应用详情
export const getAppInfo_api = (id: string) => server.get(`/application/${id}`);
// 新增应用

View File

@ -1,5 +1,5 @@
<template>
<div class="boolean-param">
<div class="boolean-param ant-form-horizontal">
<j-row :gutter="4">
<j-col :span="12">
<j-form-item label=" " :name="name.concat(['trueText'])" :rules="[

View File

@ -8,9 +8,7 @@ export const useRouterParams = () => {
const router = useRouter();
const routeName = router.currentRoute.value.name as string
watchEffect(() => {
params.value = routeName && menu.params[routeName] ? menu.params[routeName] : {}
})
params.value = routeName && menu.params[routeName] ? menu.params[routeName] : {}
onBeforeUnmount(() => {
if (routeName && menu.params[routeName]) { // 如果当前路由params参数离开页面清除掉

View File

@ -445,7 +445,7 @@ const setDevMesChartOption = (
type: 'line',
smooth: true,
symbolSize: 0, //
color: '#96ECE3',
color: '#ADC6FF',
areaStyle: {
color: {
type: 'linear',
@ -456,7 +456,7 @@ const setDevMesChartOption = (
colorStops: [
{
offset: 0,
color: '#96ECE3', // 100%
color: '#ADC6FF', // 100%
},
{
offset: 1,

View File

@ -39,6 +39,7 @@
productStore.current?.count &&
productStore.current?.count > 0
"
ghost
type="primary"
@click="showDevice"
>更换</j-button
@ -1080,8 +1081,5 @@ nextTick(() => {
}
.changeBtn {
margin: 0 0 0 20px;
color: #315efb;
background: #ffffff;
border: 1px solid #315efb;
}
</style>

View File

@ -304,7 +304,7 @@ onMounted(() => {
cursor: not-allowed;
}
.productDetailHead {
max-width: 50%;
max-width: 300px;
overflow: hidden;
white-space: nowrap;
overflow: hidden;

View File

@ -10,7 +10,6 @@
>
<j-input
v-model:value="form.title"
:maxlength="64"
placeholder="请输入系统名称"
/>
</j-form-item>
@ -255,7 +254,7 @@
<script setup lang="ts">
import { modalState, formState, logoState } from '../data/interface';
import { getImage } from '@/utils/comm.ts';
import { Form, message } from 'jetlinks-ui-components';
import { Form, message } from 'jetlinks-ui-components';
import { FILE_UPLOAD } from '@/api/comm';
import {
getSystemPermission,
@ -276,7 +275,7 @@ import {
} from '@/api/initHome';
import { LocalStore } from '@/utils/comm';
import { TOKEN_KEY } from '@/utils/variable';
import { SystemConst } from '@/utils/consts'
import { SystemConst } from '@/utils/consts';
const formRef = ref();
const menuRef = ref();
const formBasicRef = ref();
@ -297,9 +296,16 @@ const form = ref<formState>({
basePath: `${window.location.origin}/api`,
logo: getImage('/logo.png'),
ico: getImage('/favicon.ico'),
background:getImage('/login.png')
background: getImage('/login.png'),
});
const rulesFrom = ref({
title: [
{
max: 64,
message: '最多可输入64位',
trigger: 'change',
},
],
headerTheme: [
{
required: true,
@ -322,49 +328,52 @@ const { resetFields, validate, validateInfos } = useForm(
/**
* 提交数据
*/
const saveBasicInfo = () =>{
return new Promise( async (resolve) => {
validate()
.then(async () => {
const item = [
{
scope: 'front',
properties: {
...form.value,
apikey: '',
'base-path': '',
const saveBasicInfo = () => {
return new Promise(async (resolve) => {
validate()
.then(async () => {
const item = [
{
scope: 'front',
properties: {
...form.value,
apikey: '',
'base-path': '',
},
},
},
{
scope: 'amap',
properties: {
apiKey: form.value.apikey,
{
scope: 'amap',
properties: {
apiKey: form.value.apikey,
},
},
},
{
scope: 'paths',
properties: {
'base-path': form.value.basePath,
{
scope: 'paths',
properties: {
'base-path': form.value.basePath,
},
},
},
];
const res = await save(item);
if (res.status === 200) {
resolve(true);
localStorage.setItem(SystemConst.AMAP_KEY,form.value.apikey);
const ico: any = document.querySelector('link[rel="icon"]');
if (ico !== null) {
ico.href = form.value.ico;
];
const res = await save(item);
if (res.status === 200) {
resolve(true);
localStorage.setItem(
SystemConst.AMAP_KEY,
form.value.apikey,
);
const ico: any = document.querySelector('link[rel="icon"]');
if (ico !== null) {
ico.href = form.value.ico;
}
} else {
resolve(false);
}
}else {
})
.catch(() => {
resolve(false);
}
})
.catch(() => {
resolve(false);
});
})
}
});
});
};
/**
* logo格式校验
*/
@ -397,22 +406,22 @@ const handleChangeLogo = (info: any) => {
/**
* 浏览器页签上传之前
*/
const beforeIconUpload = (file:any) => {
const beforeIconUpload = (file: any) => {
const isType = iconTypes.value.includes(file.type);
if(!isType){
if (!isType) {
message.error('请上传ico格式的图片');
return false;
}
const isSize = file.size / 1024 / 1024 < 1;
if(!isSize){
if (!isSize) {
message.error('支持1M以内的图片');
}
return isType && isSize;
}
};
/**
* 浏览器页签发生改变
*/
const changeIconUpload = (info: any) => {
const changeIconUpload = (info: any) => {
if (info.file.status === 'uploading') {
iconLoading.value = true;
}
@ -421,11 +430,11 @@ const beforeIconUpload = (file:any) => {
iconLoading.value = false;
form.value.ico = info.file.response?.result;
}
}
};
/**
* 背景图片上传之前
*/
const beforeBackUpload = (file: any) => {
const beforeBackUpload = (file: any) => {
const isType = imageTypes.value.includes(file.type);
if (!isType) {
message.error(`请上传.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片`);

View File

@ -46,13 +46,13 @@
<j-form-item label="说明" name="description">
<j-textarea v-model:value="form.description" showCount :maxlength="200"></j-textarea>
</j-form-item>
<PermissionButton type="primary" @click="handleSave" :hasPermission="['rule-engine/Alarm/Configuration:add','rule-engine/Alarm/Configuration:update']">保存</PermissionButton>
<PermissionButton type="primary" :loading="loading" @click="handleSave" :hasPermission="['rule-engine/Alarm/Configuration:add','rule-engine/Alarm/Configuration:update']">保存</PermissionButton>
</j-form>
</div>
</template>
<script lang="ts" setup>
import { getTargetTypes, save, detail } from '@/api/rule-engine/configuration';
import { getTargetTypes, save, detail , updata} from '@/api/rule-engine/configuration';
import { queryLevel } from '@/api/rule-engine/config';
import { query } from '@/api/rule-engine/scene';
import { getImage } from '@/utils/comm';
@ -71,10 +71,11 @@ const queryData = () => {
if (id) {
detail(id).then((res) => {
if (res.status === 200) {
form.level = res?.result?.level;
form.name = res?.result?.name;
form.targetType = res?.result?.targetType;
form.description = res?.result?.description;
form.value = res?.result
// form.level = res?.result?.level;
// form.name = res?.result?.name;
// form.targetType = res?.result?.targetType;
// form.description = res?.result?.description;
configurationData.value.current = res.result;
query({
terms: [
@ -134,7 +135,7 @@ const rule = {
},
],
};
let form = reactive({
let form = ref({
level: '',
targetType: '',
name: '',
@ -175,18 +176,18 @@ const handleSave = async () => {
formRef.value
.validate()
.then(async () => {
const res = await save(form);
loading.value = false;
const res = id ? await updata(form.value) : await save(form.value);
if (res.status === 200) {
message.success('操作成功,请配置关联的场景联动');
loading.value = false;
menuStory.jumpPage(
'rule-engine/Alarm/Configuration/Save',
'rule-engine/Alarm/Configuration/Save',
{},
{ id: res.result?.id },
);
if (!id) {
configurationData.value.current = res.result;
}
}
}
})
.catch((error) => {

View File

@ -229,4 +229,9 @@ const closeModal = () => {
};
</script>
<style lang="less" scoped>
.subTitle {
color: rgba(0, 0, 0, 0.65);
font-size: 14px;
margin-top: 10px;
}
</style>

View File

@ -6,7 +6,6 @@
sorts: [{ name: 'createTime', order: 'desc' }],
terms,
}"
:gridColumns="[1, 1, 1]"
ref="actionRef"
>
<template #headerTitle>
@ -180,4 +179,9 @@ const saveSuccess = () => {
};
</script>
<style lang="less" scoped>
.subTitle {
color: rgba(0, 0, 0, 0.65);
font-size: 14px;
margin-top: 10px;
}
</style>

View File

@ -83,6 +83,7 @@ const jumpDetail = (item:any) =>{
background-color: #fff;
border: 1px solid #e0e4e8;
border-radius: 2px;
height: 100%;
}
.new-alarm-items {
ul {

View File

@ -42,7 +42,7 @@
<TimeSelect
key="flow-static"
:type="'week'"
:quickBtnList="quickBtnList"
@change="initQueryTime"
/>
</template>
@ -152,12 +152,6 @@ let queryCodition = reactive({
targetType: 'device',
});
let alarmStatisticsOption = ref<any>({});
const quickBtnList = [
{ label: '昨日', value: 'yesterday' },
{ label: '近一周', value: 'week' },
{ label: '近一月', value: 'month' },
{ label: '近一年', value: 'year' },
];
type DashboardItem = {
group: string;
data: Record<string, any>;
@ -270,7 +264,8 @@ const getDashBoard = () => {
name: '告警数',
data: fifteenData.map((item) => item.value),
type: 'line',
color: '#2F54EB',
color: '#FF595E',
smooth: true,
symbolSize: 0,
areaStyle: {
color: {
@ -278,11 +273,11 @@ const getDashBoard = () => {
x: 0,
y: 0,
x2: 0,
y2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#2F54EB', // 100%
color: '#FF595E', // 100%
},
{
offset: 1,
@ -463,7 +458,7 @@ const selectChange = () => {
data: sData.reverse(),
type: 'line',
smooth: true,
color: '#685DEB',
color: '#ADC6FF',
areaStyle: {
color: {
type: 'linear',
@ -474,7 +469,7 @@ const selectChange = () => {
colorStops: [
{
offset: 0,
color: '#685DEB', // 100%
color: '#ADC6FF', // 100%
},
{
offset: 1,

View File

@ -13,7 +13,7 @@ export const handleParamsData = (data: any[], key: string = 'column'): any[] =>
export const thenRules = [{
validator(_: string, value: any) {
if (!value || (value && !value.length) || !v.some(item => item.actions && item.actions.length)) {
if (!value || (value && !value.length) || !value.some(item => item.actions && item.actions.length)) {
return Promise.reject('至少配置一个执行动作')
}
return Promise.resolve();

View File

@ -52,14 +52,14 @@
{{ slotProps.name }}
</span>
</Ellipsis>
<div class="subTitle">
<Ellipsis :lineClamp="2">
<div class="subTitle">
说明{{
slotProps?.description ||
typeMap.get(slotProps.triggerType)?.tip
}}
</div>
</Ellipsis>
</div>
</template>
<template #actions="item">
<PermissionButton

View File

@ -788,6 +788,9 @@
multiple
:tree-data="form.orgIdList"
placeholder="请选择组织"
:filterTreeNode="
(v: string, node: any) => filterSelectNode(v, node, 'name')
"
>
<template #title="{ name }">
{{ name }}
@ -1439,7 +1442,7 @@
<script setup lang="ts">
import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { LocalStore } from '@/utils/comm';
import { LocalStore, filterSelectNode } from '@/utils/comm';
import {
getDepartmentList_api,
@ -1729,7 +1732,7 @@ function getRoleIdList() {
}
//
function getOrgIdList() {
getDepartmentList_api().then((resp) => {
getDepartmentList_api({ paging: false }).then((resp) => {
if (resp.status === 200) {
form.orgIdList = resp.result as dictType;
}

View File

@ -283,7 +283,7 @@ const queryParams = ref({});
const tableRef = ref();
const table = {
refresh: () => {
tableRef.value.reload();
tableRef.value.reload(queryParams.value);
},
toSave: (id?: string, view = false) => {
if (id) menuStory.jumpPage('system/Apply/Save', {}, { id, view });

View File

@ -61,24 +61,33 @@ const columns = [
},
];
const rowSelection = {
onSelect: (record: any) => {
const targetId = record.id;
let newKeys = [...props.selectedRowKeys];
// onSelect: (record: any) => {
// const targetId = record.id;
// let newKeys = [...props.selectedRowKeys];
if (props.selectedRowKeys.includes(targetId)) {
newKeys = newKeys.filter((id) => id !== targetId);
} else newKeys.push(targetId);
// if (props.selectedRowKeys.includes(targetId)) {
// newKeys = newKeys.filter((id) => id !== targetId);
// } else newKeys.push(targetId);
emits('update:selectedRowKeys', newKeys);
if (props.mode === 'appManger') {
emits('update:changedApis', {
...props.changedApis,
[record.id]: record,
});
}
},
// emits('update:selectedRowKeys', newKeys);
// if (props.mode === 'appManger') {
// emits('update:changedApis', {
// ...props.changedApis,
// [record.id]: record,
// });
// }
// },
onChange: (keys: string[]) => {
rowSelection.selectedRowKeys.value = keys;
// rowSelection.selectedRowKeys.value = keys;
emits('update:selectedRowKeys', keys);
keys.forEach((key: string) => {
if (props.mode === 'appManger') {
emits('update:changedApis', {
...props.changedApis,
[key]: props.tableData.find((f: any) => f.id === key),
});
}
});
},
selectedRowKeys: ref<string[]>([]),
};
@ -87,7 +96,9 @@ const save = async () => {
// id
const currenTableKeys = props.tableData.map((m: any) => m.id);
// id
const currentSelectedKeys = rowSelection.selectedRowKeys.value;
const currentSelectedKeys = rowSelection.selectedRowKeys.value.filter(
(key: string) => currenTableKeys.includes(key),
);
// , id
const oldSelectedKeys = currenTableKeys.filter((key) =>
props.sourceKeys.includes(key),
@ -124,11 +135,15 @@ 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,
permissions: props.tableData.find((f: any) => f.id === key)
?.security,
}));
const addItems = addKeys.map((key) => ({
id: key,
permissions: props.changedApis[key]?.security,
// permissions: props.changedApis[key]?.security,
permissions: props.tableData.find((f: any) => f.id === key)
?.security,
}));
Promise.all([
updateOperations_api(code, '_delete', { operations: removeItems }),