newchartDetail.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view>
  3. <view class="" style="margin-top: 0rpx;padding: 0rpx 0rpx 0rpx 20rpx;">
  4. <view class="align-items" style="position: absolute; top: 90rpx; left: 0;" v-if="allType == null">
  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" @click="openWorker()" v-if="type == 'ExamineWorker'">
  31. {{worker ? worker : '全部职工'}}
  32. <u-select v-model="workShow" :list="workList" @confirm="workConfirm()"></u-select>
  33. </view>
  34. <view class="font-fifty-six SourceHanSansCN choose" @click="reset()">
  35. 重置
  36. </view>
  37. <view>
  38. <qiun-data-charts type="pie" :chartData="chartData" background="none" canvas2d="false" />
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import service from '@/api/index.js'
  45. export default {
  46. name:'chartDetail',
  47. props:{
  48. allType:null
  49. },
  50. data(){
  51. return {
  52. chartData: {
  53. series: [{
  54. data: []
  55. }]
  56. },
  57. type:'',
  58. house:'',
  59. houseId:'',
  60. worker:'',
  61. workerId:'',
  62. chooseHouseList:[],
  63. workList:[],
  64. houseShow:false,
  65. workShow:false,
  66. keyword:'',
  67. pop:false,
  68. current:-1
  69. }
  70. },
  71. created(){
  72. let thet = this;
  73. if(this.allType!=null){
  74. this.type=this.allType;
  75. if(this.type == 'examineArea'){
  76. this.getExamineArea();
  77. }else if(this.type == 'ExamineWorker'){
  78. this.getwork();
  79. this.getExamineWorker()
  80. }else if(this.type == 'getExamineServe'){
  81. this.getExamineServe()
  82. }else if(this.type == 'getExaminePipeType'){
  83. this.getExaminePipeType()
  84. }else if(this.type == 'getExaminePipeLength'){
  85. this.getExaminePipeLength()
  86. }else if(this.type == 'getExamineValveType'){
  87. this.getExamineValveType()
  88. }else if(this.type =='getAreaSum'){
  89. this.getAreaSum()
  90. }
  91. this.getArea();
  92. }
  93. },
  94. onLoad(e) {
  95. this.type = e.type;
  96. if(this.type == 'examineArea'){
  97. this.getExamineArea();
  98. }else if(this.type == 'ExamineWorker'){
  99. this.getwork();
  100. this.getExamineWorker()
  101. }else if(this.type == 'getExamineServe'){
  102. this.getExamineServe()
  103. }else if(this.type == 'getExaminePipeType'){
  104. this.getExaminePipeType()
  105. }else if(this.type == 'getExaminePipeLength'){
  106. this.getExaminePipeLength()
  107. }else if(this.type == 'getExamineValveType'){
  108. this.getExamineValveType()
  109. }else if(this.type =='getAreaSum'){
  110. this.getAreaSum()
  111. }
  112. this.getArea();
  113. },
  114. methods:{
  115. openHouse(){
  116. this.pop = !this.pop;
  117. },
  118. openWorker(){
  119. this.workShow = !this.workShow;
  120. },
  121. workConfirm(e){
  122. this.worker = e[0].label;
  123. this.workerId = e[0].value;
  124. this.getExamineWorker(this.workerId)
  125. },
  126. reset(){
  127. this.houseId = '';
  128. this.worker='',
  129. this.workerId='',
  130. this.getArea();
  131. if(this.type == 'examineArea'){
  132. this.getExamineArea(this.houseId)
  133. }else if(this.type == 'ExamineWorker'){
  134. this.getExamineWorker();
  135. }else if(this.type == 'getExamineServe'){
  136. this.getExamineServe(this.houseId)
  137. }else if(this.type == 'getExaminePipeType'){
  138. this.getExaminePipeType(this.houseId)
  139. }else if(this.type == 'getExaminePipeLength'){
  140. this.getExaminePipeLength(this.houseId)
  141. }else if(this.type == 'getExamineValveType'){
  142. this.getExamineValveType(this.houseId)
  143. }else if(this.type =='getAreaSum'){
  144. this.getAreaSum(this.houseId)
  145. }
  146. this.house = null;
  147. this.current = -1;
  148. this.$UTILS.showPrompt('重置成功!')
  149. },
  150. search(){
  151. this.house = this.housename
  152. if(this.type == 'examineArea'){
  153. this.getExamineArea(this.houseId)
  154. }else if(this.type == 'getExamineServe'){
  155. this.getExamineServe(this.houseId)
  156. }else if(this.type == 'getExaminePipeType'){
  157. this.getExaminePipeType(this.houseId)
  158. }else if(this.type == 'getExaminePipeLength'){
  159. this.getExaminePipeLength(this.houseId)
  160. }else if(this.type == 'getExamineValveType'){
  161. this.getExamineValveType(this.houseId)
  162. }else if(this.type =='getAreaSum'){
  163. this.getAreaSum(this.houseId)
  164. }
  165. this.pop = false;
  166. },
  167. searchinfo(){
  168. service.getArea({name:this.keyword}).then(res => {
  169. this.chooseHouseList = [];
  170. res.forEach((item, index) => {
  171. this.chooseHouseList.push({
  172. value: item.id,
  173. label: item.name,
  174. selectType:'xiaoqu'
  175. })
  176. })
  177. })
  178. this.keyword = null;
  179. },
  180. active(item,index){
  181. this.current = index;
  182. this.housename = item.label;
  183. this.houseId = item.value;
  184. this.selectType = item.selectType;
  185. },
  186. getArea(){
  187. service.getArea().then(res => {
  188. this.chooseHouseList = [];
  189. res.forEach((item, index) => {
  190. this.chooseHouseList.push({
  191. value: item.id,
  192. label: item.name,
  193. })
  194. })
  195. })
  196. },
  197. //获取职工列表
  198. getwork(){
  199. service.getWorker().then(res => {
  200. this.workList = [];
  201. res.forEach((item, index) => {
  202. this.workList.push({
  203. value: item.id,
  204. label: item.name,
  205. })
  206. })
  207. })
  208. },
  209. //小区合格率
  210. getExamineArea(houseId) {
  211. service.getExamineArea({areaId:this.houseId}).then(res => {
  212. this.chartData.series[0].data = res
  213. console.log('this.chartData', this.chartData)
  214. })
  215. },
  216. //职工合格率
  217. getExamineWorker(workerId) {
  218. service.getExamineWorker({workerId:this.workerId}).then(res => {
  219. this.chartData.series[0].data = res
  220. console.log('getExamineWorker', res)
  221. })
  222. },
  223. //小区服务统计
  224. getExamineServe(serveId) {
  225. service.getExamineServe({id:this.houseId}).then(res => {
  226. this.chartData.series[0].data = res
  227. console.log('getExamineServe', res)
  228. })
  229. },
  230. //管材类别统计
  231. getExaminePipeType(pipeTypeId) {
  232. service.getExaminePipeType({id:this.houseId}).then(res => {
  233. this.chartData.series[0].data = res
  234. console.log('getExaminePipeType', res)
  235. })
  236. },
  237. //管材长度统计
  238. getExaminePipeLength(pipeLengthId) {
  239. service.getExaminePipeLength({id:this.houseId}).then(res => {
  240. this.chartData.series[0].data = res
  241. console.log('getExaminePipeLength', res)
  242. })
  243. },
  244. //自闭阀类别统计
  245. getExamineValveType(valveTypeId) {
  246. service.getExamineValveType({id:this.houseId}).then(res => {
  247. this.chartData.series[0].data = res
  248. console.log('getExamineValveType', res)
  249. })
  250. },
  251. //小区汇总统计
  252. getAreaSum(areaSumId) {
  253. service.getAreaSum({areaId:this.houseId}).then(res => {
  254. this.chartData.series[0].data = res
  255. console.log('getAreaSum', res)
  256. })
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .choose {
  263. text-align: center;
  264. padding: 20rpx;
  265. margin: 30rpx;
  266. color: #FFFFFF;
  267. background: #43CEB1;
  268. border-radius: 64rpx;
  269. }
  270. .active{
  271. background-color: #1890FF;
  272. }
  273. </style>