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 { 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
|
||||
|
|
|
@ -61,22 +61,21 @@ const data: any = ref({
|
|||
|
||||
const pickerTimeChange = () => {
|
||||
data.value.time.type = undefined;
|
||||
console.log(1);
|
||||
};
|
||||
|
||||
const getEcharts = async (val: any) => {
|
||||
loading.value = true;
|
||||
const resp: any = await dashboard(pointParams(val));
|
||||
if (resp.success) {
|
||||
if (resp.success && resp?.result?.length) {
|
||||
const x = resp.result
|
||||
.map((item: any) => item.data.timeString)
|
||||
.reverse();
|
||||
const y = resp.result.map((item: any) => item.data.value).reverse();
|
||||
handleOptions(x, y);
|
||||
}
|
||||
setTimeout(() => {
|
||||
setTimeout(()=>{
|
||||
loading.value = false;
|
||||
}, 300);
|
||||
},300)
|
||||
};
|
||||
|
||||
const handleOptions = (x = [], y = []) => {
|
||||
|
|
|
@ -33,6 +33,10 @@ const props = defineProps({
|
|||
id: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
pluginId:{
|
||||
type:String,
|
||||
default: undefined
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -46,7 +50,7 @@ const handleOk = async () => {
|
|||
loading.value = true
|
||||
const res = await savePluginData(
|
||||
'device',
|
||||
props.accessId!,
|
||||
props.pluginId!,
|
||||
route.params.id as string,
|
||||
checkKey.value
|
||||
).catch(() => ({ success: false }))
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
v-if='inkingVisible'
|
||||
:id='inklingDeviceId'
|
||||
:accessId='instanceStore.current.accessId'
|
||||
:pluginId="channelId"
|
||||
@cancel="inkingVisible = false"
|
||||
@submit='saveInkling'
|
||||
/>
|
||||
|
@ -150,7 +151,7 @@ const queryInkling = () => {
|
|||
queryPluginAccessDetail(instanceStore.current?.accessId).then(async res => {
|
||||
if (res.success) {
|
||||
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) {
|
||||
inklingDeviceId.value = pluginRes.result?.externalId
|
||||
}
|
||||
|
|
|
@ -425,6 +425,7 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
|||
props: {
|
||||
noEdit: noEdit?.value?.source || [],
|
||||
target: target,
|
||||
productNoEdit: productNoEdit?.value
|
||||
}
|
||||
},
|
||||
doubleClick(record){
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
>
|
||||
</j-select>
|
||||
<j-popconfirm-modal
|
||||
v-if="myValue != 'manual' && props.target === 'product'"
|
||||
v-if="myValue != 'manual' && !showReset"
|
||||
:bodyStyle="{
|
||||
width: '450px',
|
||||
height: myValue === 'rule' ? '300px' : '80px',
|
||||
|
@ -37,7 +37,7 @@
|
|||
<AIcon type="EditOutlined" />
|
||||
</j-button>
|
||||
</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>
|
||||
<AIcon type="MoreOutlined" />
|
||||
</span>
|
||||
|
@ -96,10 +96,9 @@ import VirtualRule from './VirtualRule/index.vue';
|
|||
import { Form } from 'jetlinks-ui-components';
|
||||
import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable'
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import {
|
||||
queryProductVirtualProperty
|
||||
} from '@/api/device/product';
|
||||
import { resetRule } from '@/api/device/instance';
|
||||
import { updata } from '@/api/rule-engine/configuration';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
const instanceStore = useInstanceStore();
|
||||
const PropertySource: { label: string; value: string }[] = isNoCommunity
|
||||
? [
|
||||
|
@ -134,7 +133,7 @@ type Emit = {
|
|||
};
|
||||
|
||||
const fullRef = inject(FULL_CODE);
|
||||
|
||||
const showReset = ref(false);
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
|
@ -152,6 +151,10 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
productNoEdit:{
|
||||
type:Array,
|
||||
default: []
|
||||
}
|
||||
});
|
||||
|
||||
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() =>{
|
||||
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
|
||||
})
|
||||
let res:any = await resetRule(instanceStore.current?.productId,instanceStore.current?.id,props.value?.id)
|
||||
if(res.status === 200){
|
||||
onlyMessage('操作成功!')
|
||||
}
|
||||
}
|
||||
const cancel = () => {
|
||||
|
@ -245,6 +254,13 @@ watch(
|
|||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
onMounted(()=>{
|
||||
if(props.target === 'device'){
|
||||
props.productNoEdit?.id?.forEach((item:any)=>{
|
||||
item === props.value?.id ? showReset.value = true : ''
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -215,6 +215,7 @@ const columns = [
|
|||
]
|
||||
|
||||
const handleAdd = () => {
|
||||
editData.value = {}
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
okText="确定"
|
||||
>
|
||||
<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
|
||||
v-if="inputData.status"
|
||||
label="kafka地址"
|
||||
|
@ -47,13 +54,6 @@
|
|||
>
|
||||
<j-input v-model:value="inputData.topic"></j-input>
|
||||
</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-modal>
|
||||
</template>
|
||||
|
|
|
@ -6,20 +6,22 @@
|
|||
只能分配有“共享”权限的资产数据
|
||||
</h5>
|
||||
|
||||
<div style="display: flex; margin-left: 24px;">
|
||||
<div class="row">
|
||||
<span style="margin-right: 8px">批量配置</span>
|
||||
<j-switch v-model:checked="bulkBool" checked-children="开" un-checked-children="关" style="width: 56px" />
|
||||
</div>
|
||||
<div v-show="bulkBool">
|
||||
<div v-show="bulkBool" style="margin-left: 30px;">
|
||||
<j-checkbox-group v-model:value="bulkList" :options="options" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<pro-search
|
||||
<!-- <pro-search
|
||||
type="simple"
|
||||
:columns="searchColumns"
|
||||
target="category-bind-modal"
|
||||
@search="search"
|
||||
/>
|
||||
/> -->
|
||||
<j-pro-table
|
||||
ref="tableRef"
|
||||
:request="table.requestFun"
|
||||
|
@ -32,7 +34,17 @@
|
|||
onSelectAll: selectAll
|
||||
}"
|
||||
: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">
|
||||
<CardBox :value="slotProps" :actions="[{ key: 1 }]" v-bind="slotProps" :active="table._selectedRowKeys.value.includes(slotProps.id)
|
||||
" @click="table.onSelectChange" :status="slotProps.state?.value"
|
||||
|
@ -490,6 +502,7 @@ const search = (query: any) => {
|
|||
|
||||
h5 {
|
||||
padding: 12px;
|
||||
padding-left: 24px;
|
||||
background-color: #f6f6f6;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
@ -498,4 +511,7 @@ const search = (query: any) => {
|
|||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
:deep(.jtable-body-header-left){
|
||||
width: 80%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -130,12 +130,12 @@ function getTree(cb?: Function) {
|
|||
treeMap.clear()
|
||||
getTreeData_api(params)
|
||||
.then((resp: any) => {
|
||||
selectedKeys.value = [resp.result[0]?.id];
|
||||
sourceTree.value = resp.result.sort((a: any, b: any) =>
|
||||
a.sortIndex === b.sortIndex
|
||||
? b.createTime - a.createTime
|
||||
: a.sortIndex - b.sortIndex,
|
||||
); // 报存源数据
|
||||
selectedKeys.value = [resp.result[0]?.id];
|
||||
handleTreeMap(resp.result); // 将树形结构转换为map结构
|
||||
treeData.value = resp.result; // 第一次不用进行过滤
|
||||
cb && cb();
|
||||
|
@ -275,7 +275,7 @@ init();
|
|||
.tree {
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
|
||||
flex: 1 1 auto;
|
||||
.department-tree-item-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
:columns="columns"
|
||||
target="category"
|
||||
@search="(params:any)=>queryParams = {...params}"
|
||||
style="margin-bottom: 0;"
|
||||
/>
|
||||
<div class="table">
|
||||
<j-pro-table
|
||||
|
@ -31,6 +32,7 @@
|
|||
:defaultParams="{
|
||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||
}"
|
||||
style="max-height: 510px; overflow: auto; padding-top: 0;"
|
||||
/>
|
||||
</div>
|
||||
</j-modal>
|
||||
|
|
Loading…
Reference in New Issue