workbench.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="container workbench-content">
  3. <view class="cu-bar search bg-white">
  4. <view class="search-form round" @click="search()">
  5. <text class="cuIcon-search"></text>
  6. <input :adjust-position="false" type="text" placeholder="搜索 设备名称、型号、编号" disabled="true"></input>
  7. </view>
  8. <view class="action" @click="scancode()">
  9. <text class="cuIcon-scan text-black text-bold" style="font-size: 56rpx;"></text>
  10. </view>
  11. </view>
  12. <view class="cu-bar bg-white solid-bottom margin-top-sm text-black">
  13. <view class="action text-bold">
  14. 工作台
  15. </view>
  16. </view>
  17. <view class="cu-list grid col-3">
  18. <view class="cu-item" @click="goPage('/pages/equipment/archives')">
  19. <view class="cuIcon">
  20. <image src="/static/workbench/archive.png" class="png" mode="widthFix"></image>
  21. </view>
  22. <text>设备档案</text>
  23. </view>
  24. <view class="cu-item" @click="goPage('/pages/equipment/list?plan_type=inspection')">
  25. <view class="cuIcon">
  26. <image src="/static/workbench/inspection.png" class="png" mode="widthFix"></image>
  27. <view class="cu-tag badge" v-if="inspection > 0">
  28. <block>{{inspection}}</block>
  29. </view>
  30. </view>
  31. <text>设备巡检</text>
  32. </view>
  33. <view class="cu-item" @click="goPage('/pages/equipment/list?plan_type=maintenance')">
  34. <view class="cuIcon">
  35. <image src="/static/workbench/maintenance.png" class="png" mode="widthFix"></image>
  36. <view class="cu-tag badge" v-if="maintenance > 0">
  37. <block>{{maintenance}}</block>
  38. </view>
  39. </view>
  40. <text>设备保养</text>
  41. </view>
  42. <view class="cu-item" @click="goPage('/pages/repair/list?type=pending')">
  43. <view class="cuIcon">
  44. <image src="/static/workbench/repair_pool.png" class="png" mode="widthFix"></image>
  45. <view class="cu-tag badge" v-if="repairPool > 0">
  46. <block>{{repairPool}}</block>
  47. </view>
  48. </view>
  49. <text>待接工单</text>
  50. </view>
  51. <view class="cu-item" @click="goPage('/pages/repair/list?type=registered')">
  52. <view class="cuIcon">
  53. <image src="/static/workbench/repair.png" class="png" mode="widthFix"></image>
  54. <view class="cu-tag badge" v-if="repair > 0">
  55. <block>{{repair}}</block>
  56. </view>
  57. </view>
  58. <text>我的工单</text>
  59. </view>
  60. <view class="cu-item" @click="goPage('/pages/equipment/list?status=scrapped')">
  61. <view class="cuIcon">
  62. <image src="/static/workbench/scrapped.png" class="png" mode="widthFix"></image>
  63. </view>
  64. <text>设备报废</text>
  65. </view>
  66. </view>
  67. <view class="cu-bar bg-white solid-bottom margin-top-sm text-black">
  68. <view class="action text-bold">
  69. 设备运行情况
  70. </view>
  71. </view>
  72. <view class="cu-list bg-white padding">
  73. <qiun-data-charts type="pie"
  74. :opts="{dataLabel: false, legend: {position: 'right', fontColor: '#333333', lineHeight: 30}}"
  75. :chartData="equipmentChartsData" />
  76. </view>
  77. <view class="cu-bar bg-white solid-bottom margin-top-sm text-black">
  78. <view class="action text-bold">
  79. 巡检/保养计划
  80. </view>
  81. <view class="action text-gray text-sm">
  82. 近7天巡检/保养次数
  83. </view>
  84. </view>
  85. <view class="cu-list bg-white padding">
  86. <qiun-data-charts type="line"
  87. :opts="{legend: {fontColor: '#333333'}, yAxis: {gridType: 'dash', dashLength: 4, gridColor: '#F1F1F1'}}"
  88. :chartData="planChartsData" />
  89. </view>
  90. <view class="cu-bar bg-white solid-bottom margin-top-sm text-black">
  91. <view class="action text-bold">
  92. 设备维修工单
  93. </view>
  94. <view class="action text-gray text-sm">
  95. 近7天维修工单数
  96. </view>
  97. </view>
  98. <view class="cu-list bg-white padding">
  99. <qiun-data-charts type="column"
  100. :opts="{legend: {show: false}, yAxis: {gridType: 'dash', dashLength: 4, gridColor: '#F1F1F1'}}"
  101. :chartData="repairChartsData" />
  102. </view>
  103. <view class="cu-bar bg-white solid-bottom margin-top-sm text-black">
  104. <view class="action text-bold">
  105. 设备故障原因
  106. </view>
  107. <view class="action text-gray text-sm">
  108. 本月设备故障原因占比
  109. </view>
  110. </view>
  111. <view class="cu-list bg-white padding">
  112. <qiun-data-charts type="ring"
  113. :opts="{dataLabel: false, legend: {position: 'right', fontColor: '#333333', lineHeight: 30}, title: {name: ''}, subtitle: {name: ''}}"
  114. :chartData="failureChartsData" />
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. var _self
  120. export default {
  121. data() {
  122. return {
  123. repair: 0,
  124. repairPool: 0,
  125. inspection: 0,
  126. maintenance: 0,
  127. equipmentChartsData: {},
  128. planChartsData: {},
  129. repairChartsData: {},
  130. failureChartsData: {}
  131. };
  132. },
  133. mounted() {
  134. _self = this
  135. _self.getWorkbenchInfo()
  136. },
  137. methods: {
  138. getWorkbenchInfo() {
  139. _self.$api.workbench().then((res) => {
  140. _self.repair = res.data.repair
  141. _self.repairPool = res.data.repairPool
  142. _self.inspection = res.data.inspection
  143. _self.maintenance = res.data.maintenance
  144. _self.packageChartData(res.data.statisticChart)
  145. }).catch((err) => {
  146. })
  147. },
  148. packageChartData(statisticChart) {
  149. let equipmentPie = {
  150. "series": [{
  151. "data": statisticChart.equipmentStatus
  152. }]
  153. };
  154. let planLine = {
  155. "categories": statisticChart.weekDate,
  156. "series": [{
  157. "name": "巡检计划",
  158. "data": statisticChart.inspectionWeekData
  159. }, {
  160. "name": "保养计划",
  161. "data": statisticChart.maintenanceWeekData
  162. }]
  163. };
  164. let repairColumn = {
  165. "categories": statisticChart.weekDate,
  166. "series": [{
  167. "name": "工单数",
  168. "data": statisticChart.repairWeekData
  169. }]
  170. };
  171. let failureRing = {
  172. "series": [{
  173. "data": statisticChart.failureCause
  174. }]
  175. };
  176. _self.equipmentChartsData = JSON.parse(JSON.stringify(equipmentPie))
  177. _self.planChartsData = JSON.parse(JSON.stringify(planLine))
  178. _self.repairChartsData = JSON.parse(JSON.stringify(repairColumn))
  179. _self.failureChartsData = JSON.parse(JSON.stringify(failureRing))
  180. },
  181. scancode() {
  182. uni.scanCode({
  183. scanType: ['qrCode'],
  184. success: function(res) {
  185. let qrcode = res.result
  186. if (!qrcode) {
  187. _self.tui.toast('无法识别二维码')
  188. return
  189. }
  190. _self.parsingCode(qrcode)
  191. }
  192. })
  193. },
  194. parsingCode(qrcode) {
  195. let qrArr = qrcode.split("/")
  196. let coding = qrArr[qrArr.length - 1]
  197. if (!coding || coding.length != 8) {
  198. _self.tui.toast('无法识别二维码')
  199. return
  200. }
  201. uni.navigateTo({
  202. url: '/pages/equipment/info?coding=' + coding,
  203. })
  204. },
  205. goPage(url) {
  206. uni.navigateTo({
  207. url
  208. })
  209. },
  210. search() {
  211. uni.navigateTo({
  212. url: '/pages/index/search'
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss">
  219. .workbench-content {
  220. .grid.col-3 {
  221. image {
  222. width: 40%;
  223. }
  224. text {
  225. color: #333333 !important;
  226. }
  227. }
  228. }
  229. </style>