wui-components-v2 1.0.75 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ const props = defineProps<{
15
15
  pageType?: string
16
16
  data: Entities
17
17
  rowActions?: rowActions[]
18
+ ractions?: rowActions[]
18
19
  zpaging?: any
19
20
  }>()
20
21
  const pageType = ref('')
@@ -25,7 +26,14 @@ const router = useRouter()
25
26
 
26
27
  // anction按钮
27
28
  const anctions = computed(() => {
28
- return props.rowActions?.filter(isShowAction) || []
29
+ const rowActions = props.rowActions || []
30
+ return [...rowActions.filter(isShowAction)]
31
+ })
32
+
33
+ // raction按钮
34
+ const ractions = computed(() => {
35
+ const ractions = props.ractions || []
36
+ return [...ractions.filter(isShowAction)]
29
37
  })
30
38
 
31
39
  // 跳转编辑页面
@@ -43,7 +51,7 @@ function edit() {
43
51
 
44
52
  const actionItem = ref<Groups>()
45
53
  const actionItemShow = ref(false)
46
- // 跳转action页面
54
+ // 打开action弹框
47
55
  function action(subitem: rowActions) {
48
56
  console.log(subitem)
49
57
  actionItem.value = {
@@ -55,6 +63,11 @@ function action(subitem: rowActions) {
55
63
  // router.push(`/pages/edit-page/index?sourceId=${subitem.id}&id=${props.code}&title=${subitem.title}&pageType=`)
56
64
  }
57
65
 
66
+ // 跳转raction页面
67
+ function raction(subitem: rowActions) {
68
+ router.push(`/pages/list/index?sourceId=${subitem.id}&mainCode=${props.code}&title=${subitem.title}&pageType=${props.pageType}`)
69
+ }
70
+
58
71
  // 跳转详情页面
59
72
  function detail() {
60
73
  router.push(`/pages/details-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}`)
@@ -68,7 +81,7 @@ function isShowAction(item: rowActions) {
68
81
  return prepose.transDefaultValue.includes(props.data.fieldMap[prepose.sourceId])
69
82
  })
70
83
  }
71
- return false
84
+ return true
72
85
  }
73
86
  </script>
74
87
 
@@ -79,6 +92,11 @@ function isShowAction(item: rowActions) {
79
92
  {{ subitem.title }}
80
93
  </wd-button>
81
94
  </view>
95
+ <view v-if="props.ractions" class="flex gap-1">
96
+ <wd-button v-for="subitem in ractions" :key="subitem.id" plain size="small" @click="raction(subitem)">
97
+ {{ subitem.title }}
98
+ </wd-button>
99
+ </view>
82
100
 
83
101
  <wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">
84
102
  编辑
@@ -5,11 +5,11 @@ import { useRouter } from 'uni-mini-router'
5
5
  defineOptions({
6
6
  name: 'ListTopButtons',
7
7
  })
8
- const props = defineProps<{ buttons: string[], sourceId: string, id?: string, pageTitle: string, pageType?: string }>()
8
+ const props = defineProps<{ mainCode: string, buttons: string[], sourceId: string, id?: string, pageTitle: string, pageType?: string }>()
9
9
  const router = useRouter()
10
10
  // 跳转添加页面
11
11
  function gotoAddPage() {
12
- router.push(`/pages/edit-page/index?sourceId=${props.sourceId}&id=${props.id || ''}&title=${props.pageTitle}&mainCode=''&pageType=${props.pageType}`)
12
+ router.push(`/pages/edit-page/index?sourceId=${props.sourceId}&id=${props.id || ''}&title=${props.pageTitle}&mainCode=${props.mainCode}&pageType=${props.pageType}`)
13
13
  }
14
14
  </script>
15
15
 
@@ -68,7 +68,6 @@ function handleSubmit() {
68
68
  }
69
69
  }
70
70
  catch (error: any) {
71
- toast.error({ msg: error })
72
71
  console.log(error, 'error')
73
72
  }
74
73
  }
@@ -8,6 +8,7 @@ const props = defineProps<{
8
8
  criterias: Fields[]
9
9
  primaryCriteria: Fields
10
10
  enumColumn?: Enums
11
+ mainCode: string
11
12
  }>()
12
13
  const emits = defineEmits(['submit'])
13
14
  const show = ref(false)
@@ -54,11 +54,13 @@ const pageTitle = ref('')
54
54
  const searchData = ref('')
55
55
  const pageType = ref('')
56
56
  const enumColumn = ref<Enums>({})
