Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
XieYongHong 2023-07-14 14:25:22 +08:00
commit 051a5082f3
8 changed files with 107 additions and 52 deletions

View File

@ -43,7 +43,7 @@ export default {
server.post<recordsItemType[]>(`/media/device/${deviceId}/${channelId}/records/in-server/files`, data), server.post<recordsItemType[]>(`/media/device/${deviceId}/${channelId}/records/in-server/files`, data),
// 播放云端回放 // 播放云端回放
playbackStart: (recordId: string) => `${BASE_API_PATH}/record/${recordId}.mp4?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}`, playbackStart: (recordId: string) => `${BASE_API_PATH}/media/record/${recordId}.mp4?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}`,
downLoadFile: (recordId: string) => `${BASE_API_PATH}/record/${recordId}.mp4?download=true&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` downLoadFile: (recordId: string) => `${BASE_API_PATH}/media/record/${recordId}.mp4?download=true&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}`
} }

View File

@ -4,6 +4,7 @@
:visible="true" :visible="true"
width="700px" width="700px"
@cancel="handleCancel" @cancel="handleCancel"
:destroyOnClose="true"
> >
<div class="sizeText"> <div class="sizeText">
将批量修改 将批量修改
@ -86,7 +87,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { FormInstance } from 'ant-design-vue'; import type { FormInstance } from 'ant-design-vue';
import { savePointBatch } from '@/api/data-collect/collector'; import { savePointBatch } from '@/api/data-collect/collector';
import { Rule } from 'ant-design-vue/lib/form';
import { cloneDeep, isObject } from 'lodash'; import { cloneDeep, isObject } from 'lodash';
import { regOnlyNumber } from '../../../data'; import { regOnlyNumber } from '../../../data';
@ -107,15 +107,6 @@ const formData = ref({
features: [], features: [],
}); });
const checkLength = (_rule: Rule, value: string): Promise<any> =>
new Promise(async (resolve, reject) => {
if (value) {
return String(value).length > 64
? reject('最多可输入64个字符')
: resolve('');
}
});
const handleOk = async () => { const handleOk = async () => {
const data = cloneDeep(formData.value); const data = cloneDeep(formData.value);
const { accessModes, features, interval } = data; const { accessModes, features, interval } = data;
@ -136,7 +127,11 @@ const handleOk = async () => {
); );
} }
} }
features.length !== 0 && (i.features = data.features); if(features.length !== 0) {
i.features = data.features
} else {
i.features = i.features.map((it: any) =>it.value)
}
if (!!interval || Number(interval) === 0) { if (!!interval || Number(interval) === 0) {
i.interval = data.interval; i.interval = data.interval;
i.configuration = { i.configuration = {
@ -157,10 +152,6 @@ const handleOk = async () => {
const handleCancel = () => { const handleCancel = () => {
emit('change', false); emit('change', false);
}; };
const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -10,22 +10,28 @@
message: '请选择指令类型', message: '请选择指令类型',
}" }"
> >
<j-select <MSelect
placeholder="请选择指令类型"
v-model:value="modelRef.messageType" v-model:value="modelRef.messageType"
show-search :options="_options"
@change="onTypeChange" @change="onTypeChange"
> type="messageType"
<j-select-option value="READ_PROPERTY" />
>读取属性</j-select-option <!-- // <j-select
> // placeholder=""
<j-select-option value="WRITE_PROPERTY" // v-model:value="modelRef.messageType"
>修改属性</j-select-option // show-search
> // @change="onTypeChange"
<j-select-option value="INVOKE_FUNCTION" // >
>调用功能</j-select-option // <j-select-option value="READ_PROPERTY"
> // ></j-select-option
</j-select> // >
// <j-select-option value="WRITE_PROPERTY"
// ></j-select-option
// >
// <j-select-option value="INVOKE_FUNCTION"
// ></j-select-option
// >
// </j-select> -->
</j-form-item> </j-form-item>
</j-col> </j-col>
<j-col <j-col
@ -89,7 +95,11 @@
:itemType=" :itemType="
property.valueType?.type || property.type || 'int' property.valueType?.type || property.type || 'int'
" "
:placeholder="property.valueType?.type === 'array' ? '多个数据用英文,分割' : ''" :placeholder="
property.valueType?.type === 'array'
? '多个数据用英文,分割'
: ''
"
:options=" :options="
property.valueType?.type === 'enum' property.valueType?.type === 'enum'
? (property?.valueType?.elements || []).map( ? (property?.valueType?.elements || []).map(
@ -102,15 +112,25 @@
) )
: property.valueType?.type === 'boolean' : property.valueType?.type === 'boolean'
? [ ? [
{ label: property.valueType?.trueText, value: property.valueType?.trueValue }, {
{ label: property.valueType?.falseText, value: property.valueType?.falseValue }, label: property.valueType?.trueText,
value: property.valueType?.trueValue,
},
{
label: property.valueType?.falseText,
value: property.valueType?.falseValue,
},
] ]
: undefined : undefined
" "
/> />
</j-form-item> </j-form-item>
</j-col> </j-col>
<j-col :span="24" v-if="modelRef.messageType === 'INVOKE_FUNCTION'" class="inputs"> <j-col
:span="24"
v-if="modelRef.messageType === 'INVOKE_FUNCTION'"
class="inputs"
>
<j-form-item <j-form-item
:name="['message', 'functionId']" :name="['message', 'functionId']"
label="功能" label="功能"
@ -164,6 +184,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import EditTable from './EditTable.vue'; import EditTable from './EditTable.vue';
import MSelect from '../../../components/MSelect/index.vue';
const formRef = ref(); const formRef = ref();
@ -187,7 +208,7 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue']);
const editRef = ref(); const editRef = ref();
@ -210,11 +231,25 @@ const onPropertyChange = (val: string, flag?: boolean) => {
); );
property.value = _item || {}; property.value = _item || {};
} }
if(!flag){ if (!flag) {
modelRef.message.value = undefined modelRef.message.value = undefined;
} }
}; };
const _options = [
{
id: 'READ_PROPERTY',
name: '读取属性',
},
{
id: 'WRITE_PROPERTY',
name: '修改属性',
},
{
id: 'INVOKE_FUNCTION',
name: '调用功能',
},
];
const onTypeChange = () => { const onTypeChange = () => {
// , // ,
// modelRef.message = { // modelRef.message = {
@ -231,14 +266,14 @@ const funcChange = (val: string, _inputs?: any[]) => {
props.metadata?.functions.find((item: any) => item.id === val) props.metadata?.functions.find((item: any) => item.id === val)
?.inputs || []; ?.inputs || [];
const list = arr.map((item: any) => { const list = arr.map((item: any) => {
const _item = _inputs?.find(i => i.id === item.id) const _item = _inputs?.find((i) => i.id === item.id);
return { return {
id: item.id, id: item.id,
name: item.name, name: item.name,
value: undefined, value: undefined,
valueType: item?.valueType?.type, valueType: item?.valueType?.type,
..._item, ..._item,
required: item?.expands?.required required: item?.expands?.required,
}; };
}); });
modelRef.message.inputs = list; modelRef.message.inputs = list;
@ -254,7 +289,10 @@ watch(
onPropertyChange(newVal?.message?.properties, true); onPropertyChange(newVal?.message?.properties, true);
} }
if (newVal?.message?.functionId) { if (newVal?.message?.functionId) {
funcChange(newVal?.message?.functionId, newVal?.message?.inputs); funcChange(
newVal?.message?.functionId,
newVal?.message?.inputs,
);
} }
} }
}, },
@ -273,7 +311,7 @@ const saveBtn = () =>
resolve(false); resolve(false);
}); });
} }
emit('update:modelValue', _data) emit('update:modelValue', _data);
resolve(_data); resolve(_data);
}) })
.catch((err: any) => { .catch((err: any) => {

View File

@ -112,7 +112,7 @@
collapsible="header" collapsible="header"
> >
<j-collapse-panel <j-collapse-panel
:key="(cluster.serverId || '') + index" :key="index + 1"
:show-arrow="!formData.shareCluster" :show-arrow="!formData.shareCluster"
> >
<template #header v-if="!shareCluster"> <template #header v-if="!shareCluster">

View File

@ -132,6 +132,16 @@ const validateAddress = (_rule: any, value: string): Promise<any> => {
}); });
}; };
const sizeValidator = (_rule:any, value: number):Promise<any> =>{
return new Promise(async(resolve,reject)=>{
const posReg = /^\d+$/;
if(posReg.test(value.toString()) && value >= 0 && value <=65535 ){
return resolve('');
}else {
return reject(_rule.message);
}
})
}
export const Rules = { export const Rules = {
name: [ name: [
{ {
@ -313,6 +323,11 @@ export const Rules = {
required: true, required: true,
message: '请输入长度值', message: '请输入长度值',
}, },
{
validator:sizeValidator,
message:'请输入0~65535之间的正整数',
trigger:'change'
}
], ],
length: [ length: [
{ {

View File

@ -43,7 +43,7 @@
</j-space> </j-space>
</j-tooltip> </j-tooltip>
</template> </template>
<template #channelId="slotProps"> <template #gbChannelId="slotProps">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center;">
<Ellipsis style="width: 150px"> <Ellipsis style="width: 150px">
{{ slotProps.gbChannelId }} {{ slotProps.gbChannelId }}
@ -180,8 +180,8 @@ const columns = [
}, },
{ {
title: '国标ID', title: '国标ID',
dataIndex: 'channelId', dataIndex: 'gbChannelId',
key: 'channelId', key: 'gbChannelId',
scopedSlots: true, scopedSlots: true,
width: 200, width: 200,
headerCell: 'gbChannelIdHeader', // headerCell: 'gbChannelIdHeader', //

View File

@ -77,7 +77,7 @@ const handleHeader= (data:any) =>{
}) })
} }
const dataSource = reactive({ const dataSource = reactive({
table:props.headers.length > 0 ? handleHeader(props.headers) : '' table:props.headers.length > 0 ? handleHeader(props.headers) : []
}); });
watch(()=>JSON.stringify(props.headers),()=>{ watch(()=>JSON.stringify(props.headers),()=>{
@ -102,12 +102,17 @@ const handleAdd = () => {
}; };
const validate = () =>{ const validate = () =>{
return new Promise((resolve:any,reject:any)=>{ return new Promise((resolve:any,reject:any)=>{
tableRef.value.validate().then(()=>{ if(dataSource.table){
tableRef.value.validate().then(()=>{
valueChange() valueChange()
resolve(data.value) resolve(data.value)
}).catch((err:any)=>{ }).catch((err:any)=>{
console.log(err);
reject(false) reject(false)
}) })
}else{
resolve([])
}
}) })
} }
defineExpose({ defineExpose({

View File

@ -191,20 +191,26 @@ const formModel = reactive<{
const variableRef = ref(); const variableRef = ref();
const formRef = ref(); const formRef = ref();
const _getType = computed(() => {
if(['notifier-dingTalk'].includes(props.data?.channelProvider)) {
return ['user', 'tag']
} else {
return ['user', 'org', 'tag']
}
})
const _variableDefinitions = computed(() => { const _variableDefinitions = computed(() => {
const arr = ['user', 'org', 'tag'];
return variable.value.filter((item: any) => { return variable.value.filter((item: any) => {
const _type = item.expands?.businessType || item.type || ''; const _type = item.expands?.businessType || item.type || '';
return !arr.includes(_type); return !['user', 'org', 'tag'].includes(_type);
}); });
}); });
const handleVariable = (obj: any) => { const handleVariable = (obj: any) => {
const arr = ['user', 'org', 'tag'];
const _array = variable.value const _array = variable.value
.filter((item: any) => { .filter((item: any) => {
const _type = item.expands?.businessType || item.type || ''; const _type = item.expands?.businessType || item.type || '';
return arr.includes(_type); return _getType.value.includes(_type);
}) })
.map((i: any) => i?.id); .map((i: any) => i?.id);
const _variable = variableMap.get(formModel.channelProvider); const _variable = variableMap.get(formModel.channelProvider);