home.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view class="container">
  3. <view class="top_bg" @click="permission = !permission"></view>
  4. <!-- 状态统计区域 -->
  5. <view class="top_types" v-if="!permission">
  6. <view class="types_box">
  7. <view class="box_num">100</view>
  8. <view class="box_info">工单数</view>
  9. </view>
  10. <view class="types_box">
  11. <view class="box_num">10</view>
  12. <view class="box_info">处理中</view>
  13. </view>
  14. <view class="types_box">
  15. <view class="box_num">50</view>
  16. <view class="box_info">已完成</view>
  17. </view>
  18. <view class="types_box">
  19. <view class="box_num">60</view>
  20. <view class="box_info">已超时</view>
  21. </view>
  22. </view>
  23. <view class="top_types2" v-else>
  24. <view class="top">
  25. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#6FB6B8"></uni-segmented-control>
  26. </view>
  27. <view class="bottom">
  28. <view class="bottom_box">
  29. <view class="box_num">100</view>
  30. <view class="box_info">工单数</view>
  31. </view>
  32. <view class="bottom_box">
  33. <view class="box_num">10</view>
  34. <view class="box_info">处理中</view>
  35. </view>
  36. <view class="bottom_box">
  37. <view class="box_num">50</view>
  38. <view class="box_info">已完成</view>
  39. </view>
  40. <view class="bottom_box">
  41. <view class="box_num">60</view>
  42. <view class="box_info">已超时</view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 排班区域 -->
  47. <view class="watch">
  48. <view class="watch_title">
  49. <img src="../../static/images/repairsImg/watch.png" />
  50. 排班
  51. </view>
  52. <!-- 表格区域 -->
  53. <uni-table stripe emptyText="暂无更多数据">
  54. <!-- 表头行 -->
  55. <uni-tr>
  56. <uni-th width="80" align="center">姓名</uni-th>
  57. <uni-th width="50" align="center">工种</uni-th>
  58. <uni-th width="80" align="center">状态</uni-th>
  59. <uni-th width="70" align="center">是否值班</uni-th>
  60. </uni-tr>
  61. <!-- 表格数据行 -->
  62. <uni-tr v-for="(item, index) in tableData" :key="index">
  63. <!-- 姓名区域 -->
  64. <uni-td align="center">{{ item.name }}</uni-td>
  65. <!-- 工种区域 -->
  66. <uni-td align="center">{{ item.type }}</uni-td>
  67. <!-- 状态区域 -->
  68. <uni-td align="center">
  69. <picker @change="bindPickerChange($event, item)" :range="typeArray">
  70. <view class="watch_color" v-if="item.status == '0'">{{ typeArray[item.status] }}</view>
  71. <view class="watch_color2" v-if="item.status == '1'">{{ typeArray[item.status] }}</view>
  72. <view class="watch_color3" v-if="item.status == '2'">{{ typeArray[item.status] }}</view>
  73. </picker>
  74. </uni-td>
  75. <!-- 是否值班 -->
  76. <uni-td align="center">
  77. <view @click="handleChange(item, index)">{{ item.work.toString() }}</view>
  78. </uni-td>
  79. </uni-tr>
  80. </uni-table>
  81. <!-- 是否值班弹窗区域 -->
  82. <uni-popup ref="popup_work">
  83. <view class="watch_pop">
  84. <view class="poop_title">
  85. <view class="cancel" @click="$refs.popup_work.close()">取消</view>
  86. <view class="confirm" @click="handlePopConfirm">确定</view>
  87. </view>
  88. <view class="poop_body">
  89. <view class="body_item" v-for="(item, index_pop) in workArray" :key="index_pop" @click="handleChangeWork(item)">
  90. <view class="body_item_info">
  91. {{ item }}
  92. </view>
  93. <view class="body_item_icon" v-if="defaultIndex.includes(item)">✔</view>
  94. </view>
  95. </view>
  96. </view>
  97. </uni-popup>
  98. </view>
  99. <!-- 排行榜区域 -->
  100. <view class="rank">
  101. <view class="rank_title">
  102. <img src="../../static/images/repairsImg/rank.png" />
  103. 工单完成排行榜
  104. </view>
  105. <!-- 排行榜柱状图 -->
  106. <view class="rank_charts">
  107. <!-- 加上canvas2d属性后 模拟器上图表显示异常,真机调试没有问题,开发时不添加canvas2d属性,发布时添加canvas2d属性 -->
  108. <!-- :canvas2d="true" -->
  109. <qiun-data-charts type="bar" :opts="opts" :chartData="chartData" />
  110. </view>
  111. </view>
  112. <!-- 悬浮按钮区域 -->
  113. <view class="fixed">
  114. <img src="../../static/images/repairsImg/add.png" />
  115. <uni-badge :offset="[5, 5]" absolute="rightTop" text="8">
  116. <img class="img" src="../../static/images/repairsImg/message.png" @click="handleGoMsg" />
  117. </uni-badge>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. export default {
  123. data() {
  124. return {
  125. defaultIndex: [],
  126. changeIndex: 0,
  127. typeArray: ['接单中', '订单饱和', '停止接单'],
  128. workArray: ['正常班次', '值班班次'],
  129. permission: true,
  130. items: ['团队数据统计', '个人数据统计'],
  131. current: 0,
  132. chartData: {
  133. categories: ['张三', '李四', '王五', '老六', '刘八'],
  134. series: [
  135. {
  136. name: '好评数',
  137. data: [35, 36, 31, 33, 13]
  138. },
  139. {
  140. name: '完成数',
  141. data: [18, 27, 21, 24, 6]
  142. }
  143. ]
  144. },
  145. opts: {
  146. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  147. padding: [15, 30, 0, 5],
  148. enableScroll: false,
  149. legend: {},
  150. xAxis: {
  151. boundaryGap: 'justify',
  152. disableGrid: false,
  153. min: 0,
  154. axisLine: false,
  155. max: 40
  156. },
  157. yAxis: {},
  158. extra: {
  159. bar: {
  160. type: 'group',
  161. width: 15,
  162. meterBorde: 1,
  163. meterFillColor: '#FFFFFF',
  164. activeBgColor: '#000000',
  165. activeBgOpacity: 0.08,
  166. linearType: 'custom',
  167. barBorderCircle: true,
  168. seriesGap: 2,
  169. categoryGap: 2
  170. }
  171. }
  172. },
  173. // status状态: 0 接单中 1 订单饱和 2 停止接单
  174. // work状态: 0 正常班次 1 值班班次
  175. tableData: [
  176. {
  177. name: '张三',
  178. type: '电工',
  179. status: 0,
  180. work: ['正常班次', '值班班次']
  181. },
  182. {
  183. name: '张三三',
  184. type: '泥工',
  185. status: 1,
  186. work: ['值班班次']
  187. },
  188. {
  189. name: '张三',
  190. type: '电工',
  191. status: 2,
  192. work: ['正常班次']
  193. },
  194. {
  195. name: '张三三',
  196. type: '泥工',
  197. status: 0,
  198. work: ['值班班次']
  199. },
  200. {
  201. name: '张三',
  202. type: '电工',
  203. status: 1,
  204. work: ['值班班次']
  205. },
  206. {
  207. name: '张三三',
  208. type: '泥工',
  209. status: 2,
  210. work: ['正常班次']
  211. }
  212. ]
  213. }
  214. },
  215. mounted() {},
  216. methods: {
  217. // 是否值班弹窗确定按钮回调
  218. handlePopConfirm() {
  219. uni.showModal({
  220. title: '提示',
  221. content: '确定修改是否值班状态吗?',
  222. success: (res) => {
  223. if (res.confirm) {
  224. this.tableData[this.changeIndex].work = this.defaultIndex
  225. console.log('用户点击确定')
  226. } else if (res.cancel) {
  227. console.log('用户点击取消')
  228. }
  229. }
  230. })
  231. this.$refs.popup_work.close()
  232. },
  233. // 点击值班状态回调
  234. handleChange(item, index) {
  235. this.$refs.popup_work.open('bottom')
  236. this.changeIndex = index
  237. this.defaultIndex = JSON.parse(JSON.stringify(item.work))
  238. },
  239. // 切换值班状态回调
  240. handleChangeWork(item) {
  241. if (this.defaultIndex.includes(item)) {
  242. const temIndex = this.defaultIndex.indexOf(item)
  243. this.defaultIndex.splice(temIndex, 1)
  244. } else {
  245. this.defaultIndex.push(item)
  246. }
  247. },
  248. // 切换排班状态回调
  249. bindPickerChange(e, item) {
  250. uni.showModal({
  251. title: '提示',
  252. content: '确定修改状态吗?',
  253. success: (res) => {
  254. if (res.confirm) {
  255. item.status = e.detail.value
  256. console.log('用户点击确定')
  257. } else if (res.cancel) {
  258. console.log('用户点击取消')
  259. }
  260. }
  261. })
  262. },
  263. // 点击悬浮按钮回调
  264. handleGoMsg() {
  265. uni.navigateTo({
  266. url: '/pagesRepairs/message/message'
  267. })
  268. },
  269. // 顶部分段器切换回调
  270. onClickItem(e) {
  271. if (this.current != e.currentIndex) {
  272. this.current = e.currentIndex
  273. console.log(this.current)
  274. }
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .container {
  281. width: 100vw;
  282. height: calc(100vh - 152rpx);
  283. overflow-y: auto;
  284. .top_bg {
  285. height: 165rpx;
  286. background-color: #6fb6b8;
  287. }
  288. .top_types {
  289. display: flex;
  290. justify-content: space-evenly;
  291. margin: auto;
  292. margin-top: -100rpx;
  293. width: 690rpx;
  294. height: 188rpx;
  295. border-radius: 10rpx;
  296. box-shadow: 0px 0px 4rpx rgba(0, 0, 0, 0.25);
  297. background-color: #fff;
  298. .types_box {
  299. flex: 1;
  300. display: flex;
  301. flex-direction: column;
  302. justify-content: center;
  303. align-items: center;
  304. .box_num {
  305. font-size: 46rpx;
  306. color: #ff5733;
  307. }
  308. .box_info {
  309. margin-top: 10rpx;
  310. font-size: 34rpx;
  311. }
  312. }
  313. }
  314. .top_types2 {
  315. box-sizing: border-box;
  316. margin: auto;
  317. margin-top: -100rpx;
  318. padding: 0 30rpx;
  319. width: 690rpx;
  320. height: 282rpx;
  321. border-radius: 10rpx;
  322. box-shadow: 0px 0px 4rpx rgba(0, 0, 0, 0.25);
  323. background-color: #fff;
  324. .top {
  325. height: 112rpx;
  326. border-bottom: 1rpx solid #e6e6e6;
  327. }
  328. .bottom {
  329. display: flex;
  330. justify-content: space-evenly;
  331. height: 170rpx;
  332. .bottom_box {
  333. flex: 1;
  334. display: flex;
  335. flex-direction: column;
  336. justify-content: center;
  337. align-items: center;
  338. .box_num {
  339. font-size: 46rpx;
  340. color: #ff5733;
  341. }
  342. .box_info {
  343. margin-top: 10rpx;
  344. font-size: 34rpx;
  345. }
  346. }
  347. }
  348. }
  349. .watch {
  350. box-sizing: border-box;
  351. margin: 20rpx auto;
  352. padding: 0 30rpx;
  353. width: 690rpx;
  354. border-radius: 10rpx;
  355. box-shadow: 0px 0px 4rpx rgba(0, 0, 0, 0.25);
  356. .watch_title {
  357. display: flex;
  358. align-items: center;
  359. height: 95rpx;
  360. font-size: 36rpx;
  361. border-bottom: 1rpx solid #e6e6e6;
  362. img {
  363. margin-right: 14rpx;
  364. width: 44rpx;
  365. height: 44rpx;
  366. }
  367. }
  368. .watch_color {
  369. color: #6fb6b8;
  370. }
  371. .watch_color2 {
  372. color: #1e7dfb;
  373. }
  374. .watch_color3 {
  375. color: #ff5733;
  376. }
  377. .watch_td {
  378. display: flex;
  379. }
  380. .watch_pop {
  381. width: 100%;
  382. height: 575rpx;
  383. overflow-y: auto;
  384. background-color: #fff;
  385. .poop_title {
  386. box-sizing: border-box;
  387. padding: 0 30rpx;
  388. display: flex;
  389. align-items: center;
  390. justify-content: space-between;
  391. height: 100rpx;
  392. font-size: 34rpx;
  393. border-bottom: 1rpx solid #f5f5f5;
  394. .cancel {
  395. color: #888888;
  396. }
  397. .confirm {
  398. color: #1e7dfb;
  399. }
  400. }
  401. .poop_body {
  402. margin-top: 50rpx;
  403. .body_item {
  404. position: relative;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. height: 100rpx;
  409. border-bottom: 1rpx solid #f5f5f5;
  410. .body_item_info {
  411. }
  412. .body_item_icon {
  413. position: absolute;
  414. top: 30rpx;
  415. right: 85rpx;
  416. color: #1e7dfb;
  417. }
  418. }
  419. }
  420. }
  421. }
  422. .rank {
  423. position: relative;
  424. box-sizing: border-box;
  425. margin: 0 auto 100rpx;
  426. padding: 0 30rpx;
  427. width: 690rpx;
  428. height: 745rpx;
  429. border-radius: 10rpx;
  430. box-shadow: 0px 0px 4rpx rgba(0, 0, 0, 0.25);
  431. .rank_title {
  432. display: flex;
  433. align-items: center;
  434. height: 95rpx;
  435. font-size: 36rpx;
  436. border-bottom: 1rpx solid #e6e6e6;
  437. img {
  438. margin-right: 14rpx;
  439. width: 41rpx;
  440. height: 41rpx;
  441. }
  442. }
  443. .rank_charts {
  444. position: absolute;
  445. bottom: 0;
  446. width: 100%;
  447. height: 650rpx;
  448. }
  449. }
  450. .fixed {
  451. z-index: 2;
  452. position: fixed;
  453. right: 0;
  454. bottom: 155rpx;
  455. display: flex;
  456. justify-content: space-evenly;
  457. align-items: center;
  458. width: 252rpx;
  459. height: 123rpx;
  460. border-radius: 150rpx 0 0 150rpx;
  461. box-shadow: 0px 0px 7rpx rgba(0, 0, 0, 0.15);
  462. background-color: #fff;
  463. img {
  464. width: 76rpx;
  465. height: 76rpx;
  466. }
  467. .img {
  468. width: 88rpx;
  469. height: 88rpx;
  470. }
  471. }
  472. }
  473. </style>