index.js 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833
  1. // index.js
  2. // 获取应用实例
  3. import * as echarts from '../../ec-canvas/echarts' // 这个是自己实际的目录
  4. import {path} from '../../utils/circle';
  5. const app = getApp()
  6. Page({
  7. data: {
  8. showRight:1,
  9. transportStatusData:{},
  10. transportBusinessData:{},
  11. transportBusinessNum:1,
  12. orderWaringStatusData:{},
  13. waringStatus:0,
  14. waringStatusList:["当天","本周","本月",],
  15. transportCityData:[],
  16. transOrderList:[],
  17. transOrderIndex:0,
  18. polyline:[],
  19. tempList:[],
  20. hisLocal:[],
  21. urlLeft:'/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg"',
  22. banner: "/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg",
  23. ossPath: app.globalData.$filePath,
  24. title: '冷链追溯系统',
  25. token: '',
  26. mapCtx: '',
  27. latitude: '', //纬度
  28. longitude: '', //经度
  29. navbarData: {
  30. title: app.globalData.title,
  31. showCapsule: true,
  32. share: false
  33. },
  34. alarmDTO: {
  35. chipNum: 0,
  36. allTimeNum: 0,
  37. realTimeNum: 0
  38. },
  39. temperatureDTO: { //温度监测数量
  40. normal: 0,
  41. warning: 0,
  42. alarm: 0
  43. },
  44. waringDTO: {
  45. chipNum: 0,
  46. allTimeNum: 0,
  47. realTimeNum: 0
  48. },
  49. inTrans: 0, //已出库(个)
  50. inStore: 0, //已入库(个)
  51. inEnd: 0, //已结束(个)
  52. total: 0, //已生产(个)
  53. error11: 0, //一型有源报警数量
  54. error20: 0, //二型报警数量
  55. total10: 0, //一型无源数量
  56. total11: 0, //一型有源数量
  57. total20: 0, //二型数量
  58. warning11: 0, //一型有源预警数量
  59. warning20: 0, //一型无源预警数量
  60. mapTopData: {
  61. name: '暂无',
  62. status: '暂无',
  63. updateTime: '暂无',
  64. lastTemperature: '暂无',
  65. minTemperature: '暂无',
  66. maxTemperature: '暂无'
  67. },
  68. llzsEc: {
  69. lazyLoad: true,
  70. },
  71. chainTempList: [],
  72. tempList:[],
  73. Ec: {
  74. lazyLoad: true,
  75. },
  76. pieEc: {
  77. lazyLoad: true,
  78. },
  79. labelNum: {
  80. lazyLoad: true,
  81. },
  82. latitude: 40,
  83. longitude: 116,
  84. status: {
  85. checkedMap:true,
  86. statisticsInfo:true,
  87. statusLabelTest:true,
  88. statusLabelNum:true,
  89. statusLabelType:true,
  90. expressStatu:true,
  91. transportStatus:true,
  92. tempChart:true,
  93. onlineNum:true,
  94. packageStatu:true,
  95. onlineSituat:true,
  96. newSituat:true
  97. },
  98. CustomBar: app.globalData.CustomBar,
  99. StatusBar: app.globalData.StatusBar,
  100. systemMenu: [{
  101. menuName: '查一查',
  102. icon: '/img/idx_img2.png',
  103. path: 'find',
  104. },
  105. {
  106. menuName: '冷链管理',
  107. icon: '/img/dev_img4.png',
  108. path: 'coldChain'
  109. },
  110. {
  111. menuName: '产品管理',
  112. icon: '/img/idx_img4.png',
  113. path: 'productManager'
  114. },
  115. {
  116. menuName: '员工管理',
  117. icon: '/img/idx_img5.png',
  118. path: 'workerManager'
  119. },
  120. ],
  121. isAuth: false,
  122. showAuthWin: false,
  123. showChaType: false,
  124. isPrem: false,
  125. device: false,
  126. modalHidden: true,
  127. scrollTop:0,//滚动监听
  128. // 沃森新
  129. cardIndex:0,
  130. tabLeftTop:[
  131. {name:'新冠',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'},
  132. {name:'肺炎',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'},
  133. {name:'流感',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'}
  134. ],
  135. tabLeftTop_remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常',
  136. 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}]
  137. },
  138. // 事件处理函数
  139. onLoad() {
  140. var that = this;
  141. if (!wx.getStorageSync('status')) {
  142. wx.setStorageSync('status', JSON.stringify(that.data.status));
  143. }
  144. },
  145. showRight(){
  146. this.setData({
  147. showRight:true,
  148. })
  149. },
  150. gopage1(){
  151. this.setData({
  152. showRight:false,
  153. })
  154. },
  155. onReady: function () {
  156. var that = this;
  157. // that.canvasRingA = that.selectComponent("#canvasRingA");
  158. // that.canvasRingB = that.selectComponent("#canvasRingB");
  159. // that.canvasRingC = that.selectComponent("#canvasRingC");
  160. // that.canvasRingG = that.selectComponent("#canvasRingG");
  161. // that.canvasRingA.showCanvasRing();
  162. // that.canvasRingB.showCanvasRing();
  163. // that.canvasRingC.showCanvasRing();
  164. // that.canvasRingG.showCanvasRing();
  165. // that.canvasRingD = that.selectComponent("#canvasRingD");
  166. // that.canvasRingE = that.selectComponent("#canvasRingE");
  167. // that.canvasRingF = that.selectComponent("#canvasRingF");
  168. // that.canvasRingL = that.selectComponent("#canvasRingL");
  169. // that.canvasRingD.showCanvasRing();
  170. // that.canvasRingE.showCanvasRing();
  171. // that.canvasRingF.showCanvasRing();
  172. // that.canvasRingL.showCanvasRing();
  173. },
  174. onShow: function (options) {
  175. var that = this;
  176. var status = JSON.parse(wx.getStorageSync('status')) || '';
  177. var title = wx.getStorageSync('title') || ''
  178. var status =status ? status:that.data.status;
  179. title = title ? title : '冷链追溯系统'
  180. this.setData({
  181. status,
  182. title
  183. })
  184. //获取新闻
  185. this.getNewsList();
  186. /**沃森新 */
  187. // this.setPie4Chart({total:8,abnormal:3,normal:8});
  188. // this.setCard_top_right_butChart([{"name":"北京","orderNum":50},{"name":"上海","orderNum":30},{"name":"安徽","orderNum":20},{"name":"成都","orderNum":20},{"name":"广东","orderNum":20},]);
  189. // this.product_two_left_two([
  190. // {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]},
  191. // {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]},
  192. // {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]},
  193. // ])
  194. // this.setCardPieTwo();
  195. // this.setCard3dBar();
  196. // this.setKLine();
  197. var diagamList = [
  198. {name: "标签1",value: 0,unNormalTotal:0,symbolSize:40},
  199. {name: "标签2",value: 0,unNormalTotal:0,symbolSize:40},
  200. {name: "标签3",value: 1,unNormalTotal:2,symbolSize:40},
  201. {name: "标签4",value: 3,unNormalTotal:1,symbolSize:40},
  202. {name: "标签5",value: 3,unNormalTotal:1,symbolSize:40},
  203. ]
  204. this.setCardDiagram(diagamList);
  205. // this.setCardFivePie();
  206. this.setCardXuTuOption({normalTotal:15});
  207. // this.setCardFivePie_rght();
  208. 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]}]
  209. this.setCardSixRightBar(sixRightBarList);
  210. var sevenCardPieList = [
  211. {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
  212. {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
  213. {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
  214. {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
  215. ]
  216. this.setSevenCardPie(sevenCardPieList);
  217. // var sevenCardPieList = [
  218. // { name: "标签1", value: 50 },
  219. // { name: "标签2", value: 20 },
  220. // ]
  221. // this.setCardSenvenPie(sevenCardPieList);
  222. // var eightBarLeftList = [
  223. // {name:'标签1',data:[2.0, 4.9, 7.0, 23.2,]},
  224. // {name:'标签2',data:[2.6, 5.9, 9.0, 21.4,]},
  225. // {name:'标签3',data:[3.6, 6.9, 8.0, 18.4,]},
  226. // {name:'标签4',data:[4.6, 7.9, 7.0, 16.4,]},
  227. // ]
  228. // this.setCardEightBar(eightBarLeftList);
  229. // var eightRightBarList = [
  230. // {name:'标签1',data:[10, 20, 30, 40, 50, 60]},
  231. // {name:'标签2',data:[10, 20, 30, 40, 50, 60]},
  232. // {name:'标签3',data:[10, 20, 30, 40, 50, 60]},
  233. // {name:'',data:[15,22,32,45,48,67]}
  234. // ]
  235. // this.setCardEightRightBar(eightRightBarList);
  236. // this.setCardNineBar([{"name":"二价流脑","orderNum":50},{"name":"胶囊","orderNum":30},{"name":"产品1","orderNum":20},{"name":"颗粒","orderNum":20},]);
  237. // 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]}]
  238. // this.setCardNineRightBar(nineRightBarList);
  239. /**沃森新 */
  240. //获取token,若无则判定用户是游客访问,不进行任何请求
  241. var token = wx.getStorageSync('token');
  242. this.setData({
  243. token,
  244. chainTempList:[],
  245. tempList:[]
  246. })
  247. if (!token) {
  248. setTimeout(function () {
  249. that.noLogin()
  250. }, 500)
  251. return;
  252. }
  253. //地区产品统计
  254. this.setCardLeftFive({
  255. name:['北京', '云南', '广州', '辽宁', '山东', '重庆'],
  256. data:[
  257. {name:'2022',data:[18203, 23489, 29034, 104970, 131744, 630230]},
  258. {name:'2012',data:[19325, 23438, 31000, 121594, 134141, 681807]},
  259. ]
  260. });
  261. // 主产品查询
  262. this.getsignProduct();
  263. //主产品使用、库存、总数统计
  264. this.getSignProductUseAndStackState();
  265. //单一主产品不同地区使用情况
  266. this.getSingleProductUseZoneStat();
  267. // 获取按钮
  268. this.getUserDefaultMenuList();
  269. // 图5 主产品在库、在途、结束统计
  270. this.getSignProductState();
  271. // 主产品正常、预警统计
  272. this.getSignPorductNormalWarningState();
  273. // 主产品使用量、生产量统计
  274. this.getSignProductUsedProduceState();
  275. // 主产品不同年度 使用量统计
  276. this.getSignPrroductYearUsedProduceState();
  277. },
  278. getOrderWarnOption(list){
  279. var fontSize = 12
  280. var fontColor = "#999999"
  281. return {
  282. color:["#0079FF","#FF723A","#EA1C43"],
  283. title: {
  284. show:false
  285. },
  286. grid:{
  287. top:"5%",
  288. left:"5%",
  289. right:"5%",
  290. bottom:"5%",
  291. },
  292. tooltip: {
  293. show:true
  294. },
  295. legend: {
  296. data:list.map(item=>item.name),
  297. icon:"rect",
  298. orient:"vertical",
  299. top:"middle",
  300. right:"10%",
  301. itemWidth:fontSize,
  302. itemHeight:fontSize,
  303. textStyle:{
  304. fontSize:fontSize,
  305. color:fontColor,
  306. },
  307. formatter(name){
  308. return name+" " + list.filter(item=>item.name == name)[0].num
  309. },
  310. },
  311. series: [
  312. {
  313. type: 'pie',
  314. silent:0,
  315. radius: ["40%", '90%'],
  316. center: ["30%", '50%'],
  317. label:{
  318. position:'inside',
  319. formatter:"{d}%",
  320. },
  321. itemStyle:{
  322. borderColor:"#ffffff",
  323. borderWidth:2,
  324. },
  325. data: list.filter(item=>{
  326. item.value = item.num
  327. return item
  328. }),
  329. },
  330. ]
  331. }
  332. },
  333. getCysOrderOption(list){
  334. var fontSize=8;
  335. return {
  336. color:["#7190F6","#FF723A","#EA1C43"],
  337. title: {
  338. show:false
  339. },
  340. grid:{
  341. top:"5%",
  342. left:"8%",
  343. right:"5%",
  344. bottom:"14%",
  345. },
  346. xAxis: {
  347. type: 'category',
  348. axisTick:{show:false,},
  349. axisLine:{lineStyle:{color:"#DEE3FF",}},
  350. axisLabel:{color:"#999999", fontSize,interval: 0},
  351. data: list.map(item=>item.name),
  352. },
  353. yAxis: {
  354. type: 'value',
  355. splitLine:{lineStyle:{color:"#DEE3FF",}},
  356. axisLabel:{color:"#999999", fontSize,},
  357. },
  358. series: [
  359. {
  360. type: 'bar',
  361. barMaxWidth:30,
  362. barMinHeight:10,
  363. data: list.map(item=>item.orderNum),
  364. },
  365. ]
  366. }
  367. },
  368. setTemp(temperature) {
  369. var that = this;
  370. that.ecWen = that.selectComponent('#ecDomWen');
  371. that.ecWen.init((canvas, width, height, dpr) => {
  372. const chart = echarts.init(canvas, null, {
  373. width: width,
  374. height: height,
  375. devicePixelRatio: dpr // new
  376. });
  377. var option = that.getTempOption();
  378. option.xAxis.data = temperature.map(v => v.createTime.replace(" ", "\n"));
  379. option.series[0].data = temperature.map(v => v.temp);
  380. chart.setOption(option);
  381. that.wenChart = chart;
  382. return chart;
  383. });
  384. },
  385. showMap(markers) {
  386. var that = this;
  387. var token = wx.getStorageSync('token');
  388. this.mapCtx = wx.createMapContext('home_map');
  389. var points = []
  390. for (var i in markers) {
  391. if(i==0){
  392. points.push({
  393. width:54,
  394. height:54,
  395. latitude:Number(markers[i].lat),
  396. longitude:Number(markers[i].lng),
  397. iconPath:"/img/map_icon1.png",
  398. })
  399. }
  400. else if(i == markers.length-1){
  401. points.push({
  402. width:54,
  403. height:54,
  404. latitude:Number(markers[i].lat),
  405. longitude:Number(markers[i].lng),
  406. iconPath:"/img/index_icon_1000.png",
  407. })
  408. }
  409. markers[i].latitude = Number(markers[i].lat)
  410. markers[i].longitude = Number(markers[i].lng)
  411. delete markers[i].lat
  412. delete markers[i].lng
  413. }
  414. that.setData({
  415. markers:points,
  416. polyline: [{
  417. color: '#2D59E6',
  418. width: 2,
  419. points: markers,
  420. }],
  421. latitude:markers.length != 0 ? markers[0].latitude : '',
  422. longitude:markers.length != 0 ? markers[0].longitude : ''
  423. });
  424. that.mapCtx.includePoints({
  425. points: markers || [],
  426. padding: [50, 50, 50, 50]
  427. })
  428. },
  429. noLogin() {
  430. var temp = [
  431. {temp: '23.3',createTime: "2021-12-03 17:06:40"},
  432. {temp: '23.2', createTime: "2021-12-03 17:08:10"},
  433. {temp: '23.1', createTime: "2021-12-03 17:09:40"},
  434. {temp: '23.1', createTime: "2021-12-03 17:11:10"},
  435. {temp: '23.3', createTime: "2021-12-03 17:12:40"},
  436. {temp:' 23.2', createTime: "2021-12-03 17:14:10"},
  437. {temp: '23.3', createTime: "2021-12-03 17:15:40"},
  438. {temp: '23.3', createTime: "2021-12-03 17:18:40"},
  439. {temp: '23.2', createTime: "2021-12-03 17:26:10"},
  440. {temp: '23.2', createTime: "2021-12-03 17:32:10"}
  441. ]
  442. //设备定位列表
  443. var markerList = [{
  444. id: 1,
  445. lat: "49.828921",
  446. lng: "122.956163",
  447. lastTemp: 29.2,
  448. transportType: '10',
  449. status: '10',
  450. },
  451. {
  452. id: 2,
  453. lat: "39.898959",
  454. lng: "116.188584",
  455. lastTemp: 19.2,
  456. transportType: '40',
  457. status: '00',
  458. },
  459. {
  460. id: 3,
  461. lat: "29.828457",
  462. lng: "120.495225",
  463. lastTemp: 29.3,
  464. transportType: '40',
  465. status: '10',
  466. },
  467. {
  468. id: 4,
  469. lat: "21.358161",
  470. lng: "111.003038",
  471. lastTemp: 29.5,
  472. transportType: '30',
  473. status: '20',
  474. },
  475. {
  476. id: 5,
  477. lat: "38.948484",
  478. lng: "120.846788",
  479. lastTemp: 29.8,
  480. transportType: '20',
  481. status: '10',
  482. },
  483. {
  484. id: 6,
  485. lat: "33.785733",
  486. lng: "104.850694",
  487. lastTemp: 28.2,
  488. transportType: '10',
  489. status: '00',
  490. },
  491. {
  492. id: 7,
  493. lat: "29.225357",
  494. lng: "121.306968",
  495. lastTemp: 27.2,
  496. transportType: '30',
  497. status: '00',
  498. },
  499. ]
  500. this.showMap(markerList);
  501. this.setData({
  502. chainTempList:temp,
  503. tempList:temp,
  504. },()=>{
  505. this.setTemp(temp);
  506. })
  507. //地区产品统计
  508. this.setCardLeftFive({
  509. name:['北京', '云南', '广州', '辽宁', '山东', '重庆'],
  510. data:[
  511. {name:'2022',data:[18203, 23489, 29034, 104970, 131744, 630230]},
  512. {name:'2012',data:[19325, 23438, 31000, 121594, 134141, 681807]},
  513. ]
  514. });
  515. const cardTwo_leftOne = [
  516. {stack: 0, end: 1, productName: "阿莫西林", trans: 0},
  517. {stack: 0, end: 1, productName: "红霉素", trans: 0},
  518. {stack: 0, end: 1, productName: "红霉素", trans: 0},
  519. ]
  520. this.setCard_two_left_one(cardTwo_leftOne);
  521. // 主产品正常、预警统计
  522. this.setCardEightBar([
  523. {normal: 1, warning: 0, product_name: "阿莫西林"},
  524. {normal: 0, warning: 1, product_name: "红霉素"},
  525. {normal: 1, warning: 9, product_name: "新型冠状病毒疫苗"}
  526. ]);
  527. var list = [
  528. {product_name: "阿莫西林",data:[{data: 1,index: 39,color:"#2D59E6"},{data:1,index:872,color:"#71CCFF"}]},
  529. {product_name: "红霉素",data:[{data:1,index: 266,color: "#2D59E6"},{data: 1,index: 862,color:"#71CCFF"}]},
  530. {product_name: "新型冠状病毒疫苗",data:[{data:10,index: 555, color: "#2D59E6"},{data:1,index:200,color:"#71CCFF"}]},
  531. ];
  532. for (let index = 0; index < list.length; index++) {
  533. for (let lindex = 0; lindex < list[index].data.length; lindex++) {
  534. var color = list[index].data[lindex].color;
  535. var total = list[index].data[lindex].data;
  536. var itemIndex = list[index].data[lindex].index;
  537. that.setCardFivePie_rght(color,total,itemIndex);
  538. }
  539. }
  540. var seriesSixBar = [
  541. {name: 2022, type: "line", stack: "Total",data:[1, 1, 6]},
  542. {name: 2021, type: "line", stack: "Total",data:[4, 0,0]},
  543. ]
  544. var cardSixLineList = ["阿莫西林", "红霉素", "新型冠状病毒疫苗"];
  545. this.setCardSixBar(seriesSixBar,cardSixLineList);
  546. },
  547. showMap1(markers) {
  548. var that = this;
  549. var token = wx.getStorageSync('token');
  550. this.mapCtx = wx.createMapContext('home_map');
  551. for (var i in markers) {
  552. markers[i].bId = markers[i].id
  553. markers[i].id = Number(i)
  554. markers[i].width = 54
  555. markers[i].height = 54
  556. markers[i].iconPath = "/img/index_icon_" + markers[i].transportType + '' + markers[i].status + ".png"
  557. markers[i].latitude = Number(markers[i].lat)
  558. markers[i].longitude = Number(markers[i].lng)
  559. delete markers[i].lat
  560. delete markers[i].lng
  561. }
  562. that.setData({
  563. markers,
  564. latitude:markers.length != 0 ? markers[0].latitude : '',
  565. longitude:markers.length != 0 ? markers[0].longitude : ''
  566. },()=>{
  567. if(markers.length!=0 && token){
  568. //地图数据加载完成后,获取第一条数据的详情
  569. that.getListInfo(markers[0].bId);
  570. that.getListChainTemperature(markers[0].bId);
  571. }else{
  572. var temp = [
  573. {temp: '23.3',createTime: "2021-12-03 17:06:40"},
  574. {temp: '23.2', createTime: "2021-12-03 17:08:10"},
  575. {temp: '23.1', createTime: "2021-12-03 17:09:40"},
  576. {temp: '23.1', createTime: "2021-12-03 17:11:10"},
  577. {temp: '23.3', createTime: "2021-12-03 17:12:40"},
  578. {temp:' 23.2', createTime: "2021-12-03 17:14:10"},
  579. {temp: '23.3', createTime: "2021-12-03 17:15:40"},
  580. {temp: '23.3', createTime: "2021-12-03 17:18:40"},
  581. {temp: '23.2', createTime: "2021-12-03 17:26:10"},
  582. {temp: '23.2', createTime: "2021-12-03 17:32:10"}
  583. ]
  584. that.setTemp(temp)
  585. }
  586. });
  587. that.mapCtx.includePoints({
  588. points: markers,
  589. padding: [50, 50, 50, 50]
  590. })
  591. },
  592. getMapInfo(e) {
  593. var that = this;
  594. var index = e.detail.markerId;
  595. if (that.data.token) {
  596. for (var i in that.data.markers) {
  597. if (that.data.markers[i].id == index) {
  598. //冷链信息
  599. that.getListInfo(that.data.markers[i].bId);
  600. //冷链温度曲线
  601. that.getListChainTemperature(that.data.markers[i].bId);
  602. return;
  603. }
  604. }
  605. } else {
  606. wx.navigateTo({
  607. url: '/pages/login/login',
  608. })
  609. }
  610. },
  611. onPageScroll:function(e){
  612. this.setData({
  613. scrollTop:e.scrollTop
  614. })
  615. },
  616. getList() {
  617. var that = this;
  618. app.requestP({
  619. url: '/index/listChainLocal',
  620. method: 'post',
  621. contentType: ' application/json'
  622. }).then(res => {
  623. var result = []
  624. res.data.data && res.data.data.map(item=>{
  625. if(item.lng != 0 && item.lat != 0){
  626. result.push(item)
  627. }
  628. })
  629. that.showMap(result);
  630. }).catch(err=>{
  631. app.showToptip(that,'error',err.data.msg)
  632. })
  633. },
  634. getListInfo(id) {
  635. var that = this;
  636. app.requestP({
  637. url: '/index/getChainInfo',
  638. method: 'post',
  639. contentType: 'application/json',
  640. data: {
  641. id
  642. }
  643. }).then(res => {
  644. const {
  645. name,
  646. status,
  647. updateTime,
  648. lastTemperature,
  649. minTemperature,
  650. maxTemperature
  651. } = res.data.data;
  652. that.setData({ //数据处理
  653. mapTopData: {
  654. name: name || '暂无',
  655. status: status == '00' ? '正常' : status == '10' ? '黄色预警' : status == '20' ? '红色预警' : '暂无',
  656. updateTime: updateTime || '暂无',
  657. lastTemperature: lastTemperature ? lastTemperature + '℃' : '暂无',
  658. minTemperature: minTemperature ? minTemperature + '℃' : '暂无',
  659. maxTemperature: maxTemperature || '暂无'
  660. },
  661. })
  662. }).catch(err=>{
  663. app.showToptip(that,'error',err.data.msg)
  664. })
  665. },
  666. getListChainTemperature(id) {
  667. var that = this;
  668. app.requestP({
  669. url: '/index/listChainTemperature',
  670. method: 'post',
  671. contentType: 'application/json',
  672. data: {
  673. id
  674. },
  675. }).then(res => {
  676. that.setData({
  677. chainTempList: res.data.data,
  678. tempList:res.data.data
  679. })
  680. that.setTemp(res.data.data);
  681. }).catch(err => {
  682. app.showToptip(that, 'error', '暂无温度数据');
  683. })
  684. },
  685. setTransOption(temperature) {
  686. var that = this;
  687. that.ecWen = that.selectComponent('#llzsChartDom');
  688. that.ecWen.init((canvas, width, height, dpr) => {
  689. const chart = echarts.init(canvas, null, {
  690. width: width,
  691. height: height,
  692. devicePixelRatio: dpr
  693. });
  694. var option = that.getTransOption();
  695. option.xAxis.data = temperature.map(v => v.productTypeName);
  696. option.series[0].data = temperature.map(v => v.state10);
  697. option.series[1].data = temperature.map(v => v.state11);
  698. option.series[2].data = temperature.map(v => v.state20);
  699. chart.setOption(option);
  700. that.wenChart = chart;
  701. return chart;
  702. });
  703. },
  704. getTransOption() {
  705. return {
  706. title: {
  707. text: '数量',
  708. textStyle: {
  709. color: '#74788D',
  710. fontWeight: 'normal',
  711. fontSize: '16rpx'
  712. }
  713. },
  714. tooltip: {
  715. show: false,
  716. trigger: 'axis'
  717. },
  718. color: ['#7661FF', '#5AC8FA', '#00B972'],
  719. legend: {
  720. data: ['全程温控', '实时追溯', '追溯标签'],
  721. icon: "rect", // 设置形状 类型包括 circle,rect ,roundRect,triangle
  722. itemHeight: 11,
  723. itemWidth: 11,
  724. align: 'left',
  725. itemGap: 5,
  726. right: 10,
  727. top: 0,
  728. textStyle:{
  729. color:'#999',
  730. }
  731. },
  732. grid: {
  733. left: '0%',
  734. right: '0%',
  735. bottom: '3%',
  736. containLabel: true
  737. },
  738. xAxis: {
  739. type: 'category',
  740. nameTextStyle: {
  741. color: "#77869E",
  742. fontSize: 10
  743. },
  744. axisLine: {
  745. onZero: false,
  746. lineStyle: {
  747. color: "#999"
  748. }
  749. },
  750. axisTick: {
  751. show: false
  752. },
  753. splitLine: {
  754. show: false,
  755. },
  756. data: ["产品一", "产品二", "产品三", "产品四"],
  757. },
  758. yAxis: [{
  759. type: 'value'
  760. }],
  761. series: [{
  762. name: '追溯标签',
  763. type: 'bar',
  764. label: {
  765. show: true,
  766. position: 'top'
  767. },
  768. symbolSize: '0',
  769. lineStyle: {
  770. width: 1
  771. },
  772. data: [50, 180, 290, 50]
  773. },
  774. {
  775. name: '全程温控',
  776. type: 'bar',
  777. label: {
  778. show: true,
  779. position: 'top'
  780. },
  781. symbolSize: '0',
  782. lineStyle: {
  783. width: 1
  784. },
  785. data: [200, 200, 292, 200]
  786. }, {
  787. name: '实时追溯',
  788. type: 'bar',
  789. label: {
  790. show: true,
  791. position: 'top'
  792. },
  793. symbolSize: '0',
  794. lineStyle: {
  795. width: 1
  796. },
  797. data: [248, 290, 290, 240]
  798. }
  799. ]
  800. }
  801. },
  802. getTempOption() {
  803. return {
  804. title: {
  805. text: '温度:℃',
  806. textStyle: {
  807. color: '#999',
  808. fontSize: 6,
  809. }
  810. },
  811. grid: {
  812. top: "20%",
  813. left: "4%",
  814. right: "5%",
  815. bottom: "3%",
  816. containLabel: true
  817. },
  818. xAxis: {
  819. type: 'category',
  820. // boundaryGap: false,
  821. nameTextStyle: {
  822. color: "#77869E",
  823. fontSize: 4
  824. },
  825. axisLine: {
  826. onZero: false,
  827. lineStyle: {
  828. color: "#cccccc"
  829. }
  830. },
  831. axisTick: {
  832. show: false
  833. },
  834. splitLine: {
  835. show: false,
  836. },
  837. axisLabel: {
  838. show: true,
  839. textStyle: {
  840. color: '#999', //更改坐标轴文字颜色
  841. fontSize: 5, //更改坐标轴文字大小
  842. }
  843. },
  844. 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'],
  845. // show: false
  846. },
  847. yAxis: {
  848. type: 'value',
  849. splitNumber: 10,
  850. max: 40,
  851. axisLine: {
  852. lineStyle: {
  853. color: "#cccccc",
  854. },
  855. show: true
  856. },
  857. axisLabel: {
  858. show: true,
  859. textStyle: {
  860. color: '#999', //更改坐标轴文字颜色
  861. fontSize: 5, //更改坐标轴文字大小
  862. }
  863. },
  864. splitLine: {
  865. show: false
  866. }
  867. },
  868. series: [{
  869. type: 'line',
  870. showSymbol: false,
  871. smooth: true,
  872. lineStyle: {
  873. width: 1,
  874. color: "#328EFD", //#D4D4D4
  875. },
  876. areaStyle: {
  877. origin: "start",
  878. color: {
  879. type: 'linear',
  880. x: 0,
  881. y: 0,
  882. x2: 0,
  883. y2: 1,
  884. colorStops: [{
  885. offset: 0,
  886. color: '#FFFFFF' //
  887. }, {
  888. offset: 1,
  889. color: '#4C96FE' //#D4D4D4
  890. }],
  891. global: false
  892. }
  893. },
  894. data: [18, 36, 25, 30, -20, 40, 33]
  895. }]
  896. }
  897. },
  898. productTypeChipCount(userId) {
  899. var that = this;
  900. app.requestP({
  901. url: '/index/productTypeChipCount',
  902. method: 'post',
  903. data: {
  904. userId
  905. }
  906. }).then(res => {
  907. that.setData({
  908. productTypeChipCount: res.data.data
  909. })
  910. const temperature = res.data.data;
  911. that.setPieChart(temperature.slice(0,6));
  912. }).catch(err => {
  913. that.setData({
  914. productTypeChipCount: []
  915. })
  916. })
  917. },
  918. setPieChart(temperature) {
  919. var that = this;
  920. var num = 0;
  921. var color = ['#45C2E0', '#C1EBDD', '#FFC851','#5A5476','#1869A0','#FF9393'];
  922. temperature.map(v => num += v.num);
  923. that.ecWen = that.selectComponent('#pieDom');
  924. that.ecWen.init((canvas, width, height, dpr) => {
  925. const chart = echarts.init(canvas, null, {
  926. width: width,
  927. height: height,
  928. devicePixelRatio: dpr
  929. });
  930. var option = that.getPieChartOption();
  931. option.color = color;
  932. option.series[0].data = temperature.map(v => {
  933. var per = v.num / num * 100;
  934. return {
  935. value:v.num,
  936. name: v.productTypeName+':'+ v.num + ' 占比' + per.toFixed(2) + '%'
  937. }
  938. });
  939. chart.setOption(option);
  940. that.wenChart = chart;
  941. return chart;
  942. });
  943. },
  944. getPieChartOption() {
  945. return {
  946. legend: {
  947. top: 'bottom',
  948. show: false,
  949. },
  950. grid: {
  951. left: '0%',
  952. right: '0%',
  953. bottom: '3%',
  954. containLabel: true
  955. },
  956. // color:['#45C2E0', '#C1EBDD', '#FFC851','#5A5476','#1869A0','#FF9393'],
  957. series: [{
  958. type: 'pie',
  959. radius: [30, 60],
  960. center: ['50%', '50%'],
  961. itemStyle: {
  962. normal: {
  963. label: {
  964. formatter: function (v) {
  965. //文字中遇到空格就换行
  966. let text = v.name.split(" ").join("\n");
  967. return text;
  968. },
  969. show: true,
  970. },
  971. labelLine: {
  972. show: true,
  973. color:''
  974. }
  975. },
  976. },
  977. emphasis: {
  978. itemStyle: {
  979. shadowBlur: 10,
  980. shadowOffsetX: 0,
  981. shadowColor: 'rgba(0, 0, 0, 0.5)'
  982. },
  983. },
  984. data: [{
  985. value: 40,
  986. itemStyle:{
  987. normal:{
  988. color:'#45C2E0'
  989. }
  990. }
  991. },
  992. {
  993. value: 38,
  994. },
  995. {
  996. value: 32,
  997. },
  998. {
  999. value: 30,
  1000. },
  1001. ]
  1002. }]
  1003. }
  1004. },
  1005. getChainStatus(userId) {
  1006. var that = this;
  1007. app.requestP({
  1008. url: '/index/getChainStatus',
  1009. method: 'post',
  1010. data: {
  1011. userId
  1012. }
  1013. }).then(res => {
  1014. const {
  1015. alarmDTO,
  1016. temperatureDTO,
  1017. waringDTO,
  1018. inTrans,
  1019. inStore,
  1020. inEnd,
  1021. total
  1022. } = res.data.data;
  1023. that.setData({
  1024. temperatureDTO,
  1025. waringDTO,
  1026. inTrans,
  1027. inStore,
  1028. inEnd,
  1029. total
  1030. })
  1031. }).catch(err=>{
  1032. app.showToptip(that,'error',err.data.msg)
  1033. })
  1034. },
  1035. getWarningState(userId) {
  1036. var that = this;
  1037. app.requestP({
  1038. url: '/index/warningState',
  1039. method: 'post',
  1040. data: {
  1041. userId
  1042. }
  1043. }).then(res => {
  1044. const {
  1045. error11,
  1046. error20,
  1047. total10,
  1048. total11,
  1049. total20,
  1050. warning11,
  1051. warning20
  1052. } = res.data.data;
  1053. that.setData({
  1054. error11,
  1055. error20,
  1056. total10,
  1057. total11,
  1058. total20,
  1059. warning11,
  1060. warning20
  1061. }, () => {
  1062. // that.canvasRingA.showCanvasRing();
  1063. // that.canvasRingB.showCanvasRing();
  1064. // that.canvasRingC.showCanvasRing();
  1065. // that.canvasRingD.showCanvasRing();
  1066. // that.canvasRingE.showCanvasRing();
  1067. // that.canvasRingF.showCanvasRing();
  1068. // that.canvasRingG.showCanvasRing();
  1069. // that.canvasRingL.showCanvasRing();
  1070. })
  1071. }).catch(err=>{
  1072. app.showToptip(that,'error',err.data.msg)
  1073. })
  1074. },
  1075. setMapCenter() {
  1076. var that = this;
  1077. var locations = that.data.markers;
  1078. that.mapCtx.includePoints({
  1079. points: locations,
  1080. padding: [50, 50, 50, 50]
  1081. })
  1082. },
  1083. getUserInfo() {
  1084. var that = this;
  1085. app.requestP({
  1086. method: "post",
  1087. url: "/user/getUserInfo",
  1088. }).then(function (res) {
  1089. var userId = res.data.data.userId;
  1090. // that.getProductChipState();
  1091. that.productTypeChipCount(userId);
  1092. that.getChainStatus(userId);
  1093. // that.getWarningState(userId);
  1094. }).catch(err => {
  1095. app.showToptip(that, 'error', '请刷新重试');
  1096. })
  1097. },
  1098. transportationInfo() {
  1099. var token = wx.getStorageSync('token');
  1100. if(!token){
  1101. wx.navigateTo({
  1102. url: '/pages/login/login',
  1103. })
  1104. return;
  1105. }
  1106. var transportationJson = JSON.stringify(this.data.productChipStateList);
  1107. wx.navigateTo({
  1108. url: '/pages/index/transportationInfo/transportationInfo?list=' + transportationJson,
  1109. })
  1110. },
  1111. monitoringNum() {
  1112. var token = wx.getStorageSync('token');
  1113. if(!token){
  1114. wx.navigateTo({
  1115. url: '/pages/login/login',
  1116. })
  1117. return;
  1118. }
  1119. var productTypeChipCountJson = JSON.stringify(this.data.productTypeChipCount);
  1120. wx.navigateTo({
  1121. url: '/pages/index/monitoringNum/monitoringNum?list=' + productTypeChipCountJson,
  1122. })
  1123. },
  1124. packageInfo(){
  1125. var token = wx.getStorageSync('token');
  1126. if(!token){
  1127. wx.navigateTo({
  1128. url: '/pages/login/login',
  1129. })
  1130. return;
  1131. }
  1132. var packageList = JSON.stringify(this.data.packageList);
  1133. wx.navigateTo({
  1134. url: '/pages/index/packageInfo/packageinfo?list=' + packageList,
  1135. })
  1136. },
  1137. expressInfo(){
  1138. var token = wx.getStorageSync('token');
  1139. if(!token){
  1140. wx.navigateTo({
  1141. url: '/pages/login/login',
  1142. })
  1143. return;
  1144. }
  1145. var expressData = JSON.stringify(this.data.expressData);
  1146. var title = JSON.stringify([{name:'出库',type:'o'},{name:'入库',type:'i'}]);
  1147. var titleName = JSON.stringify({titleName:'出入库统计'});
  1148. wx.navigateTo({
  1149. url: '/pages/index/statics/statics?list=' +encodeURIComponent(expressData)+'&title='+title+'&titleName='+titleName,
  1150. })
  1151. },
  1152. goAbnormal(){
  1153. wx.navigateTo({
  1154. url: '/pages/index/abnormal/abnormal',
  1155. })
  1156. },
  1157. ordersInfo(){
  1158. wx.navigateTo({
  1159. url: '/pages/index/ordersList/ordersList',
  1160. })
  1161. },
  1162. transporDetails(){
  1163. var temp = this.data.temp;
  1164. var productName = this.data.productName;
  1165. var {product10,product20,product30,product40,product50} = this.data;
  1166. var token = wx.getStorageSync('token');
  1167. if(!token){
  1168. wx.navigateTo({
  1169. url: '/pages/login/login',
  1170. })
  1171. return;
  1172. }
  1173. wx.navigateTo({
  1174. url: '/pages/index/transporDetails/transporDetails?temp='+encodeURIComponent(JSON.stringify(temp))+'&productName='+encodeURIComponent(JSON.stringify(productName))+'&productNum='+encodeURIComponent(JSON.stringify([product10,product20,product30,product40,product50])),
  1175. })
  1176. },
  1177. onShareAppMessage() {
  1178. return {
  1179. title: 'cover-view',
  1180. }
  1181. },
  1182. monitoringNum() {
  1183. var token = wx.getStorageSync('token');
  1184. if(!token){
  1185. wx.navigateTo({
  1186. url: '/pages/login/login',
  1187. })
  1188. return;
  1189. }
  1190. var transportCityDataJson = JSON.stringify(this.data.transportCityData);
  1191. wx.navigateTo({
  1192. url: '/pages/index/monitoringNum/monitoringNum?list=' + transportCityDataJson,
  1193. })
  1194. },
  1195. getNewsList() {
  1196. var that = this;
  1197. app.requestP({
  1198. url: '/query/news',
  1199. method: 'post',
  1200. needToken: false,
  1201. data: {
  1202. keyword: '',
  1203. pageNum: '1',
  1204. pageSize: '5'
  1205. }
  1206. }).then(res => {
  1207. that.setData({
  1208. newsList: res.data.data.map(item => {
  1209. return {
  1210. ...item,
  1211. createTime: item.createTime.substring(item.createTime.length - 8)
  1212. }
  1213. })
  1214. })
  1215. }).catch(err => {
  1216. app.showToptip(that, 'error', err.data.msg)
  1217. })
  1218. },
  1219. goNewsInfo(e) {
  1220. var id = e.currentTarget.dataset.id;
  1221. wx.navigateTo({
  1222. url: '/pages/index/newsInfo/newsInfo?id=' + id,
  1223. })
  1224. },
  1225. goNewsList() {
  1226. wx.navigateTo({
  1227. url: '/pages/index/newList/newList',
  1228. })
  1229. },
  1230. getUserDefaultMenuList() {
  1231. var that = this;
  1232. app.requestP({
  1233. url: '/userDeaultMenu/list',
  1234. method: 'post',
  1235. }).then(res => {
  1236. that.setData({
  1237. systemMenu: res.data.data
  1238. })
  1239. }).catch(err => {
  1240. app.showToptip(that, 'error', err.data.msg)
  1241. })
  1242. },
  1243. tapMenu(e) {
  1244. let type = e.currentTarget.dataset.type
  1245. let path = e.currentTarget.dataset.path;
  1246. //判断token,若有则假设已经登录
  1247. if (!wx.getStorageSync('token')) {
  1248. wx.redirectTo({
  1249. url: '/pages/login/login',
  1250. })
  1251. return;
  1252. }
  1253. //获取用户信息,判断userInfo是否过期
  1254. let userInfo = wx.getStorageSync('userInfo');
  1255. const {
  1256. loginRole,
  1257. ifOverFlow,
  1258. status
  1259. } = userInfo;
  1260. // this.matchPage(loginRole, ifOverFlow, status, path);
  1261. app.globalData.tabarData = {loginRole, ifOverFlow, status, path};
  1262. wx.switchTab({
  1263. url: '/pages/workbench/workbench',
  1264. })
  1265. },
  1266. goMessage:function(){
  1267. if(this.data.token){
  1268. wx.navigateTo({
  1269. url: '/pages/news/newList',
  1270. })
  1271. }else{
  1272. wx.redirectTo({
  1273. url: '/pages/login/login',
  1274. })
  1275. }
  1276. },
  1277. // 沃森新
  1278. // 主产品查询
  1279. getsignProduct(){
  1280. app.requestP({
  1281. url: '/daping/signProduct',
  1282. method: 'post',
  1283. }).then(res => {
  1284. this.setData({
  1285. tabLeftTop:res.data.data
  1286. })
  1287. }).catch(err => {
  1288. app.showToptip(this,'err',err.data.msg)
  1289. })
  1290. },
  1291. // 主产品使用、库存、总数统计
  1292. getSignProductUseAndStackState(){
  1293. app.requestP({
  1294. url: '/daping/signProductUseAndStackState',
  1295. method: 'post',
  1296. }).then(res => {
  1297. this.setPie4Chart(res.data.data)
  1298. }).catch(err => {
  1299. app.showToptip(this,'err',err.data.msg)
  1300. })
  1301. },
  1302. setCard(e){
  1303. var index = e.currentTarget.dataset.index;
  1304. this.setData({
  1305. cardIndex:index,
  1306. // tabLeftTop_remark:this.data.tabLfeftTop[index].remark
  1307. })
  1308. },
  1309. //单一主产品不同地区使用情况
  1310. getSingleProductUseZoneStat(){
  1311. app.requestP({
  1312. url: '/daping/singleProductUseZoneState',
  1313. method: 'post',
  1314. }).then(res=>{
  1315. this.setCard_top_right_butChart(res.data.data);
  1316. this.setKLine(res.data.data);
  1317. }).catch(err=>{
  1318. app.showToptip(this,'err',err.data.msg)
  1319. })
  1320. },
  1321. setPie4Chart(list){
  1322. var that = this;
  1323. var series = [];
  1324. list.map((item,index)=>{
  1325. series.push(...that.pice4Chart("#23D9E9",index == 0 ? "20%" :index == 1 ? '50%':'80%',item.total,item.use_num,item.stack_num,item.name,'45%',))
  1326. });
  1327. that.pie4ChartConDom = that.selectComponent('#pie4ChartConDom');
  1328. that.pie4ChartConDom.init((canvas, width, height, dpr) => {
  1329. const chart = echarts.init(canvas, null, {
  1330. width: width,
  1331. height: height,
  1332. devicePixelRatio: dpr
  1333. });
  1334. chart.setOption({
  1335. title: {
  1336. show:false
  1337. },
  1338. grid:{
  1339. top:"0%",
  1340. left:"0%",
  1341. right:"0%",
  1342. bottom:"0%",
  1343. },
  1344. color: ["red", "rgb(10,92,170)", "rgb(114,205,255)"],
  1345. legend: {
  1346. icon:"rect",
  1347. top:10,
  1348. right:0,
  1349. itemWidth:20,
  1350. itemHeight:20,
  1351. textStyle:{
  1352. fontSize:16,
  1353. color: "#D1E9F5",
  1354. },
  1355. },
  1356. series:series,
  1357. });
  1358. return chart;
  1359. })
  1360. },
  1361. pice4Chart(color,pos,total,use_num,stack_num,name,top){
  1362. var that = this;
  1363. var placeHolderStyle = {
  1364. normal: {
  1365. label: {
  1366. show: false,
  1367. formatter: function (v) {
  1368. //文字中遇到空格就换行
  1369. let text = v.value;
  1370. return text;
  1371. },
  1372. },
  1373. labelLine: {
  1374. show: true,
  1375. },
  1376. },
  1377. };
  1378. const pieValue1 = {
  1379. value1:(stack_num+use_num) / total,
  1380. value2: 1 - (stack_num+use_num) / total
  1381. };
  1382. const pieValue2 = {
  1383. value1:use_num / total,
  1384. value2:1 - use_num / total
  1385. };
  1386. const pieValue3 = {
  1387. value1: stack_num / total,
  1388. value2: 1 - stack_num / total
  1389. };
  1390. return [{
  1391. type: "pie",
  1392. clockWise: true, //顺时加载
  1393. hoverAnimation: false, //鼠标移入变大
  1394. silent:false,
  1395. radius: [20, 23],
  1396. center: [pos, top],
  1397. itemStyle: placeHolderStyle,
  1398. data: [
  1399. {
  1400. value: pieValue1.value1,
  1401. itemStyle:{
  1402. normal:{
  1403. color:'#0e74ff'
  1404. }
  1405. }
  1406. },
  1407. {
  1408. value: pieValue1.value2,
  1409. itemStyle:{
  1410. normal:{
  1411. color:"rgb(243,243,251)"
  1412. }
  1413. }
  1414. }
  1415. ],
  1416. },{
  1417. type: "pie",
  1418. clockWise: true, //顺时加载
  1419. hoverAnimation: false, //鼠标移入变大
  1420. radius: [15, 18],
  1421. silent:false,
  1422. center: [pos, top],
  1423. itemStyle: placeHolderStyle,
  1424. data: [
  1425. {
  1426. value: pieValue2.value1,
  1427. itemStyle:{
  1428. normal:{
  1429. color:'#64a6ff'
  1430. }
  1431. }
  1432. },
  1433. {
  1434. value: pieValue2.value2,
  1435. itemStyle:{
  1436. normal:{
  1437. color:"rgb(243,243,251)"
  1438. }
  1439. }
  1440. }
  1441. ],
  1442. },
  1443. {
  1444. type: "pie",
  1445. clockWise: true, //顺时加载
  1446. hoverAnimation: false, //鼠标移入变大
  1447. silent:false,
  1448. radius: [10, 13],
  1449. center: [pos, top],
  1450. itemStyle: placeHolderStyle,
  1451. data: [
  1452. {
  1453. value: pieValue3.value1,
  1454. itemStyle:{
  1455. normal:{
  1456. color:'red'
  1457. }
  1458. }
  1459. },
  1460. {
  1461. value: pieValue3.value2,
  1462. itemStyle:{
  1463. normal:{
  1464. color:"rgb(243,243,251)"
  1465. }
  1466. }
  1467. }
  1468. ],
  1469. }]
  1470. },
  1471. setCard_top_right_butChart(list){
  1472. var that = this;
  1473. that.selectComponent('#cardBarChartConDom').init((canvas, width, height, dpr) => {
  1474. const chart = echarts.init(canvas, null, {
  1475. width: width,
  1476. height: height,
  1477. devicePixelRatio: dpr
  1478. });
  1479. list = list.map(item=>{
  1480. return {orderNum:item.total,name:item.city || 'N/A'}
  1481. })
  1482. var option = that.getCysOrderOption(list);
  1483. option.series = [{
  1484. type:'bar',
  1485. barMaxWidth: 15,
  1486. barMinHeight: 10,
  1487. data:list.map(item=>item.orderNum),
  1488. label: {
  1489. show: true,
  1490. position: 'inside'
  1491. },
  1492. itemStyle:{
  1493. normal:{color:'#333FFF'}
  1494. }
  1495. }]
  1496. chart.setOption(option);
  1497. return chart;
  1498. });
  1499. },
  1500. // 图5 主产品在库、在途、结束统计
  1501. getSignProductState(){
  1502. app.requestP({
  1503. url: '/daping/signProductState',
  1504. method: 'post',
  1505. }).then(res=>{
  1506. this.setCard_two_left_one(res.data.data);
  1507. this.setKLine(res.data.data);
  1508. }).catch(err=>{
  1509. app.showToptip(this,'err',err.data.msg)
  1510. })
  1511. },
  1512. setCard_two_left_one(list){
  1513. var that = this;
  1514. that.selectComponent('#product_two_left_one').init((canvas, width, height, dpr) => {
  1515. const chart = echarts.init(canvas, null, {
  1516. width: width,
  1517. height: height,
  1518. devicePixelRatio: dpr
  1519. });
  1520. var option = that.getStaticBarChart();
  1521. option.legend = {
  1522. data:['在库','在途','结束'],
  1523. icon:"circle",
  1524. top:"2%",
  1525. right:"auto",
  1526. itemWidth:8,
  1527. itemHeight:8,
  1528. textStyle:{
  1529. fontSize:8,
  1530. color:'#485465',
  1531. },
  1532. }
  1533. option.color = ['#2D59E6','#FFAF36','#7FD1FF']
  1534. option.grid.top='20%';
  1535. option.grid.bottom='13%';
  1536. option.series = [];
  1537. option.xAxis.data = [];
  1538. const echartsData = [
  1539. {name:'在库',data:list.map(item=>item.stack)},
  1540. {name:'结束',data:list.map(item=>item.end)},
  1541. {name:'在途',data:list.map(item=>item.trans)}
  1542. ]
  1543. option.xAxis.data = list.map(item=>item.productName);
  1544. echartsData.map((item,index)=>{
  1545. option.series.push({
  1546. name:item.name,
  1547. type: "bar",
  1548. stack: "Ad",
  1549. emphasis: {
  1550. focus: "series",
  1551. },
  1552. data:item.data
  1553. })
  1554. })
  1555. chart.setOption(option);
  1556. return chart;
  1557. })
  1558. },
  1559. product_two_left_two(list){
  1560. var that = this;
  1561. that.selectComponent('#product_two_left_two').init((canvas, width, height, dpr) => {
  1562. const chart = echarts.init(canvas, null, {
  1563. width: width,
  1564. height: height,
  1565. devicePixelRatio: dpr
  1566. });
  1567. var option = this.getStaticBarChart();
  1568. option.series = [];
  1569. option.legend = {
  1570. data:list.map(item=>item.name),
  1571. icon:"circle",
  1572. top:"2%",
  1573. right:"auto",
  1574. itemWidth:8,
  1575. itemHeight:8,
  1576. textStyle:{
  1577. fontSize:8,
  1578. color:'#485465',
  1579. },
  1580. }
  1581. option.grid.top='20%';
  1582. option.grid.bottom='13%';
  1583. list.map((item,index)=>{
  1584. option.series.push({
  1585. name:item.name,
  1586. type: index != list.length -1 ? 'bar' :'line',
  1587. // yAxisIndex: 1,
  1588. data:item.data
  1589. });
  1590. // if(index != list.length-1){
  1591. // delete option.series[index].yAxisIndex;
  1592. // }
  1593. })
  1594. chart.setOption(option);
  1595. return chart;
  1596. })
  1597. },
  1598. getStaticBarChart(){
  1599. return {
  1600. xAxis: {
  1601. type: "category",
  1602. axisTick:{show:false,},
  1603. nameTextStyle: {
  1604. color: "#77869E",
  1605. fontSize: 8,
  1606. },
  1607. axisLabel: {
  1608. color: '#999999',
  1609. fontSize: 8,
  1610. },
  1611. axisLine: {
  1612. onZero: false,
  1613. lineStyle: {
  1614. color: "#cccccc",
  1615. },
  1616. },
  1617. data: ["Mon", "Tue", "Wed", "Thu",],
  1618. },
  1619. yAxis: {
  1620. type: "value",
  1621. minInterval: 1,
  1622. axisLine: {
  1623. lineStyle: {
  1624. color: "#cccccc",
  1625. },
  1626. show: false,
  1627. },
  1628. axisLabel: {
  1629. color: "#999999",
  1630. fontSize: 8,
  1631. },
  1632. },
  1633. color: ["#7661FF", "#5AC8FA", "#00B972"],
  1634. grid: {
  1635. left: "3%",
  1636. top: "8%",
  1637. right: "4%",
  1638. bottom: "3%",
  1639. containLabel: true,
  1640. },
  1641. series: [
  1642. {
  1643. data: [120, 200, 150, 80, 70, 110, 130, 110],
  1644. type: "bar",
  1645. },
  1646. ],
  1647. };
  1648. },
  1649. setCardPieTwo(list){
  1650. var that = this;
  1651. that.selectComponent('#product_three_left_one').init((canvas, width, height, dpr) => {
  1652. const chart = echarts.init(canvas, null, {
  1653. width: width,
  1654. height: height,
  1655. devicePixelRatio: dpr
  1656. });
  1657. var option = this.getStaticPieChart();
  1658. var itemStyle = {
  1659. normal: {
  1660. label: {
  1661. show: true,
  1662. formatter: function (v) {
  1663. //文字中遇到空格
  1664. let text = v.name+'\n'+v.value;
  1665. return text;
  1666. },
  1667. },
  1668. labelLine: {
  1669. show: true,
  1670. length:4,
  1671. length2:4,
  1672. },
  1673. },
  1674. }
  1675. option.series = [
  1676. {
  1677. type: "pie",
  1678. radius: "40%",
  1679. center: ["50%", "25%"],
  1680. itemStyle,
  1681. label: {
  1682. position: "inside",
  1683. formatter: "{d}%",
  1684. fontSize: 8,
  1685. color: '#fff',
  1686. },
  1687. data: [
  1688. { name: "标签1", value: 50 },
  1689. { name: "标签2", value: 20 },
  1690. { name: "标签3", value: 10 },
  1691. ],
  1692. },
  1693. {
  1694. type: "pie",
  1695. radius: "40%",
  1696. center: ["50%", "75%"],
  1697. percentPrecision:0,
  1698. minShowLabelAngle:30,
  1699. itemStyle,
  1700. label: {
  1701. position: "inside",
  1702. formatter: "{d}%",
  1703. fontSize: 8,
  1704. color: '#fff',
  1705. },
  1706. data: [
  1707. { name: "标签1", value: 50 },
  1708. { name: "标签2", value: 20 },
  1709. { name: "标签3", value: 10 },
  1710. ],
  1711. },
  1712. ]
  1713. chart.setOption(option);
  1714. return chart;
  1715. })
  1716. },
  1717. getStaticPieChart(){
  1718. return {
  1719. color: ["#964CC4", "#04A3CC", "#3B6AD5"],
  1720. title: {
  1721. show: false,
  1722. },
  1723. grid: {
  1724. top: "12%",
  1725. left: "5%",
  1726. right: "5%",
  1727. bottom: "12%",
  1728. },
  1729. series: [
  1730. // {
  1731. // type: "pie",
  1732. // radius: "50%",
  1733. // center: ["50%", "25%"],
  1734. // label: {
  1735. // position: "inside",
  1736. // formatter: "{d}%",
  1737. // fontSize: 8,
  1738. // color: '#fff',
  1739. // },
  1740. // data: [
  1741. // { name: "在途", value: 50 },
  1742. // { name: "完成", value: 20 },
  1743. // { name: "待发运", value: 10 },
  1744. // ],
  1745. // },
  1746. // {
  1747. // type: "pie",
  1748. // radius: "50%",
  1749. // center: ["50%", "75%"],
  1750. // percentPrecision:0,
  1751. // minShowLabelAngle:30,
  1752. // label: {
  1753. // position: "inside",
  1754. // formatter: "{d}%",
  1755. // fontSize: 8,
  1756. // color: '#fff',
  1757. // },
  1758. // data: [
  1759. // { name: "在途", value: 50 },
  1760. // { name: "完成", value: 20 },
  1761. // { name: "待发运", value: 10 },
  1762. // ],
  1763. // },
  1764. ]
  1765. }
  1766. },
  1767. setCardFivePie(){
  1768. var that = this;
  1769. that.selectComponent('#product_five_left_one').init((canvas, width, height, dpr) => {
  1770. const chart = echarts.init(canvas, null, {
  1771. width: width,
  1772. height: height,
  1773. devicePixelRatio: dpr
  1774. });
  1775. var option = this.getStaticPieChart();
  1776. option.color = ['rgb(91,132,206)','rgb(127,210,255)','rgb(44,87,226)'];
  1777. var itemStyle = {
  1778. normal: {
  1779. label: {
  1780. show: false,
  1781. formatter: function (v) {
  1782. //文字中遇到空格
  1783. let text = v.name+'\n'+v.value;
  1784. return text;
  1785. },
  1786. },
  1787. labelLine: {
  1788. show: true,
  1789. length:4,
  1790. length2:4,
  1791. },
  1792. },
  1793. }
  1794. option.series = [
  1795. {
  1796. type: "pie",
  1797. radius: "80%",
  1798. center: ["50%", "30%"],
  1799. itemStyle,
  1800. label: {
  1801. position: "inside",
  1802. formatter: "{d}%",
  1803. fontSize: 8,
  1804. color: '#fff',
  1805. },
  1806. data: [
  1807. { name: "标签1", value: 50 },
  1808. { name: "标签2", value: 20 },
  1809. { name: "标签3", value: 10 },
  1810. ],
  1811. },
  1812. {
  1813. type: "pie",
  1814. radius: "80%",
  1815. center: ["50%", "53%"],
  1816. itemStyle,
  1817. data: [
  1818. { name: "标签1", value: 50 },
  1819. { name: "标签2", value: 20 },
  1820. { name: "标签3", value: 10 },
  1821. ],
  1822. },
  1823. {
  1824. type: "pie",
  1825. radius: "80%",
  1826. itemStyle,
  1827. center: ["50%", "77%"],
  1828. data: [
  1829. { name: "标签1", value: 50 },
  1830. { name: "标签2", value: 20 },
  1831. { name: "标签3", value: 10 },
  1832. ],
  1833. },
  1834. ]
  1835. option.grid = {
  1836. top: "12%",
  1837. left: "10%",
  1838. right: "0%",
  1839. bottom: "12%",
  1840. },
  1841. chart.setOption(option);
  1842. return chart;
  1843. })
  1844. },
  1845. setCard3dBar(){
  1846. var that = this;
  1847. that.selectComponent('#product_three_left_two').init((canvas, width, height, dpr) => {
  1848. const chart = echarts.init(canvas, null, {
  1849. width: width,
  1850. height: height,
  1851. devicePixelRatio: dpr
  1852. });
  1853. 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]]
  1854. chart.setOption({
  1855. tooltip: {},
  1856. xAxis3D: {
  1857. type: 'category',
  1858. 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']
  1859. },
  1860. yAxis3D: {
  1861. type: 'category',
  1862. data: ['Saturday', 'Friday', 'Thursday','Wednesday', 'Tuesday', 'Monday', 'Sunday']
  1863. },
  1864. zAxis3D: {
  1865. type: 'value'
  1866. },
  1867. grid3D: {
  1868. boxWidth: 200,
  1869. boxDepth: 80,
  1870. viewControl: {
  1871. // projection: 'orthographic'
  1872. },
  1873. light: {
  1874. main: {
  1875. intensity: 1.2,
  1876. shadow: true
  1877. },
  1878. ambient: {
  1879. intensity: 0.3
  1880. }
  1881. }
  1882. },
  1883. series: [
  1884. {
  1885. type: 'bar3D',
  1886. data: data.map(function (item) {
  1887. return {
  1888. value: [item[1], item[0], item[2]]
  1889. };
  1890. }),
  1891. shading: 'lambert',
  1892. label: {
  1893. fontSize: 16,
  1894. borderWidth: 1
  1895. },
  1896. emphasis: {
  1897. label: {
  1898. fontSize: 20,
  1899. color: '#900'
  1900. },
  1901. itemStyle: {
  1902. color: '#900'
  1903. }
  1904. }
  1905. }
  1906. ]
  1907. });
  1908. return chart;
  1909. })
  1910. },
  1911. setKLine(list){
  1912. var that = this;
  1913. that.selectComponent('#product_four').init((canvas, width, height, dpr) => {
  1914. const chart = echarts.init(canvas, null, {
  1915. width: width,
  1916. height: height,
  1917. devicePixelRatio: dpr
  1918. });
  1919. list = list.map(item=>{
  1920. return {orderNum:item.total,name:item.city || 'N/A'}
  1921. })
  1922. var option = that.getCysOrderOption(list);
  1923. // lenged
  1924. option.series = [{
  1925. type:'bar',
  1926. barMaxWidth: 15,
  1927. barMinHeight: 10,
  1928. data:list.map(item=>item.orderNum),
  1929. label: {
  1930. show: true,
  1931. position: 'inside'
  1932. },
  1933. itemStyle:{
  1934. normal:{color:'#333FFF'}
  1935. }
  1936. }]
  1937. chart.setOption(option);
  1938. return chart;
  1939. })
  1940. },
  1941. calculateMA(dayCount, data) {
  1942. var result = [];
  1943. for (var i = 0, len = data.length; i < len; i++) {
  1944. if (i < dayCount) {
  1945. result.push('-');
  1946. continue;
  1947. }
  1948. var sum = 0;
  1949. for (var j = 0; j < dayCount; j++) {
  1950. sum += +data[i - j][1];
  1951. }
  1952. result.push(sum / dayCount);
  1953. }
  1954. return result;
  1955. },
  1956. setCardDiagram(list){
  1957. var that = this;
  1958. that.selectComponent('#product_four_left_two').init((canvas, width, height, dpr) => {
  1959. const chart = echarts.init(canvas, null, {
  1960. width: width,
  1961. height: height,
  1962. devicePixelRatio: dpr
  1963. });
  1964. chart.setOption({
  1965. backgroundColor: "transparent",
  1966. tooltip: {
  1967. formatter:function(params){
  1968. const {data:{name,value,unNormalTotal}} = params;
  1969. return `${name}\n正常: ${value}\n预警: ${unNormalTotal}`
  1970. }
  1971. },
  1972. grid: {},
  1973. animationDurationUpdate: function (idx) {
  1974. // 越往后的数据延迟越大
  1975. return idx * 100;
  1976. },
  1977. color: ["red", "rgb(10,92,170)", "rgb(114,205,255)"],
  1978. animationEasingUpdate: "bounceIn",
  1979. series: [
  1980. {
  1981. type: "graph",
  1982. layout: "force",
  1983. force: {
  1984. repulsion: 100, //越大斥力越大
  1985. gravity: 0.05, //越大节点越往中心靠拢
  1986. edgeLength: 20, //值越小则长度越长
  1987. },
  1988. roam: true,
  1989. draggable: true,
  1990. symbolSize: 1,
  1991. itemStyle: {
  1992. // opacity: 0.9,
  1993. color: () => {
  1994. return (
  1995. 'red',
  1996. 'rgb(114,205,255)',
  1997. 'rgb(10,92,170)'
  1998. );
  1999. },
  2000. },
  2001. label: {
  2002. normal: {
  2003. show: true,
  2004. fontSize: 10,
  2005. },
  2006. },
  2007. data: list
  2008. },
  2009. ],
  2010. })
  2011. return chart;
  2012. })
  2013. },
  2014. setCardXuTuOption(testNum){
  2015. var that = this;
  2016. let icon =
  2017. "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";
  2018. for (var index = 0; index < 4; index++) {
  2019. that.selectComponent('#product_five_right_one'+index).init((canvas, width, height, dpr) => {
  2020. const chart = echarts.init(canvas, null, {
  2021. width: width,
  2022. height: height,
  2023. devicePixelRatio: dpr
  2024. });
  2025. chart.setOption({
  2026. backgroundColor: "transparent",
  2027. tooltip: {
  2028. trigger: "axis",
  2029. axisPointer: {
  2030. type: "shadow",
  2031. },
  2032. formatter: "{b0}: {c0}%",
  2033. },
  2034. grid: {
  2035. containLabel: true,
  2036. height: "200px",
  2037. width: "auto",
  2038. left: "0",
  2039. top: "center",
  2040. },
  2041. xAxis: {
  2042. max: 100,
  2043. splitLine: {
  2044. show: false,
  2045. },
  2046. axisLine: {
  2047. show: false,
  2048. },
  2049. axisLabel: {
  2050. show: false,
  2051. },
  2052. axisTick: {
  2053. show: false,
  2054. },
  2055. },
  2056. yAxis: {
  2057. type: "category",
  2058. inverse: true,
  2059. axisLine: {
  2060. show: false,
  2061. },
  2062. axisTick: {
  2063. show: false,
  2064. },
  2065. axisLabel: {
  2066. // margin: 10,
  2067. fontSize: 20,
  2068. color: "white",
  2069. },
  2070. axisPointer: {
  2071. label: {
  2072. show: true,
  2073. margin: 100,
  2074. },
  2075. },
  2076. },
  2077. series: [
  2078. {
  2079. type: "pictorialBar",
  2080. symbolRepeat: "fixed",
  2081. symbolMargin: "6!",
  2082. label: {
  2083. normal: {
  2084. show: false,
  2085. position: "right",
  2086. offset: [3, 0],
  2087. formatter: (param) => {
  2088. return param.value.toFixed(0) + "%";
  2089. },
  2090. textStyle: {
  2091. fontSize: 20,
  2092. color: "white",
  2093. },
  2094. },
  2095. },
  2096. symbolClip: true,
  2097. symbolSize: [22, 30],
  2098. symbolPosition: "start",
  2099. symbolBoundingData: 100,
  2100. data: [
  2101. {
  2102. value: testNum.normalTotal,
  2103. symbol: icon,
  2104. itemStyle: {
  2105. color: "#1DDBF9",
  2106. },
  2107. },
  2108. ],
  2109. z: 10,
  2110. },
  2111. {
  2112. type: "pictorialBar",
  2113. itemStyle: {
  2114. normal: {
  2115. opacity: 0.2,
  2116. },
  2117. },
  2118. animationDuration: 0,
  2119. symbolRepeat: "fixed",
  2120. symbolMargin: "6!",
  2121. symbolSize: [22, 30],
  2122. symbolBoundingData: 100,
  2123. symbolPosition: "start",
  2124. // symbolOffset: [
  2125. // 10,
  2126. // 0
  2127. // ],
  2128. data: [
  2129. {
  2130. value: 100,
  2131. symbol: icon,
  2132. itemStyle: {
  2133. color: "#1DDBF9",
  2134. },
  2135. },
  2136. ],
  2137. z: 5,
  2138. },
  2139. ],
  2140. })
  2141. return chart
  2142. })
  2143. }
  2144. },
  2145. // 主产品使用量、生产量统计
  2146. getSignProductUsedProduceState(){
  2147. var that = this;
  2148. app.requestP({
  2149. url: '/daping/signProductUsedProduceState',
  2150. method: 'post',
  2151. }).then(res=>{
  2152. this.setData({
  2153. statisticSproductList:res.data.data.map(item=>{
  2154. return {
  2155. product_name:item.product_name,
  2156. data:[
  2157. {data:item.produce,index:Math.floor(Math.random()*1000),color:'#2D59E6'},
  2158. {data:item.end,index:Math.floor(Math.random()*1000),color:'#71CCFF'},
  2159. ]
  2160. }
  2161. }),
  2162. },()=>{
  2163. var list = that.data.statisticSproductList;
  2164. for (let index = 0; index < list.length; index++) {
  2165. for (let lindex = 0; lindex < list[index].data.length; lindex++) {
  2166. var color = list[index].data[lindex].color;
  2167. var total = list[index].data[lindex].data;
  2168. var itemIndex = list[index].data[lindex].index;
  2169. that.setCardFivePie_rght(color,total,itemIndex);
  2170. }
  2171. }
  2172. })
  2173. }).catch(err=>{
  2174. app.showToptip(this,'err',err.data.msg)
  2175. })
  2176. },
  2177. setCardFivePie_rght(color,total,itemIndex){
  2178. var that = this;
  2179. var placeHolderStyle = {
  2180. normal: {
  2181. label: {
  2182. show: false,
  2183. formatter: function (v) {
  2184. //文字中遇到空格就换行
  2185. let text = v.value;
  2186. return text;
  2187. },
  2188. },
  2189. labelLine: {
  2190. show: true,
  2191. },
  2192. },
  2193. };
  2194. that.selectComponent('#product_five_right'+itemIndex).init((canvas, width, height, dpr) => {
  2195. const chart = echarts.init(canvas, null, {
  2196. width: width,
  2197. height: height,
  2198. devicePixelRatio: dpr
  2199. });
  2200. var option = that.getStaticPieChart();
  2201. option.series = [];
  2202. option.color = [color];
  2203. option.series.push({
  2204. type: "pie",
  2205. silent: 1,
  2206. radius: ["65%", "80%"],
  2207. label: {
  2208. show: false,
  2209. },
  2210. labelLine: 0,
  2211. emphasis: {
  2212. label: {
  2213. show: true,
  2214. fontSize: "40",
  2215. fontWeight: "bold",
  2216. },
  2217. },
  2218. data: [
  2219. {
  2220. value:total,
  2221. label: {
  2222. show: true,
  2223. fontSize: 8 * 1.5,
  2224. color: '#485465',
  2225. position: "center",
  2226. formatter: "{c}",
  2227. },
  2228. },
  2229. // { value: 55 ,},
  2230. ],
  2231. })
  2232. chart.setOption(option);
  2233. return chart;
  2234. })
  2235. },
  2236. // 主产品不同年度 使用量统计
  2237. getSignPrroductYearUsedProduceState(){
  2238. app.requestP({
  2239. url: '/daping/signPrroductYearUsedProduceState',
  2240. method: 'post',
  2241. }).then(res=>{
  2242. var xAxisName = [];
  2243. var seriesYear = [];
  2244. var series = [];
  2245. res.data.data.map((item,index)=>{
  2246. item.map((itemChild)=>{
  2247. if(xAxisName.indexOf(itemChild.productName) == -1){
  2248. xAxisName.push(itemChild.productName);
  2249. }
  2250. if(seriesYear.indexOf(itemChild.year) == -1){
  2251. seriesYear.push(itemChild.year);
  2252. series.push({
  2253. name:itemChild.year,
  2254. type: "line",
  2255. stack: "Total",
  2256. data:[itemChild.produce]
  2257. })
  2258. }else{
  2259. series.map((serItem,i)=>{
  2260. if(serItem.name == itemChild.year){
  2261. series[i].data.push(itemChild.produce)
  2262. }
  2263. if(serItem.name != itemChild.year){
  2264. series[i].data.push(0);
  2265. }
  2266. })
  2267. }
  2268. })
  2269. if(index == res.data.data.length-1){
  2270. this.setCardSixBar(series,xAxisName);
  2271. this.setCardSixRightBar(series,xAxisName)
  2272. }
  2273. })
  2274. }).catch(err=>{
  2275. app.showToptip(this,'err',err.data.msg)
  2276. })
  2277. },
  2278. setCardSixBar(lineList,xAxisName){
  2279. var that = this;
  2280. that.selectComponent('#product_six_left').init((canvas, width, height, dpr) => {
  2281. const chart = echarts.init(canvas, null, {
  2282. width: width,
  2283. height: height,
  2284. devicePixelRatio: dpr
  2285. });
  2286. var colors = ['#F71404','#2D59E6','#71CCFF']
  2287. var option = that.getStaticBarChart();
  2288. option.color = ['#F71404','#2D59E6','#71CCFF'];
  2289. option.grid.top = '26%'
  2290. option.series = [];
  2291. option.xAxis.data = xAxisName;
  2292. option.title={
  2293. text: '单位:支',
  2294. left: 'right',
  2295. top:'15%',
  2296. textStyle: {
  2297. color: '#666',
  2298. fontSize: 12,
  2299. }
  2300. },
  2301. option.legend = {
  2302. data:lineList.map(item=>item.name+''),
  2303. icon:"circle",
  2304. top:"10%",
  2305. right:"auto",
  2306. itemWidth:8,
  2307. itemHeight:8,
  2308. textStyle:{
  2309. fontSize:8,
  2310. color:'#485465',
  2311. },
  2312. }
  2313. lineList.map((item,index)=>{
  2314. option.series.push({
  2315. name:item.name+'',
  2316. type:'line',
  2317. data:item.data,
  2318. lineStyle:{
  2319. normal:{
  2320. color:colors[index]
  2321. }
  2322. },
  2323. itemStyle:{
  2324. normal:{
  2325. color:colors[index]
  2326. }
  2327. }
  2328. })
  2329. })
  2330. chart.setOption(option);
  2331. return chart
  2332. })
  2333. },
  2334. setCardSixRightBar(lineList,xAxisName){
  2335. var that = this;
  2336. that.selectComponent('#product_six_right').init((canvas, width, height, dpr) => {
  2337. const chart = echarts.init(canvas, null, {
  2338. width: width,
  2339. height: height,
  2340. devicePixelRatio: dpr
  2341. });
  2342. var option = this.setCardLineTotal();
  2343. option.series = [];
  2344. var colors = ['#F71404','#2D59E6','#71CCFF'];
  2345. option.color = ['#F71404','#2D59E6','#71CCFF'];
  2346. option.grid.top = '26%'
  2347. option.xAxis.data = xAxisName;
  2348. option.title={
  2349. text: '单位:支',
  2350. left: 'right',
  2351. top:'15%',
  2352. textStyle: {
  2353. color: '#666',
  2354. fontSize: 12,
  2355. }
  2356. },
  2357. option.legend = {
  2358. data:lineList.map(item=>item.name+''),
  2359. icon:"circle",
  2360. top:"10%",
  2361. right:"auto",
  2362. itemWidth:8,
  2363. itemHeight:8,
  2364. textStyle:{
  2365. fontSize:8,
  2366. color:'#485465',
  2367. },
  2368. }
  2369. lineList.map((item,index)=>{
  2370. option.series.push({
  2371. name:item.name+'',
  2372. type:'line',
  2373. data:item.data,
  2374. areaStyle: {},
  2375. lineStyle:{
  2376. normal:{
  2377. color:colors[index]
  2378. }
  2379. },
  2380. itemStyle:{
  2381. normal:{
  2382. color:colors[index]
  2383. }
  2384. }
  2385. })
  2386. })
  2387. chart.setOption(option)
  2388. return chart;
  2389. })
  2390. },
  2391. setCardLineTotal(){
  2392. return {
  2393. xAxis: {
  2394. type: "category",
  2395. axisTick:{show:false,},
  2396. nameTextStyle: {
  2397. color: "#77869E",
  2398. fontSize: 8,
  2399. },
  2400. axisLabel: {
  2401. color: '#999999',
  2402. fontSize: 8,
  2403. },
  2404. axisLine: {
  2405. onZero: false,
  2406. lineStyle: {
  2407. color: "#cccccc",
  2408. },
  2409. },
  2410. data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  2411. },
  2412. yAxis: {
  2413. type: "value",
  2414. minInterval: 1,
  2415. axisLabel:{color:"#000", fontSize:8,},
  2416. axisLine: {
  2417. lineStyle: {
  2418. color: "#cccccc",
  2419. },
  2420. show: true,
  2421. },
  2422. },
  2423. color: ["#7661FF", "#5AC8FA", "#00B972"],
  2424. grid: {
  2425. left: "3%",
  2426. top: "5%",
  2427. right: "4%",
  2428. bottom: "3%",
  2429. containLabel: true,
  2430. },
  2431. series: [
  2432. {
  2433. data: [120, 200, 150, 80, 70, 110, 130, 110],
  2434. type: "line",
  2435. },
  2436. ]
  2437. }
  2438. },
  2439. setSevenCardPie(list){
  2440. var that = this;
  2441. that.selectComponent('#product_seven_left').init((canvas, width, height, dpr) => {
  2442. const chart = echarts.init(canvas, null, {
  2443. width: width,
  2444. height: height,
  2445. devicePixelRatio: dpr
  2446. });
  2447. var itemStyle = {
  2448. normal: {
  2449. label: {
  2450. show: false,
  2451. formatter: function (v) {
  2452. //文字中遇到空格
  2453. let text = v.name+'\n'+v.value;
  2454. return text;
  2455. },
  2456. },
  2457. labelLine: {
  2458. show: true,
  2459. length:4,
  2460. length2:4,
  2461. },
  2462. },
  2463. }
  2464. var option = this.getStaticPieChart();
  2465. option.color = ['rgb(247,20,4)','rgb(127,210,255)','rgb(44,88,288)'];
  2466. var center = [["50%", "10%"],["50%", "35%"],["50%", "60%"],["50%", "85%"]];
  2467. option.series = [];
  2468. list.map((item,index)=>{
  2469. option.series.push({
  2470. type: "pie",
  2471. radius: ['40%','70%'],
  2472. center: center[index],
  2473. itemStyle,
  2474. label: {
  2475. position: "inside",
  2476. formatter: "{d}%",
  2477. fontSize: 8,
  2478. color: '#fff',
  2479. },
  2480. data: item.data,
  2481. })
  2482. })
  2483. chart.setOption(option)
  2484. return chart
  2485. })
  2486. },
  2487. setCardSenvenPie(list){
  2488. var that = this;
  2489. that.selectComponent('#product_seven_right').init((canvas, width, height, dpr) => {
  2490. const chart = echarts.init(canvas, null, {
  2491. width: width,
  2492. height: height,
  2493. devicePixelRatio: dpr
  2494. });
  2495. var option = this.getStaticPieChart();
  2496. option.series = [];
  2497. option.color = ['#FFAF36','#7A4AFE']
  2498. option.legend = {
  2499. data:list.map(item=>item.name),
  2500. icon:"circle",
  2501. top:"2%",
  2502. right:"auto",
  2503. itemWidth:8,
  2504. itemHeight:8,
  2505. textStyle:{
  2506. fontSize:8,
  2507. color:'#485465',
  2508. },
  2509. }
  2510. option.series = [{
  2511. type: "pie",
  2512. radius: "80%",
  2513. center: ["50%", "50%"],
  2514. label: {
  2515. show:false,
  2516. position: "inside",
  2517. formatter: "{d}%",
  2518. fontSize: 8,
  2519. color: '#fff',
  2520. },
  2521. data:list,
  2522. }]
  2523. chart.setOption(option);
  2524. return chart;
  2525. })
  2526. },
  2527. // 主产品正常、预警统计
  2528. getSignPorductNormalWarningState(){
  2529. app.requestP({
  2530. url: '/daping/signPorductNormalWarningState',
  2531. method: 'post',
  2532. }).then(res=>{
  2533. this.setCardEightBar(res.data.data)
  2534. }).catch(err=>{
  2535. app.showToptip(this,'err',err.data.msg)
  2536. })
  2537. },
  2538. setCardEightBar(list){
  2539. var that = this;
  2540. that.selectComponent('#product_eight_left').init((canvas, width, height, dpr) => {
  2541. const chart = echarts.init(canvas, null, {
  2542. width: width,
  2543. height: height,
  2544. devicePixelRatio: dpr
  2545. });
  2546. var option = that.getStaticBarChart();
  2547. option.series = [];
  2548. option.grid.top='20%';
  2549. option.grid.bottom='13%';
  2550. option.xAxis.data = list.map(item=>item.product_name);
  2551. const echartsData = [
  2552. {name:'正常',data:list.map(item=>item.normal)},
  2553. {name:'报警',data:list.map(item=>item.warning)},
  2554. ]
  2555. option.color = ['#2D59E6','#E1291C']
  2556. option.legend = {
  2557. data:echartsData.map(item=>item.name),
  2558. icon:"circle",
  2559. top:"2%",
  2560. right:"auto",
  2561. itemWidth:8,
  2562. itemHeight:8,
  2563. textStyle:{
  2564. fontSize:8,
  2565. color:'#485465',
  2566. },
  2567. }
  2568. echartsData.map((item,index)=>{
  2569. option.series.push({
  2570. name: item.name,
  2571. type: 'bar',
  2572. emphasis: {
  2573. focus: "series",
  2574. },
  2575. data:item.data,
  2576. });
  2577. })
  2578. chart.setOption(option);
  2579. return chart;
  2580. });
  2581. },
  2582. setCardEightRightBar(list){
  2583. var that = this;
  2584. that.selectComponent('#product_eight_right').init((canvas, width, height, dpr) => {
  2585. const chart = echarts.init(canvas, null, {
  2586. width: width,
  2587. height: height,
  2588. devicePixelRatio: dpr
  2589. });
  2590. var option = that.getStaticBarChart();
  2591. option.title = {
  2592. show:false,
  2593. text: '',
  2594. top:'10%',
  2595. textStyle: {
  2596. color: '#999',
  2597. fontSize: 6,
  2598. }
  2599. }
  2600. option.legend = {
  2601. data:list.map(item=>item.name),
  2602. icon:"circle",
  2603. top:"2%",
  2604. right:"auto",
  2605. itemWidth:8,
  2606. itemHeight:8,
  2607. textStyle:{
  2608. fontSize:8,
  2609. color:'#485465',
  2610. },
  2611. }
  2612. option.grid = {
  2613. top:'20%',
  2614. bottom:'15%',
  2615. right:'15%',
  2616. left:'15%'
  2617. }
  2618. option.color = ['#26E657','#FFAF36','#F71404'];
  2619. option.yAxis = [
  2620. {
  2621. type: 'value',
  2622. // min: 0,
  2623. // max: 250,
  2624. interval: 50,
  2625. minInterval: 1,
  2626. axisLine: {
  2627. lineStyle: {
  2628. color: "#cccccc",
  2629. },
  2630. show: false,
  2631. },
  2632. axisLabel: {
  2633. color: "#999999",
  2634. fontSize: 8,
  2635. },
  2636. },
  2637. {
  2638. type: 'value',
  2639. min: 0,
  2640. max:25,
  2641. interval: 5,
  2642. // minInterval: 1,
  2643. axisLine: {
  2644. lineStyle: {
  2645. // color: "",
  2646. },
  2647. show: false,
  2648. },
  2649. axisLabel: {
  2650. color: "#999999",
  2651. fontSize: 8,
  2652. },
  2653. }
  2654. ];
  2655. option.series = [];
  2656. list.map((item,index)=>{
  2657. option.series.push({
  2658. name: item.name,
  2659. type: 'bar',
  2660. stack: "Ad",
  2661. emphasis: {
  2662. focus: "series",
  2663. },
  2664. data:item.data,
  2665. })
  2666. })
  2667. chart.setOption(option);
  2668. return chart;
  2669. })
  2670. },
  2671. setCardNineBar(list){
  2672. var that = this;
  2673. that.selectComponent('#product_nine_left').init((canvas, width, height, dpr) => {
  2674. const chart = echarts.init(canvas, null, {
  2675. width: width,
  2676. height: height,
  2677. devicePixelRatio: dpr
  2678. });
  2679. var option = that.getCysOrderOption(list);
  2680. option.title = {
  2681. text: '产品分类信息',
  2682. top:'10%',
  2683. textStyle: {
  2684. color: '#999',
  2685. fontSize: 6,
  2686. }
  2687. }
  2688. option.grid = {
  2689. top:"25%",
  2690. left:"13%",
  2691. right:"15%",
  2692. bottom:"14%",
  2693. }
  2694. option.yAxis = [
  2695. {
  2696. type: 'value',
  2697. // min: 0,
  2698. // max: 250,
  2699. // interval: 50,
  2700. minInterval: 1,
  2701. axisLine: {
  2702. lineStyle: {
  2703. color: "#cccccc",
  2704. },
  2705. show: false,
  2706. },
  2707. axisLabel: {
  2708. color: "#999999",
  2709. fontSize: 8,
  2710. },
  2711. },
  2712. {
  2713. type: 'value',
  2714. min: 0,
  2715. max:25,
  2716. interval: 5,
  2717. // minInterval: 1,
  2718. axisLine: {
  2719. lineStyle: {
  2720. // color: "",
  2721. },
  2722. show: false,
  2723. },
  2724. axisLabel: {
  2725. color: "#999999",
  2726. fontSize: 8,
  2727. },
  2728. }
  2729. ];
  2730. chart.setOption(option);
  2731. return chart;
  2732. })
  2733. },
  2734. setCardNineRightBar(list){
  2735. var that = this;
  2736. that.selectComponent('#product_nine_right').init((canvas, width, height, dpr) => {
  2737. const chart = echarts.init(canvas, null, {
  2738. width: width,
  2739. height: height,
  2740. devicePixelRatio: dpr
  2741. });
  2742. var option = that.setCardLineTotal();
  2743. option.series = [];
  2744. option.legend = {
  2745. data:list.map(item=>item.name),
  2746. icon:"circle",
  2747. top:"5%",
  2748. right:"auto",
  2749. itemWidth:8,
  2750. itemHeight:8,
  2751. textStyle:{
  2752. fontSize:8,
  2753. color:'#485465',
  2754. },
  2755. }
  2756. option.yAxis = {
  2757. type: "value",
  2758. // minInterval: 1,
  2759. axisLine: {
  2760. lineStyle: {
  2761. color: "#cccccc",
  2762. },
  2763. },
  2764. axisLabel: {
  2765. color: "#999999",
  2766. fontSize: 8,
  2767. },
  2768. },
  2769. option.grid.top = '20%';
  2770. option.grid.right = '10%';
  2771. list.map(item=>{
  2772. option.series.push({
  2773. name:item.name,
  2774. type: 'line',
  2775. stack: 'Total',
  2776. areaStyle: {},
  2777. showSymbol:false,
  2778. emphasis: {
  2779. focus: 'series'
  2780. },
  2781. data: item.data,
  2782. })
  2783. })
  2784. chart.setOption(option)
  2785. return chart;
  2786. })
  2787. },
  2788. // 地区产品统计
  2789. setCardLeftFive(list){
  2790. var that = this;
  2791. that.selectComponent('#product_five').init((canvas, width, height, dpr) => {
  2792. const chart = echarts.init(canvas, null, {
  2793. width: width,
  2794. height: height,
  2795. devicePixelRatio: dpr
  2796. });
  2797. var option = {
  2798. xAxis: {
  2799. type: 'value',
  2800. axisLabel: {
  2801. show: false
  2802. }
  2803. },
  2804. grid:{
  2805. top:0,
  2806. left: '3%',
  2807. right: '4%',
  2808. bottom: '3%',
  2809. containLabel: true
  2810. },
  2811. yAxis: {
  2812. type: 'category',
  2813. data: list.name.map(item=>item),
  2814. axisTick: { show: false },
  2815. axisLabel:{color:"#999999", fontSize:9,},
  2816. axisLine: { lineStyle: { color: '#DEE3FF' } },
  2817. },
  2818. series:list.data.map(item=>{
  2819. return{ name:item.name,type:'bar',data:item.data }
  2820. })
  2821. }
  2822. chart.setOption(option);
  2823. return chart;
  2824. })
  2825. },
  2826. })