workbench.vue 10 KB

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