index.js 72 KB

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