index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="catalog-v">
  3. <uni-nav-bar class="nav" :fixed="true" :statusBar="true" :border="false" height="44" right-icon="bars"
  4. @clickRight="clickRight" left-icon="left" @clickLeft="back">
  5. <!-- 左边插槽 -->
  6. <block #default>
  7. <view class="" @click="close"
  8. style="position: absolute;top: 0;left: 40px;bottom: 0;text-align: center;line-height: 82rpx;height: 100%;width: 40rpx;">
  9. <u-icon name="close"></u-icon>
  10. </view>
  11. <view class="nav-left">
  12. <view class="nav-left-text">{{ config.fullName }}</view>
  13. </view>
  14. </block>
  15. </uni-nav-bar>
  16. <view class="search-box_sticky" :style="{'top':topSearch+'rpx'}">
  17. <view class="search-box">
  18. <u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
  19. :show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
  20. </u-search>
  21. </view>
  22. </view>
  23. <view class="workFlow-list">
  24. <view class="part" v-if="childrenData.length">
  25. <view class="u-flex u-flex-wrap">
  26. <view class="item u-flex-col u-col-center" v-for="(child, ii) in childrenData" :key="ii"
  27. @click="handelClick(child)">
  28. <text class="u-font-40 item-icon" :class="child.icon"
  29. :style="{ background: child.iconBackground || '#008cff' }" />
  30. <text class="u-font-24 u-line-1 item-text">{{child.fullName}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <JnpfEmpty v-else />
  35. </view>
  36. <treeCollapse :show="showApply" v-if="showApply" :treeData="menuList" @change="handelClick"></treeCollapse>
  37. </view>
  38. </template>
  39. <script>
  40. import treeCollapse from '@/components/treeCollapse'
  41. export default {
  42. components: {
  43. treeCollapse
  44. },
  45. data() {
  46. return {
  47. showApply: false,
  48. topSearch: 80,
  49. keyword: "",
  50. statusBarHeight: "",
  51. userInfo: {
  52. systemIds: [],
  53. }, //CurrentUser接口中的userInfo数据
  54. modelId: "",
  55. config: {},
  56. fullName: "",
  57. childrenData: []
  58. };
  59. },
  60. computed: {
  61. baseURL() {
  62. return this.define.baseURL;
  63. },
  64. token() {
  65. return uni.getStorageSync('token')
  66. },
  67. report() {
  68. return this.define.report;
  69. },
  70. pcURL() {
  71. return this.define.pcURL;
  72. },
  73. menuList() {
  74. let list = uni.getStorageSync('menuList').filter(o => o.enCode !== 'workFlow')
  75. return list
  76. }
  77. },
  78. onLoad(e) {
  79. this.config = JSON.parse(this.jnpf.base64.decode(e.config)) || {};
  80. if (Array.isArray(this.config.children) && this.config.children.length) this.childrenData = JSON.parse(JSON
  81. .stringify(this.config.children))
  82. this.keyword = ""
  83. this.handleData(this.childrenData)
  84. uni.setNavigationBarTitle({
  85. title: this.config.fullName
  86. })
  87. this.getStatusBarHeight();
  88. },
  89. methods: {
  90. close() {
  91. uni.switchTab({
  92. url: '/pages/index/index',
  93. });
  94. },
  95. back() {
  96. uni.navigateBack({
  97. delta: 1
  98. })
  99. },
  100. clickRight() {
  101. this.handleData(this.menuList)
  102. this.$nextTick(() => {
  103. this.showApply = !this.showApply
  104. })
  105. },
  106. handleData(childrenData) {
  107. const loop = (list, parent) => {
  108. for (let i = 0; i < list.length; i++) {
  109. let propertyJson = JSON.parse(list[i].propertyJson)
  110. this.$set(list[i], 'moduleId', propertyJson.moduleId)
  111. if (list[i].children && Array.isArray(list[i].children)) {
  112. loop(list[i].children, list[i])
  113. }
  114. }
  115. }
  116. loop(childrenData)
  117. },
  118. getStatusBarHeight() {
  119. let that = this
  120. wx.getSystemInfo({
  121. success(res) {
  122. that.statusBarHeight = res.statusBarHeight;
  123. },
  124. });
  125. // #ifdef APP-PLUS
  126. uni.getSystemInfo({
  127. success(res) {
  128. that.statusBarHeight = res.statusBarHeight;
  129. let topSearch = 75 + that.statusBarHeight * 2
  130. that.topSearch = topSearch
  131. }
  132. })
  133. // #endif
  134. },
  135. search() {
  136. this.searchTimer && clearTimeout(this.searchTimer);
  137. this.searchTimer = setTimeout(() => {
  138. if (!this.keyword) return this.childrenData = JSON.parse(JSON.stringify(this.config.children))
  139. const regex = new RegExp(this.keyword, 'i');
  140. this.childrenData = this.childrenData.filter(item => regex.test(item.fullName))
  141. }, 300);
  142. },
  143. handelClick(item) {
  144. this.showApply = false
  145. this.modelId = item.moduleId
  146. if (item.type == 1) {
  147. uni.navigateTo({
  148. url: "/pages/apply/catalog/index?config=" +
  149. this.jnpf.base64.encode(JSON.stringify(item)),
  150. fail: () => {
  151. this.$u.toast("暂无此页面");
  152. },
  153. });
  154. return;
  155. }
  156. let url = ''
  157. // 2-页面 11-回传表单
  158. if (item.type == 2 || item.type == 11) {
  159. if (!item.pageAddress) {
  160. this.$u.toast("暂无此页面");
  161. return;
  162. }
  163. url = item.pageAddress + "?menuId=" + item.id + "&fullName=" + item.fullName
  164. }
  165. // 3-在线表单 9-流程
  166. if (item.type == 3 || item.type == 9) {
  167. if (!item.moduleId) {
  168. this.$u.toast("暂无此页面");
  169. return;
  170. }
  171. url = "/pages/apply/dynamicModel/index?config=" + this.jnpf.base64.encode(JSON.stringify(item))
  172. }
  173. // 外链
  174. if (item.type == 7) {
  175. if (!item.pageAddress) {
  176. this.$u.toast("暂无此页面");
  177. return;
  178. }
  179. url = "/pages/apply/externalLink/index?url=" + encodeURIComponent(item.pageAddress) + "&fullName=" +
  180. item.fullName + "&type=" + item.type
  181. }
  182. // 报表(原)
  183. if (item.type == 5) {
  184. if (!item.moduleId) {
  185. this.$u.toast("暂无此页面");
  186. return;
  187. }
  188. userInfo = uni.getStorageSync('userInfo') || {}
  189. const appCode = userInfo.systemCode
  190. const urlPre = encodeURIComponent(
  191. `${this.report}/preview.html?id=${item.moduleId}&token=${this.token}&appCode=${appCode}&page=1&from=menu`
  192. )
  193. url = "/pages/apply/externalLink/index?url=" + urlPre + "&fullName=" + item.fullName + "&type=" +
  194. item.type
  195. }
  196. // 报表
  197. if (item.type == 10) {
  198. if (!item.moduleId) {
  199. this.$u.toast("暂无此页面");
  200. return;
  201. }
  202. const urlPre = encodeURIComponent(
  203. `${this.pcURL}/reportPreview?id=${item.moduleId}&token=${this.token}&from=app`
  204. );
  205. url = "/pages/apply/externalLink/index?url=" + urlPre + "&fullName=" + item.fullName + "&type=" +
  206. item.type
  207. }
  208. // 门户
  209. if (item.type == 8) {
  210. if (!item.moduleId) {
  211. this.$u.toast("暂无此页面");
  212. return;
  213. }
  214. url = "/pages/portal/scanPortal/index?id=" + item.moduleId + "&portalType=1&fullName=" +
  215. item.fullName
  216. }
  217. if (!url) return;
  218. uni.navigateTo({
  219. url,
  220. fail: () => {
  221. this.$u.toast("暂无此页面");
  222. },
  223. });
  224. }
  225. },
  226. };
  227. </script>
  228. <style lang="scss">
  229. page {
  230. background-color: #f0f2f6;
  231. }
  232. .catalog-v {
  233. .search-box_sticky {
  234. margin-bottom: 20rpx;
  235. .search-box {
  236. padding: 20rpx;
  237. }
  238. }
  239. .nav {
  240. z-index: 99999;
  241. :deep(.uni-navbar__content) {
  242. z-index: 99999;
  243. }
  244. :deep(.uni-navbar__header-container) {
  245. justify-content: center;
  246. }
  247. }
  248. .nav-left {
  249. max-width: 100%;
  250. display: flex;
  251. align-items: center;
  252. .nav-left-text {
  253. font-weight: 700;
  254. font-size: 29rpx;
  255. flex: 1;
  256. min-width: 0;
  257. white-space: nowrap;
  258. overflow: hidden;
  259. text-overflow: ellipsis;
  260. }
  261. }
  262. .select-box,
  263. .u-drawer {
  264. max-height: 600rpx;
  265. :deep(.u-drawer-content) {
  266. height: 100% !important;
  267. }
  268. .currentItem {
  269. color: #2979ff;
  270. }
  271. }
  272. .search-box {
  273. overflow-y: overlay;
  274. height: 112rpx;
  275. width: 100%;
  276. padding: 20rpx 20rpx;
  277. z-index: 10000;
  278. background: #fff;
  279. }
  280. .workFlow-list {
  281. .part {
  282. .item {
  283. margin-bottom: 0;
  284. padding: 1rem 0;
  285. }
  286. }
  287. }
  288. }
  289. </style>