fix: #bug10635 10631

This commit is contained in:
leiqiaochu 2023-03-21 11:37:30 +08:00
parent 995eca23cb
commit 2a51e49b61
6 changed files with 17 additions and 9 deletions

View File

@ -20,13 +20,15 @@ import { CSSProperties, PropType } from 'vue';
import AMap, { initAMapApiLoader } from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css';
import { getAMapUiPromise } from './utils';
import { useSystem } from '@/store/system';
const system = useSystem();
interface AMapProps {
style?: CSSProperties;
class?: string;
AMapUI?: string | boolean;
}
const amapKey = localStorage.getItem('amap_key')
const amapKey = system.$state.configInfo.amap?.apiKey;
initAMapApiLoader({
key: amapKey || '',

View File

@ -1,6 +1,6 @@
import { ProductItem } from "@/views/device/Product/typings";
import { defineStore } from "pinia";
import { detail , getDeviceNumber} from '@/api/device/product'
import { detail, getDeviceNumber } from '@/api/device/product'
import encodeQuery from "@/utils/encodeQuery";
export const useProductStore = defineStore({
@ -17,22 +17,24 @@ export const useProductStore = defineStore({
},
async getDetail(id: string) {
const resp = await detail(id)
if(resp.status === 200){
this.current = resp.result
if (resp.status === 200) {
this.current = {
...this.current,...resp.result
}
this.detail = resp.result
}
},
async refresh(id: string) {
this.getDetail(id)
const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } }))
if(res.status === 200){
if (res.status === 200) {
this.current.count = res.result
}
},
setTabActiveKey(key: string) {
this.tabActiveKey = key
},
reSet(){
reSet() {
this.current = {} as ProductItem
this.detail = {} as ProductItem
}

View File

@ -83,7 +83,9 @@ import type { Footer } from '@/views/device/DashBoard/typings';
import TopCard from '@/views/device/DashBoard/components/TopCard.vue';
import { useMenuStore } from '@/store/menu';
import Amap from './components/Amap.vue';
let AmapKey = localStorage.getItem('amap_key');
import { useSystem } from '@/store/system';
const system = useSystem();
const AmapKey = system.$state.configInfo.amap?.apiKey
let productTotal = ref(0);
let productFooter = ref<Footer[]>([
{

View File

@ -907,11 +907,12 @@ const submitData = async () => {
productStore.current = { ...res.result };
access.value = res.result;
message.success('操作成功!');
getData(obj.accessId);
}
visible.value = false;
queryParams.value = {};
});
getData(obj.accessId);
}
} else {
message.error('请选择接入方式');

View File

@ -163,6 +163,7 @@ watch(
productStore.reSet();
productStore.tabActiveKey = 'Info';
productStore.refresh(newId as string);
console.log(productStore);
}
},
{ immediate: true, deep: true },

View File

@ -338,7 +338,7 @@ const saveBasicInfo = () =>{
{
scope: 'amap',
properties: {
api: form.value.apikey,
apiKey: form.value.apikey,
},
},
{