fix: bug#16958、18772、系统菜单非选中状态不显示
* fix: bug#视频回放加载bug * fix: bug#18502 * fix: bug#视频回放加载bug * fix: bug#18156 * fix: bug#16958、18772 * fix: bug#18674 * feat: 系统菜单非选中状态不显示bug * fix: bug#18772 * fix: bug#16958
This commit is contained in:
parent
c3286b6661
commit
ac074990cb
|
@ -25,7 +25,7 @@
|
|||
"event-source-polyfill": "^1.0.31",
|
||||
"global": "^4.4.0",
|
||||
"jetlinks-store": "^0.0.3",
|
||||
"jetlinks-ui-components": "^1.0.28",
|
||||
"jetlinks-ui-components": "^1.0.33",
|
||||
"js-cookie": "^3.0.1",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"less": "^4.1.3",
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
import { isObject, isArray } from 'lodash-es'
|
||||
|
||||
type TermsType = {
|
||||
column: string
|
||||
type: string
|
||||
value: string
|
||||
termsType: string
|
||||
terms: Array<TermsType>
|
||||
}
|
||||
|
||||
type ParamsType = {
|
||||
terms?: Array<TermsType>
|
||||
sorts?: Array<{name:string, order: string }>
|
||||
current?: any
|
||||
}
|
||||
|
||||
export const encodeParams = (params: Record<string, any>) => {
|
||||
const _params = new URLSearchParams()
|
||||
for (const key in params) {
|
||||
|
@ -10,6 +24,42 @@ export const encodeParams = (params: Record<string, any>) => {
|
|||
return _params.toString()
|
||||
}
|
||||
|
||||
const handleTermsToString = (queryTerms: any, terms: Array<TermsType>, parentKey?: string) => {
|
||||
terms.forEach((a, aIndex) => {
|
||||
Object.keys(a).forEach((b) => {
|
||||
const key = `${parentKey}[${aIndex}].${b}`
|
||||
if (b === 'terms') {
|
||||
handleTermsToString(queryTerms, a[b], `${key}.`)
|
||||
} else {
|
||||
queryTerms[key] = a[b]
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
export const paramsEncodeQuery = (params?: ParamsType) => {
|
||||
if (!params) return {}
|
||||
|
||||
const queryParams = {
|
||||
current: params.current,
|
||||
}
|
||||
|
||||
const { sorts, terms } = params
|
||||
|
||||
if (terms) {
|
||||
handleTermsToString(queryParams, terms, 'terms.')
|
||||
}
|
||||
|
||||
if (sorts) {
|
||||
sorts.forEach((item, index) => {
|
||||
queryParams[`sorts[${index}].name`] = item.name;
|
||||
queryParams[`sorts[${index}].order`] = item.order;
|
||||
})
|
||||
}
|
||||
return queryParams
|
||||
}
|
||||
|
||||
export default function encodeQuery(params: any) {
|
||||
if (!params) return {};
|
||||
const queryParam = {
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { queryNoPagingPost } from '@/api/device/product';
|
||||
import { downloadFileByUrl } from '@/utils/utils';
|
||||
import encodeQuery from '@/utils/encodeQuery';
|
||||
import { paramsEncodeQuery } from '@/utils/encodeQuery';
|
||||
import { deviceExport } from '@/api/device/instance';
|
||||
|
||||
const emit = defineEmits(['close']);
|
||||
|
@ -88,7 +88,8 @@ const productName = computed(() => {
|
|||
})
|
||||
|
||||
const handleOk = async () => {
|
||||
const params = encodeQuery(props.data);
|
||||
console.log(props.data)
|
||||
const params = paramsEncodeQuery(props.data);
|
||||
// downloadFile(
|
||||
// deviceExport(modelRef.product || '', modelRef.fileType),
|
||||
// params,
|
||||
|
@ -109,4 +110,4 @@ const handleOk = async () => {
|
|||
const handleCancel = () => {
|
||||
emit('close');
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
isCheck
|
||||
? {
|
||||
selectedRowKeys: _selectedRowKeys,
|
||||
onChange: onSelectChange,
|
||||
onSelect: onSelectChange,
|
||||
onSelectAll: selectAll,
|
||||
onSelectNone: ()=>_selectedRowKeys = []
|
||||
}
|
||||
: false
|
||||
"
|
||||
|
@ -708,10 +710,37 @@ const getActions = (
|
|||
return actions;
|
||||
};
|
||||
|
||||
const onSelectChange = (keys: string[]) => {
|
||||
_selectedRowKeys.value = [...keys];
|
||||
const onSelectChange = (item: any,state: boolean) => {
|
||||
const arr = new Set(_selectedRowKeys.value);
|
||||
// console.log(item, state);
|
||||
if (state) {
|
||||
arr.add(item.id);
|
||||
} else {
|
||||
arr.delete(item.id);
|
||||
}
|
||||
_selectedRowKeys.value = [...arr.values()];
|
||||
};
|
||||
|
||||
const selectAll = (selected: Boolean, selectedRows: any,changeRows:any) => {
|
||||
if (selected) {
|
||||
changeRows.map((i: any) => {
|
||||
if (!_selectedRowKeys.value.includes(i.id)) {
|
||||
_selectedRowKeys.value.push(i.id)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const arr = changeRows.map((item: any) => item.id)
|
||||
const _ids: string[] = [];
|
||||
_selectedRowKeys.value.map((i: any) => {
|
||||
if (!arr.includes(i)) {
|
||||
_ids.push(i)
|
||||
}
|
||||
})
|
||||
_selectedRowKeys.value = _ids
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const handleClick = (dt: any) => {
|
||||
if (isCheck.value) {
|
||||
if (_selectedRowKeys.value.includes(dt.id)) {
|
||||
|
|
|
@ -510,11 +510,17 @@ const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
|||
reader.onload = (json) => {
|
||||
if(json.target?.result){
|
||||
const data = JSON.parse(json.target?.result);
|
||||
|
||||
Object.keys(data).forEach((i:any)=>{
|
||||
const map = new Map()
|
||||
data[i].forEach((item:any)=>(
|
||||
map.set(item.id,item)
|
||||
))
|
||||
data[i] = [...map.values()]
|
||||
})
|
||||
let check = formModel.metadata === 'jetlinks' ? requiredCheck(data) : aliCheck(data)
|
||||
if(!check){
|
||||
onlyMessage('操作成功!')
|
||||
formModel.import = json.target?.result;
|
||||
formModel.import = JSON.stringify(data);
|
||||
}
|
||||
} else {
|
||||
onlyMessage('文件内容不能为空', 'error')
|
||||
|
|
|
@ -47,6 +47,18 @@
|
|||
placeholder="请输入证书文件"
|
||||
/>
|
||||
</j-form-item>
|
||||
<j-form-item label="证书类型" v-bind="validateInfos.mode">
|
||||
<j-radio-group v-model:value="formData.mode" button-style="solid">
|
||||
<j-radio-button value="client" style="margin-right: 30px;" size="large">客户端</j-radio-button>
|
||||
<j-radio-button value="server" size="large">服务端</j-radio-button>
|
||||
</j-radio-group>
|
||||
</j-form-item>
|
||||
<j-form-item label="认证方式" v-if="formData.mode === 'client'" v-bind="validateInfos.authenticationMethod">
|
||||
<j-radio-group button-style="solid" v-model:value="formData.authenticationMethod">
|
||||
<j-radio-button value="single" style="margin-right: 30px;" size="large">单向认证</j-radio-button>
|
||||
<j-radio-button value="binomial" size="large">双向认证</j-radio-button>
|
||||
</j-radio-group>
|
||||
</j-form-item>
|
||||
<j-form-item
|
||||
label="证书私钥"
|
||||
v-bind="validateInfos['configs.key']"
|
||||
|
@ -112,6 +124,7 @@ import type { UploadChangeParam } from 'ant-design-vue';
|
|||
import { save, update, queryDetail } from '@/api/link/certificate';
|
||||
import { FormDataType, TypeObjType } from '../type';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
@ -131,6 +144,8 @@ const formData = ref<FormDataType>({
|
|||
key: '',
|
||||
},
|
||||
description: '',
|
||||
mode:'server',
|
||||
authenticationMethod:'single'
|
||||
});
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(
|
||||
|
@ -148,13 +163,25 @@ const { resetFields, validate, validateInfos } = useForm(
|
|||
{ required: true, message: '请输入或上传文件', trigger: 'blur' },
|
||||
],
|
||||
description: [{ max: 200, message: '最多可输入200个字符' }],
|
||||
mode:[{ required: true, message: '请选择证书类型', trigger: 'blur' }],
|
||||
authenticationMethod:[{ required: true, message: '请选择认证方式', trigger: 'blur' }]
|
||||
}),
|
||||
);
|
||||
|
||||
const onSubmit = () => {
|
||||
validate()
|
||||
.then(async (res) => {
|
||||
const params = toRaw(formData.value);
|
||||
let params:any = toRaw(formData.value);
|
||||
if(formData.value.mode === 'client'){
|
||||
if(formData.value.authenticationMethod === 'binomial'){
|
||||
params.configs.trust = params.configs.cert
|
||||
}else{
|
||||
params.configs = {
|
||||
key:formData.value.configs.key,
|
||||
trust:formData.value.configs.cert
|
||||
}
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
const response =
|
||||
id === ':id'
|
||||
|
@ -190,6 +217,12 @@ const detail = async (id: string) => {
|
|||
const type = result.type.value as TypeObjType;
|
||||
formData.value = {
|
||||
...result,
|
||||
configs:{
|
||||
key:result.configs.key,
|
||||
cert:result.configs?.cert ? result.configs?.cert : result.configs?.trust
|
||||
},
|
||||
mode: result.mode.value,
|
||||
authenticationMethod: result.authenticationMethod.value,
|
||||
type,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ export type FormDataType = {
|
|||
};
|
||||
id?: string;
|
||||
format?: string;
|
||||
mode?: object;
|
||||
mode?: object | string;
|
||||
creatorId?: string;
|
||||
createTime?: number;
|
||||
authenticationMethod: string;
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
/>
|
||||
</template>
|
||||
<j-collapse-panel
|
||||
v-for="item in dataSource"
|
||||
v-for="item in tabs"
|
||||
:key="item.provider"
|
||||
>
|
||||
<template #header>
|
||||
|
@ -36,7 +36,7 @@
|
|||
:key="child.provider"
|
||||
>
|
||||
<Item
|
||||
:data="data.find(i => i?.provider === child?.provider)"
|
||||
:data="child"
|
||||
@refresh="onRefresh"
|
||||
:isLast="index === item.children?.length"
|
||||
:provider="item.provider"
|
||||
|
@ -105,15 +105,42 @@ const dataMap = new Map();
|
|||
|
||||
const data = ref<any[]>([]);
|
||||
|
||||
const tabs = ref<any[]>([])
|
||||
const handleSearch = () => {
|
||||
queryChannelConfig().then((resp) => {
|
||||
if (resp.status === 200) {
|
||||
(resp?.result || []).map((item: any) => {
|
||||
dataMap.set(item.provider, item);
|
||||
});
|
||||
data.value = Array.from(dataMap).map((item) => {
|
||||
return item?.[1];
|
||||
});
|
||||
// (resp?.result || []).map((item: any) => {
|
||||
// dataMap.set(item.provider, item);
|
||||
// });
|
||||
// data.value = Array.from(dataMap).map((item) => {
|
||||
// return item?.[1];
|
||||
// });
|
||||
const arr = dataSource
|
||||
.map((item: any) => {
|
||||
const _child = item.children.map((i: any) => {
|
||||
const _item = (resp.result || []).find(
|
||||
(t: any) => t?.provider === i?.provider,
|
||||
);
|
||||
return {
|
||||
...i,
|
||||
..._item,
|
||||
};
|
||||
});
|
||||
return {
|
||||
...item,
|
||||
children: _child,
|
||||
};
|
||||
})
|
||||
.filter((it: any) => {
|
||||
return it.children.filter((lt: any) => lt?.id)?.length;
|
||||
})
|
||||
.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
children: item.children.filter((lt: any) => lt?.id),
|
||||
};
|
||||
});
|
||||
tabs.value = arr
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -123,15 +150,15 @@ const onRefresh = () => {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
dataMap.clear();
|
||||
dataSource.forEach((item) => {
|
||||
item.children.map((i) => {
|
||||
dataMap.set(i.provider, i);
|
||||
});
|
||||
});
|
||||
data.value = Array.from(dataMap).map((item) => {
|
||||
return item?.[1];
|
||||
});
|
||||
// dataMap.clear();
|
||||
// dataSource.forEach((item) => {
|
||||
// item.children.map((i) => {
|
||||
// dataMap.set(i.provider, i);
|
||||
// });
|
||||
// });
|
||||
// data.value = Array.from(dataMap).map((item) => {
|
||||
// return item?.[1];
|
||||
// });
|
||||
handleSearch();
|
||||
});
|
||||
</script>
|
||||
|
|
32
yarn.lock
32
yarn.lock
|
@ -3738,33 +3738,18 @@ jetlinks-store@^0.0.3:
|
|||
resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz"
|
||||
integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q==
|
||||
|
||||
jetlinks-ui-components@^1.0.23:
|
||||
version "1.0.26"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.26.tgz#26896c578396b09d49649ac87c3943491af3a9ae"
|
||||
integrity sha512-HkLk52C6pDKe/Ca9O4w34h1/PrC7GdBUheiicPOX2V/Lc49N+WzI9wmrCd82XBm8MocPM4gAOJxNaTxY20EO9w==
|
||||
jetlinks-ui-components@^1.0.33:
|
||||
version "1.0.33"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.33.tgz#49ce2b8c1e7be66272864728d5df82f834ec4490"
|
||||
integrity sha512-vYUP4MhzO6r0golmKqO8lHk8w5ldhAkgXWZfFII1Zoa7JtUwveqpSywTU23iSmCN+4muPaSLvHw713k6OdzLmg==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
ant-design-vue "^3.2.15"
|
||||
colorpicker-v3 "^2.10.2"
|
||||
jetlinks-ui-components "^1.0.23"
|
||||
lodash-es "^4.17.21"
|
||||
monaco-editor "^0.40.0"
|
||||
sortablejs "^1.15.0"
|
||||
vuedraggable "^4.1.0"
|
||||
|
||||
jetlinks-ui-components@^1.0.28:
|
||||
version "1.0.28"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.28.tgz#5b26937f9a0dc7e02006d230944d9044ea9fb4ee"
|
||||
integrity sha512-yuxOswVTAcR5hevPoxtfdZnosiGy+KmoPMWxShr3B2UDAMybNjps10nKKMsn70Tdvm5VnYZFw5GvTktRxyr/JA==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
ant-design-vue "^3.2.15"
|
||||
colorpicker-v3 "^2.10.2"
|
||||
jetlinks-ui-components "^1.0.23"
|
||||
lodash-es "^4.17.21"
|
||||
monaco-editor "^0.40.0"
|
||||
onigasm "^2.2.5"
|
||||
sortablejs "^1.15.0"
|
||||
vuedraggable "^4.1.0"
|
||||
|
||||
|
@ -5101,6 +5086,13 @@ onetime@^6.0.0:
|
|||
dependencies:
|
||||
mimic-fn "^4.0.0"
|
||||
|
||||
onigasm@^2.2.5:
|
||||
version "2.2.5"
|
||||
resolved "http://registry.jetlinks.cn/onigasm/-/onigasm-2.2.5.tgz#cc4d2a79a0fa0b64caec1f4c7ea367585a676892"
|
||||
integrity sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==
|
||||
dependencies:
|
||||
lru-cache "^5.1.1"
|
||||
|
||||
only@0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.jetlinks.cn/only/-/only-0.0.2.tgz"
|
||||
|
|
Loading…
Reference in New Issue