57
+ const mainCode = ref('')
57
58
  onLoad((option: any) => {
58
59
  console.log(option)
59
60
  sourceId.value = option.sourceId
60
61
  pageTitle.value = option.title
61
62
  pageType.value = option.pageType
63
+ mainCode.value = option.mainCode || ''
62
64
  uni.setNavigationBarTitle({
63
65
  title: option.title,
64
66
  })
@@ -97,7 +99,7 @@ async function queryList(pageNo: number, pageSize: number) {
97
99
  // })
98
100
 
99
101
  try {
100
- const res = await pageKey(sourceId.value, '', searchData.value)// 获取key
102
+ const res = await pageKey(sourceId.value, mainCode.value, searchData.value)// 获取key
101
103
  const data = await listData(res.key, pageNo, pageSize)// 获取数据
102
104
  // const count = await getPageTotal(key.data?.key)// 获取总数
103
105
  Zpaging.value.complete(data.entities)
@@ -146,16 +148,16 @@ function submitSearch(data: any) {
146
148
  <template>
147
149
  <z-paging ref="Zpaging" v-model="datas" :default-page-size="5" :show-loading-more-when-reload="true" @query="queryList">
148
150
  <template #top>
149
- <Search :enum-column="enumColumn" :criterias="config.criterias" :primary-criteria="config.primaryCriteria" @submit="submitSearch" />
151
+ <Search :main-code="mainCode" :enum-column="enumColumn" :criterias="config.criterias" :primary-criteria="config.primaryCriteria" @submit="submitSearch" />
150
152
  <view>
151
- <ListTopButtons :buttons="config.buttons" :source-id="sourceId" :page-title="pageTitle" :page-type="pageType" />
153
+ <ListTopButtons :main-code="mainCode" :buttons="config.buttons" :source-id="sourceId" :page-title="pageTitle" :page-type="pageType" />
152
154
  </view>
153
155
  <slot name="top" />
154
156
  </template>
155
157
  <foldCard v-for="item in datas" :key="item.code" :enum-column="enumColumn" :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns" :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn" model="complex">
156
158
  <template #buttons>
157
159
  <slot name="cardBotomButtons" :data="item" />
158
- <CardBotomButtons :zpaging="Zpaging" :row-actions="config.rowActions" :source-id="sourceId" :item="config" :code="item.code" :page-type="pageType" :data="item" />
160
+ <CardBotomButtons :zpaging="Zpaging" :row-actions="config.rowActions" :ractions="config.ractions" :source-id="sourceId" :item="config" :code="item.code" :page-type="pageType" :data="item" />
159
161
  </template>
160
162
  </foldCard>
161
163
  <template #bottom>
@@ -3,9 +3,11 @@ import type { PropType } from 'vue'
3
3
  import { computed, defineOptions, defineProps, ref } from 'vue'
4
4
  import { useRouter } from 'uni-mini-router'
5
5
  import { onShow } from '@dcloudio/uni-app'
6
+ import { set } from '@vueuse/core'
6
7
  import { menu } from '../../api/menu'
7
8
  import DemoCard from '../demo-card/demo-card.vue'
8
9
  import { useManualTheme } from '../../composables/useManualTheme'
10
+ import { useGlobalToast } from '../../composables/useGlobalToast'
9
11
 
10
12
  defineOptions({
11
13
  name: 'WuiMenus',
@@ -21,7 +23,7 @@ const props = defineProps({
21
23
  },
22
24
  })
23
25
  const router = useRouter()
24
- // const toast = useGlobalToast()
26
+ const toast = useGlobalToast()
25
27
  interface Icon {
26
28
  id: string
27
29
  path: string
@@ -144,7 +146,10 @@ function queryList() {
144
146
  menu().then((res: any) => {
145
147
  // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
146
148
  if (!res?.blocks.length) {
147
- router.replaceAll('/pages/login/index')
149
+ toast.warning('暂无权限,请联系管理员')
150
+ setTimeout(() => {
151
+ router.replaceAll('/pages/login/index')
152
+ }, 1000)
148
153
  }
149
154
  paging.value.complete(res?.blocks || [])
150
155
  // uni.setNavigationBarTitle({ title: res.data?.programName || '' })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/type.ts CHANGED
@@ -26,6 +26,7 @@ export interface Config extends Groups {
26
26
  criterias: Fields[]
27
27
  labelColumn?: Columns
28
28
  rowActions?: rowActions[]
29
+ ractions?: rowActions[]
29
30
  }
30
31
 
31
32
  // 列表数据