fix: bug#17537,修复设备详情映射bug,修复数采仪表盘bug
* fix: 资产分配权限为空问题 * fix: bug#17557、17299 * fix: 修改bug * fix: bug#17148 * fix: bug#17564 * fix: 数采仪表盘bug * fix: bug#17537 * fix: 设备详情bug
This commit is contained in:
parent
402057b1d6
commit
dd0cd666dc
|
@ -4,6 +4,13 @@ import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable'
|
||||||
import { DeviceInstance } from '@/views/device/Instance/typings'
|
import { DeviceInstance } from '@/views/device/Instance/typings'
|
||||||
import { DeviceMetadata, UnitType } from '@/views/device/Product/typings';
|
import { DeviceMetadata, UnitType } from '@/views/device/Product/typings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置设备继承产品的物模型规则
|
||||||
|
* @param deviceId 设备ID
|
||||||
|
* @param productId 产品ID
|
||||||
|
*/
|
||||||
|
export const resetRule = (productId:string,deviceId:string,data:any) => server.remove(`/virtual/property/product/${productId}/${deviceId}/_batch`,{},{data})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备物模型
|
* 删除设备物模型
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
|
|
|
@ -61,22 +61,21 @@ const data: any = ref({
|
||||||
|
|
||||||
const pickerTimeChange = () => {
|
const pickerTimeChange = () => {
|
||||||
data.value.time.type = undefined;
|
data.value.time.type = undefined;
|
||||||
console.log(1);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getEcharts = async (val: any) => {
|
const getEcharts = async (val: any) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const resp: any = await dashboard(pointParams(val));
|
const resp: any = await dashboard(pointParams(val));
|
||||||
if (resp.success) {
|
if (resp.success && resp?.result?.length) {
|
||||||
const x = resp.result
|
const x = resp.result
|
||||||
.map((item: any) => item.data.timeString)
|
.map((item: any) => item.data.timeString)
|
||||||
.reverse();
|
.reverse();
|
||||||
const y = resp.result.map((item: any) => item.data.value).reverse();
|
const y = resp.result.map((item: any) => item.data.value).reverse();
|
||||||
handleOptions(x, y);
|
handleOptions(x, y);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(()=>{
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}, 300);
|
},300)
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOptions = (x = [], y = []) => {
|
const handleOptions = (x = [], y = []) => {
|
||||||
|
|
|
@ -33,6 +33,10 @@ const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
|
},
|
||||||
|
pluginId:{
|
||||||
|
type:String,
|
||||||
|
default: undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -46,7 +50,7 @@ const handleOk = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const res = await savePluginData(
|
const res = await savePluginData(
|
||||||
'device',
|
'device',
|
||||||
props.accessId!,
|
props.pluginId!,
|
||||||
route.params.id as string,
|
route.params.id as string,
|
||||||
checkKey.value
|
checkKey.value
|
||||||
).catch(() => ({ success: false }))
|
).catch(() => ({ success: false }))
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
v-if='inkingVisible'
|
v-if='inkingVisible'
|
||||||
:id='inklingDeviceId'
|
:id='inklingDeviceId'
|
||||||
:accessId='instanceStore.current.accessId'
|
:accessId='instanceStore.current.accessId'
|
||||||
|
:pluginId="channelId"
|
||||||
@cancel="inkingVisible = false"
|
@cancel="inkingVisible = false"
|
||||||
@submit='saveInkling'
|
@submit='saveInkling'
|
||||||
/>
|
/>
|
||||||
|
@ -150,7 +151,7 @@ const queryInkling = () => {
|
||||||
queryPluginAccessDetail(instanceStore.current?.accessId).then(async res => {
|
queryPluginAccessDetail(instanceStore.current?.accessId).then(async res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
channelId.value = res.result.channelId
|
channelId.value = res.result.channelId
|
||||||
const pluginRes = await getPluginData('device',instanceStore.current?.accessId, instanceStore.current?.id)
|
const pluginRes = await getPluginData('device',channelId.value, instanceStore.current?.id)
|
||||||
if (pluginRes.success) {
|
if (pluginRes.success) {
|
||||||
inklingDeviceId.value = pluginRes.result?.externalId
|
inklingDeviceId.value = pluginRes.result?.externalId
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,6 +425,7 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
||||||
props: {
|
props: {
|
||||||
noEdit: noEdit?.value?.source || [],
|
noEdit: noEdit?.value?.source || [],
|
||||||
target: target,
|
target: target,
|
||||||
|
productNoEdit: productNoEdit?.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doubleClick(record){
|
doubleClick(record){
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
>
|
>
|
||||||
</j-select>
|
</j-select>
|
||||||
<j-popconfirm-modal
|
<j-popconfirm-modal
|
||||||
v-if="myValue != 'manual' && props.target === 'product'"
|
v-if="myValue != 'manual' && !showReset"
|
||||||
:bodyStyle="{
|
:bodyStyle="{
|
||||||
width: '450px',
|
width: '450px',
|
||||||
height: myValue === 'rule' ? '300px' : '80px',
|
height: myValue === 'rule' ? '300px' : '80px',
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<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">
|
<j-dropdown v-if="myValue === 'rule' && target === 'device' && showReset" :getPopupContainer="(triggerNode) => triggerNode.parentNode">
|
||||||
<span style="width: 20px;" @click.prevent>
|
<span style="width: 20px;" @click.prevent>
|
||||||
<AIcon type="MoreOutlined" />
|
<AIcon type="MoreOutlined" />
|
||||||
</span>
|
</span>
|
||||||
|
@ -96,10 +96,9 @@ 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 { useInstanceStore } from '@/store/instance';
|
||||||
import {
|
import { resetRule } from '@/api/device/instance';
|
||||||
queryProductVirtualProperty
|
|
||||||
} from '@/api/device/product';
|
|
||||||
import { updata } from '@/api/rule-engine/configuration';
|
import { updata } from '@/api/rule-engine/configuration';
|
||||||
|
import { onlyMessage } from '@/utils/comm';
|
||||||
const instanceStore = useInstanceStore();
|
const instanceStore = useInstanceStore();
|
||||||
const PropertySource: { label: string; value: string }[] = isNoCommunity
|
const PropertySource: { label: string; value: string }[] = isNoCommunity
|
||||||
? [
|
? [
|
||||||
|
@ -134,7 +133,7 @@ type Emit = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fullRef = inject(FULL_CODE);
|
const fullRef = inject(FULL_CODE);
|
||||||
|
const showReset = ref(false);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -152,6 +151,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
|
productNoEdit:{
|
||||||
|
type:Array,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<Emit>();
|
const emit = defineEmits<Emit>();
|
||||||
|
@ -211,17 +214,23 @@ 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 resetRules = async() =>{
|
const resetRules = async() =>{
|
||||||
let res:any = await queryProductVirtualProperty(instanceStore.current?.productId,props.value.id)
|
let res:any = await resetRule(instanceStore.current?.productId,instanceStore.current?.id,props.value?.id)
|
||||||
if(res && res.status === 200 && res.result.rule){
|
if(res.status === 200){
|
||||||
const data:any = {}
|
onlyMessage('操作成功!')
|
||||||
data.virtualRule = res.result.rule
|
|
||||||
data.virtualRule.triggerProperties = res.result.triggerProperties
|
|
||||||
data.type = type.value
|
|
||||||
updateValue({
|
|
||||||
source:myValue.value,
|
|
||||||
...data
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
|
@ -245,6 +254,13 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
onMounted(()=>{
|
||||||
|
if(props.target === 'device'){
|
||||||
|
props.productNoEdit?.id?.forEach((item:any)=>{
|
||||||
|
item === props.value?.id ? showReset.value = true : ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -215,6 +215,7 @@ const columns = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
|
editData.value = {}
|
||||||
visible.value = true
|
visible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
okText="确定"
|
okText="确定"
|
||||||
>
|
>
|
||||||
<j-form layout="vertical" :model="inputData" ref="formRef">
|
<j-form layout="vertical" :model="inputData" ref="formRef">
|
||||||
|
<j-form-item label="状态">
|
||||||
|
<j-switch
|
||||||
|
checked-children="启用"
|
||||||
|
un-checked-children="启用"
|
||||||
|
v-model:checked="inputData.status"
|
||||||
|
></j-switch>
|
||||||
|
</j-form-item>
|
||||||
<j-form-item
|
<j-form-item
|
||||||
v-if="inputData.status"
|
v-if="inputData.status"
|
||||||
label="kafka地址"
|
label="kafka地址"
|
||||||
|
@ -47,13 +54,6 @@
|
||||||
>
|
>
|
||||||
<j-input v-model:value="inputData.topic"></j-input>
|
<j-input v-model:value="inputData.topic"></j-input>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item label="状态">
|
|
||||||
<j-switch
|
|
||||||
checked-children="启用"
|
|
||||||
un-checked-children="启用"
|
|
||||||
v-model:checked="inputData.status"
|
|
||||||
></j-switch>
|
|
||||||
</j-form-item>
|
|
||||||
</j-form>
|
</j-form>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -6,20 +6,22 @@
|
||||||
只能分配有“共享”权限的资产数据
|
只能分配有“共享”权限的资产数据
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<div class="row">
|
<div style="display: flex; margin-left: 24px;">
|
||||||
<span style="margin-right: 8px">批量配置</span>
|
<div class="row">
|
||||||
<j-switch v-model:checked="bulkBool" checked-children="开" un-checked-children="关" style="width: 56px" />
|
<span style="margin-right: 8px">批量配置</span>
|
||||||
</div>
|
<j-switch v-model:checked="bulkBool" checked-children="开" un-checked-children="关" style="width: 56px" />
|
||||||
<div v-show="bulkBool">
|
</div>
|
||||||
<j-checkbox-group v-model:value="bulkList" :options="options" />
|
<div v-show="bulkBool" style="margin-left: 30px;">
|
||||||
|
<j-checkbox-group v-model:value="bulkList" :options="options" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pro-search
|
<!-- <pro-search
|
||||||
type="simple"
|
type="simple"
|
||||||
:columns="searchColumns"
|
:columns="searchColumns"
|
||||||
target="category-bind-modal"
|
target="category-bind-modal"
|
||||||
@search="search"
|
@search="search"
|
||||||
/>
|
/> -->
|
||||||
<j-pro-table
|
<j-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:request="table.requestFun"
|
:request="table.requestFun"
|
||||||
|
@ -32,7 +34,17 @@
|
||||||
onSelectAll: selectAll
|
onSelectAll: selectAll
|
||||||
}"
|
}"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
style="max-height: 500px; overflow:auto"
|
||||||
>
|
>
|
||||||
|
<template #headerTitle>
|
||||||
|
<pro-search
|
||||||
|
type="simple"
|
||||||
|
:columns="searchColumns"
|
||||||
|
target="category-bind-modal"
|
||||||
|
@search="search"
|
||||||
|
style="width: 75%;"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #card="slotProps">
|
<template #card="slotProps">
|
||||||
<CardBox :value="slotProps" :actions="[{ key: 1 }]" v-bind="slotProps" :active="table._selectedRowKeys.value.includes(slotProps.id)
|
<CardBox :value="slotProps" :actions="[{ key: 1 }]" v-bind="slotProps" :active="table._selectedRowKeys.value.includes(slotProps.id)
|
||||||
" @click="table.onSelectChange" :status="slotProps.state?.value"
|
" @click="table.onSelectChange" :status="slotProps.state?.value"
|
||||||
|
@ -490,6 +502,7 @@ const search = (query: any) => {
|
||||||
|
|
||||||
h5 {
|
h5 {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
|
padding-left: 24px;
|
||||||
background-color: #f6f6f6;
|
background-color: #f6f6f6;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
@ -498,4 +511,7 @@ const search = (query: any) => {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.jtable-body-header-left){
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -130,12 +130,12 @@ function getTree(cb?: Function) {
|
||||||
treeMap.clear()
|
treeMap.clear()
|
||||||
getTreeData_api(params)
|
getTreeData_api(params)
|
||||||
.then((resp: any) => {
|
.then((resp: any) => {
|
||||||
selectedKeys.value = [resp.result[0]?.id];
|
|
||||||
sourceTree.value = resp.result.sort((a: any, b: any) =>
|
sourceTree.value = resp.result.sort((a: any, b: any) =>
|
||||||
a.sortIndex === b.sortIndex
|
a.sortIndex === b.sortIndex
|
||||||
? b.createTime - a.createTime
|
? b.createTime - a.createTime
|
||||||
: a.sortIndex - b.sortIndex,
|
: a.sortIndex - b.sortIndex,
|
||||||
); // 报存源数据
|
); // 报存源数据
|
||||||
|
selectedKeys.value = [resp.result[0]?.id];
|
||||||
handleTreeMap(resp.result); // 将树形结构转换为map结构
|
handleTreeMap(resp.result); // 将树形结构转换为map结构
|
||||||
treeData.value = resp.result; // 第一次不用进行过滤
|
treeData.value = resp.result; // 第一次不用进行过滤
|
||||||
cb && cb();
|
cb && cb();
|
||||||
|
@ -275,7 +275,7 @@ init();
|
||||||
.tree {
|
.tree {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
flex: 1 1 auto;
|
||||||
.department-tree-item-content {
|
.department-tree-item-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
target="category"
|
target="category"
|
||||||
@search="(params:any)=>queryParams = {...params}"
|
@search="(params:any)=>queryParams = {...params}"
|
||||||
|
style="margin-bottom: 0;"
|
||||||
/>
|
/>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<j-pro-table
|
<j-pro-table
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
:defaultParams="{
|
:defaultParams="{
|
||||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
}"
|
}"
|
||||||
|
style="max-height: 510px; overflow: auto; padding-top: 0;"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
|
|
Loading…
Reference in New Issue