Merge branch 'dev'

# Conflicts:
#	src/components/Layout/components/Notice.vue
#	src/views/account/Center/components/data.ts
#	src/views/device/Instance/Detail/Running/Property/Detail/Charts.vue
#	src/views/device/Product/index.vue
#	src/views/device/components/Metadata/Import/index.vue
#	src/views/device/components/Metadata/Import/valideta.ts
#	src/views/rule-engine/Scene/Save/action/Device/actions/index.vue
#	src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue
#	src/views/system/Menu/Detail/BasicInfo.vue
#	src/views/system/NoticeRule/components/Save/index.vue
This commit is contained in:
XieYongHong 2024-01-15 18:54:37 +08:00
commit 8600bbee98
19 changed files with 171 additions and 105 deletions

BIN
public/images/marker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -529,7 +529,7 @@ export const getPropertiesInfo = (deviceId: string, data: Record<string, unknown
* @param data
* @returns
*/
export const getPropertiesList = (deviceId: string, property: string, data: Record<string, unknown>) => server.post(`/device-instance/${deviceId}/property/${property}/_query`, data)
export const getPropertiesList = (deviceId: string, property: string, data: Record<string, unknown>) => server.post(`/device-instance/${deviceId}/property/${property}/_query/no-paging`, data)
/**
*

View File

@ -37,7 +37,6 @@ const total = ref(0);
// const list = ref<any[]>([]);
const loading = ref(false);
const visible = ref(false);
const subscribeNotice = () => {
getWebSocket('notification', '/notifications', {})
?.pipe()
@ -88,9 +87,8 @@ const subscribeNotice = () => {
const read = (type: string, data: any) => {
changeStatus_api('_read', [data.payload.id]).then((resp: any) => {
if (resp.status !== 200) return;
// notification.close(data.payload.id);
notification.close(data.payload.id);
getList();
console.log(data,type)
if (type !== '_read') {
menuStory.routerPush('account/center', {
tabKey: 'StationMessage',

View File

@ -6,6 +6,7 @@
@cancel="cancel"
@ok="ok"
:confirmLoading="loading"
:maskClosable="false"
>
<div style="height: 300px; width: 100%;">
<vue-cropper

View File

@ -86,4 +86,5 @@ const workflowNotice = [
]
export const getInitData = () =>{
return menuStore.hasMenu('process') ? [...systemNotice,...workflowNotice] : [...systemNotice]
}

View File

@ -20,11 +20,9 @@
},
}"
:icon="{
image: 'https://a.amap.com/jsapi_demos/static/images/poi-marker.png',
image: '/images/marker.png',
anchor: 'bottom-center',
size: [25, 34],
clipOrigin: [459, 92],
clipSize: [50, 68],
}"
></el-amap-label-marker
>
@ -35,6 +33,7 @@
<script lang="ts" setup>
import AmapComponent from '@/components/AMapComponent/index.vue';
import { getGo } from '@/api/device/dashboard';
import { getImage } from '@/utils/comm';
let point = ref();
const getMapData = async () => {
const res = await getGo({

View File

@ -19,13 +19,17 @@
</div>
</template>
<j-form layout="vertical" ref="formRef" :model="modelRef">
<template v-for="(item, index) in (props.config || [])" :key="index">
<template v-for="(item, index) in props.config || []" :key="index">
<j-form-item
v-for="i in item.properties"
:name="i.property"
:key="i.property"
:required='!!i.type.expands?.required'
:rules='!!i.type.expands?.required ? [{ required: true, message: `请输入${i.name}`}] :[]'
:required="!!i.type.expands?.required"
:rules="
!!i.type.expands?.required
? [{ required: true, message: `请输入${i.name}` }]
: []
"
>
<template #label>
<span style="margin-right: 5px">{{ i.name }}</span>
@ -36,16 +40,7 @@
<ValueItem
v-model:modelValue="modelRef[i.property]"
:itemType="i.type.type"
:options="
i.type.type === 'enum'
? (i.type?.elements || []).map((item) => {
return {
label: item?.text,
value: item?.value,
};
})
: undefined
"
:options="getOptions(i)"
/>
</j-form-item>
</template>
@ -68,23 +63,44 @@ const instanceStore = useInstanceStore();
const props = defineProps({
config: {
type: Array,
default: []
}
})
default: [],
},
});
const getOptions = (i: any) => {
if (i.type.type === 'enum') {
return (i.type?.elements || []).map((item) => {
return {
label: item?.text,
value: item?.value,
};
});
} else if (i.type.type === 'boolean') {
return [
{
label: i.type?.falseText,
value: i.type?.falseValue,
},
{
label: i.type?.trueText,
value: i.type?.trueValue,
}
];
}
return undefined;
};
watchEffect(() => {
const obj = instanceStore.current?.configuration
if(obj && Object.keys(obj).length) {
const obj = instanceStore.current?.configuration;
if (obj && Object.keys(obj).length) {
(props?.config || []).map((item: any) => {
if(Array.isArray(item.properties) && item?.properties.length){
if (Array.isArray(item.properties) && item?.properties.length) {
item.properties.map((i: any) => {
modelRef[i.property] = obj[i.property]
})
modelRef[i.property] = obj[i.property];
});
}
})
});
}
})
});
const onClose = () => {
emit('close');
@ -97,10 +113,10 @@ const saveBtn = () => {
const values = toRaw(modelRef);
const resp = await modify(instanceStore.current?.id || '', {
id: instanceStore.current?.id,
configuration: { ...values }
})
if(resp.status === 200){
onlyMessage('操作成功!')
configuration: { ...values },
});
if (resp.status === 200) {
onlyMessage('操作成功!');
emit('save');
}
}

View File

@ -135,7 +135,6 @@ const queryChartsList = async () => {
loading.value = false;
}
)
if (resp.status === 200) {
const dataList: any[] = [
{
@ -144,7 +143,7 @@ const queryChartsList = async () => {
type: prop.data?.name || '',
},
];
(resp.result as any)?.data?.forEach((i: any) => {
(resp.result as any)?.forEach((i: any) => {
dataList.push({
...i,
year: i.timestamp,

View File

@ -110,7 +110,7 @@
{
required: !!item?.type?.expands?.required,
message: `${
item.type.type === 'enum'
item.type.type === 'enum' || 'boolean'
? '请选择'
: '请输入'
}${item.name}`,
@ -129,10 +129,11 @@
></j-input-password>
<j-select
placeholder="请选择"
v-if="item.type.type === 'enum'"
v-if="item.type.type === 'enum' || item.type.type === 'boolean'"
v-model:value="formData.data[item.property]"
:options="getOptions(item)"
>
<j-select-option
<!-- <j-select-option
v-for="el in item?.type?.type === 'enum' &&
item?.type?.elements
? item?.type?.elements
@ -141,8 +142,9 @@
:value="el.value"
>
{{ el.text }}
</j-select-option>
</j-select-option> -->
</j-select>
<j-input-number v-if="['int','float','double','long'].includes(item.type.type)" v-model:value="formData.data[item.property]" placeholder="请输入"></j-input-number>
</j-form-item>
</j-form>
<Title data="存储策略">
@ -346,6 +348,29 @@ const form = reactive<Record<string, any>>({
const formData = reactive<Record<string, any>>({
data: productStore.current?.configuration || {},
});
//
const getOptions = (i:any) =>{
if (i.type.type === 'enum') {
return (i.type?.elements || []).map((item) => {
return {
label: item?.text,
value: item?.value,
};
});
} else if (i.type.type === 'boolean') {
return [
{
label: i.type?.falseText,
value: i.type?.falseValue,
},
{
label: i.type?.trueText,
value: i.type?.trueValue,
}
];
}
return undefined;
}
const fun = () =>{
console.log(formData.data,productStore.current?.configuration)
}

View File

@ -32,6 +32,7 @@
accept=".json"
:showUploadList="false"
:before-upload="beforeUpload"
:disabled="!permission"
>
<PermissionButton
hasPermission="device/Product:import"
@ -197,6 +198,7 @@ import { useMenuStore } from 'store/menu';
import { useRoute } from 'vue-router';
import { useRouterParams } from '@/utils/hooks/useParams';
import { accessConfigTypeFilter } from '@/utils/setting';
import { usePermissionStore } from '@/store/permission';
/**
* 表格数据
*/
@ -258,7 +260,9 @@ const columns = [
ellipsis: true,
},
];
const permission = usePermissionStore().hasPermission(
`device/Product:import`,
);
const _selectedRowKeys = ref<string[]>([]);
const currentForm = ref({});

