index.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332
  1. <template >
  2. <view >
  3. <uni-collapse class="uni-flex">
  4. <uni-collapse-item title="常用操作">
  5. <uni-grid :column="3" :square="false" :highlight="false">
  6. <uni-grid-item>
  7. <view class="grid-item-box pointer" @click="toSign1">
  8. <uni-icons type="settings" size="20"></uni-icons>
  9. <text class="text">签证申请单</text>
  10. </view>
  11. </uni-grid-item>
  12. <uni-grid-item>
  13. <view class="grid-item-box pointer" @click="toSign2">
  14. <uni-icons type="settings" size="20"></uni-icons>
  15. <text class="text">待审签证单</text>
  16. </view>
  17. </uni-grid-item>
  18. <uni-grid-item>
  19. <navigator url="../template/GetMaterialIns/GetMaterialIns">
  20. <view class="grid-item-box pointer" >
  21. <uni-icons type="settings" size="20"></uni-icons>
  22. <text class="text">入库单</text>
  23. </view>
  24. </navigator>
  25. </uni-grid-item>
  26. </uni-grid>
  27. <uni-grid :column="3" :square="false" :highlight="false">
  28. <uni-grid-item>
  29. <view class="grid-item-box pointer" @click="selectProject">
  30. <uni-icons type="close" size="20"></uni-icons>
  31. <text class="text">选择项目</text>
  32. </view>
  33. </uni-grid-item>
  34. <uni-grid-item>
  35. <navigator url="../template/GetMaterialOuts/GetMaterialOuts">
  36. <view class="grid-item-box pointer" >
  37. <uni-icons type="settings" size="20"></uni-icons>
  38. <text class="text">领料单</text>
  39. </view>
  40. </navigator>
  41. </uni-grid-item>
  42. <uni-grid-item>
  43. <navigator url="../template/GetSafeQualityCheckDTOs/GetSafeQualityCheckDTOs?type=0">
  44. <view class="grid-item-box pointer" >
  45. <uni-icons type="close" size="20"></uni-icons>
  46. <text class="text">质量检查</text>
  47. </view>
  48. </navigator>
  49. </uni-grid-item>
  50. </uni-grid>
  51. <uni-grid :column="3" :square="false" :highlight="false">
  52. <uni-grid-item>
  53. <navigator url="../template/GetSafeQualityCheckDTOs/GetSafeQualityCheckDTOs?type=1">
  54. <view class="grid-item-box pointer" >
  55. <uni-icons type="close" size="20"></uni-icons>
  56. <text class="text">安全检查</text>
  57. </view>
  58. </navigator>
  59. </uni-grid-item>
  60. <uni-grid-item>
  61. <view class="grid-item-box pointer" @click="logout">
  62. <uni-icons type="close" size="20"></uni-icons>
  63. <text class="text">登出</text>
  64. </view>
  65. </uni-grid-item>
  66. </uni-grid>
  67. </uni-collapse-item>
  68. </uni-collapse>
  69. <view class="qiun-columns">
  70. <view class="qiun-padding" style="font-size: 32rpx;">
  71. <text>{{tips}}</text>
  72. </view>
  73. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  74. <view class="qiun-title-dot-light">项目进度图</view>
  75. </view>
  76. <view class="qiun-charts1">
  77. <text class="gree">节点1</text class="gree"> => <text class="gree">节点2</text> => <text class="gree">节点3</text> =>
  78. <text class="gree">节点4</text> => <text class="orange">节点1</text class="gray"> => <text class="gray">节点2</text> =>
  79. <text class="gray">节点3</text> => <text class="gray">节点4</text>
  80. </view>
  81. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  82. <view class="qiun-title-dot-light">工程进度图</view>
  83. </view>
  84. <view class="qiun-charts3">
  85. <!--#ifndef MP-ALIPAY -->
  86. <canvas canvas-id="canvasArcbar1" id="canvasArcbar1" class="charts3"></canvas>
  87. <canvas canvas-id="canvasArcbar2" id="canvasArcbar2" class="charts3" style="margin-left: 250rpx;"></canvas>
  88. <canvas canvas-id="canvasArcbar3" id="canvasArcbar3" class="charts3" style="margin-left: 500rpx;"></canvas>
  89. <!--#endif-->
  90. </view>
  91. <view class="qiun-title-bar" style="background-color: #E5FDC3;">
  92. <view class="qiun-title-dot-light">质量图</view>
  93. </view>
  94. <view class="qiun-charts" style="background-color: #E5FDC3;">
  95. <!--#ifdef MP-ALIPAY -->
  96. <canvas canvas-id="canvasColumn" id="canvasColumn" class="charts" style="background-color: #E5FDC3;" :width="cWidth*pixelRatio"
  97. :height="cHeight*pixelRatio" :style="{'width':cWidth+'px','height':cHeight+'px'}" @touchstart="touchIt($event,'canvasColumn')"></canvas>
  98. <!--#endif-->
  99. <!--#ifndef MP-ALIPAY -->
  100. <canvas canvas-id="canvasColumn" id="canvasColumn" class="charts" style="background-color: #E5FDC3;" @touchstart="touchIt($event,'canvasColumn')"></canvas>
  101. <!--#endif-->
  102. </view>
  103. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  104. <view class="qiun-title-dot-light">安全图</view>
  105. </view>
  106. <view class="qiun-charts">
  107. <!--#ifdef MP-ALIPAY -->
  108. <canvas canvas-id="canvasMix" id="canvasMix" class="charts" :width="cWidth*pixelRatio" :height="cHeight*pixelRatio"
  109. :style="{'width':cWidth+'px','height':cHeight+'px'}" disable-scroll=true @touchstart="touchMix" @touchmove="moveMix"
  110. @touchend="touchEndMix"></canvas>
  111. <!--#endif-->
  112. <!--#ifndef MP-ALIPAY -->
  113. <canvas canvas-id="canvasMix" id="canvasMix" class="charts" disable-scroll=true @touchstart="touchMix" @touchmove="moveMix"
  114. @touchend="touchEndMix"></canvas>
  115. <!--#endif-->
  116. </view>
  117. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  118. <view class="qiun-title-dot-light">文明施工图</view>
  119. </view>
  120. <view class="qiun-charts">
  121. <!--#ifndef MP-ALIPAY -->
  122. <canvas canvas-id="canvasPie" id="canvasPie" class="charts" @touchstart="touchPie($event,'canvasPie')"></canvas>
  123. <!--#endif-->
  124. </view>
  125. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  126. <view class="qiun-title-dot-light">环形图</view>
  127. </view>
  128. <view class="qiun-charts">
  129. <!--#ifndef MP-ALIPAY -->
  130. <canvas canvas-id="canvasRing" id="canvasRing" class="charts" @touchstart="touchPie($event,'canvasRing')"></canvas>
  131. <!--#endif-->
  132. </view>
  133. </view>
  134. <!-- 底部导航开始 /////////////////////////////////////////////////////////////-->
  135. <!-- is_lhp判断是否为刘海屏在main.js里,好像uniapp有一个css变量获取刘海屏的安全区域 -->
  136. <view class="tabBar" :style="{height:is_lhp?'140rpx':'98rpx'}">
  137. <!-- 导航的中间圆圈 -->
  138. <view class="border_box" :style="{paddingBottom:is_lhp?'40rpx':''}">
  139. <view class="tabBar_miden_border"></view>
  140. </view>
  141. <view class="tabBar_list" :style="{paddingBottom:is_lhp?'40rpx':''}">
  142. <view v-for="(item) in tab_nav_list" :key="item.id" :class="{'tabBar_item':item.id!=2,'tabBar_item2':item.id==2}" @tap="cut_index(item.id)">
  143. <image v-if="show_index == item.id" :src="`/static/tabBar/${item.id+1}${item.id+1}.png`"></image>
  144. <image v-else :src="`/static/tabBar/${item.id+1}.png`"></image>
  145. <view :class="{'tabBar_name':true,'nav_active':show_index == item.id}">{{item.name}}</view>
  146. </view>
  147. </view>
  148. </view>
  149. <!-- 底部导航结束 /////////////////////////////////////////////////////////////-->
  150. </view>
  151. </template>
  152. <script>
  153. import uCharts from '@/components/u-charts/u-charts.js';
  154. var startX,startY;
  155. var endPos={},isScrolling;
  156. var _self;
  157. var canvasObj = {};
  158. export default {
  159. data() {
  160. return {
  161. href: '',
  162. state: this.$store.state,
  163. cWidth: '',
  164. cHeight: '',
  165. cWidth2: '', //横屏图表
  166. cHeight2: '', //横屏图表
  167. cWidth3: '', //圆弧进度图
  168. cHeight3: '', //圆弧进度图
  169. arcbarWidth: '', //圆弧进度图,进度条宽度,此设置可使各端宽度一致
  170. gaugeWidth: '', //仪表盘宽度,此设置可使各端宽度一致
  171. tips: '',
  172. pixelRatio: 1,
  173. serverData: '',
  174. itemCount: 30, //x轴单屏数据密度
  175. sliderMax: 50,
  176. /* 底部导航 */
  177. show_index:0,//控制显示那个组件
  178. tab_nav_list :[{'id':0,'name':'首页'},{'id':1,'name':'签证申请'},{'id':2,'name':'入库单'},{'id':3,'name':'领料单'},{'id':4,'name':'质量检查'}],//菜单列表
  179. is_lhp:false,
  180. }
  181. },
  182. onLoad() {
  183. console.info("首页1");
  184. //判断登录是否超时,若超时,则跳转到登录界面
  185. this.$util.persistLogin(this);
  186. _self = this;
  187. //#ifdef MP-ALIPAY
  188. uni.getSystemInfo({
  189. success: function(res) {
  190. if (res.pixelRatio > 1) {
  191. //正常这里给2就行,如果pixelRatio=3性能会降低一点
  192. //_self.pixelRatio =res.pixelRatio;
  193. _self.pixelRatio = 2;
  194. }
  195. }
  196. });
  197. //#endif
  198. this.cWidth = uni.upx2px(750);
  199. this.cHeight = uni.upx2px(500);
  200. this.cWidth2 = uni.upx2px(700);
  201. this.cHeight2 = uni.upx2px(1100);
  202. this.cWidth3 = uni.upx2px(250);
  203. this.cHeight3 = uni.upx2px(250);
  204. this.arcbarWidth = uni.upx2px(24);
  205. this.gaugeWidth = uni.upx2px(30);
  206. },
  207. onReady() {
  208. this.getServerData();
  209. },
  210. methods: {
  211. toSign1() {
  212. uni.navigateTo({
  213. url: '/pages/template/requisitionlist/requisitionlist'
  214. });
  215. },
  216. toSign2() {
  217. uni.navigateTo({
  218. url: '/pages/template/GetVises/GetVises'
  219. });
  220. },
  221. preventhuadong() {
  222. },
  223. logout() {
  224. console.info("logout");
  225. this.$store.commit('setIsLogin', false);
  226. this.$store.commit('setUser', null);
  227. this.$store.commit('setToken', '');
  228. this.$store.commit('setName', '');
  229. this.$store.commit('setRoles', '');
  230. uni.navigateTo({
  231. url: "/"
  232. });
  233. },
  234. /* 选择项目 */
  235. selectProject() {
  236. uni.navigateTo({
  237. url: '/pages/SelectProject/SelectProject'
  238. });
  239. },
  240. /* 图表 start*/
  241. getServerData() {
  242. uni.showLoading({
  243. title: "正在加载数据..."
  244. })
  245. uni.request({
  246. url: 'https://unidemo.dcloud.net.cn/hello-uniapp-ucharts-data.json',
  247. data: {},
  248. success: function(res) {
  249. _self.fillData(res.data);
  250. },
  251. fail: () => {
  252. _self.tips = "网络错误,小程序端请检查合法域名";
  253. },
  254. complete() {
  255. uni.hideLoading();
  256. }
  257. });
  258. },
  259. fillData(data) {
  260. this.serverData = data;
  261. this.tips = data.tips;
  262. this.sliderMax = data.Candle.categories.length;
  263. let Column = {
  264. categories: [],
  265. series: []
  266. };
  267. let ColumnMeter = {
  268. categories: [],
  269. series: []
  270. };
  271. let LineA = {
  272. categories: [],
  273. series: []
  274. };
  275. let LineB = {
  276. categories: [],
  277. series: []
  278. };
  279. let Area = {
  280. categories: [],
  281. series: []
  282. };
  283. let Pie = {
  284. series: []
  285. };
  286. let Ring = {
  287. series: []
  288. };
  289. let Funnel = {
  290. series: []
  291. };
  292. let Radar = {
  293. categories: [],
  294. series: []
  295. };
  296. let Arcbar1 = {
  297. series: []
  298. };
  299. let Arcbar2 = {
  300. series: []
  301. };
  302. let Arcbar3 = {
  303. series: []
  304. };
  305. let Gauge = {
  306. categories: [],
  307. series: []
  308. };
  309. let Candle = {
  310. categories: [],
  311. series: []
  312. };
  313. let Mix = {
  314. categories: [],
  315. series: []
  316. };
  317. //这里我后台返回的是数组,所以用等于,如果您后台返回的是单条数据,需要push进去
  318. Column.categories = data.Column.categories;
  319. //这里的series数据是后台做好的,如果您的数据没有和前面我注释掉的格式一样,请自行拼接数据
  320. Column.series = data.Column.series;
  321. ColumnMeter.categories = data.ColumnMeter.categories;
  322. //这里的series数据,如果为Meter,series[0]定义为外层数据,series[1]定义为内层数据
  323. ColumnMeter.series = data.ColumnMeter.series;
  324. LineA.categories = data.LineA.categories;
  325. LineA.series = data.LineA.series;
  326. LineB.categories = data.LineB.categories;
  327. LineB.series = data.LineB.series;
  328. Area.categories = data.Area.categories;
  329. Area.series = data.Area.series;
  330. Pie.series = data.Pie.series;
  331. Ring.series = data.Ring.series;
  332. Funnel.series = data.Pie.series;
  333. //自定义文案示例,需设置format字段
  334. for (let i = 0; i < Ring.series.length; i++) {
  335. Ring.series[i].format = () => {
  336. return Ring.series[i].name + Ring.series[i].data
  337. };
  338. }
  339. Radar.categories = data.Radar.categories;
  340. Radar.series = data.Radar.series;
  341. Arcbar1.series = data.Arcbar1.series;
  342. Arcbar2.series = data.Arcbar2.series;
  343. Arcbar3.series = data.Arcbar3.series;
  344. Gauge.categories = data.Gauge.categories;
  345. Gauge.series = data.Gauge.series;
  346. Candle.categories = data.Candle.categories;
  347. Candle.series = data.Candle.series;
  348. Mix.categories = data.Mix.categories;
  349. Mix.series = data.Mix.series;
  350. this.showColumn("canvasColumn", Column);
  351. this.showColumnMeter("canvasColumnMeter", ColumnMeter);
  352. this.showLineA("canvasLineA", LineA);
  353. this.showLineB("canvasLineB", LineB);
  354. this.showArea("canvasArea", Area);
  355. this.showPie("canvasPie", Pie);
  356. this.showRing("canvasRing", Ring);
  357. this.showFunnel("canvasFunnel", Funnel);
  358. this.showRadar("canvasRadar", Radar);
  359. this.showArcbar("canvasArcbar1", Arcbar1);
  360. this.showArcbar2("canvasArcbar2", Arcbar2);
  361. this.showArcbar3("canvasArcbar3", Arcbar3);
  362. this.showGauge("canvasGauge", Gauge);
  363. this.showCandle("canvasCandle", Candle);
  364. this.showMix("canvasMix", Mix);
  365. },
  366. showColumn(canvasId, chartData) {
  367. canvasObj[canvasId] = new uCharts({
  368. $this: _self,
  369. canvasId: canvasId,
  370. type: 'column',
  371. padding: [15, 15, 0, 15],
  372. legend: {
  373. show: true,
  374. padding: 5,
  375. lineHeight: 11,
  376. margin: 0,
  377. },
  378. fontSize: 11,
  379. background: '#FFFFFF',
  380. pixelRatio: _self.pixelRatio,
  381. animation: false,
  382. categories: chartData.categories,
  383. series: chartData.series,
  384. xAxis: {
  385. disableGrid: true,
  386. },
  387. yAxis: {
  388. format: (val) => {
  389. return val.toFixed(0) + '元'
  390. }
  391. },
  392. dataLabel: true,
  393. width: _self.cWidth * _self.pixelRatio,
  394. height: _self.cHeight * _self.pixelRatio,
  395. extra: {
  396. column: {
  397. type: 'group',
  398. width: _self.cWidth * _self.pixelRatio * 0.45 / chartData.categories.length
  399. }
  400. }
  401. });
  402. },
  403. showColumnMeter(canvasId, chartData) {
  404. canvasObj[canvasId] = new uCharts({
  405. $this: _self,
  406. canvasId: canvasId,
  407. type: 'column',
  408. padding: [15, 15, 0, 15],
  409. legend: {
  410. show: true,
  411. padding: 5,
  412. lineHeight: 11,
  413. margin: 0,
  414. },
  415. fontSize: 11,
  416. background: '#FFFFFF',
  417. pixelRatio: _self.pixelRatio,
  418. animation: false,
  419. categories: chartData.categories,
  420. series: chartData.series,
  421. xAxis: {
  422. disableGrid: true,
  423. },
  424. yAxis: {
  425. //disabled:true
  426. },
  427. dataLabel: true,
  428. width: _self.cWidth * _self.pixelRatio,
  429. height: _self.cHeight * _self.pixelRatio,
  430. extra: {
  431. column: {
  432. type: 'meter',
  433. width: _self.cWidth * _self.pixelRatio * 0.45 / chartData.categories.length,
  434. meter: {
  435. border: 4,
  436. fillColor: '#E5FDC3'
  437. }
  438. }
  439. }
  440. });
  441. },
  442. showLineA(canvasId, chartData) {
  443. canvasObj[canvasId] = new uCharts({
  444. $this: _self,
  445. canvasId: canvasId,
  446. type: 'line',
  447. fontSize: 11,
  448. padding: [15, 15, 0, 15],
  449. legend: {
  450. show: true,
  451. padding: 5,
  452. lineHeight: 11,
  453. margin: 5,
  454. },
  455. dataLabel: false,
  456. dataPointShape: false,
  457. background: '#FFFFFF',
  458. pixelRatio: _self.pixelRatio,
  459. categories: chartData.categories,
  460. series: chartData.series,
  461. animation: false,
  462. enableScroll: true, //开启图表拖拽功能
  463. xAxis: {
  464. disableGrid: false,
  465. type: 'grid',
  466. gridType: 'dash',
  467. itemCount: 4,
  468. scrollShow: true,
  469. scrollAlign: 'left',
  470. //scrollBackgroundColor:'#F7F7FF',//可不填写,配合enableScroll图表拖拽功能使用,X轴滚动条背景颜色,默认为 #EFEBEF
  471. //scrollColor:'#DEE7F7',//可不填写,配合enableScroll图表拖拽功能使用,X轴滚动条颜色,默认为 #A6A6A6
  472. },
  473. yAxis: {
  474. //disabled:true
  475. gridType: 'dash',
  476. splitNumber: 8,
  477. min: 10,
  478. max: 180,
  479. format: (val) => {
  480. return val.toFixed(0) + '元'
  481. } //如不写此方法,Y轴刻度默认保留两位小数
  482. },
  483. width: _self.cWidth * _self.pixelRatio,
  484. height: _self.cHeight * _self.pixelRatio,
  485. dataLabel: true,
  486. dataPointShape: true,
  487. extra: {
  488. lineStyle: 'straight'
  489. },
  490. });
  491. },
  492. showLineB(canvasId, chartData) {
  493. canvasObj[canvasId] = new uCharts({
  494. $this: _self,
  495. canvasId: canvasId,
  496. type: 'line',
  497. fontSize: 11,
  498. padding: [15, 15, 0, 15],
  499. legend: {
  500. show: true,
  501. padding: 5,
  502. lineHeight: 11,
  503. margin: 5,
  504. },
  505. background: '#FFFFFF',
  506. pixelRatio: _self.pixelRatio,
  507. rotate: true, //开启图表横屏
  508. // #ifdef MP-ALIPAY
  509. rotateLock: true, //百度及支付宝需要锁定旋转
  510. // #endif
  511. categories: chartData.categories,
  512. animation: false,
  513. series: chartData.series,
  514. xAxis: {
  515. disableGrid: true,
  516. },
  517. yAxis: {
  518. //disabled:true
  519. },
  520. width: _self.cWidth2 * _self.pixelRatio,
  521. height: _self.cHeight2 * _self.pixelRatio,
  522. dataLabel: true,
  523. dataPointShape: true,
  524. extra: {
  525. lineStyle: 'curve'
  526. },
  527. });
  528. },
  529. showArea(canvasId, chartData) {
  530. canvasObj[canvasId] = new uCharts({
  531. $this: _self,
  532. canvasId: canvasId,
  533. type: 'area',
  534. fontSize: 11,
  535. padding: [0, 15, 10, 15],
  536. legend: {
  537. show: true,
  538. position: 'top',
  539. float: 'center',
  540. itemGap: 30,
  541. padding: 5,
  542. lineHeight: 18,
  543. margin: 0,
  544. },
  545. dataLabel: false,
  546. dataPointShape: true,
  547. background: '#FFFFFF',
  548. pixelRatio: _self.pixelRatio,
  549. categories: chartData.categories,
  550. series: chartData.series,
  551. animation: false,
  552. xAxis: {
  553. type: 'grid',
  554. gridColor: '#CCCCCC',
  555. gridType: 'dash',
  556. dashLength: 8,
  557. boundaryGap: 'justify' //两端不留白配置
  558. },
  559. yAxis: {
  560. gridType: 'dash',
  561. gridColor: '#CCCCCC',
  562. dashLength: 8,
  563. splitNumber: 5,
  564. },
  565. width: _self.cWidth * _self.pixelRatio,
  566. height: _self.cHeight * _self.pixelRatio,
  567. extra: {
  568. area: {
  569. type: 'curve',
  570. opacity: 0.2,
  571. addLine: true,
  572. width: 2
  573. }
  574. }
  575. });
  576. },
  577. showPie(canvasId, chartData) {
  578. canvasObj[canvasId] = new uCharts({
  579. $this: _self,
  580. canvasId: canvasId,
  581. type: 'pie',
  582. fontSize: 11,
  583. padding: [15, 15, 0, 15],
  584. legend: {
  585. show: true,
  586. padding: 5,
  587. lineHeight: 11,
  588. margin: 0,
  589. },
  590. background: '#FFFFFF',
  591. pixelRatio: _self.pixelRatio,
  592. series: chartData.series,
  593. animation: false,
  594. width: _self.cWidth * _self.pixelRatio,
  595. height: _self.cHeight * _self.pixelRatio,
  596. dataLabel: true,
  597. extra: {
  598. pie: {
  599. lableWidth: 15
  600. }
  601. },
  602. });
  603. },
  604. showRing(canvasId, chartData) {
  605. canvasObj[canvasId] = new uCharts({
  606. $this: _self,
  607. canvasId: canvasId,
  608. type: 'ring',
  609. fontSize: 11,
  610. padding: [5, 5, 5, 5],
  611. legend: {
  612. show: true,
  613. position: 'right',
  614. float: 'center',
  615. itemGap: 10,
  616. padding: 5,
  617. lineHeight: 26,
  618. margin: 5,
  619. //backgroundColor:'rgba(41,198,90,0.2)',
  620. //borderColor :'rgba(41,198,90,0.5)',
  621. borderWidth: 1
  622. },
  623. title: {
  624. name: '70%',
  625. color: '#7cb5ec',
  626. fontSize: 25 * _self.pixelRatio,
  627. },
  628. subtitle: {
  629. name: '收益率',
  630. color: '#666666',
  631. fontSize: 15 * _self.pixelRatio,
  632. },
  633. extra: {
  634. pie: {
  635. lableWidth: 15,
  636. ringWidth: 40 * _self.pixelRatio, //圆环的宽度
  637. offsetAngle: 0 //圆环的角度
  638. }
  639. },
  640. background: '#FFFFFF',
  641. pixelRatio: _self.pixelRatio,
  642. series: chartData.series,
  643. animation: false,
  644. width: _self.cWidth * _self.pixelRatio,
  645. height: _self.cHeight * _self.pixelRatio,
  646. disablePieStroke: true,
  647. dataLabel: true,
  648. });
  649. },
  650. showFunnel(canvasId, chartData) {
  651. canvasObj[canvasId] = new uCharts({
  652. $this: _self,
  653. canvasId: canvasId,
  654. type: 'funnel',
  655. fontSize: 11,
  656. padding: [15, 15, 0, 15],
  657. legend: {
  658. show: true,
  659. padding: 5,
  660. lineHeight: 11,
  661. margin: 0,
  662. },
  663. background: '#FFFFFF',
  664. pixelRatio: _self.pixelRatio,
  665. series: chartData.series,
  666. animation: false,
  667. width: _self.cWidth * _self.pixelRatio,
  668. height: _self.cHeight * _self.pixelRatio,
  669. dataLabel: true,
  670. extra: {
  671. funnel: {
  672. border: true,
  673. borderWidth: 2,
  674. borderColor: '#FFFFFF'
  675. }
  676. },
  677. });
  678. },
  679. showRadar(canvasId, chartData) {
  680. canvasObj[canvasId] = new uCharts({
  681. $this: _self,
  682. canvasId: canvasId,
  683. type: 'radar',
  684. fontSize: 11,
  685. padding: [15, 15, 0, 15],
  686. legend: {
  687. show: true,
  688. padding: 5,
  689. lineHeight: 11,
  690. margin: 0,
  691. },
  692. background: '#FFFFFF',
  693. pixelRatio: _self.pixelRatio,
  694. animation: false,
  695. dataLabel: true,
  696. categories: chartData.categories,
  697. series: chartData.series,
  698. width: _self.cWidth * _self.pixelRatio,
  699. height: _self.cHeight * _self.pixelRatio,
  700. extra: {
  701. radar: {
  702. max: 200 //雷达数值的最大值
  703. }
  704. }
  705. });
  706. },
  707. showArcbar(canvasId, chartData) {
  708. new uCharts({
  709. $this: _self,
  710. canvasId: canvasId,
  711. type: 'arcbar',
  712. fontSize: 11,
  713. title: {
  714. name: Math.round(chartData.series[0].data * 100) + '%',
  715. color: chartData.series[0].color,
  716. fontSize: 25 * _self.pixelRatio
  717. },
  718. subtitle: {
  719. name: chartData.series[0].name,
  720. color: '#666666',
  721. fontSize: 15 * _self.pixelRatio
  722. },
  723. extra: {
  724. arcbar: {
  725. type: 'default',
  726. width: _self.arcbarWidth * _self.pixelRatio, //圆弧的宽度
  727. }
  728. },
  729. background: '#FFFFFF',
  730. pixelRatio: _self.pixelRatio,
  731. series: chartData.series,
  732. animation: false,
  733. width: _self.cWidth3 * _self.pixelRatio,
  734. height: _self.cHeight3 * _self.pixelRatio,
  735. dataLabel: true,
  736. });
  737. },
  738. showArcbar2(canvasId, chartData) {
  739. new uCharts({
  740. $this: _self,
  741. canvasId: canvasId,
  742. type: 'arcbar',
  743. fontSize: 11,
  744. title: {
  745. name: Math.round(chartData.series[0].data * 100) + '%',
  746. color: chartData.series[0].color,
  747. fontSize: 25 * _self.pixelRatio
  748. },
  749. subtitle: {
  750. name: chartData.series[0].name,
  751. color: '#666666',
  752. fontSize: 15 * _self.pixelRatio
  753. },
  754. extra: {
  755. arcbar: {
  756. type: 'default',
  757. width: _self.arcbarWidth * _self.pixelRatio, //圆弧的宽度
  758. backgroundColor: '#ffe3e8',
  759. startAngle: 1.25,
  760. endAngle: 0.75
  761. }
  762. },
  763. background: '#FFFFFF',
  764. pixelRatio: _self.pixelRatio,
  765. series: chartData.series,
  766. animation: false,
  767. width: _self.cWidth3 * _self.pixelRatio,
  768. height: _self.cHeight3 * _self.pixelRatio,
  769. dataLabel: true,
  770. });
  771. },
  772. showArcbar3(canvasId, chartData) {
  773. new uCharts({
  774. $this: _self,
  775. canvasId: canvasId,
  776. type: 'arcbar',
  777. fontSize: 11,
  778. title: {
  779. name: Math.round(chartData.series[0].data * 100) + '%',
  780. color: chartData.series[0].color,
  781. fontSize: 25 * _self.pixelRatio
  782. },
  783. subtitle: {
  784. name: chartData.series[0].name,
  785. color: '#666666',
  786. fontSize: 15 * _self.pixelRatio
  787. },
  788. extra: {
  789. arcbar: {
  790. type: 'circle', //整圆类型进度条图
  791. width: _self.arcbarWidth * _self.pixelRatio, //圆弧的宽度
  792. startAngle: 0.5 //整圆类型只需配置起始角度即可
  793. }
  794. },
  795. background: '#FFFFFF',
  796. pixelRatio: _self.pixelRatio,
  797. series: chartData.series,
  798. animation: false,
  799. width: _self.cWidth3 * _self.pixelRatio,
  800. height: _self.cHeight3 * _self.pixelRatio,
  801. dataLabel: true,
  802. });
  803. },
  804. showGauge(canvasId, chartData) {
  805. canvasObj[canvasId] = new uCharts({
  806. $this: _self,
  807. canvasId: canvasId,
  808. type: 'gauge',
  809. fontSize: 11,
  810. title: {
  811. name: Math.round(chartData.series[0].data * 100) + '%',
  812. color: chartData.categories[1].color,
  813. fontSize: 25 * _self.pixelRatio,
  814. offsetY: 50 * _self.pixelRatio, //新增参数,自定义调整Y轴文案距离
  815. },
  816. subtitle: {
  817. name: chartData.series[0].name,
  818. color: '#666666',
  819. fontSize: 15 * _self.pixelRatio,
  820. offsetY: -50 * _self.pixelRatio, //新增参数,自定义调整Y轴文案距离
  821. },
  822. extra: {
  823. gauge: {
  824. type: 'default',
  825. width: _self.gaugeWidth * _self.pixelRatio, //仪表盘背景的宽度
  826. startAngle: 0.75,
  827. endAngle: 0.25,
  828. startNumber: 0,
  829. endNumber: 100,
  830. splitLine: {
  831. fixRadius: 0,
  832. splitNumber: 10,
  833. width: _self.gaugeWidth * _self.pixelRatio, //仪表盘背景的宽度
  834. color: '#FFFFFF',
  835. childNumber: 5,
  836. childWidth: _self.gaugeWidth * 0.4 * _self.pixelRatio, //仪表盘背景的宽度
  837. },
  838. pointer: {
  839. width: _self.gaugeWidth * 0.8 * _self.pixelRatio, //指针宽度
  840. color: 'auto'
  841. }
  842. }
  843. },
  844. background: '#FFFFFF',
  845. pixelRatio: _self.pixelRatio,
  846. categories: chartData.categories,
  847. series: chartData.series,
  848. animation: true,
  849. width: _self.cWidth * _self.pixelRatio,
  850. height: _self.cHeight * _self.pixelRatio,
  851. dataLabel: true,
  852. });
  853. },
  854. changeGaugeData() {
  855. let series = [{
  856. name: "完成率",
  857. data: Math.random()
  858. }]; //这里是随机数据,生产环境请从服务器获取,注意series数据类型为数组
  859. //这里我借用之前的categories数据,判断一下新数据的title.color,没有写死在程序里,以便于自定义
  860. let newTitleColor;
  861. for (let i = 0; i < _self.serverData.Gauge.categories.length; i++) {
  862. if (series[0].data <= _self.serverData.Gauge.categories[i].value) {
  863. newTitleColor = _self.serverData.Gauge.categories[i].color;
  864. break;
  865. }
  866. }
  867. canvasObj['canvasGauge'].updateData({
  868. series: series, //这里给了新数值
  869. categories: _self.serverData.Gauge.categories,
  870. title: {
  871. name: Math.round(series[0].data * 100) + '%',
  872. color: newTitleColor,
  873. fontSize: 25 * _self.pixelRatio,
  874. offsetY: 50 * _self.pixelRatio, //新增参数,自定义调整Y轴文案距离
  875. },
  876. subtitle: {
  877. name: '更新数据',
  878. color: '#666666',
  879. fontSize: 15 * _self.pixelRatio,
  880. offsetY: -50 * _self.pixelRatio, //新增参数,自定义调整Y轴文案距离
  881. }
  882. });
  883. },
  884. showCandle(canvasId, chartData) {
  885. canvasObj[canvasId] = new uCharts({
  886. $this: _self,
  887. canvasId: canvasId,
  888. type: 'candle',
  889. fontSize: 11,
  890. padding: [15, 15, 0, 15],
  891. legend: {
  892. show: true,
  893. padding: 5,
  894. lineHeight: 11,
  895. margin: 8,
  896. },
  897. background: '#FFFFFF',
  898. pixelRatio: _self.pixelRatio,
  899. enableMarkLine: true,
  900. /***需要开启标记线***/
  901. categories: chartData.categories,
  902. series: chartData.series,
  903. animation: true,
  904. enableScroll: true, //开启图表拖拽功能
  905. xAxis: {
  906. disableGrid: true, //不绘制X轴网格线
  907. labelCount: 4, //X轴文案数量
  908. //type:'grid',
  909. //gridType:'dash',
  910. itemCount: _self.itemCount, //可不填写,配合enableScroll图表拖拽功能使用,x轴单屏显示数据的数量,默认为5个
  911. scrollShow: true, //新增是否显示滚动条,默认false
  912. scrollAlign: 'right',
  913. //scrollBackgroundColor:'#F7F7FF',//可不填写,配合enableScroll图表拖拽功能使用,X轴滚动条背景颜色,默认为 #EFEBEF
  914. //scrollColor:'#DEE7F7',//可不填写,配合enableScroll图表拖拽功能使用,X轴滚动条颜色,默认为 #A6A6A6
  915. },
  916. yAxis: {
  917. //disabled:true
  918. gridType: 'dash',
  919. splitNumber: 5,
  920. format: (val) => {
  921. return val.toFixed(0)
  922. }
  923. },
  924. width: _self.cWidth * _self.pixelRatio,
  925. height: _self.cHeight * _self.pixelRatio,
  926. dataLabel: false,
  927. dataPointShape: true,
  928. extra: {
  929. candle: {
  930. color: {
  931. upLine: '#f04864',
  932. upFill: '#f04864',
  933. downLine: '#2fc25b',
  934. downFill: '#2fc25b'
  935. },
  936. average: {
  937. show: true,
  938. name: ['MA5', 'MA10', 'MA30'],
  939. day: [5, 10, 20],
  940. color: ['#1890ff', '#2fc25b', '#facc14']
  941. }
  942. },
  943. tooltip: {
  944. bgColor: '#000000',
  945. bgOpacity: 0.7,
  946. gridType: 'dash',
  947. dashLength: 5,
  948. gridColor: '#1890ff',
  949. fontColor: '#FFFFFF',
  950. horizentalLine: true,
  951. xAxisLabel: true,
  952. yAxisLabel: true,
  953. labelBgColor: '#DFE8FF',
  954. labelBgOpacity: 0.95,
  955. labelAlign: 'left',
  956. labelFontColor: '#666666'
  957. },
  958. markLine: {
  959. type: 'dash',
  960. dashLength: 5,
  961. data: [{
  962. value: 2150,
  963. lineColor: '#f04864',
  964. showLabel: true
  965. }, {
  966. value: 2350,
  967. lineColor: '#f04864',
  968. showLabel: true
  969. }]
  970. }
  971. }
  972. });
  973. },
  974. touchCandle(e) {
  975. canvasObj['canvasCandle'].scrollStart(e);
  976. },
  977. moveCandle(e) {
  978. canvasObj['canvasCandle'].scroll(e);
  979. },
  980. touchEndCandle(e) {
  981. canvasObj['canvasCandle'].scrollEnd(e);
  982. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  983. canvasObj['canvasCandle'].showToolTip(e, {
  984. format: function(item, category) {
  985. return category + ' ' + item.name + ':' + item.data
  986. }
  987. });
  988. },
  989. changeData() {
  990. canvasObj['canvasColumn'].updateData({
  991. series: _self.serverData.ColumnB.series,
  992. categories: _self.serverData.ColumnB.categories
  993. });
  994. },
  995. touchLineA(e) {
  996. canvasObj['canvasLineA'].scrollStart(e);
  997. },
  998. moveLineA(e) {
  999. canvasObj['canvasLineA'].scroll(e);
  1000. },
  1001. touchEndLineA(e) {
  1002. canvasObj['canvasLineA'].scrollEnd(e);
  1003. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  1004. canvasObj['canvasLineA'].showToolTip(e, {
  1005. format: function(item, category) {
  1006. return category + ' ' + item.name + ':' + item.data
  1007. }
  1008. });
  1009. },
  1010. showMix(canvasId, chartData) {
  1011. canvasObj[canvasId] = new uCharts({
  1012. $this: _self,
  1013. canvasId: canvasId,
  1014. type: 'mix',
  1015. fontSize: 11,
  1016. padding: [15, 15, 0, 15],
  1017. legend: {
  1018. show: true,
  1019. padding: 5,
  1020. lineHeight: 11,
  1021. margin: 6,
  1022. },
  1023. background: '#FFFFFF',
  1024. pixelRatio: _self.pixelRatio,
  1025. categories: chartData.categories,
  1026. series: chartData.series,
  1027. animation: false,
  1028. enableScroll: true, //开启图表拖拽功能
  1029. xAxis: {
  1030. disableGrid: false,
  1031. type: 'grid',
  1032. gridType: 'dash',
  1033. itemCount: 4,
  1034. scrollShow: true,
  1035. scrollAlign: 'left',
  1036. },
  1037. yAxis: {
  1038. gridType: 'dash',
  1039. dashLength: 4,
  1040. splitNumber: 5,
  1041. min: 10,
  1042. max: 180,
  1043. format: (val) => {
  1044. return val.toFixed(0)
  1045. }
  1046. },
  1047. width: _self.cWidth * _self.pixelRatio,
  1048. height: _self.cHeight * _self.pixelRatio,
  1049. dataLabel: true,
  1050. dataPointShape: true,
  1051. extra: {
  1052. column: {
  1053. width: 20 * _self.pixelRatio
  1054. },
  1055. tooltip: {
  1056. bgColor: '#000000',
  1057. bgOpacity: 0.7,
  1058. gridType: 'dash',
  1059. dashLength: 8,
  1060. gridColor: '#1890ff',
  1061. fontColor: '#FFFFFF',
  1062. horizentalLine: true,
  1063. xAxisLabel: true,
  1064. yAxisLabel: true,
  1065. labelBgColor: '#DFE8FF',
  1066. labelBgOpacity: 0.95,
  1067. labelAlign: 'left',
  1068. labelFontColor: '#666666'
  1069. }
  1070. },
  1071. });
  1072. },
  1073. touchMix(e) {
  1074. canvasObj['canvasMix'].scrollStart(e);
  1075. },
  1076. moveMix(e) {
  1077. canvasObj['canvasMix'].scroll(e);
  1078. },
  1079. touchEndMix(e) {
  1080. canvasObj['canvasMix'].scrollEnd(e);
  1081. canvasObj['canvasMix'].touchLegend(e);
  1082. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  1083. canvasObj['canvasMix'].showToolTip(e, {
  1084. format: function(item, category) {
  1085. return category + ' ' + item.name + ':' + item.data
  1086. }
  1087. });
  1088. },
  1089. touchIt(e, id) {
  1090. canvasObj[id].touchLegend(e, {
  1091. animation: false
  1092. });
  1093. canvasObj[id].showToolTip(e, {
  1094. format: function(item, category) {
  1095. if (typeof item.data === 'object') {
  1096. return category + ' ' + item.name + ':' + item.data.value
  1097. } else {
  1098. return category + ' ' + item.name + ':' + item.data
  1099. }
  1100. }
  1101. });
  1102. },
  1103. touchPie(e, id) {
  1104. canvasObj[id].showToolTip(e, {
  1105. format: function(item) {
  1106. return item.name + ':' + item.data
  1107. }
  1108. });
  1109. },
  1110. /* 图表end */
  1111. // 切换组件
  1112. cut_index(type){
  1113. console.log('----------------------------------',type)
  1114. let _this = this
  1115. _this.show_index = type
  1116. if(_this.show_index == 0){
  1117. uni.navigateTo({
  1118. url:'/pages/index/index'
  1119. })
  1120. }
  1121. else if(_this.show_index == 1){
  1122. uni.navigateTo({
  1123. url:'/pages/template/requisitionlist/requisitionlist'
  1124. })
  1125. }
  1126. else if(_this.show_index == 2){
  1127. uni.navigateTo({
  1128. url:'/pages/template/GetMaterialIns/GetMaterialIns'
  1129. })
  1130. }
  1131. else if (_this.show_index == 3) {
  1132. uni.navigateTo({
  1133. url: '/pages/template/GetMaterialOuts/GetMaterialOuts'
  1134. })
  1135. }else if (_this.show_index == 4) {
  1136. uni.navigateTo({
  1137. url: '/pages/template/GetSafeQualityCheckDTOs/GetSafeQualityCheckDTOs?type=0'
  1138. })
  1139. }
  1140. }
  1141. }
  1142. }
  1143. </script>
  1144. <style scoped>
  1145. uni-view {
  1146. font-size: 15px;
  1147. }
  1148. .uni-row {
  1149. height: 40px;
  1150. }
  1151. .uni-row-column {
  1152. float: left;
  1153. width: 150rpx;
  1154. height: 40px;
  1155. }
  1156. .grid-item-box {
  1157. flex: 1;
  1158. /* #ifndef APP-NVUE */
  1159. display: flex;
  1160. /* #endif */
  1161. flex-direction: column;
  1162. align-items: center;
  1163. justify-content: center;
  1164. padding: 15px 0;
  1165. }
  1166. .qiun-padding {
  1167. padding: 2%;
  1168. width: 96%;
  1169. }
  1170. .qiun-wrap {
  1171. display: flex;
  1172. flex-wrap: wrap;
  1173. }
  1174. .qiun-rows {
  1175. display: flex;
  1176. flex-direction: row !important;
  1177. }
  1178. .qiun-columns {
  1179. display: flex;
  1180. flex-direction: column !important;
  1181. }
  1182. .qiun-common-mt {
  1183. margin-top: 10rpx;
  1184. }
  1185. .qiun-bg-white {
  1186. background: #FFFFFF;
  1187. }
  1188. .qiun-title-bar {
  1189. width: 96%;
  1190. padding: 10rpx 2%;
  1191. flex-wrap: nowrap;
  1192. }
  1193. .qiun-title-dot-light {
  1194. border-left: 10rpx solid #0ea391;
  1195. padding-left: 10rpx;
  1196. font-size: 32rpx;
  1197. color: #000000
  1198. }
  1199. /* 通用样式 */
  1200. .qiun-charts {
  1201. width: 750rpx;
  1202. height: 500rpx;
  1203. background-color: #FFFFFF;
  1204. }
  1205. .qiun-charts1 {
  1206. width: 750rpx;
  1207. height: 100rpx;
  1208. padding: 5px 10px;
  1209. background-color: #FFFFFF;
  1210. }
  1211. .charts {
  1212. width: 750rpx;
  1213. height: 500rpx;
  1214. background-color: #FFFFFF;
  1215. }
  1216. /* 横屏样式 */
  1217. .qiun-charts-rotate {
  1218. width: 700rpx;
  1219. height: 1100rpx;
  1220. background-color: #FFFFFF;
  1221. padding: 25rpx;
  1222. }
  1223. .charts-rotate {
  1224. width: 700rpx;
  1225. height: 1100rpx;
  1226. background-color: #FFFFFF;
  1227. }
  1228. /* 圆弧进度样式 */
  1229. .qiun-charts3 {
  1230. width: 750rpx;
  1231. height: 250rpx;
  1232. background-color: #FFFFFF;
  1233. position: relative;
  1234. }
  1235. .charts3 {
  1236. position: absolute;
  1237. width: 250rpx;
  1238. height: 250rpx;
  1239. background-color: #FFFFFF;
  1240. }
  1241. .qiun-tip {
  1242. display: block;
  1243. width: auto;
  1244. overflow: hidden;
  1245. padding: 15rpx;
  1246. height: 30rpx;
  1247. line-height: 30rpx;
  1248. margin: 10rpx;
  1249. background: #ff9933;
  1250. font-size: 30rpx;
  1251. border-radius: 8rpx;
  1252. justify-content: center;
  1253. text-align: center;
  1254. border: 1px solid #dc7004;
  1255. color: #FFFFFF;
  1256. }
  1257. .gree {
  1258. color: #09BB07;
  1259. }
  1260. .orange {
  1261. color: orange;
  1262. }
  1263. .gray {
  1264. color: #E0E0E0;
  1265. }
  1266. </style>