index.vue 7.0 KB

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