fix: bug#11171 11169

This commit is contained in:
leiqiaochu 2023-03-29 14:55:04 +08:00
parent d690240184
commit 00f7ca8824
2 changed files with 65 additions and 19 deletions

View File

@ -8,6 +8,12 @@
v-if=" v-if="
permissionStore.hasPermission( permissionStore.hasPermission(
'device/Product:update', 'device/Product:update',
) &&
permissionStore.hasPermission(
'link/AccessConfig:add',
) &&
permissionStore.hasPermission(
'link/AccessConfig:update',
) )
" "
> >
@ -24,7 +30,7 @@
<j-col :span="12"> <j-col :span="12">
<Title data="接入方式"> <Title data="接入方式">
<template #extra> <template #extra>
<j-tooltip <!-- <j-tooltip
:title=" :title="
productStore.current?.count && productStore.current?.count &&
productStore.current?.count > 0 productStore.current?.count > 0
@ -44,7 +50,48 @@
@click="showDevice" @click="showDevice"
>更换</j-button >更换</j-button
> >
</j-tooltip> </j-tooltip> -->
<PermissionButton
style="margin: 0 0 0 20px"
type="primary"
size="small"
:tooltip="{
title:
productStore.current?.count &&
productStore.current?.count > 0
? '产品下有设备实例时不能更换接入方式'
: !(permissionStore.hasPermission(
'device/Product:update',
) &&
permissionStore.hasPermission(
'link/AccessConfig:add',
) &&
permissionStore.hasPermission(
'link/AccessConfig:update',
))
? '暂无权限,请联系管理员'
: '',
}"
:disabled="
(productStore.current?.count &&
productStore.current?.count > 0) ||
!(
permissionStore.hasPermission(
'device/Product:update',
) &&
permissionStore.hasPermission(
'link/AccessConfig:add',
) &&
permissionStore.hasPermission(
'link/AccessConfig:update',
)
)
"
ghost
@click="showDevice"
>
更换
</PermissionButton>
</template> </template>
</Title> </Title>
<div> <div>
@ -419,7 +466,7 @@ import { marked } from 'marked';
import type { TableColumnType } from 'ant-design-vue'; import type { TableColumnType } from 'ant-design-vue';
import { useMenuStore } from '@/store/menu'; import { useMenuStore } from '@/store/menu';
import _ from 'lodash'; import _ from 'lodash';
import { accessConfigTypeFilter } from '@/utils/setting' import { accessConfigTypeFilter } from '@/utils/setting';
const tableRef = ref(); const tableRef = ref();
const formRef = ref(); const formRef = ref();
@ -502,8 +549,8 @@ const query = reactive({
options: async () => { options: async () => {
return new Promise((resolve) => { return new Promise((resolve) => {
getProviders().then((resp: any) => { getProviders().then((resp: any) => {
const data = resp.result || [] const data = resp.result || [];
resolve(accessConfigTypeFilter(data)) resolve(accessConfigTypeFilter(data));
}); });
}); });
}, },
@ -935,7 +982,7 @@ const getData = async (accessId?: string) => {
); );
getProviders().then((resp) => { getProviders().then((resp) => {
if (resp.status === 200) { if (resp.status === 200) {
const data = resp.result || [] const data = resp.result || [];
dataSource.value = accessConfigTypeFilter(data as any[]); dataSource.value = accessConfigTypeFilter(data as any[]);
} }
}); });
@ -1019,10 +1066,13 @@ watchEffect(() => {
nextTick(() => { nextTick(() => {
getData(); getData();
}); });
watch(()=>productStore.current,()=>{ watch(
getData(); () => productStore.current,
formData.data = productStore.current?.configuration || {} () => {
}) getData();
formData.data = productStore.current?.configuration || {};
},
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep( :deep(

View File

@ -85,7 +85,7 @@
:value="form.deviceType" :value="form.deviceType"
:options="deviceList" :options="deviceList"
@change="changeDeviceType" @change="changeDeviceType"
:disabled="disabled" :disabled="productStore.detail?.accessId ? true : false"
> >
<template #title="item"> <template #title="item">
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
@ -142,12 +142,9 @@ const loading = ref<boolean>(false);
const dialogRef = ref(); const dialogRef = ref();
const treeList = ref<Record<string, any>[]>([]); const treeList = ref<Record<string, any>[]>([]);
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const logoLoading = ref<boolean>(false);
const formRef = ref(); const formRef = ref();
const disabled = ref<boolean>(false);
const idDisabled = ref<boolean>(false); const idDisabled = ref<boolean>(false);
const useForm = Form.useForm; const useForm = Form.useForm;
const _selectedRowKeys = ref([]);
const photoValue = ref('/images/device-product.png'); const photoValue = ref('/images/device-product.png');
const imageTypes = reactive([ const imageTypes = reactive([
'image/jpeg', 'image/jpeg',
@ -258,12 +255,12 @@ const queryProductTree = async () => {
* 处理产品分类key * 处理产品分类key
*/ */
const dealProductTree = (arr: any) => { const dealProductTree = (arr: any) => {
return arr.map((element: any) => { return arr.map((element: any) => {
element.key = element.id; element.key = element.id;
if (element.children) { if (element.children) {
element.children = dealProductTree(element.children); element.children = dealProductTree(element.children);
} }
return element return element;
}); });
}; };
/** /**
@ -279,9 +276,9 @@ const show = (data: any) => {
form.deviceType = data.deviceType.value; form.deviceType = data.deviceType.value;
form.describe = form.describe; form.describe = form.describe;
form.id = data.id; form.id = data.id;
disabled.value = productStore.current?.accessId ? true : false;
idDisabled.value = true; idDisabled.value = true;
} else if (props.isAdd === 1) { } else if (props.isAdd === 1) {
productStore.reSet();
form.name = ''; form.name = '';
form.classifiedId = undefined; form.classifiedId = undefined;
form.classifiedName = ''; form.classifiedName = '';
@ -289,8 +286,7 @@ const show = (data: any) => {
form.deviceType = ''; form.deviceType = '';
form.describe = undefined; form.describe = undefined;
form.id = undefined; form.id = undefined;
disabled.value = false; idDisabled.value = false;
disabled.vlaue = false;
} }
visible.value = true; visible.value = true;
}; };