| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664 |
- // index.js
- // 获取应用实例
- import * as echarts from '../../ec-canvas/echarts' // 这个是自己实际的目录
- import {path} from '../../utils/circle';
- const app = getApp()
- Page({
- data: {
- transportStatusData:{},
- transportBusinessData:{},
- transportBusinessNum:1,
- orderWaringStatusData:{},
- waringStatus:0,
- waringStatusList:["当天","本周","本月",],
- transportCityData:[],
- transOrderList:[],
- transOrderIndex:0,
- polyline:[],
- tempList:[],
- hisLocal:[],
- urlLeft:'/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg"',
- banner: "/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg",
- ossPath: app.globalData.$filePath,
- title: '冷链追溯系统',
- token: '',
- mapCtx: '',
- latitude: '', //纬度
- longitude: '', //经度
- navbarData: {
- title: app.globalData.title,
- showCapsule: true,
- share: false
- },
- alarmDTO: {
- chipNum: 0,
- allTimeNum: 0,
- realTimeNum: 0
- },
- temperatureDTO: { //温度监测数量
- normal: 0,
- warning: 0,
- alarm: 0
- },
- waringDTO: {
- chipNum: 0,
- allTimeNum: 0,
- realTimeNum: 0
- },
- inTrans: 0, //已出库(个)
- inStore: 0, //已入库(个)
- inEnd: 0, //已结束(个)
- total: 0, //已生产(个)
- error11: 0, //一型有源报警数量
- error20: 0, //二型报警数量
- total10: 0, //一型无源数量
- total11: 0, //一型有源数量
- total20: 0, //二型数量
- warning11: 0, //一型有源预警数量
- warning20: 0, //一型无源预警数量
- mapTopData: {
- name: '暂无',
- status: '暂无',
- updateTime: '暂无',
- lastTemperature: '暂无',
- minTemperature: '暂无',
- maxTemperature: '暂无'
- },
- llzsEc: {
- lazyLoad: true,
- },
- chainTempList: [],
- 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,
- showAuthWin: false,
- showChaType: false,
- isPrem: false,
- device: 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:[{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50}]
- },
- // 事件处理函数
- onLoad() {
- var that = this;
- if (!wx.getStorageSync('status')) {
- wx.setStorageSync('status', JSON.stringify(that.data.status));
- }
- },
- onReady: function () {
- var that = this;
- // that.canvasRingA = that.selectComponent("#canvasRingA");
- // that.canvasRingB = that.selectComponent("#canvasRingB");
- // that.canvasRingC = that.selectComponent("#canvasRingC");
- // that.canvasRingG = that.selectComponent("#canvasRingG");
- // that.canvasRingA.showCanvasRing();
- // that.canvasRingB.showCanvasRing();
- // that.canvasRingC.showCanvasRing();
- // that.canvasRingG.showCanvasRing();
- // that.canvasRingD = that.selectComponent("#canvasRingD");
- // that.canvasRingE = that.selectComponent("#canvasRingE");
- // that.canvasRingF = that.selectComponent("#canvasRingF");
- // that.canvasRingL = that.selectComponent("#canvasRingL");
- // that.canvasRingD.showCanvasRing();
- // that.canvasRingE.showCanvasRing();
- // that.canvasRingF.showCanvasRing();
- // that.canvasRingL.showCanvasRing();
- },
- 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.setPie4Chart({total:8,abnormal:3,normal:8});
- // this.setCard_top_right_butChart([{"name":"北京","orderNum":50},{"name":"上海","orderNum":30},{"name":"安徽","orderNum":20},{"name":"成都","orderNum":20},{"name":"广东","orderNum":20},]);
- // this.product_two_left_two([
- // {name:'标签1',data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]},
- // {name:'标签2',data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]},
- // {name:'',data:[30.0, 42.2, 43.3, 44.5, 46.3, 80.2, 200.3, 123.4, 223.0, 26.5, 12.0, 6.2]},
- // ])
- // this.setCardPieTwo();
- // this.setCard3dBar();
- // this.setKLine();
- 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 cardSixBarList = [{"name":"北京","orderNum":50},{"name":"上海","orderNum":30},{"name":"安徽","orderNum":20},{"name":"成都","orderNum":20},{"name":"广东","orderNum":20}];
- // var cardSixLineList = [{name:'标签1',data:[10,15,18,25,15]},{name:'标签2',data:[14,16,20,28,17]},{name:'标签3',data:[20,24,28,32,22]}]
- // this.setCardSixBar(cardSixBarList,cardSixLineList);
- // 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);
- // var sevenCardPieList = [
- // { name: "标签1", value: 50 },
- // { name: "标签2", value: 20 },
- // ]
- // this.setCardSenvenPie(sevenCardPieList);
- // var eightBarLeftList = [
- // {name:'标签1',data:[2.0, 4.9, 7.0, 23.2,]},
- // {name:'标签2',data:[2.6, 5.9, 9.0, 21.4,]},
- // {name:'标签3',data:[3.6, 6.9, 8.0, 18.4,]},
- // {name:'标签4',data:[4.6, 7.9, 7.0, 16.4,]},
- // ]
- // this.setCardEightBar(eightBarLeftList);
- // var eightRightBarList = [
- // {name:'标签1',data:[10, 20, 30, 40, 50, 60]},
- // {name:'标签2',data:[10, 20, 30, 40, 50, 60]},
- // {name:'标签3',data:[10, 20, 30, 40, 50, 60]},
- // {name:'',data:[15,22,32,45,48,67]}
- // ]
- // this.setCardEightRightBar(eightRightBarList);
- // this.setCardNineBar([{"name":"二价流脑","orderNum":50},{"name":"胶囊","orderNum":30},{"name":"产品1","orderNum":20},{"name":"颗粒","orderNum":20},]);
- // var nineRightBarList = [{name:'生产',data:[120, 132, 101, 134, 90, 230, 210]},{name:'销售',data:[220, 182, 191, 234, 290, 330, 310]},{name:'在途',data:[150, 232, 201, 154, 190, 330, 410]},{name:'交付',data:[158, 242, 141, 164, 180, 230, 510]}]
- // this.setCardNineRightBar(nineRightBarList);
- /**沃森新 */
- //获取token,若无则判定用户是游客访问,不进行任何请求
- var token = wx.getStorageSync('token');
- this.setData({
- token,
- chainTempList:[],
- 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();
- },
- getOrderWarnOption(list){
- var fontSize = 12
- var fontColor = "#999999"
- return {
- color:["#0079FF","#FF723A","#EA1C43"],
- title: {
- show:false
- },
- grid:{
- top:"5%",
- left:"5%",
- right:"5%",
- bottom:"5%",
- },
- tooltip: {
- show:true
- },
- legend: {
- data:list.map(item=>item.name),
- icon:"rect",
- orient:"vertical",
- top:"middle",
- right:"10%",
- itemWidth:fontSize,
- itemHeight:fontSize,
- textStyle:{
- fontSize:fontSize,
- color:fontColor,
- },
- formatter(name){
- return name+" " + list.filter(item=>item.name == name)[0].num
- },
- },
- series: [
- {
- type: 'pie',
- silent:0,
- radius: ["40%", '90%'],
- center: ["30%", '50%'],
- label:{
- position:'inside',
- formatter:"{d}%",
- },
- itemStyle:{
- borderColor:"#ffffff",
- borderWidth:2,
- },
- data: list.filter(item=>{
- item.value = item.num
- return item
- }),
- },
- ]
- }
- },
- 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({
- chainTempList:temp,
- 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);
- },
- 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.getListInfo(markers[0].bId);
- 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) {
- //冷链信息
- that.getListInfo(that.data.markers[i].bId);
- //冷链温度曲线
- that.getListChainTemperature(that.data.markers[i].bId);
- 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)
- })
- },
- getListInfo(id) {
- var that = this;
- app.requestP({
- url: '/index/getChainInfo',
- method: 'post',
- contentType: 'application/json',
- data: {
- id
- }
- }).then(res => {
- const {
- name,
- status,
- updateTime,
- lastTemperature,
- minTemperature,
- maxTemperature
- } = res.data.data;
- that.setData({ //数据处理
- mapTopData: {
- name: name || '暂无',
- status: status == '00' ? '正常' : status == '10' ? '黄色预警' : status == '20' ? '红色预警' : '暂无',
- updateTime: updateTime || '暂无',
- lastTemperature: lastTemperature ? lastTemperature + '℃' : '暂无',
- minTemperature: minTemperature ? minTemperature + '℃' : '暂无',
- maxTemperature: maxTemperature || '暂无'
- },
- })
- }).catch(err=>{
- app.showToptip(that,'error',err.data.msg)
- })
- },
- getListChainTemperature(id) {
- var that = this;
- app.requestP({
- url: '/index/listChainTemperature',
- method: 'post',
- contentType: 'application/json',
- data: {
- id
- },
- }).then(res => {
- that.setData({
- chainTempList: res.data.data,
- tempList:res.data.data
- })
- that.setTemp(res.data.data);
- }).catch(err => {
- app.showToptip(that, 'error', '暂无温度数据');
- })
- },
- setTransOption(temperature) {
- var that = this;
- that.ecWen = that.selectComponent('#llzsChartDom');
- that.ecWen.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getTransOption();
- option.xAxis.data = temperature.map(v => v.productTypeName);
- option.series[0].data = temperature.map(v => v.state10);
- option.series[1].data = temperature.map(v => v.state11);
- option.series[2].data = temperature.map(v => v.state20);
- chart.setOption(option);
- that.wenChart = chart;
- return chart;
- });
- },
- getTransOption() {
- return {
- title: {
- text: '数量',
- textStyle: {
- color: '#74788D',
- fontWeight: 'normal',
- fontSize: '16rpx'
- }
- },
- tooltip: {
- show: false,
- trigger: 'axis'
- },
- color: ['#7661FF', '#5AC8FA', '#00B972'],
- legend: {
- data: ['全程温控', '实时追溯', '追溯标签'],
- icon: "rect", // 设置形状 类型包括 circle,rect ,roundRect,triangle
- itemHeight: 11,
- itemWidth: 11,
- align: 'left',
- itemGap: 5,
- right: 10,
- top: 0,
- textStyle:{
- color:'#999',
- }
- },
- grid: {
- left: '0%',
- right: '0%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- nameTextStyle: {
- color: "#77869E",
- fontSize: 10
- },
- axisLine: {
- onZero: false,
- lineStyle: {
- color: "#999"
- }
- },
- axisTick: {
- show: false
- },
- splitLine: {
- show: false,
- },
- data: ["产品一", "产品二", "产品三", "产品四"],
- },
- yAxis: [{
- type: 'value'
- }],
- series: [{
- name: '追溯标签',
- type: 'bar',
- label: {
- show: true,
- position: 'top'
- },
- symbolSize: '0',
- lineStyle: {
- width: 1
- },
- data: [50, 180, 290, 50]
- },
- {
- name: '全程温控',
- type: 'bar',
- label: {
- show: true,
- position: 'top'
- },
- symbolSize: '0',
- lineStyle: {
- width: 1
- },
- data: [200, 200, 292, 200]
- }, {
- name: '实时追溯',
- type: 'bar',
- label: {
- show: true,
- position: 'top'
- },
- symbolSize: '0',
- lineStyle: {
- width: 1
- },
- data: [248, 290, 290, 240]
- }
- ]
- }
- },
- 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]
- }]
- }
- },
- productTypeChipCount(userId) {
- var that = this;
- app.requestP({
- url: '/index/productTypeChipCount',
- method: 'post',
- data: {
- userId
- }
- }).then(res => {
- that.setData({
- productTypeChipCount: res.data.data
- })
- const temperature = res.data.data;
- that.setPieChart(temperature.slice(0,6));
- }).catch(err => {
- that.setData({
- productTypeChipCount: []
- })
- })
- },
- 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,
- },
- ]
- }]
- }
- },
- getChainStatus(userId) {
- var that = this;
- app.requestP({
- url: '/index/getChainStatus',
- method: 'post',
- data: {
- userId
- }
- }).then(res => {
- const {
- alarmDTO,
- temperatureDTO,
- waringDTO,
- inTrans,
- inStore,
- inEnd,
- total
- } = res.data.data;
- that.setData({
- temperatureDTO,
- waringDTO,
- inTrans,
- inStore,
- inEnd,
- total
- })
- }).catch(err=>{
- app.showToptip(that,'error',err.data.msg)
- })
- },
- getWarningState(userId) {
- var that = this;
- app.requestP({
- url: '/index/warningState',
- method: 'post',
- data: {
- userId
- }
- }).then(res => {
- const {
- error11,
- error20,
- total10,
- total11,
- total20,
- warning11,
- warning20
- } = res.data.data;
- that.setData({
- error11,
- error20,
- total10,
- total11,
- total20,
- warning11,
- warning20
- }, () => {
- // that.canvasRingA.showCanvasRing();
- // that.canvasRingB.showCanvasRing();
- // that.canvasRingC.showCanvasRing();
- // that.canvasRingD.showCanvasRing();
- // that.canvasRingE.showCanvasRing();
- // that.canvasRingF.showCanvasRing();
- // that.canvasRingG.showCanvasRing();
- // that.canvasRingL.showCanvasRing();
- })
- }).catch(err=>{
- app.showToptip(that,'error',err.data.msg)
- })
- },
- 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();
- that.productTypeChipCount(userId);
- that.getChainStatus(userId);
- // that.getWarningState(userId);
- }).catch(err => {
- app.showToptip(that, 'error', '请刷新重试');
- })
- },
- transportationInfo() {
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- var transportationJson = JSON.stringify(this.data.productChipStateList);
- wx.navigateTo({
- url: '/pages/index/transportationInfo/transportationInfo?list=' + transportationJson,
- })
- },
- monitoringNum() {
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- var productTypeChipCountJson = JSON.stringify(this.data.productTypeChipCount);
- wx.navigateTo({
- url: '/pages/index/monitoringNum/monitoringNum?list=' + productTypeChipCountJson,
- })
- },
- 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,
- })
- },
- expressInfo(){
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- var expressData = JSON.stringify(this.data.expressData);
- var title = JSON.stringify([{name:'出库',type:'o'},{name:'入库',type:'i'}]);
- var titleName = JSON.stringify({titleName:'出入库统计'});
- wx.navigateTo({
- url: '/pages/index/statics/statics?list=' +encodeURIComponent(expressData)+'&title='+title+'&titleName='+titleName,
- })
- },
- goAbnormal(){
- wx.navigateTo({
- url: '/pages/index/abnormal/abnormal',
- })
- },
- ordersInfo(){
- wx.navigateTo({
- url: '/pages/index/ordersList/ordersList',
- })
- },
- transporDetails(){
- var temp = this.data.temp;
- var productName = this.data.productName;
- var {product10,product20,product30,product40,product50} = this.data;
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- wx.navigateTo({
- url: '/pages/index/transporDetails/transporDetails?temp='+encodeURIComponent(JSON.stringify(temp))+'&productName='+encodeURIComponent(JSON.stringify(productName))+'&productNum='+encodeURIComponent(JSON.stringify([product10,product20,product30,product40,product50])),
- })
- },
- onShareAppMessage() {
- return {
- title: 'cover-view',
- }
- },
- monitoringNum() {
- var token = wx.getStorageSync('token');
- if(!token){
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return;
- }
- var transportCityDataJson = JSON.stringify(this.data.transportCityData);
- wx.navigateTo({
- url: '/pages/index/monitoringNum/monitoringNum?list=' + transportCityDataJson,
- })
- },
- 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);
- this.setKLine(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);
- this.setKLine(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 = ['red','rgb(114,205,255)','rgb(10,92,170)']
- option.grid.top='20%';
- option.grid.bottom='13%';
- option.series = [];
- option.xAxis.data = [];
- list.map((item,index)=>{
- const {stack,end,trans,} = item;
- option.xAxis.data.push(item.productName);
- option.series.push({
- name:item.productName,
- type: "bar",
- stack: "Ad",
- emphasis: {
- focus: "series",
- },
- data:[stack,trans,end]
- })
- })
- console.log(option);
- 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
- });
- list = list.map(item=>{
- return {orderNum:item.total,name:item.city || 'N/A'}
- })
- var option = that.getCysOrderOption(list);
- // lenged
- 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;
- })
- },
- 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
- })
- }
- },
- setCardFivePie_rght(list){
- 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').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = this.getStaticPieChart();
- var position = [['20%','20%'],['20%','50%'],['20%','80%'],['50%','20%'],['50%','50%'],['50%','80%'],['80%','20%'],['80%','50%'],['80%','80%']]
- position.map(item=>{
- option.series.push({
- type: "pie",
- clockWise: true, //顺时加载
- hoverAnimation: false, //鼠标移入变大
- silent:false,
- radius: [20, 23],
- center: item,
- itemStyle: placeHolderStyle,
- label:{
- normal:{
- show:true,
- position:'center',
- color:'#485465',
- formatter:'{d}',
- emphasis:{
- show:true
- }
- }
- },
- data: [
- {
- value: 0.6,
- itemStyle:{
- normal:{
- color:'#0e74ff'
- }
- }
- },
- {
- value: 0.4,
- itemStyle:{
- normal:{
- color:"rgb(243,243,251)"
- }
- }
- }
- ]
- })
- })
- chart.setOption(option)
- return chart;
- })
- },
- setCardSixBar(list,lineList){
- 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.getCysOrderOption(list);
- option.color = ['rgb(243,243,251)'];
- option.grid.top = '20%'
- option.yAxis.axisLabel.color = '#000';
- option.legend = {
- data:lineList.map(item=>item.name),
- icon:"circle",
- top:"2%",
- 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(list){
- 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 = [];
- list.map(item=>{
- option.series.push({
- type: 'line',
- stack: 'Total',
- areaStyle: {},
- showSymbol:false,
- emphasis: {
- focus: 'series'
- },
- data: item.data,
- })
- })
- 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(247,20,4)','rgb(127,210,255)','rgb(44,88,288)'];
- var center = [["50%", "10%"],["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;
- })
- },
- 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.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: 'bar',
- 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 = {
- 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: index != list.length -1 ? 'bar' :'line',
- 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;
- })
- },
- })
|