index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="content">
  3. <!-- <fxyk-navbar :isSearch="false" :isNeedReturn="false" title="首页"/> -->
  4. <view class="u-padding-left-60 u-margin-bottom-30">
  5. <text class="d-block main-title">业扩项目包工程管理</text>
  6. <text class="d-block main-english">Project management of business expansion project package</text>
  7. </view>
  8. <u-line color="white" border-style="dashed"/>
  9. <view class="d-flex u-margin-top-30 position-relative" style="height: 380rpx">
  10. <canvas style="margin-top:20rpx" class="z-1" canvas-id="canvasPie" id="canvasPie"></canvas>
  11. <canvas style="margin-left:-150rpx;margin-top:40rpx" canvas-id="canvasColumn" id="canvasColumn"></canvas>
  12. <view class="position-absolute status_style">
  13. <fxyk-status title="已完成" bgColor="#4CB1FF"/>
  14. <fxyk-status title="进行中" bgColor="#E7AE5E"/>
  15. <fxyk-status title="已终止" bgColor="#FF0014"/>
  16. </view>
  17. </view>
  18. <u-line color="white" border-style="dashed"/>
  19. <fxyk-search backgroundColor="#40349C" borderColor="#fff" placeholderColor="#fff" height="80" :paddingY="40" :paddingX="40" searchIconColor="#fff" disabled/>
  20. <view class="d-flex a-center u-margin-bottom-25 tab">
  21. <fxyk-tabControl v-for="(item,index) in tabData" :key="index" class="tab-item" :class="{'tabItemNative': tabIndex === index}" :tabData='item' :itemIndex="tabIndex" @click.native="jump_path(index)"></fxyk-tabControl>
  22. </view>
  23. <template v-if="projectData.length">
  24. <view v-for="(item,index) in projectData" :key="index">
  25. <fxyk-projectCard bgColor="#544AA6" :projectData="item" @click.native="jump_content(index)"></fxyk-projectCard>
  26. </view>
  27. </template>
  28. </view>
  29. </template>
  30. <script>
  31. import uCharts from '@/js_sdk/u-charts/u-charts/u-charts.js';
  32. var _self;
  33. var canvaColumn=null;
  34. var canvaPie=null;
  35. export default {
  36. data() {
  37. return {
  38. background: {
  39. backgroundColor: "#40349C",
  40. },
  41. tabData: [
  42. {'num': 40, 'status': 1},
  43. {'num': 24, 'status': 2},
  44. {'num': 10, 'status': 3},
  45. {'num': 6, 'status': 4}
  46. ],
  47. tabIndex: 0,
  48. projectData: [
  49. {'status': 2,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  50. {'status': 1,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  51. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  52. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  53. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  54. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  55. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  56. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  57. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'}
  58. ],
  59. pixelRatio:1,
  60. serverData:'',
  61. chartData: {
  62. "categories": ["2012", "2013", "2014"],
  63. "series": [{
  64. "textColor":"#fff",
  65. "data": [{"value": 24,"color": '#4CB1FF'}, {"value": 10,"color": '#E7AE5E'},{"value": 6,"color": '#FF0014'}]
  66. }]
  67. },
  68. Pie: { series: [{
  69. "data": 24,
  70. "textColor": '#fff',
  71. "textSize": 8
  72. }, {
  73. "data": 6,
  74. "textColor": '#fff',
  75. "textSize": 8
  76. }, {
  77. "data": 10,
  78. "textColor": '#fff',
  79. "textSize": 8
  80. }]
  81. }
  82. }
  83. },
  84. onLoad() {
  85. _self = this;
  86. // 饼状图 柱状图 宽高设置
  87. this.cWidthPie=uni.upx2px(380)
  88. this.cHeightPie=uni.upx2px(360)
  89. this.cWidthColumn=uni.upx2px(420)
  90. this.cHeightColumn=uni.upx2px(360)
  91. // 显示饼状图
  92. this.showPie()
  93. // 显示柱状图
  94. this.showColumn()
  95. },
  96. computed: {
  97. tabStyle() {
  98. return function(index){
  99. if (this.tabIndex === index) {
  100. return {'background-color': '#4CB1FF'}
  101. }
  102. }
  103. }
  104. },
  105. methods: {
  106. jump_path(index) {
  107. this.tabIndex = index
  108. if (index === 1) {
  109. this.projectData = [
  110. {'status': 1,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  111. ]} else {
  112. this.projectData = [
  113. {'status': 2,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  114. {'status': 1,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  115. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  116. {'status': 3,'name':'辽宁中润农业发展有限公司','number':'121514551Fs15','content':'描述'},
  117. ]}
  118. },
  119. jump_content(index) {
  120. uni.navigateTo({
  121. url: `/pages/index/projectInfo?status=${index+1}`
  122. })
  123. },
  124. showColumn(){
  125. canvaColumn=new uCharts({
  126. $this:_self,
  127. canvasId: 'canvasColumn',
  128. type: 'column',
  129. legend:{ show:false },
  130. fontSize: 8,
  131. background: '#FFFFFF',
  132. pixelRatio: 1.5,
  133. categories: this.chartData.categories,
  134. series: this.chartData.series,
  135. xAxis: {
  136. disableGrid: true,
  137. disabled: true,
  138. },
  139. yAxis: {
  140. disableGrid: true,
  141. data: [{
  142. // 控制Y轴数据点颜色
  143. fontColor: '#40349C'
  144. }]
  145. },
  146. dataLabel: true,
  147. width: _self.cWidthColumn*_self.pixelRatio,
  148. height: _self.cHeightColumn*_self.pixelRatio,
  149. extra: {
  150. column: {
  151. type:'group',
  152. width: 30
  153. }
  154. }
  155. });
  156. },
  157. showPie() {
  158. canvaPie=new uCharts({
  159. $this:_self,
  160. canvasId: "canvasPie",
  161. colors: ['#4CB1FF','#FF0014','#E7AE5E'],
  162. type: 'pie',
  163. fontSize: 11,
  164. background: '#40349C',
  165. legend:{ show:false },
  166. pixelRatio: 0.5,
  167. series: this.Pie.series,
  168. width: _self.cWidthPie*_self.pixelRatio,
  169. height: _self.cHeightPie*_self.pixelRatio,
  170. dataLabel: true,
  171. dataPointShape: true,
  172. extra: {
  173. pie: {
  174. offsetAngle: 55,
  175. lableWidth: 0,
  176. border: true,
  177. borderWidth: 5,
  178. borderColor: '#40349C'
  179. }
  180. }
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. page {
  188. width: 100%;
  189. height: 100%;
  190. background-color: $yk-main-bg-color;
  191. }
  192. .content {
  193. width: 100%;
  194. height: 100%;
  195. min-height: 100vh;
  196. background-color: $yk-main-bg-color;
  197. }
  198. .main-title {
  199. height: 56rpx;
  200. font-size: 42rpx;
  201. font-family: Segoe UI;
  202. font-weight: 400;
  203. line-height: 56rpx;
  204. color: $yk-yellow-color;
  205. font-size: 40rpx;
  206. letter-spacing: 1rpx;
  207. }
  208. .main-english {
  209. height: 29rpx;
  210. font-size: 21rpx;
  211. font-family: Segoe UI;
  212. font-weight: 400;
  213. line-height: 29rpx;
  214. color: #FFFFFF;
  215. opacity: 0.8;
  216. }
  217. .tabItemNative {
  218. background-color: $yk-blue-color!important;
  219. }
  220. .tab {
  221. height: 120rpx;
  222. .tab-item {
  223. width: 169rpx;
  224. height: 105rpx;
  225. text-align: center;
  226. margin: 10.5rpx;
  227. border-radius: 17rpx;
  228. background-color: $yk-main-text-color;
  229. box-shadow: 0rpx 6rpx 13rpx rgba(0, 0, 0, 0.16);
  230. }
  231. }
  232. .status_style {
  233. right:40rpx;
  234. }
  235. </style>