fix: bug#13639、13188

This commit is contained in:
xieyonghong 2023-05-18 10:29:06 +08:00
parent 7b05778587
commit 1dc0722b65
11 changed files with 96 additions and 12 deletions

View File

@ -25,7 +25,7 @@
"event-source-polyfill": "^1.0.31",
"global": "^4.4.0",
"jetlinks-store": "^0.0.3",
"jetlinks-ui-components": "^1.0.15",
"jetlinks-ui-components": "^1.0.16",
"js-cookie": "^3.0.1",
"less": "^4.1.3",
"less-loader": "^11.1.0",

View File

@ -16,11 +16,13 @@
<template v-if="showType === 'network'">
<Network
v-if="provider.id !== 'plugin_gateway'"
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
<Plugin
v-else
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
@ -28,21 +30,25 @@
<Media
v-if="showType === 'media'"
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
<Channel
v-if="showType === 'channel'"
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
<Edge
v-if="showType === 'edge'"
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
<Cloud
v-if="showType === 'cloud'"
:bindProduct='bindProduct'
:provider="provider"
:data="data"
/>
@ -63,6 +69,7 @@ import Cloud from '../components/Cloud/index.vue';
import Plugin from '../components/Plugin/index.vue'
import { getProviders, detail } from '@/api/link/accessConfig';
import { accessConfigTypeFilter } from '@/utils/setting';
import { queryProductList } from '@/api/device/product';
const route = useRoute();
const id = route.params.id as string;
@ -73,6 +80,7 @@ const loading = ref(true);
const provider = ref({});
const data = ref({});
const showType: any = ref('');
const bindProduct = ref(false)
const goProviders = (param: any) => {
showType.value = param.type;
@ -188,8 +196,27 @@ const queryProviders = async () => {
}
};
/**
* 检查是否被产品使用
*/
const checkBindProduct = async (_id: string) => {
const resp = await queryProductList({
paging: false,
terms: [{
column: 'accessId',
termType: 'eq',
value: _id
}]
})
console.log(resp.success && resp.result?.total)
if (resp.success && resp.result?.total) {
bindProduct.value = true
}
}
const getProvidersData = async () => {
if (id !== ':id') {
checkBindProduct(id)
getProviders().then((response: any) => {
if (response.status === 200) {
const _data = response.result || [];

View File

@ -22,13 +22,12 @@
}}</j-tooltip>
</div>
<div class="checked-icon">
<div><CheckOutlined /></div>
<div><a-icon type='CheckOutlined' /></div>
</div>
</j-card>
</template>
<script lang="ts" setup name="AccessCard">
import { CheckOutlined } from '@ant-design/icons-vue';
const emit = defineEmits(['checkedChange']);
@ -48,7 +47,9 @@ const props = defineProps({
});
const checkedChange = (id: string) => {
if (!props.disabled) {
emit('checkedChange', id);
}
};
</script>

View File

@ -177,6 +177,7 @@
@search="procotolSearch"
/>
<PermissionButton
v-if='showAddBtn'
type="primary"
@click="addProcotol"
hasPermission="link/Protocol:add"
@ -199,6 +200,7 @@
<AccessCard
@checkedChange="procotolChange"
:checked="procotolCurrent"
:disabled='!showAddBtn'
:data="{ ...item, type: 'protocol' }"
>
</AccessCard>
@ -352,6 +354,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
bindProduct: {
type: Boolean,
default: false
}
});
const formRef1 = ref<FormInstance>();
@ -368,6 +374,10 @@ const formData = ref<Form>({
description: '',
});
const showAddBtn = computed(() => {
return route.query.view === 'false' && !props.bindProduct
})
const current = ref(0);
const stepCurrent = ref(0);
const steps = ref(['接入配置', '消息协议', '完成']);

View File

@ -260,6 +260,7 @@
@search="procotolSearch"
/>
<PermissionButton
v-if='showAddBtn'
type="primary"
@click="addProcotol"
hasPermission="link/Protocol:add"
@ -282,6 +283,7 @@
<AccessCard
@checkedChange="procotolChange"
:checked="procotolCurrent"
:disabled='!showAddBtn'
:data="{ ...item, type: 'protocol' }"
>
</AccessCard>
@ -434,6 +436,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
bindProduct: {
type: Boolean,
default: false
}
});
const route = useRoute();
@ -462,6 +468,10 @@ const procotolList: any = ref([]);
const allProcotolList = ref([]);
const procotolCurrent: any = ref('');
const showAddBtn = computed(() => {
return route.query.view === 'false' && !props.bindProduct
})
const procotolChange = (id: string) => {
procotolCurrent.value = id;
};

