| | |
| | | function getSpecifyDayDate (day) { |
| | | const timeCount = new Date().getTime() - day * 24 * 60 * 60 * 1000 |
| | | const date = new Date(timeCount) |
| | | return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} 00:00:00` |
| | | var month = "" |
| | | if (date.getMonth()+1<10){ |
| | | month = "0"+(date.getMonth()+1) |
| | | }else { |
| | | month = date.getMonth() + 1 |
| | | } |
| | | return `${date.getFullYear()}-${month}-${date.getDate()} 00:00:00` |
| | | } |
| | | |
| | | /** |
| | |
| | | const date = new Date() |
| | | const year = date.getFullYear() |
| | | const month = date.getMonth() + 1 |
| | | const strDate = date.getDate() - 1 |
| | | const strDate = date.getDate() |
| | | return `${year}-${month}-${strDate} 23:59:59` |
| | | } |
| | | |
| | |
| | | num = num-0 |
| | | return (num > 9999) ? (num / 10000).toFixed(2) + 'w' : num.toFixed(0) |
| | | } |
| | | export const getObjType = obj => { |
| | | var toString = Object.prototype.toString; |
| | | var map = { |
| | | '[object Boolean]': 'boolean', |
| | | '[object Number]': 'number', |
| | | '[object String]': 'string', |
| | | '[object Function]': 'function', |
| | | '[object Array]': 'array', |
| | | '[object Date]': 'date', |
| | | '[object RegExp]': 'regExp', |
| | | '[object Undefined]': 'undefined', |
| | | '[object Null]': 'null', |
| | | '[object Object]': 'object' |
| | | }; |
| | | if (obj instanceof Element) { |
| | | return 'element'; |
| | | } |
| | | return map[toString.call(obj)]; |
| | | }; |
| | | /** |
| | | * 对象深拷贝 |
| | | */ |
| | | export const deepClone = data => { |
| | | var type = getObjType(data); |
| | | var obj; |
| | | if (type === 'array') { |
| | | obj = []; |
| | | } else if (type === 'object') { |
| | | obj = {}; |
| | | } else { |
| | | //不再具有下一层次 |
| | | return data; |
| | | } |
| | | if (type === 'array') { |
| | | for (var i = 0, len = data.length; i < len; i++) { |
| | | obj.push(deepClone(data[i])); |
| | | } |
| | | } else if (type === 'object') { |
| | | for (var key in data) { |
| | | obj[key] = deepClone(data[key]); |
| | | } |
| | | } |
| | | return obj; |
| | | }; |
| | | |
| | | export default { |
| | | numUnitConversion |
| | |
| | | <div class="t-r"></div> |
| | | <div class="b-l"></div> |
| | | <div class="b-r"></div> |
| | | <div class="title">全年销售总额(元)</div> |
| | | <div class="title">全年销售总额(万元)</div> |
| | | <div class="price"> |
| | | <div v-for="(item,index) in salaNum" :key="index"> |
| | | <span>{{item}}</span> |
| | |
| | | var params = {} |
| | | params.farmId = this.farmId |
| | | selctSaletZ(Object.assign(params)).then((res) => { |
| | | that.salaNum = res.data.data[0].num.toString().split('') |
| | | var num = res.data.data[0].num/10000 |
| | | that.salaNum = num.toString().split('') |
| | | }) |
| | | }, |
| | | getFarmingCount () { |
| | |
| | | }, |
| | | setMarketChart (dom) { |
| | | const chartDom = document.getElementById(dom) |
| | | console.log(chartDom, 456) |
| | | const myChart = this.$echarts.init(chartDom) |
| | | var marketData = this.marketDistrict |
| | | var geoCoordMap = {} |
| | |
| | | }, |
| | | created () { |
| | | //跳转到统一登录页 |
| | | window.location.replace('http://dev.jxpskj.com:8020/ncny/login.html') |
| | | // window.location.replace('http://dev.jxpskj.com:8020/ncny/login.html') |
| | | var that = this |
| | | |
| | | this.newAxios = axios.create({ |
| | |
| | | if (res.data.access_token) { |
| | | this.$store.commit('setUser', res.data) |
| | | auth.setToken(res.data.access_token) |
| | | console.log('23232323', res.data) |
| | | window.localStorage.setItem('userName', res.data.nick_name)//赋值 |
| | | this.$router.push({ path: '/' }) |
| | | } else { |
| | |
| | | farmSelectQuery, |
| | | } from "@/api/farm/farmingrecord" |
| | | |
| | | import publicjs from '@/utils/public' |
| | | import publicjs, { deepClone } from '@/utils/public' |
| | | import dateUtilsJs from '@/utils/dateUtils' |
| | | |
| | | export default { |
| | |
| | | inputNZ_nzname: "", |
| | | inputTRP_nzname: "", |
| | | inputNCP_nzname: "", |
| | | nsSelectTime: [dateUtilsJs.getSpecifyDayDate(30),dateUtilsJs.getToDay()], |
| | | nzSelectTime: [dateUtilsJs.getSpecifyDayDate(30),dateUtilsJs.getToDay()] |
| | | nsSelectTime: [dateUtilsJs.getSpecifyDayDate(30),dateUtilsJs.getDayLast()], |
| | | nzSelectTime: [dateUtilsJs.getSpecifyDayDate(30),dateUtilsJs.getDayLast()] |
| | | } |
| | | }, |
| | | created () { |
| | |
| | | const chartDom = document.getElementById(dom) |
| | | const myChart = this.$echarts.init(chartDom) |
| | | myChart.clear() |
| | | var nztrData = this.nztr |
| | | |
| | | var temp = deepClone(this.nztr) |
| | | let idArr = [] //相同id放在同一数组中 |
| | | let resultArr = [] //最终结果数组 |
| | | for(let i = 0;i < temp.length; i++){ |
| | | let index = idArr.indexOf(temp[i].agrname) |
| | | if(index > -1){ //有相同id存在的话,获取index索引位置 |
| | | resultArr[index].cnum += temp[i].cnum //cnum |
| | | }else{ |
| | | idArr.push(temp[i].agrname) |
| | | resultArr.push(temp[i]) |
| | | } |
| | | } |
| | | |
| | | var nztrData = resultArr |
| | | var nztrX = [] |
| | | var nztrY = [] |
| | | for (let i = 0; i < nztrData.length; i++) { |
| | |
| | | axisLabel: { |
| | | color: "rgba(255,255,255,.4)", |
| | | rotate: 0, |
| | | interval:0 |
| | | }, |
| | | }, |
| | | yAxis: { |