fix: bug#27688 批量导出设备时,不选择产品,无法导出全部设备信息,导出文件没有任何数据

* fix: bug#27688 批量导出设备时,不选择产品,无法导出全部设备信息,导出文件没有任何数据

* fix: bug#27696当阿里云关联付费实例时,无法绑定成功,界面报错,服务器异常
This commit is contained in:
qiaochuLei 2024-07-01 11:16:24 +08:00 committed by GitHub
parent e3cc42c747
commit 7a624fe907
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 8 deletions

View File

@ -98,6 +98,7 @@
.regionId .regionId
" "
show-search show-search
@change="regionChange"
@blur="productChange" @blur="productChange"
> >
<j-select-option <j-select-option
@ -492,7 +493,7 @@ const route = useRoute();
const formRef = ref(); const formRef = ref();
const _errorSet = ref<Set<string>>(new Set()); const _errorSet = ref<Set<string>>(new Set());
const modelRef = reactive({ const modelRef = reactive<any>({
id: undefined, id: undefined,
name: undefined, name: undefined,
accessConfig: { accessConfig: {
@ -500,6 +501,7 @@ const modelRef = reactive({
instanceId: undefined, instanceId: undefined,
accessKeyId: undefined, accessKeyId: undefined,
accessSecret: undefined, accessSecret: undefined,
apiEndpoint: undefined,
}, },
bridgeProductKey: undefined, bridgeProductKey: undefined,
bridgeProductName: undefined, bridgeProductName: undefined,
@ -591,16 +593,19 @@ const onCollChange = (_key: string[]) => {
}; };
const _error = computed(() => { const _error = computed(() => {
return _errorSet.value.size ? `当前选择的部分产品为禁用状态` : '' return _errorSet.value.size ? `当前选择的部分产品为禁用状态` : '';
}) });
const regionChange = (val: any) => {
modelRef.accessConfig.apiEndpoint = `https://iot.${val}.aliyuncs.com`;
};
const onActiveProduct = async () => { const onActiveProduct = async () => {
[..._errorSet.value.values()].forEach(async (i: any) => { [..._errorSet.value.values()].forEach(async (i: any) => {
const resp = await _deploy(i).catch((error) => { const resp = await _deploy(i).catch((error) => {
onlyMessage('操作失败', 'error'); onlyMessage('操作失败', 'error');
}); });
if (resp?.status === 200) { if (resp?.status === 200) {
_errorSet.value.delete(i) _errorSet.value.delete(i);
onlyMessage('操作成功!'); onlyMessage('操作成功!');
} }
}); });
@ -610,7 +615,7 @@ const onActiveProduct = async () => {
const onPlatError = (val: any) => { const onPlatError = (val: any) => {
const _item = productList.value.find((item) => item.id === val); const _item = productList.value.find((item) => item.id === val);
if (val && _item && !_item?.state) { if (val && _item && !_item?.state) {
_errorSet.value.add(val) _errorSet.value.add(val);
} }
}; };
@ -633,6 +638,7 @@ const saveBtn = () => {
(item: any) => item?.productKey === data?.bridgeProductKey, (item: any) => item?.productKey === data?.bridgeProductKey,
); );
data.bridgeProductName = product?.productName || ''; data.bridgeProductName = product?.productName || '';
data.accessConfig.apiEndpoint = modelRef.accessConfig.apiEndpoint;
loading.value = true; loading.value = true;
const resp = await savePatch({ const resp = await savePatch({
...toRaw(modelRef), ...toRaw(modelRef),

View File

@ -123,7 +123,8 @@ const handleOk = async () => {
urlParams.append(key, _params[key]) urlParams.append(key, _params[key])
} }
}) })
window.open(`${origin}/api/device-instance/${modelRef.product}/export.xlsx?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}&${urlParams}`) const url = modelRef.product ? `${origin}/api/device-instance/${modelRef.product}/export.xlsx?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}&${urlParams}` : `${origin}/api/device-instance/export.xlsx?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}&${urlParams}`
window.open(url)
emit('close'); emit('close');
}; };