fix: bug#17421,17418,17417,17416,17392

* fix: 登录加密

* fix: 登录加密功能

* fix: 树样式错乱bug修改

* fix: bug#17059

* fix: bug#17128

* fix: 17131

* fix: bug#17122

* fix: bug#17156

* fix: 修改bug

* fix: bug#17056

* fix: bug#17005

* fix: 修改bug

* fix: bug#17296

* fix: bug应用管理/集成菜单

* fix: bug#17299

* fix: bug#17148

* fix: bug#17392

* fix: bug#17416

* fix: bug#17417

* fix: bug#17418

* fix: bug#17421
This commit is contained in:
qiaochuLei 2023-08-15 14:17:08 +08:00 committed by GitHub
parent c2d30f56a7
commit 6eeed06171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 193 additions and 59 deletions

View File

@ -10,7 +10,7 @@
> >
</j-select> </j-select>
<j-popconfirm-modal <j-popconfirm-modal
v-if="myValue != 'manual'" v-if="myValue != 'manual' && props.target === 'product'"
:bodyStyle="{ :bodyStyle="{
width: '450px', width: '450px',
height: myValue === 'rule' ? '300px' : '80px', height: myValue === 'rule' ? '300px' : '80px',
@ -37,6 +37,56 @@
<AIcon type="EditOutlined" /> <AIcon type="EditOutlined" />
</j-button> </j-button>
</j-popconfirm-modal> </j-popconfirm-modal>
<j-dropdown v-if="myValue != 'manual'&& target === 'device'" :getPopupContainer="(triggerNode) => triggerNode.parentNode">
<span style="width: 20px;" @click.prevent>
<AIcon type="MoreOutlined" />
</span>
<template #overlay>
<j-menu>
<j-menu-item>
<j-popconfirm-modal
:bodyStyle="{
width: '450px',
height: myValue === 'rule' ? '300px' : '80px',
}"
:get-popup-container="(node) => fullRef || node"
placement="bottomRight"
@confirm="confirm"
@visibleChange="visibleChange"
>
<template #content>
<j-scrollbar v-if="myValue">
<div style="padding: 0 10px">
<VirtualRule
v-if="visible"
:value="value"
:source="myValue"
:dataSource="dataSource"
ref="virtualRuleRef"
/>
</div>
</j-scrollbar>
</template>
<j-button style="padding: 4px 8px" type="link">
编辑
</j-button>
</j-popconfirm-modal>
</j-menu-item>
<j-menu-divider/>
<j-menu-item>
<div style="display: flex;">
<j-button style="padding: 4px 8px" type="link" @click="resetRules">
重置
</j-button>
<j-tooltip>
<template #title>重置为产品属性规则</template>
<AIcon type="QuestionCircleOutlined" style="margin-top: 10px;"/>
</j-tooltip>
</div>
</j-menu-item>
</j-menu>
</template>
</j-dropdown>
</div> </div>
</template> </template>
@ -45,7 +95,12 @@ import { isNoCommunity } from '@/utils/utils';
import VirtualRule from './VirtualRule/index.vue'; import VirtualRule from './VirtualRule/index.vue';
import { Form } from 'jetlinks-ui-components'; import { Form } from 'jetlinks-ui-components';
import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable' import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable'
import { useInstanceStore } from '@/store/instance';
import {
queryProductVirtualProperty
} from '@/api/device/product';
import { updata } from '@/api/rule-engine/configuration';
const instanceStore = useInstanceStore();
const PropertySource: { label: string; value: string }[] = isNoCommunity const PropertySource: { label: string; value: string }[] = isNoCommunity
? [ ? [
{ {
@ -115,7 +170,6 @@ const disabled = computed(() => {
// if (props.target === 'device') { // if (props.target === 'device') {
// return true; // return true;
// } // }
return props.noEdit?.length return props.noEdit?.length
? props.noEdit.includes(props.value.id) && props?.target === 'device' ? props.noEdit.includes(props.value.id) && props?.target === 'device'
: false; : false;
@ -156,7 +210,20 @@ const confirm = async () => {
} }
}); });
}; };
//
const resetRules = async() =>{
let res:any = await queryProductVirtualProperty(instanceStore.current?.productId,props.value.id)
if(res && res.status === 200 && res.result.rule){
const data:any = {}
data.virtualRule = res.result.rule
data.virtualRule.triggerProperties = res.result.triggerProperties
data.type = type.value
updateValue({
source:myValue.value,
...data
})
}
}
const cancel = () => { const cancel = () => {
if (props.value.id && !props.value?.expands?.source) { if (props.value.id && !props.value?.expands?.source) {
myValue.value = 'device'; myValue.value = 'device';

View File

@ -581,6 +581,7 @@ const handleImport = async () => {
if (data.metadata === 'alink') { if (data.metadata === 'alink') {
try { try {
const _import = JSON.parse(data.import); const _import = JSON.parse(data.import);
loading.value = true; loading.value = true;
const res = await convertMetadata( const res = await convertMetadata(
'from', 'from',
@ -588,7 +589,8 @@ const handleImport = async () => {
_import, _import,
).catch((err) => err); ).catch((err) => err);
if (res.status === 200) { if (res.status === 200) {
const metadata = operateLimits(res.result); // const metadata = operateLimits(res.result); //
const metadata = res.result
let result; let result;
if (props?.type === 'device') { if (props?.type === 'device') {
result = await saveMetadata( result = await saveMetadata(
@ -644,14 +646,15 @@ const handleImport = async () => {
return; return;
} }
const { id } = route.params || {}; const { id } = route.params || {};
const copyOperateLimits = operateLimits( // const copyOperateLimits = operateLimits(
_object as DeviceMetadata, // _object as DeviceMetadata,
); // );
// console.log(copyOperateLimits,_object); //
const params = { const params = {
id, id,
metadata: JSON.stringify(copyOperateLimits), metadata: JSON.stringify(_object),
}; };
const paramsDevice = copyOperateLimits; const paramsDevice = _object;
let resp = undefined; let resp = undefined;
loading.value = true; loading.value = true;
if (props?.type === 'device') { if (props?.type === 'device') {

View File

@ -81,7 +81,6 @@ provide('_metadataType', props.type)
const showReset = computed(() => { const showReset = computed(() => {
if (props.type === 'device' && instanceStore.current.productMetadata) { if (props.type === 'device' && instanceStore.current.productMetadata) {
console.log(instanceStore.current,123)
const proMetadata = JSON.parse(instanceStore.current.productMetadata || '{}') const proMetadata = JSON.parse(instanceStore.current.productMetadata || '{}')
const _metadata = JSON.parse(instanceStore.current.metadata || '{}') const _metadata = JSON.parse(instanceStore.current.metadata || '{}')
return !isEqual(_metadata, proMetadata) return !isEqual(_metadata, proMetadata)

View File

@ -25,7 +25,7 @@
props.data?.alarmConfigName props.data?.alarmConfigName
}}</j-descriptions-item> }}</j-descriptions-item>
<j-descriptions-item label="告警时间" :span="1">{{ <j-descriptions-item label="告警时间" :span="1">{{
dayjs(data?.alarmTime).format('YYYY-MM-DD HH:mm:ss') dayjs(props.data?.alarmTime).format('YYYY-MM-DD HH:mm:ss')
}}</j-descriptions-item> }}</j-descriptions-item>
<j-descriptions-item label="告警级别" :span="1"> <j-descriptions-item label="告警级别" :span="1">
<j-tooltip <j-tooltip

View File

@ -285,7 +285,58 @@ const newColumns = computed(() => {
otherColumns.title = '场景名称' otherColumns.title = '场景名称'
break; break;
} }
if(props.type === 'device'){
const productColumns = {
title: '产品名称',
dataIndex: 'product_id',
key: 'product_id',
search: {
type: 'select',
options: async () => {
const termType = [
{
column: "targetType",
termType: "eq",
type: "and",
value: "product",
}
]
if (props.id) {
termType.push({
termType: 'eq',
column: 'alarmConfigId',
value: props.id,
type: 'and',
},)
}
const resp: any = await handleSearch({
sorts: [{ name: 'alarmTime', order: 'desc' }],
terms: termType
});
const listMap: Map<string, any> = new Map()
if (resp.status === 200) {
resp.result.data.forEach(item => {
if (item.targetId) {
listMap.set(item.targetId, {
label: item.targetName,
value: item.targetId,
})
}
})
return [...listMap.values()]
}
return [];
},
},
}
return [otherColumns,productColumns,...columns]
}
return ['all', 'detail'].includes(props.type) ? columns : [ return ['all', 'detail'].includes(props.type) ? columns : [
otherColumns, otherColumns,
...columns, ...columns,
@ -297,9 +348,9 @@ let params: any = ref({
terms: [], terms: [],
}); });
const handleSearch = async (params: any) => { const handleSearch = async (params: any) => {
const resp = await query(params); const resp:any = await query(params);
if (resp.status === 200) { if (resp.status === 200) {
const res = await getOrgList(); const res:any = await getOrgList();
if (res.status === 200) { if (res.status === 200) {
resp.result.data.map((item: any) => { resp.result.data.map((item: any) => {
if (item.targetType === 'org') { if (item.targetType === 'org') {
@ -318,7 +369,7 @@ const handleSearch = async (params: any) => {
} }
} }
}; };
watchEffect(() => { onMounted(() => {
if (props.type !== 'all' && !props.id) { if (props.type !== 'all' && !props.id) {
params.value.terms = [ params.value.terms = [
{ {
@ -354,6 +405,16 @@ const search = (data: any) => {
type: 'and', type: 'and',
}); });
} }
if(props.type === 'device' && data?.terms[0]?.terms[0]?.column === 'product_id'){
params.value.terms = [{
column:"targetId$dev-instance",
value:[
data?.terms[0]?.terms[0]
]
}]
// delete params.value.terms
console.log(params.value)
}
if (props.id) { if (props.id) {
params.value.terms.push({ params.value.terms.push({
termType: 'eq', termType: 'eq',

View File

@ -16,6 +16,7 @@
</j-radio-button> </j-radio-button>
</j-radio-group> </j-radio-group>
<j-range-picker <j-range-picker
:show-time="{format:'HH:mm:ss'}"
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
valueFormat="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
style="margin-left: 12px" style="margin-left: 12px"

View File

@ -357,7 +357,6 @@ getCurrentAlarm();
const initQueryTime = (data: any) => { const initQueryTime = (data: any) => {
queryCodition.startTime = data.start; queryCodition.startTime = data.start;
queryCodition.endTime = data.end; queryCodition.endTime = data.end;
console.log(queryCodition);
selectChange(); selectChange();
}; };
const selectChange = () => { const selectChange = () => {
@ -439,10 +438,14 @@ const selectChange = () => {
res.result res.result
.filter((item: any) => item.group === 'alarmTrend') .filter((item: any) => item.group === 'alarmTrend')
.forEach((item: any) => { .forEach((item: any) => {
if(time === '1d'){
item.data.timeString = item.data.timeString.split(' ')[0]
}
xData.push(item.data.timeString); xData.push(item.data.timeString);
sData.push(item.data.value); sData.push(item.data.value);
}); });
const maxY = sData.sort((a,b)=>{ const data:any = JSON.parse(JSON.stringify(sData))
const maxY = data.sort((a,b)=>{
return b-a return b-a
})[0] })[0]
alarmStatisticsOption.value = { alarmStatisticsOption.value = {

View File

@ -47,7 +47,7 @@
<div class="card-item-content-text"> <div class="card-item-content-text">
设备类型 设备类型
</div> </div>
<div>直连设备</div> <div>{{ slotProps.deviceType.text}}</div>
</j-col> </j-col>
</j-row> </j-row>
</template> </template>

View File

@ -1,39 +1,17 @@
<template> <template>
<j-modal <j-modal visible title="集成菜单" width="600px" @ok="handleOk" @cancel="cancel" class="edit-dialog-container"
visible :confirmLoading="loading">
title="集成菜单" <j-select v-model:value="form.checkedSystem" @change="(value) => value && getTree(value) " style="width: 200px"
width="600px" placeholder="请选择集成系统">
@ok="handleOk" <j-select-option v-for="item in form.systemList" :value="item.value" :key="item.value">{{ item.label
@cancel="cancel" }}</j-select-option>
class="edit-dialog-container"
:confirmLoading="loading"
>
<j-select
v-model:value="form.checkedSystem"
@change="(value) => value && getTree(value)"
style="width: 200px"
placeholder="请选择集成系统"
>
<j-select-option
v-for="item in form.systemList"
:value="item.value"
:key="item.value"
>{{ item.label }}</j-select-option
>
</j-select> </j-select>
<p style="margin: 20px 0 0 0" v-show="form.menuTree.length > 0"> <p style="margin: 20px 0 0 0" v-show="form.menuTree.length > 0">
当前集成菜单 当前集成菜单
</p> </p>
<j-tree <j-tree v-model:checkedKeys="form.checkedMenu" v-model:expandedKeys="form.expandedKeys" checkable
v-model:checkedKeys="form.checkedMenu" :tree-data="form.menuTree" :fieldNames="{ key: 'code', title: 'name' }" @check="treeCheck" :height="300">
v-model:expandedKeys="form.expandedKeys"
checkable
:tree-data="form.menuTree"
:fieldNames="{ key: 'code', title: 'name' }"
@check="treeCheck"
:height="300"
>
<template #title="{ name }"> <template #title="{ name }">
<span>{{ name }}</span> <span>{{ name }}</span>
</template> </template>
@ -66,10 +44,12 @@ const props = defineProps<{
// //
const loading = ref(false); const loading = ref(false);
const handleOk = async () => { const handleOk = async () => {
const items = filterTree(form.menuTree, [ const menuTree = JSON.parse(JSON.stringify(form.menuTree));
const items = filterTree(menuTree, [
...form.checkedMenu, ...form.checkedMenu,
...form.half, // ...form.half,
]); ]);
console.log(items);
if (form.checkedSystem) { if (form.checkedSystem) {
if (items && items.length !== 0) { if (items && items.length !== 0) {
loading.value = true; loading.value = true;
@ -128,6 +108,16 @@ function getTree(params: string) {
form.expandedKeys = resp.result.map((item: any) => item?.code); form.expandedKeys = resp.result.map((item: any) => item?.code);
}); });
} }
const getCheckMenu = (data: any, keys: any) => {
data.forEach((item: any) => {
if (item.children) {
getCheckMenu(item.children, keys)
} else {
keys.push(item.code)
}
})
}
/** /**
* 获取当前用户可访问菜单 * 获取当前用户可访问菜单
*/ */
@ -143,7 +133,9 @@ function getMenus(id: string) {
getMenuTree_api(params).then((resp: any) => { getMenuTree_api(params).then((resp: any) => {
if (resp.status === 200) { if (resp.status === 200) {
// form.menuTree = resp.result; // form.menuTree = resp.result;
const keys = resp.result.map((item: any) => item?.code) as string[]; // const keys = resp.result.map((item: any) => item?.code) as string[];
let keys: any = [];
getCheckMenu(resp.result, keys)
// form.expandedKeys = keys; // form.expandedKeys = keys;
form.checkedMenu = keys; form.checkedMenu = keys;
} }
@ -188,17 +180,23 @@ function treeCheck(checkedKeys: any, e: CheckInfo) {
} }
//- //-
function filterTree(nodes: any[], list: any[]) { function filterTree(nodes: any[], list: any[]) {
if (!nodes?.length) { if (!nodes) {
return nodes; return [];
} }
return nodes.filter((it) => { return nodes.filter((it) => {
// //
if (list.indexOf(it.code) <= -1) { if (list.includes(it.code)) {
return false; return true
} } else if (it.children) {
//
it.children = filterTree(it.children, list); it.children = filterTree(it.children, list);
return true; return it.children.length
}
// if (list.indexOf(it.code) <= -1) {
// return false;
// }
//
// it.children = filterTree(it.children, list);
// return true;
}); });
} }
</script> </script>

View File

@ -164,12 +164,14 @@ const search = debounce(() => {
function dig(_data: any[]): any { function dig(_data: any[]): any {
const pIds: string[] = []; const pIds: string[] = [];
expandedKeys.value = []
if (!_data.length) return; if (!_data.length) return;
_data.forEach((item) => { _data.forEach((item) => {
if (treeMap.has(item)) { if (treeMap.has(item)) {
const _item = treeMap.get(item); const _item = treeMap.get(item);
pIds.push(_item.parentId); pIds.push(_item.parentId);
treeArray.set(item, _item); treeArray.set(item, _item);
expandedKeys.value.push(_item.id)
} }
}); });
} }