chartDetail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <view class="" style="height: 500rpx; margin-top: 200rpx;">
  4. <view class="align-items" style="position: absolute; top: 90rpx; left: 0;" >
  5. <back></back>
  6. </view>
  7. <view class="font-fifty-six SourceHanSansCN choose" @click="openHouse()" v-if="type != 'ExamineWorker'">
  8. {{house ? house :'全部小区'}}
  9. <u-popup v-model="pop" mode="bottom" height="1000rpx">
  10. <view style="margin: 20rpx;">
  11. <u-search placeholder="请输入搜索内容" v-model="keyword" :action-style="{'font-size':'40rpx'}" @custom="searchinfo()"></u-search>
  12. </view>
  13. <view>
  14. <scroll-view scroll-y="true" style="height: 600rpx; text-align: center;">
  15. <view v-for="(item,index) in chooseHouseList" :key="item.value" >
  16. <view :class="current === index ? 'active' : '' " style="color: #000000;" @click="active(item,index)">
  17. {{item.label}}
  18. </view>
  19. </view>
  20. </scroll-view>
  21. <view class="">
  22. <button type="default" class="font-fifty-six" @click="search()">确定</button>
  23. </view>
  24. <view class="">
  25. <button type="default" @click="pop = false;" class="font-fifty-six">取消</button>
  26. </view>
  27. </view>
  28. </u-popup>
  29. </view>
  30. <view class="font-fifty-six SourceHanSansCN choose" v-if="type != 'ExamineWorker'" @click="reset()">
  31. 重置
  32. </view>
  33. <view class="font-fifty-six SourceHanSansCN choose" @click="openWorker()" v-if="type == 'ExamineWorker'">
  34. {{worker ? worker : '全部工人'}}
  35. <u-select v-model="workShow" :list="workList" @confirm="workConfirm()"></u-select>
  36. </view>
  37. <view>
  38. <qiun-data-charts type="pie" :chartData="chartData" background="none" canvas2d="true" canvasId="ssssss"/>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import service from '@/api/index.js'
  45. export default {
  46. data(){
  47. return {
  48. chartData: {
  49. series: [{
  50. data: []
  51. }]
  52. },
  53. type:'',
  54. house:'',
  55. houseId:'',
  56. worker:'',
  57. workerId:'',
  58. chooseHouseList:[],
  59. workList:[],
  60. houseShow:false,
  61. workShow:false,
  62. keyword:'',
  63. pop:false,
  64. current:-1
  65. }
  66. },
  67. onLoad(e) {
  68. this.type = e.type;
  69. if(this.type == 'examineArea'){
  70. this.getExamineArea();
  71. }else if(this.type == 'ExamineWorker'){
  72. this.getwork();
  73. this.getExamineWorker()
  74. }else if(this.type == 'getExamineServe'){
  75. this.getExamineServe()
  76. }else if(this.type == 'getExaminePipeType'){
  77. this.getExaminePipeType()
  78. }else if(this.type == 'getExaminePipeLength'){
  79. this.getExaminePipeLength()
  80. }else if(this.type == 'getExamineValveType'){
  81. this.getExamineValveType()
  82. }else if(this.type =='getAreaSum'){
  83. this.getAreaSum()
  84. }
  85. this.getArea();
  86. },
  87. methods:{
  88. openHouse(){
  89. this.pop = !this.pop;
  90. },
  91. openWorker(){
  92. this.workShow = !this.workShow;
  93. },
  94. workConfirm(e){
  95. this.worker = e[0].label;
  96. this.workerId = e[0].value;
  97. this.getExamineWorker(this.workerId)
  98. },
  99. reset(){
  100. this.houseId = '';
  101. this.getArea();
  102. if(this.type == 'examineArea'){
  103. this.getExamineArea(this.houseId)
  104. }else if(this.type == 'getExamineServe'){
  105. this.getExamineServe(this.houseId)
  106. }else if(this.type == 'getExaminePipeType'){
  107. this.getExaminePipeType(this.houseId)
  108. }else if(this.type == 'getExaminePipeLength'){
  109. this.getExaminePipeLength(this.houseId)
  110. }else if(this.type == 'getExamineValveType'){
  111. this.getExamineValveType(this.houseId)
  112. }else if(this.type =='getAreaSum'){
  113. this.getAreaSum(this.houseId)
  114. }
  115. this.house = null;
  116. this.current = -1;
  117. this.$UTILS.showPrompt('重置成功!')
  118. },
  119. search(){
  120. this.house = this.housename
  121. if(this.type == 'examineArea'){
  122. this.getExamineArea(this.houseId)
  123. }else if(this.type == 'getExamineServe'){
  124. this.getExamineServe(this.houseId)
  125. }else if(this.type == 'getExaminePipeType'){
  126. this.getExaminePipeType(this.houseId)
  127. }else if(this.type == 'getExaminePipeLength'){
  128. this.getExaminePipeLength(this.houseId)
  129. }else if(this.type == 'getExamineValveType'){
  130. this.getExamineValveType(this.houseId)
  131. }else if(this.type =='getAreaSum'){
  132. this.getAreaSum(this.houseId)
  133. }
  134. this.pop = false;
  135. },
  136. searchinfo(){
  137. service.getArea({name:this.keyword}).then(res => {
  138. this.chooseHouseList = [];
  139. res.forEach((item, index) => {
  140. this.chooseHouseList.push({
  141. value: item.id,
  142. label: item.name,
  143. selectType:'xiaoqu'
  144. })
  145. })
  146. })
  147. this.keyword = null;
  148. },
  149. active(item,index){
  150. this.current = index;
  151. this.housename = item.label;
  152. this.houseId = item.value;
  153. this.selectType = item.selectType;
  154. },
  155. getArea(){
  156. service.getArea().then(res => {
  157. this.chooseHouseList = [];
  158. res.forEach((item, index) => {
  159. this.chooseHouseList.push({
  160. value: item.id,
  161. label: item.name,
  162. })
  163. })
  164. })
  165. },
  166. //获取工人列表
  167. getwork(){
  168. service.getWorker().then(res => {
  169. this.workList = [];
  170. res.forEach((item, index) => {
  171. this.workList.push({
  172. value: item.id,
  173. label: item.name,
  174. })
  175. })
  176. })
  177. },
  178. //小区合格率
  179. getExamineArea(houseId) {
  180. service.getExamineArea({areaId:this.houseId}).then(res => {
  181. this.chartData.series[0].data = res
  182. console.log('this.chartData', this.chartData)
  183. })
  184. },
  185. //工人合格率
  186. getExamineWorker(workerId) {
  187. service.getExamineWorker({workerId:this.workerId}).then(res => {
  188. this.chartData.series[0].data = res
  189. console.log('getExamineWorker', res)
  190. })
  191. },
  192. //小区服务统计
  193. getExamineServe(serveId) {
  194. service.getExamineServe({id:this.houseId}).then(res => {
  195. this.chartData.series[0].data = res
  196. console.log('getExamineServe', res)
  197. })
  198. },
  199. //管材类别统计
  200. getExaminePipeType(pipeTypeId) {
  201. service.getExaminePipeType({id:this.houseId}).then(res => {
  202. this.chartData.series[0].data = res
  203. console.log('getExaminePipeType', res)
  204. })
  205. },
  206. //管材长度统计
  207. getExaminePipeLength(pipeLengthId) {
  208. service.getExaminePipeLength({id:this.houseId}).then(res => {
  209. this.chartData.series[0].data = res
  210. console.log('getExaminePipeLength', res)
  211. })
  212. },
  213. //自闭阀类别统计
  214. getExamineValveType(valveTypeId) {
  215. service.getExamineValveType({id:this.houseId}).then(res => {
  216. this.chartData.series[0].data = res
  217. console.log('getExamineValveType', res)
  218. })
  219. },
  220. //小区汇总统计
  221. getAreaSum(areaSumId) {
  222. service.getAreaSum({areaId:this.houseId}).then(res => {
  223. this.chartData.series[0].data = res
  224. console.log('getAreaSum', res)
  225. })
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .choose {
  232. text-align: center;
  233. padding: 20rpx;
  234. margin: 30rpx;
  235. color: #FFFFFF;
  236. background: #43CEB1;
  237. border-radius: 64rpx;
  238. }
  239. .active{
  240. background-color: #1890FF;
  241. }
  242. </style>