| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387 |
- // index.js
- // 获取应用实例
- import * as echarts from '../../ec-canvas/echarts' // 这个是自己实际的目录
- import {path} from '../../utils/circle';
- const app = getApp()
- Page({
- data: {
- showRight:false,
- polyline:[],
- tempList:[],
- hisLocal:[],
- ossPath: app.globalData.$filePath,
- title: '冷链追溯系统',
- token: '',
- mapCtx: '',
- latitude: '', //纬度
- longitude: '', //经度
- navbarData: {
- title: app.globalData.title,
- showCapsule: true,
- share: false
- },
- llzsEc: {
- lazyLoad: true,
- },
- tempList:[],
- Ec: {
- lazyLoad: true,
- },
- pieEc: {
- lazyLoad: true,
- },
- labelNum: {
- lazyLoad: true,
- },
- latitude: 40,
- longitude: 116,
- status: {
- checkedMap:true,
- statisticsInfo:true,
- statusLabelTest:true,
- statusLabelNum:true,
- statusLabelType:true,
- expressStatu:true,
- transportStatus:true,
- tempChart:true,
- onlineNum:true,
- packageStatu:true,
- onlineSituat:true,
- newSituat:true
- },
- CustomBar: app.globalData.CustomBar,
- StatusBar: app.globalData.StatusBar,
- systemMenu: [{
- menuName: '查一查',
- icon: '/img/idx_img2.png',
- path: 'find',
- },
- {
- menuName: '冷链管理',
- icon: '/img/dev_img4.png',
- path: 'coldChain'
- },
- {
- menuName: '产品管理',
- icon: '/img/idx_img4.png',
- path: 'productManager'
- },
- {
- menuName: '员工管理',
- icon: '/img/idx_img5.png',
- path: 'workerManager'
- },
- ],
- isAuth: false,
- modalHidden: true,
- scrollTop:0,//滚动监听
- // 沃森新
- cardIndex:0,
- tabLeftTop:[
- {name:'新冠',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'},
- {name:'肺炎',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'},
- {name:'流感',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'}
- ],
- tabLeftTop_remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常',
- orderCardList:[{city:'泰州市',used:50,stack: 2},{city:'北京市',used:50,stack: 2},{city:'西安市',used:50,stack: 2},{city:'天津市',stack: 2,used:50},{city:'廊坊市',stack: 2,used:50},{city:'广州市',used:50,stack: 2},{city:'郑州市',used:50,stack: 2}]
- },
- // 事件处理函数
- onLoad() {
- var that = this;
- if (!wx.getStorageSync('status')) {
- wx.setStorageSync('status', JSON.stringify(that.data.status));
- }
- },
- showRight(){
- this.setData({
- showRight:true,
- })
- },
- gopage1(){
- this.setData({
- showRight:false,
- },()=>{
- this.setCardLeft();
- })
- },
- onReady: function () {
- },
- onShow: function (options) {
- var that = this;
- var status = JSON.parse(wx.getStorageSync('status')) || '';
- var title = wx.getStorageSync('title') || ''
- var status =status ? status:that.data.status;
- title = title ? title : '冷链追溯系统'
- this.setData({
- status,
- title
- })
- //获取新闻
- this.getNewsList();
- // 加载
- this.setCardLeft();
-
- },
- setCardLeft(){
- var diagamList = [
- {name: "标签1",value: 0,unNormalTotal:0,symbolSize:40},
- {name: "标签2",value: 0,unNormalTotal:0,symbolSize:40},
- {name: "标签3",value: 1,unNormalTotal:2,symbolSize:40},
- {name: "标签4",value: 3,unNormalTotal:1,symbolSize:40},
- {name: "标签5",value: 3,unNormalTotal:1,symbolSize:40},
- ]
- this.setCardDiagram(diagamList);
- // this.setCardFivePie();
- this.setCardXuTuOption({normalTotal:15});
- // this.setCardFivePie_rght();
- var sixRightBarList = [{data:[120, 132, 101, 134, 90, 230, 210]},{data:[220, 182, 191, 234, 290, 330, 310]},{data:[150, 232, 201, 154, 190, 330, 410]}]
- this.setCardSixRightBar(sixRightBarList);
- var sevenCardPieList = [
- {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
- {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
- {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
- {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
- ]
- this.setSevenCardPie(sevenCardPieList);
- /**沃森新 */
- //获取token,若无则判定用户是游客访问,不进行任何请求
- var token = wx.getStorageSync('token');
- this.setData({
- token,
- tempList:[]
- })
- if (!token) {
- setTimeout(function () {
- that.noLogin()
- }, 500)
- return;
- }
- //地区产品统计
- this.setCardLeftFive({
- name:['北京', '云南', '广州', '辽宁', '山东', '重庆'],
- data:[
- {name:'2022',data:[18203, 23489, 29034, 104970, 131744, 630230]},
- {name:'2012',data:[19325, 23438, 31000, 121594, 134141, 681807]},
- ]
- });
- // 主产品查询
- this.getsignProduct();
- //主产品使用、库存、总数统计
- this.getSignProductUseAndStackState();
- //单一主产品不同地区使用情况
- this.getSingleProductUseZoneStat();
- // 获取按钮
- this.getUserDefaultMenuList();
- // 图5 主产品在库、在途、结束统计
- this.getSignProductState();
- // 主产品正常、预警统计
- this.getSignPorductNormalWarningState();
- // 主产品使用量、生产量统计
- this.getSignProductUsedProduceState();
- // 主产品不同年度 使用量统计
- this.getSignPrroductYearUsedProduceState();
- // 主产品在不同地区库存、使用数据统计
- this.getSignProductCityState();
- // 主产品最近一周每一天的使用量统计
- this.getSignProductEveryWeekState();
- },
- getCysOrderOption(list){
- var fontSize=8;
- return {
- color:["#7190F6","#FF723A","#EA1C43"],
- title: {
- show:false
- },
- grid:{
- top:"5%",
- left:"8%",
- right:"5%",
- bottom:"14%",
- },
- xAxis: {
- type: 'category',
- axisTick:{show:false,},
- axisLine:{lineStyle:{color:"#DEE3FF",}},
- axisLabel:{color:"#999999", fontSize,interval: 0},
- data: list.map(item=>item.name),
- },
- yAxis: {
- type: 'value',
- splitLine:{lineStyle:{color:"#DEE3FF",}},
- axisLabel:{color:"#999999", fontSize,},
- },
- series: [
- {
- type: 'bar',
- barMaxWidth:30,
- barMinHeight:10,
- data: list.map(item=>item.orderNum),
- },
- ]
- }
- },
- setTemp(temperature) {
- var that = this;
- that.ecWen = that.selectComponent('#ecDomWen');
- that.ecWen.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- var option = that.getTempOption();
- option.xAxis.data = temperature.map(v => v.createTime.replace(" ", "\n"));
- option.series[0].data = temperature.map(v => v.temp);
- chart.setOption(option);
- that.wenChart = chart;
- return chart;
- });
- },
- showMap(markers) {
- var that = this;
- var token = wx.getStorageSync('token');
- this.mapCtx = wx.createMapContext('home_map');
- var points = []
- for (var i in markers) {
- if(i==0){
- points.push({
- width:54,
- height:54,
- latitude:Number(markers[i].lat),
- longitude:Number(markers[i].lng),
- iconPath:"/img/map_icon1.png",
- })
- }
- else if(i == markers.length-1){
- points.push({
- width:54,
- height:54,
- latitude:Number(markers[i].lat),
- longitude:Number(markers[i].lng),
- iconPath:"/img/index_icon_1000.png",
- })
- }
- markers[i].latitude = Number(markers[i].lat)
- markers[i].longitude = Number(markers[i].lng)
- delete markers[i].lat
- delete markers[i].lng
- }
- that.setData({
- markers:points,
- polyline: [{
- color: '#2D59E6',
- width: 2,
- points: markers,
- }],
- latitude:markers.length != 0 ? markers[0].latitude : '',
- longitude:markers.length != 0 ? markers[0].longitude : ''
- });
- that.mapCtx.includePoints({
- points: markers || [],
- padding: [50, 50, 50, 50]
- })
- },
- noLogin() {
- var temp = [
- {temp: '23.3',createTime: "2021-12-03 17:06:40"},
- {temp: '23.2', createTime: "2021-12-03 17:08:10"},
- {temp: '23.1', createTime: "2021-12-03 17:09:40"},
- {temp: '23.1', createTime: "2021-12-03 17:11:10"},
- {temp: '23.3', createTime: "2021-12-03 17:12:40"},
- {temp:' 23.2', createTime: "2021-12-03 17:14:10"},
- {temp: '23.3', createTime: "2021-12-03 17:15:40"},
- {temp: '23.3', createTime: "2021-12-03 17:18:40"},
- {temp: '23.2', createTime: "2021-12-03 17:26:10"},
- {temp: '23.2', createTime: "2021-12-03 17:32:10"}
- ]
- //设备定位列表
- var markerList = [{
- id: 1,
- lat: "49.828921",
- lng: "122.956163",
- lastTemp: 29.2,
- transportType: '10',
- status: '10',
- },
- {
- id: 2,
- lat: "39.898959",
- lng: "116.188584",
- lastTemp: 19.2,
- transportType: '40',
- status: '00',
- },
- {
- id: 3,
- lat: "29.828457",
- lng: "120.495225",
- lastTemp: 29.3,
- transportType: '40',
- status: '10',
- },
- {
- id: 4,
- lat: "21.358161",
- lng: "111.003038",
- lastTemp: 29.5,
- transportType: '30',
- status: '20',
- },
- {
- id: 5,
- lat: "38.948484",
- lng: "120.846788",
- lastTemp: 29.8,
- transportType: '20',
- status: '10',
- },
- {
- id: 6,
- lat: "33.785733",
- lng: "104.850694",
- lastTemp: 28.2,
- transportType: '10',
- status: '00',
- },
- {
- id: 7,
- lat: "29.225357",
- lng: "121.306968",
- lastTemp: 27.2,
- transportType: '30',
- status: '00',
- },
- ]
- this.showMap(markerList);
- this.setData({
- tempList:temp,
- },()=>{
- this.setTemp(temp);
- })
- //地区产品统计
- this.setCardLeftFive({
- name:['北京', '云南', '广州', '辽宁', '山东', '重庆'],
- data:[
- {name:'2022',data:[18203, 23489, 29034, 104970, 131744, 630230]},
- {name:'2012',data:[19325, 23438, 31000, 121594, 134141, 681807]},
- ]
- });
- const cardTwo_leftOne = [
- {stack: 0, end: 1, productName: "阿莫西林", trans: 0},
- {stack: 0, end: 1, productName: "红霉素", trans: 0},
- {stack: 0, end: 1, productName: "红霉素", trans: 0},
- ]
- this.setCard_two_left_one(cardTwo_leftOne);
- // 主产品正常、预警统计
- this.setCardEightBar([
- {normal: 1, warning: 0, product_name: "阿莫西林"},
- {normal: 0, warning: 1, product_name: "红霉素"},
- {normal: 1, warning: 9, product_name: "新型冠状病毒疫苗"}
- ]);
- var list = [
- {product_name: "阿莫西林",data:[{data: 1,index: 39,color:"#2D59E6"},{data:1,index:872,color:"#71CCFF"}]},
- {product_name: "红霉素",data:[{data:1,index: 266,color: "#2D59E6"},{data: 1,index: 862,color:"#71CCFF"}]},
- {product_name: "新型冠状病毒疫苗",data:[{data:10,index: 555, color: "#2D59E6"},{data:1,index:200,color:"#71CCFF"}]},
- ];
- for (let index = 0; index < list.length; index++) {
- for (let lindex = 0; lindex < list[index].data.length; lindex++) {
- var color = list[index].data[lindex].color;
- var total = list[index].data[lindex].data;
- var itemIndex = list[index].data[lindex].index;
- that.setCardFivePie_rght(color,total,itemIndex);
- }
- }
- var seriesSixBar = [
- {name: 2022, type: "line", stack: "Total",data:[1, 1, 6]},
- {name: 2021, type: "line", stack: "Total",data:[4, 0,0]},
- ]
- var cardSixLineList = ["阿莫西林", "红霉素", "新型冠状病毒疫苗"];
- this.setCardSixBar(seriesSixBar,cardSixLineList);
- var klineList = [
- {
- maps:[{total:10,},{total:15,},{total:19,},{total:13,},{total:18,},],
- productInfo:{name:'阿莫西林'}
- },{
- maps:[{total:16,},{total:11,},{total:14,},{total:13,},{total:18,},],
- productInfo:{name:'红霉素'}
- },{
- maps:[{total:18,},{total:14,},{total:11,},{total:8,},{total:17,},],
- productInfo:{name:'新型冠状病毒疫苗'}
- }
- ];
- this.setKLine(klineList);
- },
- showMap1(markers) {
- var that = this;
- var token = wx.getStorageSync('token');
- this.mapCtx = wx.createMapContext('home_map');
- for (var i in markers) {
- markers[i].bId = markers[i].id
- markers[i].id = Number(i)
- markers[i].width = 54
- markers[i].height = 54
- markers[i].iconPath = "/img/index_icon_" + markers[i].transportType + '' + markers[i].status + ".png"
- markers[i].latitude = Number(markers[i].lat)
- markers[i].longitude = Number(markers[i].lng)
- delete markers[i].lat
- delete markers[i].lng
- }
- that.setData({
- markers,
- latitude:markers.length != 0 ? markers[0].latitude : '',
- longitude:markers.length != 0 ? markers[0].longitude : ''
- },()=>{
- if(markers.length!=0 && token){
- //地图数据加载完成后,获取第一条数据的详情
- that.getListChainTemperature(markers[0].bId);
- }else{
- var temp = [
- {temp: '23.3',createTime: "2021-12-03 17:06:40"},
- {temp: '23.2', createTime: "2021-12-03 17:08:10"},
- {temp: '23.1', createTime: "2021-12-03 17:09:40"},
- {temp: '23.1', createTime: "2021-12-03 17:11:10"},
- {temp: '23.3', createTime: "2021-12-03 17:12:40"},
- {temp:' 23.2', createTime: "2021-12-03 17:14:10"},
- {temp: '23.3', createTime: "2021-12-03 17:15:40"},
- {temp: '23.3', createTime: "2021-12-03 17:18:40"},
- {temp: '23.2', createTime: "2021-12-03 17:26:10"},
- {temp: '23.2', createTime: "2021-12-03 17:32:10"}
- ]
- that.setTemp(temp)
- }
- });
- that.mapCtx.includePoints({
- points: markers,
- padding: [50, 50, 50, 50]
- })
- },
- getMapInfo(e) {
- var that = this;
- var index = e.detail.markerId;
- if (that.data.token) {
- for (var i in that.data.markers) {
- if (that.data.markers[i].id == index) {
-
- return;
- }
- }
- } else {
- wx.navigateTo({
- url: '/pages/login/login',
- })
- }
- },
- onPageScroll:function(e){
- this.setData({
- scrollTop:e.scrollTop
- })
- },
- getList() {
- var that = this;
- app.requestP({
- url: '/index/listChainLocal',
- method: 'post',
- contentType: ' application/json'
- }).then(res => {
- var result = []
- res.data.data && res.data.data.map(item=>{
- if(item.lng != 0 && item.lat != 0){
- result.push(item)
- }
- })
- that.showMap(result);
- }).catch(err=>{
- app.showToptip(that,'error',err.data.msg)
- })
- },
- getTempOption() {
- return {
- title: {
- text: '温度:℃',
- textStyle: {
- color: '#999',
- fontSize: 6,
- }
- },
- grid: {
- top: "20%",
- left: "4%",
- right: "5%",
- bottom: "3%",
- containLabel: true
- },
- xAxis: {
- type: 'category',
- // boundaryGap: false,
- nameTextStyle: {
- color: "#77869E",
- fontSize: 4
- },
- axisLine: {
- onZero: false,
- lineStyle: {
- color: "#cccccc"
- }
- },
- axisTick: {
- show: false
- },
- splitLine: {
- show: false,
- },
- axisLabel: {
- show: true,
- textStyle: {
- color: '#999', //更改坐标轴文字颜色
- fontSize: 5, //更改坐标轴文字大小
- }
- },
- data: ['16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30'],
- // show: false
- },
- yAxis: {
- type: 'value',
- splitNumber: 10,
- max: 40,
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- show: true
- },
- axisLabel: {
- show: true,
- textStyle: {
- color: '#999', //更改坐标轴文字颜色
- fontSize: 5, //更改坐标轴文字大小
- }
- },
- splitLine: {
- show: false
- }
- },
- series: [{
- type: 'line',
- showSymbol: false,
- smooth: true,
- lineStyle: {
- width: 1,
- color: "#328EFD", //#D4D4D4
- },
- areaStyle: {
- origin: "start",
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [{
- offset: 0,
- color: '#FFFFFF' //
- }, {
- offset: 1,
- color: '#4C96FE' //#D4D4D4
- }],
- global: false
- }
- },
- data: [18, 36, 25, 30, -20, 40, 33]
- }]
- }
- },
- setPieChart(temperature) {
- var that = this;
- var num = 0;
- var color = ['#45C2E0', '#C1EBDD', '#FFC851','#5A5476','#1869A0','#FF9393'];
- temperature.map(v => num += v.num);
- that.ecWen = that.selectComponent('#pieDom');
- that.ecWen.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getPieChartOption();
- option.color = color;
- option.series[0].data = temperature.map(v => {
- var per = v.num / num * 100;
- return {
- value:v.num,
- name: v.productTypeName+':'+ v.num + ' 占比' + per.toFixed(2) + '%'
- }
- });
- chart.setOption(option);
- that.wenChart = chart;
- return chart;
- });
- },
- getPieChartOption() {
- return {
- legend: {
- top: 'bottom',
- show: false,
- },
- grid: {
- left: '0%',
- right: '0%',
- bottom: '3%',
- containLabel: true
- },
- // color:['#45C2E0', '#C1EBDD', '#FFC851','#5A5476','#1869A0','#FF9393'],
- series: [{
- type: 'pie',
- radius: [30, 60],
- center: ['50%', '50%'],
- itemStyle: {
- normal: {
- label: {
- formatter: function (v) {
- //文字中遇到空格就换行
- let text = v.name.split(" ").join("\n");
- return text;
- },
- show: true,
- },
- labelLine: {
- show: true,
- color:''
- }
- },
- },
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- },
- },
- data: [{
- value: 40,
- itemStyle:{
- normal:{
- color:'#45C2E0'
- }
- }
- },
- {
- value: 38,
- },
- {
- value: 32,
- },
- {
- value: 30,
- },
- ]
- }]
- }
- },
- setMapCenter() {
- var that = this;
- var locations = that.data.markers;
- that.mapCtx.includePoints({
- points: locations,
- padding: [50, 50, 50, 50]
- })
- },
- getUserInfo() {
- var that = this;
- app.requestP({
- method: "post",
- url: "/user/getUserInfo",
- }).then(function (res) {
- var userId = res.data.data.userId;
- // that.getProductChipState();
- }).catch(err => {
- app.showToptip(that, 'error', '请刷新重试');
- })
- },
- packageInfo(){
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- var packageList = JSON.stringify(this.data.packageList);
- wx.navigateTo({
- url: '/pages/index/packageInfo/packageinfo?list=' + packageList,
- })
- },
- getNewsList() {
- var that = this;
- app.requestP({
- url: '/query/news',
- method: 'post',
- needToken: false,
- data: {
- keyword: '',
- pageNum: '1',
- pageSize: '5'
- }
- }).then(res => {
- that.setData({
- newsList: res.data.data.map(item => {
- return {
- ...item,
- createTime: item.createTime.substring(item.createTime.length - 8)
- }
- })
- })
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg)
- })
- },
- goNewsInfo(e) {
- var id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/index/newsInfo/newsInfo?id=' + id,
- })
- },
- goNewsList() {
- wx.navigateTo({
- url: '/pages/index/newList/newList',
- })
- },
- getUserDefaultMenuList() {
- var that = this;
- app.requestP({
- url: '/userDeaultMenu/list',
- method: 'post',
- }).then(res => {
- that.setData({
- systemMenu: res.data.data
- })
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg)
- })
- },
- tapMenu(e) {
- let type = e.currentTarget.dataset.type
- let path = e.currentTarget.dataset.path;
- //判断token,若有则假设已经登录
- if (!wx.getStorageSync('token')) {
- wx.redirectTo({
- url: '/pages/login/login',
- })
- return;
- }
- //获取用户信息,判断userInfo是否过期
- let userInfo = wx.getStorageSync('userInfo');
- const {
- loginRole,
- ifOverFlow,
- status
- } = userInfo;
- // this.matchPage(loginRole, ifOverFlow, status, path);
- app.globalData.tabarData = {loginRole, ifOverFlow, status, path};
- wx.switchTab({
- url: '/pages/workbench/workbench',
- })
- },
- goMessage:function(){
- if(this.data.token){
- wx.navigateTo({
- url: '/pages/news/newList',
- })
- }else{
- wx.redirectTo({
- url: '/pages/login/login',
- })
- }
- },
- // 沃森新
- // 主产品查询
- getsignProduct(){
- app.requestP({
- url: '/daping/signProduct',
- method: 'post',
- }).then(res => {
- this.setData({
- tabLeftTop:res.data.data
- })
- }).catch(err => {
- app.showToptip(this,'err',err.data.msg)
- })
- },
- // 主产品使用、库存、总数统计
- getSignProductUseAndStackState(){
- app.requestP({
- url: '/daping/signProductUseAndStackState',
- method: 'post',
- }).then(res => {
- this.setPie4Chart(res.data.data)
- }).catch(err => {
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setCard(e){
- var index = e.currentTarget.dataset.index;
- this.setData({
- cardIndex:index,
- // tabLeftTop_remark:this.data.tabLfeftTop[index].remark
- })
- },
- //单一主产品不同地区使用情况
- getSingleProductUseZoneStat(){
- app.requestP({
- url: '/daping/singleProductUseZoneState',
- method: 'post',
- }).then(res=>{
- this.setCard_top_right_butChart(res.data.data);
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setPie4Chart(list){
- var that = this;
- var series = [];
- list.map((item,index)=>{
- series.push(...that.pice4Chart("#23D9E9",index == 0 ? "20%" :index == 1 ? '50%':'80%',item.total,item.use_num,item.stack_num,item.name,'45%',))
- });
- that.pie4ChartConDom = that.selectComponent('#pie4ChartConDom');
- that.pie4ChartConDom.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- chart.setOption({
- title: {
- show:false
- },
- grid:{
- top:"0%",
- left:"0%",
- right:"0%",
- bottom:"0%",
- },
- color: ["red", "rgb(10,92,170)", "rgb(114,205,255)"],
- legend: {
- icon:"rect",
- top:10,
- right:0,
- itemWidth:20,
- itemHeight:20,
- textStyle:{
- fontSize:16,
- color: "#D1E9F5",
- },
- },
- series:series,
- });
- return chart;
- })
- },
- pice4Chart(color,pos,total,use_num,stack_num,name,top){
- var that = this;
- var placeHolderStyle = {
- normal: {
- label: {
- show: false,
- formatter: function (v) {
- //文字中遇到空格就换行
- let text = v.value;
- return text;
- },
- },
- labelLine: {
- show: true,
- },
- },
- };
- const pieValue1 = {
- value1:(stack_num+use_num) / total,
- value2: 1 - (stack_num+use_num) / total
- };
- const pieValue2 = {
- value1:use_num / total,
- value2:1 - use_num / total
- };
- const pieValue3 = {
- value1: stack_num / total,
- value2: 1 - stack_num / total
- };
- return [{
- type: "pie",
- clockWise: true, //顺时加载
- hoverAnimation: false, //鼠标移入变大
- silent:false,
- radius: [20, 23],
- center: [pos, top],
- itemStyle: placeHolderStyle,
- data: [
- {
- value: pieValue1.value1,
- itemStyle:{
- normal:{
- color:'#0e74ff'
- }
- }
- },
- {
- value: pieValue1.value2,
- itemStyle:{
- normal:{
- color:"rgb(243,243,251)"
- }
- }
- }
- ],
- },{
- type: "pie",
- clockWise: true, //顺时加载
- hoverAnimation: false, //鼠标移入变大
- radius: [15, 18],
- silent:false,
- center: [pos, top],
- itemStyle: placeHolderStyle,
- data: [
- {
- value: pieValue2.value1,
- itemStyle:{
- normal:{
- color:'#64a6ff'
- }
- }
- },
- {
- value: pieValue2.value2,
- itemStyle:{
- normal:{
- color:"rgb(243,243,251)"
- }
- }
- }
- ],
- },
- {
- type: "pie",
- clockWise: true, //顺时加载
- hoverAnimation: false, //鼠标移入变大
- silent:false,
- radius: [10, 13],
- center: [pos, top],
- itemStyle: placeHolderStyle,
- data: [
- {
- value: pieValue3.value1,
- itemStyle:{
- normal:{
- color:'red'
- }
- }
- },
- {
- value: pieValue3.value2,
- itemStyle:{
- normal:{
- color:"rgb(243,243,251)"
- }
- }
- }
- ],
- }]
- },
- setCard_top_right_butChart(list){
- var that = this;
- that.selectComponent('#cardBarChartConDom').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- list = list.map(item=>{
- return {orderNum:item.total,name:item.city || 'N/A'}
- })
- var option = that.getCysOrderOption(list);
- option.series = [{
- type:'bar',
- barMaxWidth: 15,
- barMinHeight: 10,
- data:list.map(item=>item.orderNum),
- label: {
- show: true,
- position: 'inside'
- },
- itemStyle:{
- normal:{color:'#333FFF'}
- }
- }]
- chart.setOption(option);
- return chart;
- });
- },
- // 图5 主产品在库、在途、结束统计
- getSignProductState(){
- app.requestP({
- url: '/daping/signProductState',
- method: 'post',
- }).then(res=>{
- this.setCard_two_left_one(res.data.data);
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setCard_two_left_one(list){
- var that = this;
- that.selectComponent('#product_two_left_one').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getStaticBarChart();
- option.legend = {
- data:['在库','在途','结束'],
- icon:"circle",
- top:"2%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- option.color = ['#2D59E6','#FFAF36','#7FD1FF']
- option.grid.top='20%';
- option.grid.bottom='13%';
- option.series = [];
- option.xAxis.data = [];
- const echartsData = [
- {name:'在库',data:list.map(item=>item.stack)},
- {name:'结束',data:list.map(item=>item.end)},
- {name:'在途',data:list.map(item=>item.trans)}
- ]
- option.xAxis.data = list.map(item=>item.productName);
- echartsData.map((item,index)=>{
- option.series.push({
- name:item.name,
- type: "bar",
- stack: "Ad",
- emphasis: {
- focus: "series",
- },
- data:item.data
- })
- })
- chart.setOption(option);
- return chart;
- })
- },
- product_two_left_two(list){
- var that = this;
- that.selectComponent('#product_two_left_two').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.getStaticBarChart();
- option.series = [];
- option.legend = {
- data:list.map(item=>item.name),
- icon:"circle",
- top:"2%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- option.grid.top='20%';
- option.grid.bottom='13%';
- list.map((item,index)=>{
- option.series.push({
- name:item.name,
- type: index != list.length -1 ? 'bar' :'line',
- // yAxisIndex: 1,
- data:item.data
- });
- // if(index != list.length-1){
- // delete option.series[index].yAxisIndex;
- // }
- })
- chart.setOption(option);
- return chart;
- })
- },
- getStaticBarChart(){
- return {
- xAxis: {
- type: "category",
- axisTick:{show:false,},
- nameTextStyle: {
- color: "#77869E",
- fontSize: 8,
- },
- axisLabel: {
- color: '#999999',
- fontSize: 8,
- },
- axisLine: {
- onZero: false,
- lineStyle: {
- color: "#cccccc",
- },
- },
- data: ["Mon", "Tue", "Wed", "Thu",],
- },
- yAxis: {
- type: "value",
- minInterval: 1,
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- show: false,
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- },
- color: ["#7661FF", "#5AC8FA", "#00B972"],
- grid: {
- left: "3%",
- top: "8%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- series: [
- {
- data: [120, 200, 150, 80, 70, 110, 130, 110],
- type: "bar",
- },
- ],
- };
- },
- setCardPieTwo(list){
- var that = this;
- that.selectComponent('#product_three_left_one').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.getStaticPieChart();
- var itemStyle = {
- normal: {
- label: {
- show: true,
- formatter: function (v) {
- //文字中遇到空格
- let text = v.name+'\n'+v.value;
- return text;
- },
- },
- labelLine: {
- show: true,
- length:4,
- length2:4,
- },
- },
- }
- option.series = [
- {
- type: "pie",
- radius: "40%",
- center: ["50%", "25%"],
- itemStyle,
- label: {
- position: "inside",
- formatter: "{d}%",
- fontSize: 8,
- color: '#fff',
- },
- data: [
- { name: "标签1", value: 50 },
- { name: "标签2", value: 20 },
- { name: "标签3", value: 10 },
- ],
- },
- {
- type: "pie",
- radius: "40%",
- center: ["50%", "75%"],
- percentPrecision:0,
- minShowLabelAngle:30,
- itemStyle,
- label: {
- position: "inside",
- formatter: "{d}%",
- fontSize: 8,
- color: '#fff',
- },
- data: [
- { name: "标签1", value: 50 },
- { name: "标签2", value: 20 },
- { name: "标签3", value: 10 },
- ],
- },
- ]
- chart.setOption(option);
- return chart;
- })
- },
- getStaticPieChart(){
- return {
- color: ["#964CC4", "#04A3CC", "#3B6AD5"],
- title: {
- show: false,
- },
- grid: {
- top: "12%",
- left: "5%",
- right: "5%",
- bottom: "12%",
- },
- series: [
- // {
- // type: "pie",
- // radius: "50%",
- // center: ["50%", "25%"],
- // label: {
- // position: "inside",
- // formatter: "{d}%",
- // fontSize: 8,
- // color: '#fff',
- // },
- // data: [
- // { name: "在途", value: 50 },
- // { name: "完成", value: 20 },
- // { name: "待发运", value: 10 },
- // ],
- // },
- // {
- // type: "pie",
- // radius: "50%",
- // center: ["50%", "75%"],
- // percentPrecision:0,
- // minShowLabelAngle:30,
- // label: {
- // position: "inside",
- // formatter: "{d}%",
- // fontSize: 8,
- // color: '#fff',
- // },
- // data: [
- // { name: "在途", value: 50 },
- // { name: "完成", value: 20 },
- // { name: "待发运", value: 10 },
- // ],
- // },
- ]
- }
- },
- setCardFivePie(){
- var that = this;
- that.selectComponent('#product_five_left_one').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.getStaticPieChart();
- option.color = ['rgb(91,132,206)','rgb(127,210,255)','rgb(44,87,226)'];
- var itemStyle = {
- normal: {
- label: {
- show: false,
- formatter: function (v) {
- //文字中遇到空格
- let text = v.name+'\n'+v.value;
- return text;
- },
- },
- labelLine: {
- show: true,
- length:4,
- length2:4,
- },
- },
- }
- option.series = [
- {
- type: "pie",
- radius: "80%",
- center: ["50%", "30%"],
- itemStyle,
- label: {
- position: "inside",
- formatter: "{d}%",
- fontSize: 8,
- color: '#fff',
- },
- data: [
- { name: "标签1", value: 50 },
- { name: "标签2", value: 20 },
- { name: "标签3", value: 10 },
- ],
- },
- {
- type: "pie",
- radius: "80%",
- center: ["50%", "53%"],
- itemStyle,
- data: [
- { name: "标签1", value: 50 },
- { name: "标签2", value: 20 },
- { name: "标签3", value: 10 },
- ],
- },
- {
- type: "pie",
- radius: "80%",
- itemStyle,
- center: ["50%", "77%"],
- data: [
- { name: "标签1", value: 50 },
- { name: "标签2", value: 20 },
- { name: "标签3", value: 10 },
- ],
- },
- ]
- option.grid = {
- top: "12%",
- left: "10%",
- right: "0%",
- bottom: "12%",
- },
- chart.setOption(option);
- return chart;
- })
- },
- setCard3dBar(){
- var that = this;
- that.selectComponent('#product_three_left_two').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var data = [[0, 0, 5], [0, 1, 1], [0, 2, 0], [0, 3, 0], [0, 4, 0], [0, 5, 0], [0, 6, 0], [0, 7, 0], [0, 8, 0], [0, 9, 0], [0, 10, 0], [0, 11, 2], [0, 12, 4], [0, 13, 1], [0, 14, 1], [0, 15, 3], [0, 16, 4], [0, 17, 6], [0, 18, 4], [0, 19, 4], [0, 20, 3], [0, 21, 3], [0, 22, 2], [0, 23, 5], [1, 0, 7], [1, 1, 0], [1, 2, 0], [1, 3, 0], [1, 4, 0], [1, 5, 0], [1, 6, 0], [1, 7, 0], [1, 8, 0], [1, 9, 0], [1, 10, 5], [1, 11, 2], [1, 12, 2], [1, 13, 6], [1, 14, 9], [1, 15, 11], [1, 16, 6], [1, 17, 7], [1, 18, 8], [1, 19, 12], [1, 20, 5], [1, 21, 5], [1, 22, 7], [1, 23, 2], [2, 0, 1], [2, 1, 1], [2, 2, 0], [2, 3, 0], [2, 4, 0], [2, 5, 0], [2, 6, 0], [2, 7, 0], [2, 8, 0], [2, 9, 0], [2, 10, 3], [2, 11, 2], [2, 12, 1], [2, 13, 9], [2, 14, 8], [2, 15, 10], [2, 16, 6], [2, 17, 5], [2, 18, 5], [2, 19, 5], [2, 20, 7], [2, 21, 4], [2, 22, 2], [2, 23, 4], [3, 0, 7], [3, 1, 3], [3, 2, 0], [3, 3, 0], [3, 4, 0], [3, 5, 0], [3, 6, 0], [3, 7, 0], [3, 8, 1], [3, 9, 0], [3, 10, 5], [3, 11, 4], [3, 12, 7], [3, 13, 14], [3, 14, 13], [3, 15, 12], [3, 16, 9], [3, 17, 5], [3, 18, 5], [3, 19, 10], [3, 20, 6], [3, 21, 4], [3, 22, 4], [3, 23, 1], [4, 0, 1], [4, 1, 3], [4, 2, 0], [4, 3, 0], [4, 4, 0], [4, 5, 1], [4, 6, 0], [4, 7, 0], [4, 8, 0], [4, 9, 2], [4, 10, 4], [4, 11, 4], [4, 12, 2], [4, 13, 4], [4, 14, 4], [4, 15, 14], [4, 16, 12], [4, 17, 1], [4, 18, 8], [4, 19, 5], [4, 20, 3], [4, 21, 7], [4, 22, 3], [4, 23, 0], [5, 0, 2], [5, 1, 1], [5, 2, 0], [5, 3, 3], [5, 4, 0], [5, 5, 0], [5, 6, 0], [5, 7, 0], [5, 8, 2], [5, 9, 0], [5, 10, 4], [5, 11, 1], [5, 12, 5], [5, 13, 10], [5, 14, 5], [5, 15, 7], [5, 16, 11], [5, 17, 6], [5, 18, 0], [5, 19, 5], [5, 20, 3], [5, 21, 4], [5, 22, 2], [5, 23, 0], [6, 0, 1], [6, 1, 0], [6, 2, 0], [6, 3, 0], [6, 4, 0], [6, 5, 0], [6, 6, 0], [6, 7, 0], [6, 8, 0], [6, 9, 0], [6, 10, 1], [6, 11, 0], [6, 12, 2], [6, 13, 1], [6, 14, 3], [6, 15, 4], [6, 16, 0], [6, 17, 0], [6, 18, 0], [6, 19, 0], [6, 20, 1], [6, 21, 2], [6, 22, 2], [6, 23, 6]]
- chart.setOption({
- tooltip: {},
- xAxis3D: {
- type: 'category',
- data: ['12a', '1a', '2a', '3a', '4a', '5a', '6a','7a', '8a', '9a', '10a', '11a','12p', '1p', '2p', '3p', '4p', '5p','6p', '7p', '8p', '9p', '10p', '11p']
- },
- yAxis3D: {
- type: 'category',
- data: ['Saturday', 'Friday', 'Thursday','Wednesday', 'Tuesday', 'Monday', 'Sunday']
- },
- zAxis3D: {
- type: 'value'
- },
- grid3D: {
- boxWidth: 200,
- boxDepth: 80,
- viewControl: {
- // projection: 'orthographic'
- },
- light: {
- main: {
- intensity: 1.2,
- shadow: true
- },
- ambient: {
- intensity: 0.3
- }
- }
- },
- series: [
- {
- type: 'bar3D',
- data: data.map(function (item) {
- return {
- value: [item[1], item[0], item[2]]
- };
- }),
- shading: 'lambert',
- label: {
- fontSize: 16,
- borderWidth: 1
- },
- emphasis: {
- label: {
- fontSize: 20,
- color: '#900'
- },
- itemStyle: {
- color: '#900'
- }
- }
- }
- ]
- });
- return chart;
- })
- },
- setKLine(list){
- var that = this;
- that.selectComponent('#product_four').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getStaticBarChart();
- option.color = ['#2D59E6','#FFAF36','#7FD1FF']
- option.grid.top='20%';
- option.grid.bottom='13%';
- option.series = [];
- option.xAxis.data = [];
- const echartsData = [];
- list.map(item=>{
- echartsData.push({
- name:item.productInfo.name,data:item.maps.map(itemChild=>itemChild.total)
- })
- })
- option.xAxis.data = list.map(item=>item.productInfo.name);
- echartsData.map((item,index)=>{
- option.series.push({
- name:item.name,
- type: "bar",
- stack: "Ad",
- barMaxWidth: 25,
- // barMinHeight: 10,
- emphasis: {
- focus: "series",
- },
- data:item.data
- })
- })
- chart.setOption(option);
- return chart;
- })
- },
- calculateMA(dayCount, data) {
- var result = [];
- for (var i = 0, len = data.length; i < len; i++) {
- if (i < dayCount) {
- result.push('-');
- continue;
- }
- var sum = 0;
- for (var j = 0; j < dayCount; j++) {
- sum += +data[i - j][1];
- }
- result.push(sum / dayCount);
- }
- return result;
- },
- setCardDiagram(list){
- var that = this;
- that.selectComponent('#product_four_left_two').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- chart.setOption({
- backgroundColor: "transparent",
- tooltip: {
- formatter:function(params){
- const {data:{name,value,unNormalTotal}} = params;
- return `${name}\n正常: ${value}\n预警: ${unNormalTotal}`
- }
- },
- grid: {},
- animationDurationUpdate: function (idx) {
- // 越往后的数据延迟越大
- return idx * 100;
- },
- color: ["red", "rgb(10,92,170)", "rgb(114,205,255)"],
- animationEasingUpdate: "bounceIn",
- series: [
- {
- type: "graph",
- layout: "force",
- force: {
- repulsion: 100, //越大斥力越大
- gravity: 0.05, //越大节点越往中心靠拢
- edgeLength: 20, //值越小则长度越长
- },
- roam: true,
- draggable: true,
- symbolSize: 1,
- itemStyle: {
- // opacity: 0.9,
- color: () => {
- return (
- 'red',
- 'rgb(114,205,255)',
- 'rgb(10,92,170)'
- );
- },
- },
- label: {
- normal: {
- show: true,
- fontSize: 10,
- },
- },
- data: list
- },
- ],
- })
- return chart;
- })
- },
- setCardXuTuOption(testNum){
- var that = this;
- let icon =
- "path://M512.584639,219.893708c40.41173,0.258019,73.19961-32.274913,73.199609-72.557634,0-40.025725-32.78788-72.559681-73.199609-72.559681-40.473163,0-73.196538,32.533956-73.196538,72.559681,0,40.089206,32.723375,72.557634,73.196538,72.557634z,m73.330666,16.396499H439.129058c-55.266258,0-91.39098,48.28336-91.390981,94.203594v220.945238c0,42.847553,60.780905,42.847553,60.780905,0V347.144224h11.782872v555.564273c0,59.179548,82.417649,57.316077,84.337434,0V582.569248h15.696162V902.96754c3.391108,60.650871,84.340506,54.817796,84.340506-0.258019V347.144224h9.800631v204.234406c0,42.837314,62.696594,42.837314,62.696594,0V330.433391c0.126962-45.72979-36.116531-94.143184-91.257876-94.143184z";
- for (var index = 0; index < 4; index++) {
- that.selectComponent('#product_five_right_one'+index).init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- chart.setOption({
- backgroundColor: "transparent",
- tooltip: {
- trigger: "axis",
- axisPointer: {
- type: "shadow",
- },
- formatter: "{b0}: {c0}%",
- },
- grid: {
- containLabel: true,
- height: "200px",
- width: "auto",
- left: "0",
- top: "center",
- },
- xAxis: {
- max: 100,
- splitLine: {
- show: false,
- },
- axisLine: {
- show: false,
- },
- axisLabel: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- },
- yAxis: {
- type: "category",
- inverse: true,
- axisLine: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- axisLabel: {
- // margin: 10,
- fontSize: 20,
- color: "white",
- },
- axisPointer: {
- label: {
- show: true,
- margin: 100,
- },
- },
- },
- series: [
- {
- type: "pictorialBar",
- symbolRepeat: "fixed",
- symbolMargin: "6!",
- label: {
- normal: {
- show: false,
- position: "right",
- offset: [3, 0],
- formatter: (param) => {
- return param.value.toFixed(0) + "%";
- },
- textStyle: {
- fontSize: 20,
- color: "white",
- },
- },
- },
- symbolClip: true,
- symbolSize: [22, 30],
- symbolPosition: "start",
- symbolBoundingData: 100,
- data: [
- {
- value: testNum.normalTotal,
- symbol: icon,
- itemStyle: {
- color: "#1DDBF9",
- },
- },
- ],
- z: 10,
- },
- {
- type: "pictorialBar",
- itemStyle: {
- normal: {
- opacity: 0.2,
- },
- },
- animationDuration: 0,
- symbolRepeat: "fixed",
- symbolMargin: "6!",
- symbolSize: [22, 30],
- symbolBoundingData: 100,
- symbolPosition: "start",
- // symbolOffset: [
- // 10,
- // 0
- // ],
- data: [
- {
- value: 100,
- symbol: icon,
- itemStyle: {
- color: "#1DDBF9",
- },
- },
- ],
- z: 5,
- },
- ],
- })
- return chart
- })
- }
- },
- // 主产品使用量、生产量统计
- getSignProductUsedProduceState(){
- var that = this;
- app.requestP({
- url: '/daping/signProductUsedProduceState',
- method: 'post',
- }).then(res=>{
- this.setData({
- statisticSproductList:res.data.data.map(item=>{
- return {
- product_name:item.product_name,
- data:[
- {data:item.produce,index:Math.floor(Math.random()*1000),color:'#2D59E6'},
- {data:item.end,index:Math.floor(Math.random()*1000),color:'#71CCFF'},
- ]
- }
- }),
- },()=>{
- var list = that.data.statisticSproductList;
- for (let index = 0; index < list.length; index++) {
- for (let lindex = 0; lindex < list[index].data.length; lindex++) {
- var color = list[index].data[lindex].color;
- var total = list[index].data[lindex].data;
- var itemIndex = list[index].data[lindex].index;
- that.setCardFivePie_rght(color,total,itemIndex);
- }
- }
- })
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setCardFivePie_rght(color,total,itemIndex){
- var that = this;
- var placeHolderStyle = {
- normal: {
- label: {
- show: false,
- formatter: function (v) {
- //文字中遇到空格就换行
- let text = v.value;
- return text;
- },
- },
- labelLine: {
- show: true,
- },
- },
- };
- that.selectComponent('#product_five_right'+itemIndex).init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getStaticPieChart();
- option.series = [];
- option.color = [color];
- option.series.push({
- type: "pie",
- silent: 1,
- radius: ["65%", "80%"],
- label: {
- show: false,
- },
- labelLine: 0,
- emphasis: {
- label: {
- show: true,
- fontSize: "40",
- fontWeight: "bold",
- },
- },
- data: [
- {
- value:total,
- label: {
- show: true,
- fontSize: 8 * 1.5,
- color: '#485465',
- position: "center",
- formatter: "{c}",
- },
- },
- // { value: 55 ,},
- ],
- })
- chart.setOption(option);
- return chart;
- })
- },
- // 主产品不同年度 使用量统计
- getSignPrroductYearUsedProduceState(){
- app.requestP({
- url: '/daping/signPrroductYearUsedProduceState',
- method: 'post',
- }).then(res=>{
- var xAxisName = [];
- var seriesYear = [];
- var series = [];
- res.data.data.map((item,index)=>{
- item.map((itemChild)=>{
- if(xAxisName.indexOf(itemChild.productName) == -1){
- xAxisName.push(itemChild.productName);
- }
- if(seriesYear.indexOf(itemChild.year) == -1){
- seriesYear.push(itemChild.year);
- series.push({
- name:itemChild.year,
- type: "line",
- stack: "Total",
- data:[itemChild.produce]
- })
- }else{
- series.map((serItem,i)=>{
- if(serItem.name == itemChild.year){
- series[i].data.push(itemChild.produce)
- }
- if(serItem.name != itemChild.year){
- series[i].data.push(0);
- }
- })
- }
- })
- if(index == res.data.data.length-1){
- this.setCardSixBar(series,xAxisName);
- this.setCardSixRightBar(series,xAxisName)
- }
- })
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setCardSixBar(lineList,xAxisName){
- var that = this;
- that.selectComponent('#product_six_left').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var colors = ['#F71404','#2D59E6','#71CCFF']
- var option = that.getStaticBarChart();
- option.color = ['#F71404','#2D59E6','#71CCFF'];
- option.grid.top = '26%'
- option.series = [];
- option.xAxis.data = xAxisName;
- option.title={
- text: '单位:支',
- left: 'right',
- top:'15%',
- textStyle: {
- color: '#666',
- fontSize: 12,
- }
- },
- option.legend = {
- data:lineList.map(item=>item.name+''),
- icon:"circle",
- top:"10%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- lineList.map((item,index)=>{
- option.series.push({
- name:item.name+'',
- type:'line',
- data:item.data,
- lineStyle:{
- normal:{
- color:colors[index]
- }
- },
- itemStyle:{
- normal:{
- color:colors[index]
- }
- }
- })
- })
- chart.setOption(option);
- return chart
- })
- },
- setCardSixRightBar(lineList,xAxisName){
- var that = this;
- that.selectComponent('#product_six_right').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.setCardLineTotal();
- option.series = [];
- var colors = ['#F71404','#2D59E6','#71CCFF'];
- option.color = ['#F71404','#2D59E6','#71CCFF'];
- option.grid.top = '26%'
- option.xAxis.data = xAxisName;
- option.title={
- text: '单位:支',
- left: 'right',
- top:'15%',
- textStyle: {
- color: '#666',
- fontSize: 12,
- }
- },
- option.legend = {
- data:lineList.map(item=>item.name+''),
- icon:"circle",
- top:"10%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- lineList.map((item,index)=>{
- option.series.push({
- name:item.name+'',
- type:'line',
- data:item.data,
- areaStyle: {},
- lineStyle:{
- normal:{
- color:colors[index]
- }
- },
- itemStyle:{
- normal:{
- color:colors[index]
- }
- }
- })
- })
- chart.setOption(option)
- return chart;
- })
- },
- setCardLineTotal(){
- return {
- xAxis: {
- type: "category",
- axisTick:{show:false,},
- nameTextStyle: {
- color: "#77869E",
- fontSize: 8,
- },
- axisLabel: {
- color: '#999999',
- fontSize: 8,
- },
- axisLine: {
- onZero: false,
- lineStyle: {
- color: "#cccccc",
- },
- },
- data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- },
- yAxis: {
- type: "value",
- minInterval: 1,
- axisLabel:{color:"#000", fontSize:8,},
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- show: true,
- },
- },
- color: ["#7661FF", "#5AC8FA", "#00B972"],
- grid: {
- left: "3%",
- top: "5%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- series: [
- {
- data: [120, 200, 150, 80, 70, 110, 130, 110],
- type: "line",
- },
- ]
- }
- },
- setSevenCardPie(list){
- var that = this;
- that.selectComponent('#product_seven_left').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var itemStyle = {
- normal: {
- label: {
- show: false,
- formatter: function (v) {
- //文字中遇到空格
- let text = v.name+'\n'+v.value;
- return text;
- },
- },
- labelLine: {
- show: true,
- length:4,
- length2:4,
- },
- },
- }
- var option = this.getStaticPieChart();
- option.color = ['rgb(127,210,255)','rgb(44,88,288)','rgb(247,20,4)',];
- var center = [["50%", "12%"],["50%", "35%"],["50%", "60%"],["50%", "85%"]];
- option.series = [];
- list.map((item,index)=>{
- option.series.push({
- type: "pie",
- radius: ['40%','70%'],
- center: center[index],
- itemStyle,
- label: {
- position: "inside",
- formatter: "{d}%",
- fontSize: 8,
- color: '#fff',
- },
- data: item.data,
- })
- })
- chart.setOption(option)
- return chart
- })
- },
- setCardSenvenPie(list){
- var that = this;
- that.selectComponent('#product_seven_right').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.getStaticPieChart();
- option.series = [];
- option.color = ['#FFAF36','#7A4AFE']
- option.legend = {
- data:list.map(item=>item.name),
- icon:"circle",
- top:"2%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- option.series = [{
- type: "pie",
- radius: "80%",
- center: ["50%", "50%"],
- label: {
- show:false,
- position: "inside",
- formatter: "{d}%",
- fontSize: 8,
- color: '#fff',
- },
- data:list,
- }]
- chart.setOption(option);
- return chart;
- })
- },
- // 主产品正常、预警统计
- getSignPorductNormalWarningState(){
- app.requestP({
- url: '/daping/signPorductNormalWarningState',
- method: 'post',
- }).then(res=>{
- this.setCardEightBar(res.data.data)
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- setCardEightBar(list){
- var that = this;
- that.selectComponent('#product_eight_left').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getStaticBarChart();
- option.series = [];
- option.grid.top='20%';
- option.grid.bottom='13%';
- option.xAxis.data = list.map(item=>item.product_name);
- const echartsData = [
- {name:'正常',data:list.map(item=>item.normal)},
- {name:'报警',data:list.map(item=>item.warning)},
- ]
- option.color = ['#2D59E6','#E1291C']
- option.legend = {
- data:echartsData.map(item=>item.name),
- icon:"circle",
- top:"2%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- echartsData.map((item,index)=>{
- option.series.push({
- name: item.name,
- type: 'bar',
- emphasis: {
- focus: "series",
- },
- data:item.data,
- });
- })
- chart.setOption(option);
- return chart;
- });
- },
- setCardEightRightBar(list){
- var that = this;
- that.selectComponent('#product_eight_right').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getStaticBarChart();
- option.title = {
- show:false,
- text: '',
- top:'10%',
- textStyle: {
- color: '#999',
- fontSize: 6,
- }
- }
- option.legend = {
- data:list.map(item=>item.name),
- icon:"circle",
- top:"2%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- option.grid = {
- top:'20%',
- bottom:'15%',
- right:'15%',
- left:'15%'
- }
- option.color = ['#26E657','#FFAF36','#F71404'];
- option.yAxis = [
- {
- type: 'value',
- // min: 0,
- // max: 250,
- interval: 50,
- minInterval: 1,
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- show: false,
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- },
- {
- type: 'value',
- min: 0,
- max:25,
- interval: 5,
- // minInterval: 1,
- axisLine: {
- lineStyle: {
- // color: "",
- },
- show: false,
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- }
- ];
- option.series = [];
- list.map((item,index)=>{
- option.series.push({
- name: item.name,
- type: 'bar',
- stack: "Ad",
- emphasis: {
- focus: "series",
- },
- data:item.data,
- })
- })
- chart.setOption(option);
- return chart;
- })
- },
- setCardNineBar(list){
- var that = this;
- that.selectComponent('#product_nine_left').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getCysOrderOption(list);
- option.title = {
- text: '产品分类信息',
- top:'10%',
- textStyle: {
- color: '#999',
- fontSize: 6,
- }
- }
- option.grid = {
- top:"25%",
- left:"13%",
- right:"15%",
- bottom:"14%",
- }
- option.yAxis = [
- {
- type: 'value',
- // min: 0,
- // max: 250,
- // interval: 50,
- minInterval: 1,
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- show: false,
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- },
- {
- type: 'value',
- min: 0,
- max:25,
- interval: 5,
- // minInterval: 1,
- axisLine: {
- lineStyle: {
- // color: "",
- },
- show: false,
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- }
- ];
- chart.setOption(option);
- return chart;
- })
- },
- setCardNineRightBar(list){
- var that = this;
- that.selectComponent('#product_nine_right').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.setCardLineTotal();
- option.series = [];
- option.legend = {
- data:list.map(item=>item.name),
- icon:"circle",
- top:"5%",
- right:"auto",
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- fontSize:8,
- color:'#485465',
- },
- }
- option.yAxis = {
- type: "value",
- // minInterval: 1,
- axisLine: {
- lineStyle: {
- color: "#cccccc",
- },
- },
- axisLabel: {
- color: "#999999",
- fontSize: 8,
- },
- },
- option.grid.top = '20%';
- option.grid.right = '10%';
- list.map(item=>{
- option.series.push({
- name:item.name,
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- showSymbol:false,
- emphasis: {
- focus: 'series'
- },
- data: item.data,
- })
- })
- chart.setOption(option)
- return chart;
- })
- },
- // 地区产品统计
- setCardLeftFive(list){
- var that = this;
- that.selectComponent('#product_five').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = {
- xAxis: {
- type: 'value',
- axisLabel: {
- show: false
- }
- },
- grid:{
- top:0,
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- yAxis: {
- type: 'category',
- data: list.name.map(item=>item),
- axisTick: { show: false },
- axisLabel:{color:"#999999", fontSize:9,},
- axisLine: { lineStyle: { color: '#DEE3FF' } },
- },
- series:list.data.map(item=>{
- return{ name:item.name,type:'bar',data:item.data }
- })
- }
- chart.setOption(option);
- return chart;
- })
- },
- // 图15 主产品在不同地区库存、使用数据统计 /daping/signProductCityState
- getSignProductCityState(){
- app.requestP({
- url: '/daping/signProductCityState',
- method: 'post',
- }).then(res=>{
- this.setData({
- orderCardList:res.data.data,
- })
- var sevenCardPieNum = [];
- res.data.data.map(item=>{
- sevenCardPieNum.push({
- data:[{name:item.city,value:item.stack},{name:item.city+'1',value:item.used}]
- })
- })
- this.setSevenCardPie(sevenCardPieNum);
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- // 主产品最近一周每一天的使用量统计
- getSignProductEveryWeekState(){
- app.requestP({
- url: '/daping/signProductEveryWeekState',
- method: 'post',
- }).then(res=>{
- this.setKLine(res.data.data);
- }).catch(err=>{
- app.showToptip(this,'err',err.data.msg)
- })
- },
- })
|