| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677 |
- // 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 = [];
- 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
- })
- })
- 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;
- })
- },
- })
|