workbench.vue 9.7 KB

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