View File

@ -3,11 +3,13 @@
<Ctwing
v-if="channel === 'Ctwing'"
:provider="props.provider"
:bindProduct='bindProduct'
:data="props.data"
/>
<OneNet
v-if="channel === 'OneNet'"
:provider="props.provider"
:bindProduct='bindProduct'
:data="props.data"
/>
</div>
@ -26,6 +28,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
bindProduct: {
type: Boolean,
default: false
}
});
const channel = props.provider.channel;

View File

@ -530,7 +530,7 @@ const props = defineProps({
data: {
type: Object,
default: () => {},
},
}
});
const route = useRoute();

View File

@ -17,6 +17,7 @@
@search="networkSearch"
/>
<PermissionButton
type="primary"
@click="addNetwork"
hasPermission="link/Type:add"
@ -112,6 +113,7 @@
@search="procotolSearch"
/>
<PermissionButton
v-if='showAddBtn'
type="primary"
@click="addProcotol"
hasPermission="link/Protocol:add"
@ -134,7 +136,7 @@
<AccessCard
@checkedChange="procotolChange"
:checked="procotolCurrent"
:disabled='id !== ":id"'
:disabled='!showAddBtn'
:data="{ ...item, type: 'protocol' }"
>
</AccessCard>
@ -352,6 +354,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
bindProduct: {
type: Boolean,
default: false
}
});
const clientHeight = document.body.clientHeight;
@ -396,6 +402,10 @@ const { resetFields, validate, validateInfos } = useForm(
}),
);
const showAddBtn = computed(() => {
return route.query.view === 'false' && !props.bindProduct
})
const queryNetworkList = async (id: string, include: string, data = {}) => {
const resp = await getNetworkList(
NetworkTypeMapping.get(id),

View File

@ -14,6 +14,7 @@
@search="pluginSearch"
/>
<PermissionButton
v-if='showAddBtn'
type="primary"
@click="addPlugin"
hasPermission="link/plugin:add"
@ -36,7 +37,7 @@
<AccessCard
@checkedChange="AccessChange"
:checked="AccessCurrent"
:disabled='paramsId !== ":id"'
:disabled='!showAddBtn'
:data="{ ...item, type: 'plugin' }"
>
<template #other>
@ -185,6 +186,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
bindProduct: {
type: Boolean,
default: false
}
});
const route = useRoute();
@ -220,6 +225,10 @@ const queryPlugin = (params = {}) => {
})
}
const showAddBtn = computed(() => {
return route.query.view === 'false' && !props.bindProduct
})
const getRules = (item: any) => {
let typeName = '输入'
let rules: any[] = []

View File

@ -48,7 +48,18 @@
<j-form-item name="base-path">
<template #label>
<span>base-path</span>
<j-tooltip title="系统后台访问的url">
<j-tooltip >
<template #title>
<div style='word-break: break-all;'>
<div>
系统后台访问的url
</div>
<div>
格式{http/https}: //{IP}:{}/api
</div>
</div>
</template>
<img
class="img-style"
:src="
@ -59,7 +70,7 @@
</template>
<j-input
v-model:value="formValue['base-path']"
placeholder="输入base-path"
placeholder="{http/https}: //{前端所在服务器IP地址}:{前端暴露的服务端口}/api"
/>
</j-form-item>
<j-row :gutter="24" :span="24">

View File

@ -3823,10 +3823,10 @@ 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.15:
version "1.0.15"
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.15.tgz#fa007e685ead81ed0eb81250c5ecd3909f8b223d"
integrity sha512-ydgWz4Ee80V57yWnudRuGJASnuQULpbLAczY0NRybsVgLNf88N4FGqAug3XKBtsLn8xkPwNDlSLBCEs9baLv5Q==
jetlinks-ui-components@^1.0.16:
version "1.0.16"
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.16.tgz#bdb65385a30a121065322e5156c13080c8328080"
integrity sha512-R3oE8tpXW4oaNSCeGXRK++paNJiHYDO89Id3YqzIVX6/bWMItOWrEU6JT4iPA9uYkPTfsYHxnG5qZRloLnpiZw==
dependencies:
"@vueuse/core" "^9.12.0"
"@vueuse/router" "^9.13.0"