综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-01-16 11:17:08
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-08-04 11:12:27
  6. -->
  7. <template>
  8. <view class="work-container">
  9. <!-- 轮播图 -->
  10. <!-- <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
  11. <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
  12. <swiper-item v-for="(item, index) in data" :key="index">
  13. <view class="swiper-item" @click="clickBannerItem(item)">
  14. <image :src="item.image" mode="aspectFill" :draggable="false" />
  15. </view>
  16. </swiper-item>
  17. </swiper>
  18. </uni-swiper-dot> -->
  19. <!-- 宫格组件 -->
  20. <uni-section title="常用操作" type="line"></uni-section>
  21. <view class="grid-body">
  22. <uni-grid :column="4" :showBorder="false">
  23. <uni-grid-item>
  24. <view class="grid-item-box" @click="$refs.popup.open()">
  25. <u-image :fade="false" src="@/static/images/work/sendFlow.png" width="40px" height="40px"></u-image>
  26. <text class="text">发起流程</text>
  27. </view>
  28. </uni-grid-item>
  29. <uni-grid-item v-for="item in gridList" :key="item.url" v-if="item.hasPermi">
  30. <view class="grid-item-box" @click="toUrlFn(item.url)" v-if="item.name != '发起流程'">
  31. <u-image :fade="false" :src="item.icon" width="40px" height="40px"></u-image>
  32. <text class="text">{{ item.name }}</text>
  33. </view>
  34. </uni-grid-item>
  35. </uni-grid>
  36. </view>
  37. <uv-popup ref="popup" mode="bottom">
  38. <view class="bottom-popup">
  39. <view v-for="item, index in sendFlowList" :key="index">
  40. <u-button @click="sendFlow(item)">{{ item.name }}</u-button>
  41. </view>
  42. </view>
  43. </uv-popup>
  44. </view>
  45. </template>
  46. <script>
  47. import { listDefinition } from "@/api/flowable/definition";
  48. import { Snowflake } from '@/utils/snowFlake.js';
  49. import { getNextFlowNodeByStart, todoList } from "@/api/flowable/todo";
  50. import { definitionStart, flowXmlAndNode } from "@/api/flowable/definition";
  51. import { checkPermi, checkRole } from "@/utils/permission";
  52. export default {
  53. data() {
  54. return {
  55. current: 0,
  56. swiperDotIndex: 0,
  57. data: [{
  58. image: '/static/images/banner/banner01.jpg'
  59. },
  60. {
  61. image: '/static/images/banner/banner02.jpg'
  62. },
  63. {
  64. image: '/static/images/banner/banner03.jpg'
  65. }],
  66. gridList: [
  67. {
  68. name: '借款管理',
  69. icon: '/static/images/work/borrow.png',
  70. url: 'borrow',
  71. hasPermi: checkPermi(['oa:borrow:list'])
  72. },
  73. {
  74. name: '用车管理',
  75. icon: '/static/images/work/car.png',
  76. url: 'car',
  77. hasPermi: checkPermi(['oa:car:list'])
  78. },
  79. {
  80. name: '仪器设备',
  81. icon: '/static/images/work/device.png',
  82. url: 'instruments',
  83. hasPermi: checkPermi(['oa:device:list'])
  84. },
  85. {
  86. name: '设备作业记录',
  87. icon: '/static/images/work/workDay.png',
  88. url: 'deviceLog',
  89. hasPermi: checkPermi(['oa:deviceLog:list'])
  90. },
  91. {
  92. name: '工作填报',
  93. icon: '/static/images/work/declare.png',
  94. url: 'declare',
  95. hasPermi: checkPermi(['oa:declare:list'])
  96. }
  97. ],
  98. flowList: ['借款审批', '用车审批', '设备审批', '工作填报'],
  99. sendFlowList: [],
  100. // 查询参数
  101. queryProcessParams: {
  102. pageNum: 1,
  103. pageSize: 9999,
  104. name: null,
  105. category: null,
  106. key: null,
  107. tenantId: null,
  108. deployTime: null,
  109. derivedFrom: null,
  110. derivedFromRoot: null,
  111. parentDeploymentId: null,
  112. engineVersion: null
  113. },
  114. definitionList: [],
  115. processTotal: 0,
  116. processLoading: true
  117. }
  118. },
  119. created() {
  120. this.getDefinitionList();
  121. },
  122. methods: {
  123. checkPermi,
  124. checkRole,
  125. clickBannerItem(item) {
  126. console.info(item)
  127. },
  128. changeSwiper(e) {
  129. this.current = e.detail.current
  130. },
  131. toUrlFn(type) {
  132. if (type == 'borrow') {
  133. uni.navigateTo({
  134. url: '/pages/oa/borrow/borrowList'
  135. })
  136. } else if (type == 'deviceLog') {
  137. uni.navigateTo({
  138. url: '/pages/oa/device/deviceLog'
  139. })
  140. } else if (type == 'car') {
  141. uni.navigateTo({
  142. url: '/pages/oa/car/carList'
  143. })
  144. } else if (type == 'instruments') {
  145. uni.navigateTo({
  146. url: '/pages/oa/device/instrumentsList'
  147. })
  148. } else if (type == 'declare') {
  149. uni.navigateTo({
  150. url: '/pages/oa/declare/declareList'
  151. })
  152. }
  153. else {
  154. this.$modal.showToast('模块建设中~')
  155. }
  156. },
  157. sendFlow(row) {
  158. let formId = new Snowflake(1n, 1n, 0n).nextId().toString();
  159. getNextFlowNodeByStart({ deploymentId: row.deploymentId, variables: { formId: formId } }).then(res => {
  160. let data = res.data;
  161. const variables = {};
  162. const formData = {};
  163. formData.disabled = true;
  164. formData.formBtns = false;
  165. formData.formId = formId
  166. if (row.id) {
  167. variables.variables = formData;
  168. definitionStart(row.id, JSON.stringify(variables)).then(res => {
  169. this.$modal.msgSuccess(res.msg);
  170. let procInstanceId = res.data;
  171. todoList({
  172. pageNum: 1,
  173. pageSize: 99999999, processInsId: procInstanceId
  174. }).then(toDoRes => {
  175. let records = toDoRes.data.records;
  176. if (records.length == 1) {
  177. records = records[0]
  178. }
  179. const query = {
  180. procInsId: records.procInsId,
  181. executionId: records.executionId,
  182. deployId: records.deployId,
  183. taskId: records.taskId,
  184. taskName: records.taskName,
  185. startUserName: records.startUserName + '-' + records.startDeptName,
  186. formId: formData.formId,
  187. procDefName: records.procDefName
  188. }
  189. const encodedParams = encodeURIComponent(JSON.stringify(query));
  190. uni.navigateTo({
  191. url: `/pages/message/apply/detail?params=${encodedParams}`
  192. })
  193. this.$refs.popup.close();
  194. })
  195. })
  196. }
  197. })
  198. },
  199. getDefinitionList() {
  200. listDefinition(this.queryProcessParams).then(response => {
  201. this.definitionList = response.data.records;
  202. this.processTotal = response.data.total;
  203. this.processLoading = false;
  204. let list = []
  205. for (let i of this.definitionList) {
  206. if (this.flowList.includes(i.name)) {
  207. list.push(i)
  208. }
  209. }
  210. this.sendFlowList = list;
  211. });
  212. },
  213. }
  214. }
  215. </script>
  216. <style lang="scss">
  217. /* #ifndef APP-NVUE */
  218. page {
  219. display: flex;
  220. flex-direction: column;
  221. box-sizing: border-box;
  222. background-color: #fff;
  223. min-height: 100%;
  224. height: auto;
  225. }
  226. view {
  227. font-size: 14px;
  228. line-height: inherit;
  229. }
  230. /* #endif */
  231. .text {
  232. text-align: center;
  233. font-size: 26rpx;
  234. margin-top: 10rpx;
  235. }
  236. .grid-item-box {
  237. flex: 1;
  238. /* #ifndef APP-NVUE */
  239. display: flex;
  240. /* #endif */
  241. flex-direction: column;
  242. align-items: center;
  243. justify-content: center;
  244. padding: 15px 0;
  245. }
  246. .uni-margin-wrap {
  247. width: 690rpx;
  248. width: 100%;
  249. ;
  250. }
  251. .swiper {
  252. height: 300rpx;
  253. }
  254. .swiper-box {
  255. height: 150px;
  256. }
  257. .swiper-item {
  258. /* #ifndef APP-NVUE */
  259. display: flex;
  260. /* #endif */
  261. flex-direction: column;
  262. justify-content: center;
  263. align-items: center;
  264. color: #fff;
  265. height: 300rpx;
  266. line-height: 300rpx;
  267. }
  268. @media screen and (min-width: 500px) {
  269. .uni-swiper-dot-box {
  270. width: 400px;
  271. /* #ifndef APP-NVUE */
  272. margin: 0 auto;
  273. /* #endif */
  274. margin-top: 8px;
  275. }
  276. .image {
  277. width: 100%;
  278. }
  279. }
  280. .bottom-popup {
  281. max-height: 50vh;
  282. margin-bottom: 65px;
  283. padding: 10px;
  284. text-align: center;
  285. }
  286. </style>