workbench.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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. let resignation = []
  125. let accounting = []
  126. console.log('list', list)
  127. list.forEach((item)=>{
  128. if (item.category === '未设置') {
  129. if (item.name === '物资管理-领用申请') {
  130. test.push(item)
  131. // this.processMap.set('物资管理', [item])
  132. }
  133. if (item.name === '物资管理-采购申请') {
  134. // console.log('item', item)
  135. // this.processMap.set('物资管理', [item])
  136. test.push(item)
  137. }
  138. if (item.name === '日常办公-请假申请') {
  139. // console.log('item', item)
  140. // this.processMap.set('物资管理', [item])
  141. leaveTest.push(item)
  142. }
  143. if (item.name === '会议室预约') {
  144. // console.log('item', item)
  145. // this.processMap.set('物资管理', [item])
  146. leaveTest.push(item)
  147. }
  148. if (item.name === '离职申请') {
  149. // console.log('item', item)
  150. // this.processMap.set('物资管理', [item])
  151. resignation.push(item)
  152. }
  153. if (item.name === '离职交接申请') {
  154. // console.log('item', item)
  155. // this.processMap.set('物资管理', [item])
  156. resignation.push(item)
  157. }
  158. if (item.name === '会计-报销审批') {
  159. // console.log('item', item)
  160. // this.processMap.set('物资管理', [item])
  161. accounting.push(item)
  162. }
  163. if (item.name === '会计-发票申请') {
  164. accounting.push(item)
  165. }
  166. }
  167. })
  168. this.processMap.set('物资管理', test)
  169. this.processMap.set('日常办公', leaveTest)
  170. this.processMap.set('人力资源管理', resignation)
  171. this.processMap.set('会计', accounting)
  172. // if (this.isAdmin) {
  173. // //如果是管理员 查看所有的流程图信息
  174. // res.forEach((item)=>{
  175. // this.processMap.set(item.name, [])
  176. // })
  177. // let list = data.records
  178. // list.forEach((item)=>{
  179. // if(this.processMap.has(item.category)){
  180. // let list = this.processMap.get(item.category)
  181. // list.push(item)
  182. // }else{
  183. // this.processMap.set(item.category, [item])
  184. // }
  185. // })
  186. //
  187. // for(let [key,value] of this.processMap){
  188. // console.log(key,value);
  189. // }
  190. // } else {
  191. // //非管理员用户 只能查看物资领用 与 请假流程信息
  192. // let list = data.records
  193. // let test = []
  194. // console.log('list', list)
  195. // list.forEach((item)=>{
  196. // if (item.category === '未设置') {
  197. // if (item.name === '物资管理-领用申请') {
  198. // test.push(item)
  199. // // this.processMap.set('物资管理', [item])
  200. // }
  201. // if (item.name === '物资管理-采购申请') {
  202. // // console.log('item', item)
  203. // // this.processMap.set('物资管理', [item])
  204. // test.push(item)
  205. // }
  206. // }
  207. //
  208. // })
  209. // this.processMap.set('物资管理', test)
  210. // console.log('this.processMap', this.processMap)
  211. // }
  212. },
  213. created() {
  214. if(!this.username) {
  215. this.refreshUserInfo()
  216. }
  217. this.checkIsAdmin()
  218. },
  219. methods: {
  220. ...mapActions(['refreshUserInfo']),
  221. toApplyList (mail) {
  222. uni.navigateTo({
  223. url: '/pages/workbench/task/ApplyList'
  224. })
  225. },
  226. toTodoList (mail) {
  227. uni.navigateTo({
  228. url: '/pages/workbench/task/TodoList'
  229. })
  230. },
  231. toHistoryList (mail) {
  232. uni.navigateTo({
  233. url: '/pages/workbench/task/HistoryList'
  234. })
  235. },
  236. toFlowCopyList (mail) {
  237. uni.navigateTo({
  238. url: '/pages/workbench/task/FlowCopyList'
  239. })
  240. },
  241. start (row) {
  242. // 读取流程表单
  243. taskService.getTaskDef({
  244. procDefId: row.id,
  245. status: 'start'
  246. }).then((data) => {
  247. console.log('data',data)
  248. let processTitle = `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
  249. let query = {procDefId: row.id, procDefKey: row.key, status: 'start', title: `发起流程【${row.name}】`, formType: data.formType, formUrl: data.formUrl, formTitle: processTitle}
  250. uni.navigateTo({
  251. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  252. })
  253. })
  254. },
  255. // 查询当前用户是否是管理员用户
  256. checkIsAdmin () {
  257. userService.is().then((data) => {
  258. this.isAdmin = data
  259. })
  260. },
  261. }
  262. }
  263. </script>
  264. <style>
  265. .cu-list.card-menu {
  266. overflow: hidden;
  267. margin-right: 5px;
  268. margin-left: 5px;
  269. border-radius: 7px;
  270. }
  271. .cu-list.card-menu.margin-top-20 {
  272. margin-top: -20px;
  273. }
  274. .cu-list.menu>.cu-item .content>uni-view:first-child {
  275. display: -webkit-box;
  276. display: -webkit-flex;
  277. display: flex;
  278. -webkit-box-align: center;
  279. /* -webkit-align-items: center; */
  280. /* align-items: center; */
  281. display: inline-block;
  282. margin-right: 5px;
  283. width: 1.6em;
  284. text-align: center;
  285. }
  286. .font-size-35{
  287. font-size: 35px!important;
  288. }
  289. .circle-button{
  290. width: 44px;
  291. height: 44px;
  292. border-radius: 18px;
  293. padding-top: 4px;
  294. }
  295. .circle-button-box{
  296. width: 25%;
  297. margin-top: 10px;
  298. display: -webkit-box;
  299. display: -webkit-flex;
  300. display: flex;
  301. -webkit-box-orient: vertical;
  302. -webkit-box-direction: normal;
  303. -webkit-flex-direction: column;
  304. flex-direction: column;
  305. -webkit-box-align: center;
  306. -webkit-align-items: center;
  307. align-items: center;
  308. -webkit-box-pack: center;
  309. -webkit-justify-content: center;
  310. justify-content: center;
  311. box-sizing: border-box;
  312. }
  313. .font-b {
  314. vertical-align: middle;
  315. font-size: 18px;
  316. font-weight: 500;
  317. color: #3a3a3a;
  318. }
  319. </style>