workbench.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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" :autoplay="true"
  7. 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"
  11. v-if="item.type == 'video'"></video>
  12. </swiper-item>
  13. </swiper>
  14. <view class="cu-list grid col-4 no-border fixed">
  15. <view @tap="toTodoList" class="circle-button-box">
  16. <view class="cuIcon-time text-blue circle-button font-size-35"></view>
  17. <text>待办事项</text>
  18. </view>
  19. <view @tap="toHistoryList" class="circle-button-box">
  20. <view class="cuIcon-roundcheck text-blue circle-button font-size-35"></view>
  21. <text>已办事项</text>
  22. </view>
  23. <view @tap="toApplyList" class="circle-button-box">
  24. <view class="cuIcon-peoplelist text-blue circle-button font-size-35"></view>
  25. <text>我发起的</text>
  26. </view>
  27. <view @tap="toFlowCopyList" class="circle-button-box">
  28. <view class="cuIcon-copy text-blue circle-button font-size-35"></view>
  29. <text>抄送给我</text>
  30. </view>
  31. </view>
  32. <scroll-view scroll-y class="page" v-if="isAdmin">
  33. <template v-for="key in processMap.keys()">
  34. <view class="cu-bar bg-white solid-bottom margin-top">
  35. <view class="action">
  36. <text class=" text-orange font-b">{{ key }}</text>
  37. </view>
  38. </view>
  39. <view class="cu-list grid col-4 no-border">
  40. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)"
  41. :key="index">
  42. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  43. <text class="ellipsis-description">{{ act.name }}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <u-gap height="80" bgColor="#fff"></u-gap>
  48. </scroll-view>
  49. <scroll-view scroll-y class="page" v-else>
  50. <template v-for="key in processMap.keys()">
  51. <view class="cu-bar bg-white solid-bottom margin-top">
  52. <view class="action">
  53. <text class=" text-orange font-b">{{ key }}</text>
  54. </view>
  55. </view>
  56. <view class="cu-list grid col-4 no-border">
  57. <view class="circle-button-box" @click="start(act)" v-for="(act, index) in processMap.get(key)"
  58. :key="index">
  59. <view class="cuIcon-calendar bg-blue text-white circle-button font-size-35"></view>
  60. <text class="ellipsis-description">{{ act.name }}</text>
  61. </view>
  62. </view>
  63. </template>
  64. <u-gap height="80" bgColor="#fff"></u-gap>
  65. </scroll-view>
  66. </view>
  67. </template>
  68. <script>
  69. import userService from "@/api/sys/userService"
  70. import moment from 'moment'
  71. import {
  72. mapState,
  73. mapMutations,
  74. mapActions
  75. } from 'vuex'
  76. import actCategoryService from "@/api/flowable/actCategoryService"
  77. import processService from "@/api/flowable/processService"
  78. import taskService from "@/api/flowable/taskService"
  79. export default {
  80. data() {
  81. return {
  82. isAdmin: false,
  83. cardCur: 0,
  84. dataList: [],
  85. categoryList: [],
  86. processMap: new Map(),
  87. swiperList: [{
  88. id: 0,
  89. type: 'image',
  90. url: '/static/swiper/1.svg'
  91. }, {
  92. id: 1,
  93. type: 'image',
  94. url: '/static/swiper/2.svg'
  95. }, {
  96. id: 2,
  97. type: 'image',
  98. url: '/static/swiper/3.svg'
  99. }, {
  100. id: 3,
  101. type: 'image',
  102. url: '/static/swiper/4.svg'
  103. }, {
  104. id: 4,
  105. type: 'image',
  106. url: '/static/swiper/5.svg'
  107. }, {
  108. id: 5,
  109. type: 'image',
  110. url: '/static/swiper/6.svg'
  111. }, {
  112. id: 6,
  113. type: 'image',
  114. url: '/static/swiper/7.svg'
  115. }],
  116. dotStyle: false,
  117. towerStart: 0,
  118. direction: ''
  119. };
  120. },
  121. computed: mapState({
  122. username: (state) => state.user.username,
  123. userInfo: (state) => state.user.userInfo,
  124. }),
  125. async mounted() {
  126. let res = await actCategoryService.treeData()
  127. let data = await processService.list({
  128. current: 1,
  129. size: -1,
  130. type: 'ydd'
  131. })
  132. this.processMap = new Map()
  133. let list = data.records
  134. let test = []
  135. let leaveTest = []
  136. let jjtTest = []
  137. let resignation = []
  138. let accounting = []
  139. console.log('list', list)
  140. list.forEach((item) => {
  141. if (item.category === '未设置') {
  142. if (item.name === '进销存-领用申请') {
  143. jjtTest.push(item)
  144. jjtTest.push({
  145. name: "入库",
  146. notFlowable: true
  147. })
  148. jjtTest.push({
  149. name: "库存",
  150. notFlowable: true
  151. })
  152. jjtTest.push({
  153. name: "入库记录",
  154. notFlowable: true
  155. })
  156. jjtTest.push({
  157. name: "点菜模块",
  158. notFlowable: true
  159. })
  160. // this.processMap.set('物资管理', [item])
  161. }
  162. if (item.name === '物资管理-领用申请') {
  163. test.push(item)
  164. // this.processMap.set('物资管理', [item])
  165. }
  166. if (item.name === '物资管理-采购申请') {
  167. // console.log('item', item)
  168. // this.processMap.set('物资管理', [item])
  169. test.push(item)
  170. }
  171. if (item.name === '日常办公-请假申请') {
  172. // console.log('item', item)
  173. // this.processMap.set('物资管理', [item])
  174. leaveTest.push(item)
  175. }
  176. if (item.name === '会议室预约') {
  177. // console.log('item', item)
  178. // this.processMap.set('物资管理', [item])
  179. leaveTest.push(item)
  180. }
  181. /*if (item.name === '离职申请') {
  182. // console.log('item', item)
  183. // this.processMap.set('物资管理', [item])
  184. resignation.push(item)
  185. }
  186. if (item.name === '离职交接申请') {
  187. // console.log('item', item)
  188. // this.processMap.set('物资管理', [item])
  189. resignation.push(item)
  190. }*/
  191. if (item.name === '会计-报销审批') {
  192. // console.log('item', item)
  193. // this.processMap.set('物资管理', [item])
  194. accounting.push(item)
  195. }
  196. if (item.name === '会计-发票申请') {
  197. accounting.push(item)
  198. }
  199. }
  200. })
  201. if (this.userInfo.tenantDTO.id == "10009") {
  202. this.processMap.set('景聚庭', jjtTest)
  203. } else {
  204. this.processMap.set('物资管理', test)
  205. /*this.processMap.set('日常办公', leaveTest)
  206. this.processMap.set('人力资源管理', resignation)*/
  207. this.processMap.set('会计', accounting)
  208. }
  209. // if (this.isAdmin) {
  210. // //如果是管理员 查看所有的流程图信息
  211. // res.forEach((item)=>{
  212. // this.processMap.set(item.name, [])
  213. // })
  214. // let list = data.records
  215. // list.forEach((item)=>{
  216. // if(this.processMap.has(item.category)){
  217. // let list = this.processMap.get(item.category)
  218. // list.push(item)
  219. // }else{
  220. // this.processMap.set(item.category, [item])
  221. // }
  222. // })
  223. //
  224. // for(let [key,value] of this.processMap){
  225. // console.log(key,value);
  226. // }
  227. // } else {
  228. // //非管理员用户 只能查看物资领用 与 请假流程信息
  229. // let list = data.records
  230. // let test = []
  231. // console.log('list', list)
  232. // list.forEach((item)=>{
  233. // if (item.category === '未设置') {
  234. // if (item.name === '物资管理-领用申请') {
  235. // test.push(item)
  236. // // this.processMap.set('物资管理', [item])
  237. // }
  238. // if (item.name === '物资管理-采购申请') {
  239. // // console.log('item', item)
  240. // // this.processMap.set('物资管理', [item])
  241. // test.push(item)
  242. // }
  243. // }
  244. //
  245. // })
  246. // this.processMap.set('物资管理', test)
  247. // console.log('this.processMap', this.processMap)
  248. // }
  249. },
  250. created() {
  251. if (!this.username) {
  252. this.refreshUserInfo()
  253. }
  254. this.checkIsAdmin()
  255. },
  256. methods: {
  257. ...mapActions(['refreshUserInfo']),
  258. toApplyList(mail) {
  259. uni.navigateTo({
  260. url: '/pages/workbench/task/ApplyList'
  261. })
  262. },
  263. toTodoList(mail) {
  264. uni.navigateTo({
  265. url: '/pages/workbench/task/TodoList'
  266. })
  267. },
  268. toHistoryList(mail) {
  269. uni.navigateTo({
  270. url: '/pages/workbench/task/HistoryList'
  271. })
  272. },
  273. toFlowCopyList(mail) {
  274. uni.navigateTo({
  275. url: '/pages/workbench/task/FlowCopyList'
  276. })
  277. },
  278. start(row) {
  279. if (row.notFlowable) {
  280. switch (row.name) {
  281. case "入库":
  282. uni.navigateTo({
  283. url: '/pages/psiManagement/wareHouse/WareHouseAddForm'
  284. })
  285. break;
  286. case "库存":
  287. uni.navigateTo({
  288. url: '/pages/psiManagement/wareHouseSummary/WareHouseSummaryList'
  289. })
  290. break;
  291. case "入库记录":
  292. uni.navigateTo({
  293. url: '/pages/psiManagement/wareHouse/WareHouseList'
  294. })
  295. break;
  296. case "点菜模块":
  297. uni.navigateTo({
  298. url: '/pages/psiManagement/dishManage/DishOrder'
  299. })
  300. break;
  301. }
  302. } else {
  303. // 读取流程表单
  304. taskService.getTaskDef({
  305. procDefId: row.id,
  306. status: 'start'
  307. }).then((data) => {
  308. console.log('data', data)
  309. let processTitle =
  310. `${this.username} 在 ${moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [${row.name}]`
  311. let query = {
  312. procDefId: row.id,
  313. procDefKey: row.key,
  314. status: 'start',
  315. title: `发起流程【${row.name}】`,
  316. formType: data.formType,
  317. formUrl: data.formUrl,
  318. formTitle: processTitle
  319. }
  320. uni.navigateTo({
  321. url: '/pages/workbench/task/TaskForm?flow=' + JSON.stringify(query)
  322. })
  323. })
  324. }
  325. },
  326. // 查询当前用户是否是管理员用户
  327. checkIsAdmin() {
  328. userService.is().then((data) => {
  329. this.isAdmin = data
  330. })
  331. },
  332. }
  333. }
  334. </script>
  335. <style>
  336. .cu-list.card-menu {
  337. overflow: hidden;
  338. margin-right: 5px;
  339. margin-left: 5px;
  340. border-radius: 7px;
  341. }
  342. .cu-list.card-menu.margin-top-20 {
  343. margin-top: -20px;
  344. }
  345. .cu-list.menu>.cu-item .content>uni-view:first-child {
  346. display: -webkit-box;
  347. display: -webkit-flex;
  348. display: flex;
  349. -webkit-box-align: center;
  350. /* -webkit-align-items: center; */
  351. /* align-items: center; */
  352. display: inline-block;
  353. margin-right: 5px;
  354. width: 1.6em;
  355. text-align: center;
  356. }
  357. .font-size-35 {
  358. font-size: 35px !important;
  359. }
  360. .circle-button {
  361. width: 44px;
  362. height: 44px;
  363. border-radius: 18px;
  364. padding-top: 4px;
  365. }
  366. .circle-button-box {
  367. width: 25%;
  368. margin-top: 10px;
  369. display: -webkit-box;
  370. display: -webkit-flex;
  371. display: flex;
  372. -webkit-box-orient: vertical;
  373. -webkit-box-direction: normal;
  374. -webkit-flex-direction: column;
  375. flex-direction: column;
  376. -webkit-box-align: center;
  377. -webkit-align-items: center;
  378. align-items: center;
  379. -webkit-box-pack: center;
  380. -webkit-justify-content: center;
  381. justify-content: center;
  382. box-sizing: border-box;
  383. }
  384. .font-b {
  385. vertical-align: middle;
  386. font-size: 18px;
  387. font-weight: 500;
  388. color: #3a3a3a;
  389. }
  390. </style>