index.js 76 KB

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