智慧农业大数据平台
zengh
2022-07-19 e65d6c82a235d40b2db16cc687251b58f335b039
首页农场切换功能,刷新数据
3 files modified
74 ■■■■■ changed files
src/api/farm/farmingrecord.js 15 ●●●●● patch | view | raw | blame | history
src/router/axios.js 2 ●●● patch | view | raw | blame | history
src/views/home/index.vue 57 ●●●●● patch | view | raw | blame | history
src/api/farm/farmingrecord.js
@@ -89,22 +89,22 @@
    })
}
export const getFarmingCount = (deptId) => {
export const getFarmingCount = (farmId) => {
    return request({
        url: '/farmingRecord/getFarmingCount',
        method: 'get',
        params: {
            deptId
            farmId
        }
    })
}
export const getFarmingStatis = (deptId) => {
export const getFarmingStatis = (farmId) => {
    return request({
        url: '/farmingRecord/getFarmingStatis',
        method: 'get',
        params: {
            deptId
            farmId
        }
    })
}
@@ -119,10 +119,13 @@
        }
    })
}
export const SelectCount = () => {
export const SelectCount = (farmId) => {
    return request({
        url: '/farm/SelectCount',
        method: 'get'
        method: 'get',
        params: {
            farmId
        }
    })
}
src/router/axios.js
@@ -13,7 +13,7 @@
//   console.log(url);
// }, 3000);
window.$apiUrls = 'http://182.106.212.58:8013/api'
// window.$apiUrls = 'http://192.168.0.114:89'
// window.$apiUrls = 'http://localhost:89'
const service = axios.create({
    //   baseURL: 'http://192.168.0.107:83',
src/views/home/index.vue
@@ -505,20 +505,14 @@
            // 选择的农事类型
            farmOperType: '',
            // 农场地块id
            farmPlotId: ''
            farmPlotId: '',
            // 全局农场参数
            farmID: ''
        }
    },
    created () {
        // 本年农事操作记录
        this.getFarmingStatis()
        this.getFarmingCount()
        this.pagePalnt()
        this.selectXCount()
        this.SelectCount()
        this.selctSaletCount()
        this.selctSaletZ()
        this.selectMarketDistrict()
        // 数据刷新
        this.AllDataUpdate()
        this.getFarmList()
        this.getLandList()
    },
@@ -526,6 +520,17 @@
        this.initRightPie('EquipmentEcharts')
    },
    methods: {
        // 全局数据刷新事件
        AllDataUpdate () {
            this.getFarmingStatis()
            this.getFarmingCount()
            this.pagePalnt()
            this.selectXCount()
            this.SelectCount()
            this.selctSaletCount()
            this.selctSaletZ()
            this.selectMarketDistrict()
        },
        // 农事操作搜索
        farmSelectList () {
            this.farmOperClick({ type: this.farmOperType, landId: this.farmPlotId })
@@ -553,6 +558,8 @@
        setCenter (item) {
            this.ncListShow = false
            this.farmId = item.id
            this.AllDataUpdate()
            this.$refs.modalForm.setCenter(item.farmName)
        },
@@ -916,7 +923,8 @@
        // 企业概况
        SelectCount () {
            var that = this
            SelectCount().then((res) => {
            var farmId = this.farmId
            SelectCount(farmId).then((res) => {
                that.ncnum = res.data.data.ncnum
                that.rynum = res.data.data.rynum
            })
@@ -924,7 +932,9 @@
        // 大屏销售统计
        selctSaletCount () {
            var that = this
            selctSaletCount().then((res) => {
            var params = {}
            params.farmId = this.farmId
            selctSaletCount(Object.assign(params)).then((res) => {
                that.salaNumY = res.data.data
                this.initLine('TrendEcharts')
            })
@@ -932,22 +942,26 @@
        // 按行政区统计市场流通
        selectMarketDistrict () {
            var that = this
            selectMarketDistrict().then((res) => {
            var params = {}
            params.farmId = this.farmId
            selectMarketDistrict(Object.assign(params)).then((res) => {
                that.marketDistrict = res.data.data
            })
        },
        // 统计今年和去年的销售总额
        selctSaletZ () {
            var that = this
            selctSaletZ().then((res) => {
            var params = {}
            params.farmId = this.farmId
            selctSaletZ(Object.assign(params)).then((res) => {
                that.salaNum = res.data.data[0].num.toString().split('')
            })
        },
        getFarmingCount () {
            var that = this
            var deptId = '1123598813738675201'
            var farmId = this.farmId
            getFarmingCount(deptId).then((res) => {
            getFarmingCount(farmId).then((res) => {
                that.total = res.data.data
                // that.total = 0;
                if (that.total > 0) {
@@ -958,8 +972,8 @@
        // 本年农事操作记录,分组统计
        getFarmingStatis () {
            var that = this
            var deptId = '1123598813738675201'
            getFarmingStatis(deptId).then((res) => {
            var farmId = this.farmId
            getFarmingStatis(farmId).then((res) => {
                that.farmingList = res.data.data
            })
        },
@@ -967,7 +981,8 @@
        selectXCount () {
            // eslint-disable-next-line no-unused-vars
            var that = this
            selectXCount().then((res) => {
            var farmId = this.farmId
            selectXCount(farmId).then((res) => {
                that.landsnum = res.data.data.snum
                that.landwnum = res.data.data.wnum
@@ -987,7 +1002,7 @@
                status: 1
            }
            params.tenantId = '000000'
            params.deptId = '1123598813738675201'
            params.farmId = this.farmId
            pagePalnt(1, 10, Object.assign(params)).then((res) => {
                const data = res.data.data
                that.num = data.num