View File

@ -70,12 +70,13 @@
v-if="type === 'device' || formModel.type === 'import'"
>
<j-select v-model:value="formModel.metadata">
<j-select-option value="jetlinks"
<!-- <j-select-option value="jetlinks"
>Jetlinks物模型</j-select-option
>
<j-select-option value="alink"
>阿里云物模型TSL</j-select-option
>
> -->
<j-select-option v-for="i in codecs" :value="i.id">{{ i.name }}</j-select-option>
</j-select>
</j-form-item>
<j-form-item
@ -177,6 +178,7 @@
</j-modal>
</template>
<script setup lang="ts" name="Import">
import { getCodecs } from '@/api/device/product';
import { saveMetadata } from '@/api/device/instance';
import {
queryNoPagingPost,
@ -214,7 +216,7 @@ interface Emits {
const props = defineProps<Props>();
const emits = defineEmits<Emits>();
const loading = ref(false);
const codecs = ref<any>([])
const _visible = computed({
get: () => {
return props.visible;
@ -300,7 +302,7 @@ const requiredCheck = (data:any) =>{
check = true
return
}else{
check = testType(item,index)
check = testType(item.valueType,index)
}
if(!item?.expands?.source){
onlyMessage(`属性定义第${index + 1}个数组中缺失expands.source属性`,'error');
@ -326,20 +328,20 @@ const requiredCheck = (data:any) =>{
check = true
return
}
if(!item?.async && item?.async !== false){
onlyMessage(`方法定义第${index + 1}个数组中缺失async属性`,'error');
check = true
return
}
// if(!item?.async && item?.async !== false){
// onlyMessage(`${index + 1}async`,'error');
// check = true
// return
// }
if(item?.inputs){
testObject(item.inputs,index)
item.inputs.forEach((i:any)=>{
if(!i?.expands?.required && i?.expands?.required !== false){
onlyMessage(`方法定义inputs第${index+1}个数组中缺失expands.required属性`,'error')
check = true
return
}
})
// item.inputs.forEach((i:any)=>{
// if(!i?.expands?.required && i?.expands?.required !== false){
// onlyMessage(`inputs${index+1}expands.required`,'error')
// check = true
// return
// }
// })
}
})
}
@ -355,11 +357,11 @@ const requiredCheck = (data:any) =>{
check = true
return
}
if(!item?.async && item?.async !== false){
onlyMessage(`事件定义第${index + 1}个数组中缺失async属性`,'error');
check = true
return
}
// if(!item?.async && item?.async !== false){
// onlyMessage(`${index + 1}async`,'error');
// check = true
// return
// }
if(!item?.valueType?.type){
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.type属性`,'error');
check = true
@ -414,7 +416,7 @@ const requiredCheck = (data:any) =>{
check = true
return
}else{
testType(item?.valueType?.type,index)
testType(item?.valueType,index)
}
if(!item?.expands?.type){
onlyMessage(`标签定义第${index + 1}个数组中缺失expands.type属性`,'error');
@ -595,6 +597,12 @@ const metadataStore = useMetadataStore();
const handleImport = async () => {
formRef.value.validate().then(async (data: any) => {
let check
if((props.type === 'device' || formModel.type === 'import') &&
formModel.metadataType === 'script'){
check = formModel.metadata === 'jetlinks' ? requiredCheck(JSON.parse(formModel.import)) : aliCheck(JSON.parse(formModel.import))
}
if(!check){
const { id } = route.params || {};
if (data.metadata === 'alink') {
try {
@ -723,9 +731,16 @@ const handleImport = async () => {
);
}
}
}
});
};
onMounted(async()=>{
const res = await getCodecs()
if (res.status === 200) {
codecs.value = [{ id: 'jetlinks', name: '标准物模型' }].concat(res.result)
}
})
// const showProduct = computed(() => formModel.type === 'copy')
</script>
<style scoped lang="less">

View File

@ -4,15 +4,16 @@ export const testProperties = (data:any) =>{
}
export const testType = (data:any,index:number,isArray?:boolean,isObject?:boolean)=>{
if(data.valueType.type === 'boolean'){
if(!data?.valueType?.trueText || !data?.valueType?.trueValue || !data?.valueType?.falseText || !data?.valueType?.falseValue){
console.log(data,index)
if(data.type === 'boolean'){
if(!data?.trueText || !data?.trueValue || !data?.falseText || !data?.falseValue){
onlyMessage(`方法定义inputs第${index+1}个数组ValueType中缺失必填属性`,'error')
return true
}
}
if(data.valueType.type === 'enum' && !isObject){
if(data.valueType?.elements?.length > 0){
data.valueType.elements.forEach((a:any,b:number)=>{
if(data.type === 'enum' && !isObject){
if(data?.elements?.length > 0){
data.elements.forEach((a:any,b:number)=>{
if(!a.value || !a.text){
onlyMessage(`方法定义inputs第${index+1}个数组ValueType中elements缺失必填属性`,'error')
return true
@ -23,23 +24,23 @@ export const testType = (data:any,index:number,isArray?:boolean,isObject?:boolea
return true
}
}
if(data.valueType.type === 'array' && !isArray && !isObject){
if(data.valueType?.elementType){
testType(data.valueType.elementType,index,true)
if(data.type === 'array' && !isArray && !isObject){
if(data?.elementType){
testType(data.elementType,index,true)
}else{
onlyMessage(`方法定义inputs第${index+1}个数组ValueType中缺失elementType属性`,'error')
return true
}
}
if(data.valueType.type === 'file' && !isArray && !isObject){
if(!data.valueType?.fileType){
if(data.type === 'file' && !isArray && !isObject){
if(!data?.fileType){
onlyMessage(`方法定义inputs第${index+1}个数组ValueType中缺失fileType属性`,'error')
return true
}
}
if(data.valueType.type === 'object' && !isArray && !isObject){
if(data.type === 'object' && !isArray && !isObject){
if(data?.valueType?.properties?.length > 0){
return testObject(data.valueType.properties,index)
return testObject(data.properties,index)
}else{
onlyMessage(`方法定义inputs第${index+1}个数组ValueType中缺失properties属性`,'error')
return true

View File

@ -1506,7 +1506,6 @@ export default [
url: '/iot/DataCollect/Dashboard',
icon: 'icon-keshihua',
showPage: [
'dashboard',
'data-collect-channel',
'data-collect-opc',
'data-collector',
@ -2836,7 +2835,7 @@ export default [
},
],
buttons: [],
showPage: ['dashboard', 'media-device'],
showPage: ['media-device'],
accessSupport: { text: "不支持", value: "unsupported" },
supportDataAccess: false
},

View File

@ -452,8 +452,9 @@ const handleBind = (row: any) => {
* 绑定用户, 用户下拉筛选
*/
const filterOption = (input: string, option: any) => {
const text = option?.componentOptions?.children?.[0]?.text || option.label
return (
option.componentOptions.children[0].text
text
.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
);

View File

@ -268,7 +268,6 @@ watch(
() => props.productDetail,
(newVal) => {
if (newVal?.id) {
console.log(props.values)
if (props.values?.selector === 'fixed' && props.values?.selectorValues?.length === 1) {
const id = props.values?.selectorValues?.[0]?.value;
if (id) {
@ -300,6 +299,8 @@ watch(
)
) {
queryBuiltIn();
}else{
modelRef.message.properties = [] as any;
}
}
},

View File

@ -7,7 +7,7 @@
style="margin-right: 12px"
/>
<template v-if="shakeLimit.enabled">
<j-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.time" style="width: 38px" />
<j-input-number :min="1" :precision="0" size="small" v-model:value="shakeLimit.time" style="width: 38px" />
<span>秒内发送</span>
<j-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.threshold" style="width: 38px" />
<span>次及以上时处理</span>

View File

@ -36,6 +36,7 @@
v-model:value='paramsValue.termType'
@select='termsTypeSelect'
/>
<div v-if="!['notnull','isnull'].includes(paramsValue.termType)">
<DoubleParamsDropdown
v-if='showDouble'
icon='icon-canshu'
@ -59,6 +60,7 @@
v-model:source='paramsValue.value.source'
@select='valueSelect'
/>
</div>
<j-popconfirm title='确认删除?' @confirm='onDelete' :overlayStyle='{minWidth: "180px"}'>
<div v-show='showDelete' class='button-delete'> <AIcon type='CloseOutlined' /></div>
</j-popconfirm>
@ -82,12 +84,12 @@ import { ContextKey, arrayParamsKey, timeTypeKeys } from './util'
import { useSceneStore } from 'store/scene'
import { storeToRefs } from 'pinia';
import { Form } from 'jetlinks-ui-components'
import {indexOf, isArray, isObject, isString, pick , cloneDeep } from 'lodash-es'
import {indexOf, isArray, isObject, isString, pick} from 'lodash-es'
import {cloneDeep} from "lodash";
const sceneStore = useSceneStore()
const { data: formModel } = storeToRefs(sceneStore)
const formItemContext = Form.useInjectFormItemContext();
type Emit = {
(e: 'update:value', data: TermsType): void
}
@ -328,6 +330,11 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
newValue.value = undefined
}
}
if(
['isnull','notull'].includes(e.key)
){
newValue.value.value = 1
}
paramsValue.value = newValue
emit('update:value', { ...paramsValue })
@ -337,6 +344,7 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
}
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
console.log(labelObj,option,paramsValue.value,'____123')
if (paramsValue.value?.source === 'metric') {
paramsValue.value.metric = option?.id
}

View File

@ -41,7 +41,11 @@
</j-form-item>
</j-col>
<j-col :span="12">
<j-form-item label="编码" name="code" :rules="[
<j-form-item
label="编码"
name="code"
:validateFirst="true"
:rules="[
{
required: true,
message: '请输入编码',

View File

@ -60,14 +60,14 @@
ref="variableRef"
/>
</template>
<template v-if="current === 4 && isNoCommunity ">
<template v-if="current === 4">
<div class="alert">
<AIcon type="InfoCircleOutlined" />
通过角色控制哪些用户可以订阅从{{ name }}接收到{{ showName }}通知
</div>
<Role type="add" v-model="formModel.grant.role.idList" />
</template>
<template v-if="current === 5 || current === 4 && !isNoCommunity">
<template v-if="current === 5">
<div>
<div class="alert">
<AIcon type="InfoCircleOutlined" />
@ -170,19 +170,13 @@ const props = defineProps({
},
});
const stepList = isNoCommunity ? [
const stepList = [
'选择通知方式',
'选择通知配置',
'选择通知模板',
'配置模板变量',
'配置用户权限',
'完成',
] : [
'选择通知方式',
'选择通知配置',
'选择通知模板',
'配置模板变量',
'完成',
]
const current = ref<number>(0);
const variable = ref([]);