This commit is contained in:
parent
43489b48c2
commit
c63226cdd8
|
@ -1 +1 @@
|
|||
VITE_BASE_URL = 'https://crmeb-test.shop.lihaink.cn/api'
|
||||
VITE_BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn'
|
|
@ -1 +1 @@
|
|||
VITE_BASE_URL = '/'
|
||||
VITE_BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn'
|
|
@ -0,0 +1,17 @@
|
|||
import axios from "@/utils/axios.js";
|
||||
|
||||
// 登录
|
||||
export const login = (data) => {
|
||||
return axios.post('dataview/login', data);
|
||||
}
|
||||
|
||||
|
||||
// 养殖基地
|
||||
export const getfarmCount = (data) => {
|
||||
return axios.get('dataview.farm/farmCount', { params: data });
|
||||
}
|
||||
|
||||
// 养殖产品溯源
|
||||
export const getBreedTypeCount = (data) => {
|
||||
return axios.get('dataview.farm/breedTypeCount', { params: data });
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
import axios from "@/utils/axios.js";
|
||||
|
||||
//养殖基地类型
|
||||
export const farmTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'farm_type');
|
||||
|
||||
//养殖种类
|
||||
export const breedTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'breed_type');
|
||||
|
||||
//栏舍类型
|
||||
export const fenceHouseTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'fence_house_type');
|
||||
|
||||
//动物类型
|
||||
export const animalTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'animal_type');
|
||||
|
||||
//饲料类型
|
||||
export const feedingTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'feeding_type');
|
||||
|
||||
//离栏类型
|
||||
export const leaveFenceHouseTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'leave_fence_house_type');
|
|
@ -1,21 +1,64 @@
|
|||
import axios from "@/utils/axios.js";
|
||||
import axios from "axios";
|
||||
|
||||
|
||||
// 创建axios 实例
|
||||
const instacne = axios.create({
|
||||
baseURL: "https://crmeb-test.shop.lihaink.cn/api",
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
|
||||
const configInstacne=(ins)=>{
|
||||
ins.interceptors.request.use(
|
||||
(config) => {
|
||||
// 在发送请求之前做什么
|
||||
|
||||
|
||||
|
||||
return config;
|
||||
},
|
||||
(err) => {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
// 响应拦截
|
||||
ins.interceptors.response.use(
|
||||
(res) => {
|
||||
|
||||
// if (res.data.status != 200) {
|
||||
// ElMessage({
|
||||
// message: res.data.message,
|
||||
// type: 'warning',
|
||||
// })
|
||||
// return Promise.reject(res.data.message);
|
||||
|
||||
// }
|
||||
// 对响应的数据做什么
|
||||
return res.data;
|
||||
},
|
||||
(err) => {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
configInstacne(instacne)
|
||||
|
||||
|
||||
|
||||
// 登录
|
||||
export const login = (data) => {
|
||||
return axios.post('dataview/login', data);
|
||||
return instacne.post('dataview/login', data);
|
||||
}
|
||||
|
||||
// 区县
|
||||
export const getArea = (data) => {
|
||||
return axios.get('city/get_area', { params: data });
|
||||
return instacne.get('city/get_area', { params: data });
|
||||
}
|
||||
|
||||
// 乡镇
|
||||
export const getStreet = (data) => {
|
||||
return axios.get('city/get_street', { params: data });
|
||||
return instacne.get('city/get_street', { params: data });
|
||||
}
|
||||
|
||||
// 养殖基地
|
||||
export const getfarmCount = (data) => {
|
||||
return axios.get('dataview.farm/farmCount ', { params: data });
|
||||
}
|
|
@ -3,6 +3,17 @@ import headView from "@/components/headView.vue";
|
|||
import Businesses from "@/components/Businesses.vue";
|
||||
import { ref, nextTick, provide, onMounted, onUnmounted } from "vue";
|
||||
import mitt from "@/utils/mitt";
|
||||
import { breedTypeLists } from "@/api/dict.js";
|
||||
import { useDictStore } from "@/store/dict.js";
|
||||
|
||||
const dictStore = useDictStore();
|
||||
|
||||
const initbreedTypeLists = ()=>{
|
||||
breedTypeLists().then(res=>{
|
||||
dictStore.setBreedTypeList(res.data);
|
||||
})
|
||||
}
|
||||
initbreedTypeLists();
|
||||
|
||||
const show = ref(true);
|
||||
const reload = () => {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { defineStore } from "pinia"
|
||||
import { ref } from "vue"
|
||||
|
||||
export const useDictStore = defineStore('dict', () => {
|
||||
|
||||
const breedTypeList = ref([]);
|
||||
|
||||
const setBreedTypeList = (data) => {
|
||||
breedTypeList.value = data;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
breedTypeList,
|
||||
setBreedTypeList
|
||||
}
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
import axios from "axios";
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: import.meta.env.VITE_BASE_URL,
|
||||
baseURL: import.meta.env.VITE_BASE_URL + '/api',
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
|
|
|
@ -1,17 +1,58 @@
|
|||
<script setup>
|
||||
import { ref, reactive, onMounted } from "vue"
|
||||
import { ref, reactive, onMounted, nextTick } from "vue"
|
||||
import * as echarts from 'echarts';
|
||||
import videoFlv from "@/components/videoFlv.vue";
|
||||
import { getfarmCount, getBreedTypeCount } from "@/api/api.js";
|
||||
import { useAppStore } from "@/store/app.js";
|
||||
import { useDictStore } from "@/store/dict.js";
|
||||
|
||||
const initData = (data) => {
|
||||
const appStore = useAppStore();
|
||||
const dictStore = useDictStore();
|
||||
|
||||
const farmInfo = ref({
|
||||
farmCount: 0,
|
||||
totalScale: 0
|
||||
});
|
||||
const farmList = ref([]);
|
||||
const initFarmCount = ()=>{
|
||||
getfarmCount({
|
||||
areaCode: appStore.address.areaCode,
|
||||
streetCode: appStore.address.streetCode
|
||||
}).then((res)=>{
|
||||
farmInfo.value.farmCount = res.data.farmCount;
|
||||
farmInfo.value.totalScale = res.data.totalScale;
|
||||
farmList.value = res.data.farmList;
|
||||
initData();
|
||||
})
|
||||
}
|
||||
|
||||
const breedTypeRows = ref([]);
|
||||
const animalList = ref([]);
|
||||
const initBreedTypeCount = ()=>{
|
||||
getBreedTypeCount({
|
||||
areaCode: appStore.address.areaCode,
|
||||
streetCode: appStore.address.streetCode
|
||||
}).then((res)=>{
|
||||
breedTypeRows.value = res.data.breedTypeRows;
|
||||
animalList.value = res.data.animalList;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const initData = async (data) => {
|
||||
let arr = [];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
if(dictStore.breedTypeList.length==0) await nextTick();
|
||||
for (let i = 0; i < farmList.value.length; i++) {
|
||||
let type = dictStore.breedTypeList.find(item=>item.value==farmList.value[i].farm_type);
|
||||
arr.push(
|
||||
[
|
||||
`${i + 1}`,
|
||||
`-`,
|
||||
`-`,
|
||||
`-`,
|
||||
`${farmList.value[i].farm_name}`,
|
||||
`${type?.name||'-'}`,
|
||||
`${farmList.value[i].animal_count||'-'}`,
|
||||
]
|
||||
)
|
||||
}
|
||||
|
@ -191,7 +232,8 @@ const initMap = () => {
|
|||
const show = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
initData();
|
||||
initFarmCount();
|
||||
initBreedTypeCount();
|
||||
initMap();
|
||||
})
|
||||
</script>
|
||||
|
@ -207,12 +249,12 @@ onMounted(() => {
|
|||
<div class="tab-item">
|
||||
<img src="/src/assets/index_img/icon1.png" />
|
||||
<div>基地总数</div>
|
||||
<div class="count">{{ 50 }}个</div>
|
||||
<div class="count">{{ farmInfo.farmCount }}个</div>
|
||||
</div>
|
||||
<div class="tab-item">
|
||||
<img src="/src/assets/index_img/icon1.png" />
|
||||
<div>基地总数</div>
|
||||
<div class="count">{{ 200 }}亩</div>
|
||||
<div>占地规模</div>
|
||||
<div class="count">{{ farmInfo.totalScale }}亩</div>
|
||||
</div>
|
||||
</div>
|
||||
<dv-scroll-board
|
||||
|
@ -266,10 +308,10 @@ onMounted(() => {
|
|||
<div ref="echarts2Ref"></div>
|
||||
</div>
|
||||
<div class="qr">
|
||||
<div class="qr_card" v-for="(item, index) in 6" :key="index">
|
||||
<div class="qr_card" v-for="(item, index) in animalList" :key="index">
|
||||
<div class="name">
|
||||
<div>品类名称: 黑山羊</div>
|
||||
<div>溯源编码: 02457487544</div>
|
||||
<div>品类名称: {{ item.brand }}</div>
|
||||
<div>溯源编码: {{ item.sn }}</div>
|
||||
</div>
|
||||
<img src="/src/assets/index_img/icon1.png" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue