智慧农业大数据平台
zengh
2022-07-11 c0d44c51d431d16c6833247e9c07a80abb099376
市场流通
4 files modified
255 ■■■■■ changed files
src/api/farm/farmingrecord.js 10 ●●●●● patch | view | raw | blame | history
src/components/date-select/index.vue 122 ●●●●● patch | view | raw | blame | history
src/router/axios.js 2 ●●● patch | view | raw | blame | history
src/views/manage/index.vue 121 ●●●●● patch | view | raw | blame | history
src/api/farm/farmingrecord.js
@@ -218,3 +218,13 @@
        }
    })
}
export const getSweepRecordStatistics = (params) => {
    return request({
        url: '/sweepRecord/getSweepRecordStatistics',
        method: 'get',
        params: {
            ...params
        }
    })
}
src/components/date-select/index.vue
@@ -13,66 +13,104 @@
        </div>
        <el-date-picker
            class="emit-el-date-picker"
            size="small"
            v-model="currentDate"
            :type="dateType"
            :placeholder="datePlaceHolder"
                class="emit-el-date-picker"
                size="small"
                v-model="currentDate"
                @change="selectChange"
                :type="dateType"
                :placeholder="datePlaceHolder"
        ></el-date-picker>
    </div>
</template>
<script>
export default {
    name: 'DateSelect',
    data () {
        return {
            dateType: 'month',
            datePlaceHolder: '选择月',
            currentDate: ''
        }
    },
    export default {
        name: 'DateSelect',
    methods: {
        select (e) {
            console.log(e.target.dataset.holder)
            this.dateType = e.target.dataset.type
            this.datePlaceHolder = e.target.dataset.holder
        props: ['type'],
        data () {
            return {
                dateType: 'month',
                datePlaceHolder: '选择月',
                currentDate: ''
            }
        },
        methods: {
            select (e) {
                console.log(e.target.dataset.holder)
                this.dateType = e.target.dataset.type
                this.datePlaceHolder = e.target.dataset.holder
            },
            selectChange (e) {
                const currentTime = this.gettime(e)
                if (this.type == 'taskSelect') {
                    this.$parent.getTaskTime(currentTime)
                } else if (this.type == 'ncptrSelect') {
                    this.$parent.getNcptrTime(currentTime)
                } else if (this.type == 'nztrSelect') {
                    this.$parent.getNztrTime(currentTime)
                } else if (this.type == 'cltjSelect') {
                    this.$parent.getCltjTime(currentTime)
                } else if (this.type == 'symSelect') {
                    this.$parent.getSymTime(currentTime)
                }
            },
            gettime (data) {
                let dateValue = data.getFullYear()
                if (this.dateType == 'date') {
                    dateValue += '-'
                    dateValue += this.checkTime(data.getMonth() + 1)
                    dateValue += '-'
                    dateValue += this.checkTime(data.getDate())
                } else if (this.dateType == 'month') {
                    dateValue += '-'
                    dateValue += this.checkTime(data.getMonth() + 1)
                }
                return dateValue
            },
            checkTime (i) {
                if (i < 10) {
                    i = '0' + i
                }
                return i
            }
        }
    }
}
</script>
<style scoped lang="scss">
.time-select {
    margin-top: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    height: 34px;
    .date-box {
        margin-right: 20px;
    .time-select {
        margin-top: 20px;
        padding: 0 4px;
        display: flex;
        box-sizing: border-box;
        align-items: center;
        height: 100%;
        background: rgba(33, 186, 196, 0.1);
        color: #a9d1d7;
        height: 34px;
        & > div {
        .date-box {
            margin-right: 20px;
            display: flex;
            box-sizing: border-box;
            align-items: center;
            justify-content: center;
            width: 50px;
            height: 100%;
            cursor: pointer;
        }
            background: rgba(33, 186, 196, 0.1);
            color: #a9d1d7;
        .on {
            background: rgba(33, 186, 196, 0.5);
            border: 1px solid #66dde9;
            & > div {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 50px;
                height: 100%;
                cursor: pointer;
            }
            .on {
                background: rgba(33, 186, 196, 0.5);
                border: 1px solid #66dde9;
            }
        }
    }
}
</style>
src/router/axios.js
@@ -12,7 +12,7 @@
//   console.log(window.location);
//   console.log(url);
// }, 3000);
 window.$apiUrls = 'http://182.106.212.58:8013/api'
window.$apiUrls = 'http://182.106.212.58:8013/api'
// window.$apiUrls = 'http://localhost:89'
const service = axios.create({
    //   baseURL: 'http://192.168.0.107:83',
src/views/manage/index.vue
@@ -74,32 +74,32 @@
                    <time-box
                            :imgUrl="'/img/icon/current.png'"
                            :title="'溯源次数'"
                            :currentNum="34"
                            :currentNum="sweepList['todayNum']"
                            :subTitle="'昨日溯源次数对比'"
                            :contrast="28"
                            :upDown="'up'"
                            :contrast="sweepList['yesterdayNum']"
                            :upDown="sweepList['todayNum'] > sweepList['yesterdayNum'] ? 'up' : 'down'"
                    ></time-box>
                    <time-box
                            :imgUrl="'/img/icon/week.png'"
                            :title="'溯源次数'"
                            :currentNum="61"
                            :currentNum="sweepList['thisWeekNum']"
                            :subTitle="'上周溯源次数对比'"
                            :contrast="36"
                            :upDown="'up'"
                            :contrast="sweepList['lastWeekNum']"
                            :upDown="sweepList['thisWeekNum'] > sweepList['lastWeekNum'] ? 'up' : 'down'"
                    ></time-box>
                    <time-box
                            :imgUrl="'/img/icon/month.png'"
                            :title="'溯源次数'"
                            :currentNum="88"
                            :currentNum="sweepList['thisMonthNum']"
                            :subTitle="'上月溯源次数对比'"
                            :contrast="96"
                            :upDown="'down'"
                            :contrast="sweepList['lastMonthNum']"
                            :upDown="sweepList['thisMonthNum'] > sweepList['lastMonthNum'] ? 'up' : 'down'"
                    ></time-box>
                </div>
                <div class="task-box">
                    <div class="title">任务总数</div>
                    <date-select></date-select>
                    <date-select :type="'taskSelect'"></date-select>
                    <div class="echarts-box" id="TaskNumEcharts"></div>
                </div>
@@ -118,7 +118,8 @@
                            </div>
                        </div>
                    </div>
                    <date-select></date-select>
                    <date-select :type="'ncptrSelect'" v-if="nzOrNcp == 'ncp'"></date-select>
                    <date-select :type="'nztrSelect'" v-if="nzOrNcp == 'nz'"></date-select>
                    <div v-if="nzOrNcp == 'ncp'" class="lists-box">
                        <div v-for="(item,index) in ncptr" :key="index">
                            <div>{{index + 1}}</div>
@@ -173,20 +174,21 @@
                <div class="cl-sy">
                    <div class="title-box">
                        <div>
                            <div class="item on">
                                <div class="title">产量统计</div>
                            <div class="item" :class="{on : cltjOrsym == 'cltj'}">
                                <div @click="cltjOrsym='cltj'" class="title">产量统计</div>
                                <span></span>
                            </div>
                        </div>
                        <div>
                            <div class="item">
                                <div class="title">溯源查询趋势图</div>
                            <div class="item" :class="{on : cltjOrsym == 'sym'}">
                                <div @click="cltjOrsym='sym'" class="title">溯源查询趋势图</div>
                                <span></span>
                            </div>
                        </div>
                        <div class="date">
                            <date-select></date-select>
                            <date-select :type="'cltjSelect'" v-if="cltjOrsym == 'cltj'"></date-select>
                            <date-select :type="'symSelect'" v-if="cltjOrsym == 'sym'"></date-select>
                        </div>
                    </div>
@@ -195,13 +197,13 @@
                <div class="ns-nz">
                    <div class="title-box">
                        <div>
                            <div  class="item" :class="{on : nsjlOrnz == 'nsjl'}">
                            <div class="item" :class="{on : nsjlOrnz == 'nsjl'}">
                                <div @click="nsjlOrnz='nsjl'" class="title">农事记录</div>
                                <span></span>
                            </div>
                        </div>
                        <div>
                            <div  class="item" :class="{on : nsjlOrnz == 'nzcr'}">
                            <div class="item" :class="{on : nsjlOrnz == 'nzcr'}">
                                <div @click="nsjlOrnz='nzcr'" class="title">农资出入库记录</div>
                                <span></span>
                            </div>
@@ -264,7 +266,8 @@
        farmingRecords,
        statisticsStockMonth,
        productsSupervise,
        pageCountNzCrk
        pageCountNzCrk,
        getSweepRecordStatistics
    } from '@/api/farm/farmingrecord'
    export default {
@@ -306,9 +309,12 @@
                stockrecordList: [],
                // 农产品监管
                NcpJg: [],
                // 溯源次数
                sweepList: {},
                nzOrNcp: 'ncp',
                trpOrNcp: 'trp',
                nsjlOrnz: 'nsjl'
                nsjlOrnz: 'nsjl',
                cltjOrsym: 'cltj'
            }
        },
        created () {
@@ -318,26 +324,47 @@
            // 年产量与库存数量
            this.statisticsStockAndYield()
            // 按月统计产量
            this.statisticsStockMonth()
            this.statisticsStockMonth('2022-07')
            // 农产品投入
            this.pageCount()
            this.pageCount('2022-07')
            // 农资投入
            this.pageCountNz()
            this.pageCountNz('2022-07')
            // 统计市场流通/去年流通量/本月流通量
            this.selectMarketCirculate()
            // 统计任务总数
            this.countTaskNum()
            this.countTaskNum('2022-07')
            // 农事操作
            this.farmingRecords()
            // 农产品监管
            this.productsSupervise()
            // 农资出入库记录
            this.pageCountNzCrk()
            // 溯源次数统计
            this.getSweepRecordStatistics()
        },
        mounted () {
        },
        methods: {
            // 任务总数时间查询
            getTaskTime (e) {
                this.countTaskNum(e)
            },
            // 农产品投入时间查询
            getNcptrTime (e) {
                this.pageCount(e)
            },
            // 农资投入时间查询
            getNztrTime (e) {
                this.pageCountNz(e)
            },
            // 产量统计时间查询
            getCltjTime (e) {
                this.statisticsStockMonth(e)
            },
            // 溯源码时间查询
            getSymTime (e) {
            },
            initBar (dom) {
                const that = this
                const chartDom = document.getElementById(dom)
@@ -604,20 +631,7 @@
                const chartDom = document.getElementById(dom)
                const myChart = this.$echarts.init(chartDom)
                var data = [
                    '01',
                    '02',
                    '03',
                    '04',
                    '05',
                    '06',
                    '07',
                    '08',
                    '09',
                    '10',
                    '11',
                    '12'
                ]
                var data = []
                var data1 = [
                    '0',
                    '0',
@@ -634,8 +648,9 @@
                ]
                var data2 = []
                var ncp = this.yieldMonth
                for (let i = 1; i <= 12; i++) {
                    data2.push(ncp[i])
                for (let i = 0; i < ncp.length; i++) {
                    data.push(ncp[i].time)
                    data2.push(ncp[i].num)
                }
                const option = {
@@ -783,11 +798,11 @@
                })
            },
            // 按月统计产量
            statisticsStockMonth () {
            statisticsStockMonth (e) {
                var params = {}
                params.tenantId = '000000'
                params.deptId = '1123598813738675201'
                params.year = '2022'
                params.year = e
                statisticsStockMonth(Object.assign(params)).then((res) => {
                    this.yieldMonth = res.data.data
                    this.initClSyBar('ClSyEcharts')
@@ -804,21 +819,22 @@
                })
            },
            // 农产品投入
            pageCount () {
            pageCount (e) {
                var params = {}
                params.tenantId = '000000'
                params.deptId = '1123598813738675201'
                params.year = '2022'
                params.year = e
                params.status = '1'
                pageCount(Object.assign(params)).then((res) => {
                    this.ncptr = res.data.data
                })
            },
            // 农资投入
            pageCountNz () {
            pageCountNz (e) {
                var params = {}
                params.codes = '000000'
                params.deptId = '1123598813738675201'
                params.year = '2022'
                params.year = e
                pageCountNz(Object.assign(params)).then((res) => {
                    this.nztr = res.data.data.records
                    // 投入品监管图表
@@ -838,11 +854,11 @@
                })
            },
            // 统计任务总数
            countTaskNum () {
            countTaskNum (year) {
                var params = {}
                params.codes = '000000'
                params.deptId = '1123598813738675201'
                params.year = '2022'
                params.year = year
                countTaskNum(Object.assign(params)).then((res) => {
                    this.taskNum = res.data.data
                    this.initBar('TaskNumEcharts')
@@ -870,6 +886,15 @@
                    this.stockrecordList = res.data.data.records
                })
            },
            // 溯源次数统计
            getSweepRecordStatistics () {
                var params = {}
                // 农场id
                params.farmId = '1'
                getSweepRecordStatistics(Object.assign(params)).then((res) => {
                    this.sweepList = res.data.data
                })
            },
            // 监管图表切换
            trpOrNcpChange (item) {
                var that = this