workbench.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue">
  4. <block slot="content"> 工作台</block>
  5. </cu-custom>
  6. <swiper class="screen-swiper square-dot bg-blue" :indicator-dots="true" :circular="true"
  7. :autoplay="true" interval="2000" duration="500">
  8. <swiper-item v-for="(item,index) in swiperList" :key="index">
  9. <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
  10. <video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type=='video'"></video>
  11. </swiper-item>
  12. </swiper>
  13. <view class="cu-list grid col-4 no-border fixed">
  14. <view @tap="toTodoList" class="circle-button-box">
  15. <view class="cuIcon-time text-blue circle-button font-size-35"></view>
  16. <text>待办事项</text>
  17. </view>
  18. <view @tap="toHistoryList" class="circle-button-box">
  19. <view class="cuIcon-roundcheck text-blue circle-button font-size-35"></view>
  20. <text>已办事项</text>
  21. </view>
  22. <view @tap="toApplyList" class="circle-button-box">
  23. <view class="cuIcon-peoplelist text-blue circle-button font-size-35"></view>
  24. <text>我发起的</text>
  25. </view>
  26. <view @tap="toFlowCopyList" class="circle-button-box">
  27. <view class="cuIcon-copy text-blue circle-button font-size-35"></view>
  28. <text>抄送给我</text>
  29. </view>
  30. </view>
  31. <scroll-view scroll-y class="page" v-if="isAdmin">
  32. <template v-for="key in processMap.keys()">
  33. <view class="cu-bar bg-white solid-bottom margin-top">
  34. <view class="action">
  35. <text class=" text-orange font-b">{{key}}</text>
  36. </view>
  37. </view>
  38. <view class="cu-list grid col-4 no-border">
  39. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)" :key="index">
  40. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  41. <text class="ellipsis-description">{{act.name}}</text>
  42. </view>
  43. </view>
  44. </template>
  45. <u-gap height="80" bgColor="#fff"></u-gap>
  46. </scroll-view>
  47. <scroll-view scroll-y class="page" v-else>
  48. <template v-for="key in processMap.keys()">
  49. <view class="cu-bar bg-white solid-bottom margin-top">
  50. <view class="action">
  51. <text class=" text-orange font-b">{{key}}</text>
  52. </view>
  53. </view>
  54. <view class="cu-list grid col-4 no-border">
  55. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)" :key="index">
  56. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  57. <text class="ellipsis-description">{{act.name}}</text>
  58. </view>
  59. </view>
  60. </template>
  61. <u-gap height="80" bgColor="#fff"></u-gap>
  62. </scroll-view>
  63. </view>
  64. </template>
  65. <script>
  66. import userService from "@/api/sys/userService"
  67. import moment from 'moment'
  68. import {mapState, mapMutations, mapActions} from 'vuex'
  69. import actCategoryService from "@/api/flowable/actCategoryService"
  70. import processService from "@/api/flowable/processService"
  71. import taskService from "@/api/flowable/taskService"
  72. export default {
  73. data() {
  74. return {
  75. isAdmin: false,
  76. cardCur: 0,
  77. dataList: [],
  78. categoryList: [],
  79. processMap: new Map(),
  80. swiperList: [{
  81. id: 0,
  82. type: 'image',
  83. url: '/static/swiper/1.svg'
  84. }, {
  85. id: 1,
  86. type: 'image',
  87. url: '/static/swiper/2.svg'
  88. }, {
  89. id: 2,
  90. type: 'image',
  91. url: '/static/swiper/3.svg'
  92. }, {
  93. id: 3,
  94. type: 'image',
  95. url: '/static/swiper/4.svg'
  96. }, {
  97. id: 4,
  98. type: 'image',
  99. url: '/static/swiper/5.svg'
  100. }, {
  101. id: 5,
  102. type: 'image',
  103. url: '/static/swiper/6.svg'
  104. }, {
  105. id: 6,
  106. type: 'image',
  107. url: '/static/swiper/7.svg'
  108. }],
  109. dotStyle: false,
  110. towerStart: 0,
  111. direction: ''
  112. };
  113. },
  114. computed: mapState({
  115. username: (state) => state.user.username
  116. }),
  117. async mounted() {
  118. let res = await actCategoryService.treeData()
  119. let data = await processService.list({current: 1, size: -1, type: 'ydd'})
  120. this.processMap = new Map()
  121. let list = data.records
  122. let test = []
  123. let leaveTest = []
  124. list.forEach((item)=>{
  125. if (item.category === '未设置') {
  126. if (item.name === '物资管理-领用申请') {
  127. test.push(item)
  128. // this.processMap.set('物资管理', [item])
  129. }
  130. if (item.name === '物资管理-采购申请') {
  131. // console.log('item', item)
  132. // this.processMap.set('物资管理', [item])
  133. test.push(item)
  134. }
  135. if (item.name === '嘉溢-请假申请') {
  136. // console.log('item', item)
  137. // this.processMap.set('物资管理', [item])
  138. leaveTest.push(item)
  139. }
  140. }
  141. })
  142. this.processMap.set('物资管理', test)
  143. this.processMap.set('日常办公', leaveTest)
  144. // if (this.isAdmin) {
  145. // //如果是管理员 查看所有的流程图信息
  146. // res.forEach((item)=>{
  147. // this.processMap.set(item.name, [])
  148. // })
  149. // let list = data.records
  150. // list.forEach((item)=>{
  151. // if(this.processMap.has(item.category)){
  152. // let list = this.processMap.get(item.category)
  153. // list.push(item)
  154. // }else{
  155. // this.processMap.set(item.category, [item])
  156. // }
  157. // })
  158. //
  159. // for(let [key,value] of this.processMap){
  160. // console.log(key,value);
  161. // }
  162. // } else {
  163. // //非管理员用户 只能查看物资领用 与 请假流程信息
  164. // let list = data.records
  165. // list.forEach((item)=>{
  166. // if (item.category === '未设置') {
  167. // if (item.name === '物资管理-领用申请') {
  168. // this.processMap.set('物资管理', [item])
  169. // }
  170. // if (item.name === '嘉溢-请假申请') {
  171. // this.processMap.set('请假申请', [item])
  172. // }
  173. // }
  174. //
  175. // })
  176. // console.log('this.processMap', this.processMap)
  177. // }
  178. },
  179. created() {
  180. if(!this.username) {
  181. this.refreshUserInfo()
  182. }
  183. this.checkIsAdmin()
  184. },
  185. methods: {
  186. ...mapActions(['refreshUserInfo']),
  187. toApplyList (mail) {
  188. uni.navigateTo({
  189. url: '/pages/workbench/task/ApplyList'
  190. })
  191. },
  192. toTodoList (mail) {
  193. uni.navigateTo({
  194. url: '/pages/workbench/task/TodoList'
  195. })
  196. },
  197. toHistoryList (mail) {
  198. uni.navigateTo({
  199. url: '/pages/workbench/task/HistoryList'
  200. })
  201. },
  202. toFlowCopyList (mail) {
  203. uni.navigateTo({
  204. url: '/pages/workbench/task/FlowCopyList'
  205. })
  206. },
  207. start (row) {
  208. // 读取流程表单
  209. taskService.getTaskDef({
  210. procDefId: row.id,
  211. status: 'start'
  212. }).then((data) => {
  213. let processTitle = `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
  214. let query = {procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle}
  215. uni.navigateTo({
  216. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  217. })
  218. })
  219. },
  220. // 查询当前用户是否是管理员用户
  221. checkIsAdmin () {
  222. userService.is().then((data) => {
  223. this.isAdmin = data
  224. })
  225. },
  226. }
  227. }
  228. </script>
  229. <style>
  230. .cu-list.card-menu {
  231. overflow: hidden;
  232. margin-right: 5px;
  233. margin-left: 5px;
  234. border-radius: 7px;
  235. }
  236. .cu-list.card-menu.margin-top-20 {
  237. margin-top: -20px;
  238. }
  239. .cu-list.menu>.cu-item .content>uni-view:first-child {
  240. display: -webkit-box;
  241. display: -webkit-flex;
  242. display: flex;
  243. -webkit-box-align: center;
  244. /* -webkit-align-items: center; */
  245. /* align-items: center; */
  246. display: inline-block;
  247. margin-right: 5px;
  248. width: 1.6em;
  249. text-align: center;
  250. }
  251. .font-size-35{
  252. font-size: 35px!important;
  253. }
  254. .circle-button{
  255. width: 44px;
  256. height: 44px;
  257. border-radius: 18px;
  258. padding-top: 4px;
  259. }
  260. .circle-button-box{
  261. width: 25%;
  262. margin-top: 10px;
  263. display: -webkit-box;
  264. display: -webkit-flex;
  265. display: flex;
  266. -webkit-box-orient: vertical;
  267. -webkit-box-direction: normal;
  268. -webkit-flex-direction: column;
  269. flex-direction: column;
  270. -webkit-box-align: center;
  271. -webkit-align-items: center;
  272. align-items: center;
  273. -webkit-box-pack: center;
  274. -webkit-justify-content: center;
  275. justify-content: center;
  276. box-sizing: border-box;
  277. }
  278. .font-b {
  279. vertical-align: middle;
  280. font-size: 18px;
  281. font-weight: 500;
  282. color: #3a3a3a;
  283. }
  284. </style>