w-ui-v1 1.0.26 → 1.0.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
package/w-card/w-card.vue CHANGED
@@ -31,6 +31,41 @@ const props = defineProps({
31
31
  },
32
32
  })
33
33
 
34
+ //更多按钮
35
+ const moreBtns = computed(() => {
36
+ let data = []
37
+ props.page.rowActions?.forEach((element: any) => {
38
+ if (element.preposes[0]) {
39
+ if (element.preposes[0].transDefaultValue.includes(props.itemData.fieldMap[element.preposes[0].id])) {
40
+ data.push({
41
+ actionType: "submit",
42
+ name: element.title,
43
+ color: '#4D81F1',
44
+ ...element
45
+ })
46
+ }
47
+ } else {
48
+ data.push({
49
+ actionType: "submit",
50
+ name: element.title,
51
+ color: '#4D81F1',
52
+ ...element
53
+ })
54
+ }
55
+ });
56
+
57
+ props.page.ractions?.forEach((item: any) => {
58
+ data.push({
59
+ actionType:"openPage",
60
+ name: item.title,
61
+ color: '#4D81F1',
62
+ ...item
63
+ })
64
+ })
65
+
66
+ return data
67
+ })
68
+
34
69
  // 处理单项数据、配置
35
70
  const items = computed(() => {
36
71
  return props.page.columns?.filter((item: any) => {
@@ -52,8 +87,8 @@ const items = computed(() => {
52
87
  }) || []
53
88
  })
54
89
 
55
- const wFormMessageBoxRef= ref()
56
-
90
+ const wFormMessageBoxRef = ref()
91
+ const showMoreButns = ref(false)
57
92
  const isExpanded = ref(false)
58
93
  const defaultVisible = 4 // 默认显示行数量
59
94
 
@@ -97,13 +132,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
97
132
  url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
98
133
  })
99
134
  break
135
+ case 'openPage':
136
+ uni.navigateTo({
137
+ url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}`,
138
+ })
139
+ break
100
140
  }
101
141
 
102
142
  }
103
143
 
104
144
  //删除
105
145
  const dele = () => {
106
- console.log('delete');
107
146
  message
108
147
  .confirm({
109
148
  msg: '确定删除吗?',
@@ -123,7 +162,19 @@ const dele = () => {
123
162
 
124
163
  }
125
164
 
126
- // 自定义按钮操作
165
+ //更多按钮点击事件
166
+ const moreBtnsSelect = (item: any) => {
167
+ switch (item.item.actionType) {
168
+ case 'submit':
169
+ actionBtn(item.item)
170
+ break
171
+ case 'openPage':
172
+ goto(item.item.actionType, item.item)
173
+ break
174
+ }
175
+ }
176
+
177
+ // 更多按钮操作
127
178
  const actionBtn = (item: any) => {
128
179
  wFormMessageBoxRef.value.openFormMessageBox(item)
129
180
  }
@@ -172,12 +223,6 @@ const actionBtn = (item: any) => {
172
223
  </view>
173
224
  <template #footer>
174
225
  <view class="btns-box">
175
- <view v-if="props.page.rowActions" v-for="(bitem, index) in props.page.rowActions" :key="index">
176
- <wd-button :type="bitem.buttonType === 'dashed' ? 'info' : 'warning'" size="small" plain @click="actionBtn(bitem)"
177
- v-if="bitem.preposes[0].transDefaultValue.includes(props.itemData?.fieldMap[bitem.preposes[0].id])">
178
- {{ bitem.title }}
179
- </wd-button>
180
- </view>
181
226
  <wd-button size="small" class="btn" plain v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
182
227
  详情
183
228
  </wd-button>
@@ -189,12 +234,19 @@ const actionBtn = (item: any) => {
189
234
  v-if="props.page.buttons.includes('singleDelete')">
190
235
  删除
191
236
  </wd-button>
237
+ <view v-if="moreBtns.length > 0">
238
+ <wd-button type='info' size="small" plain @click="showMoreButns = true">
239
+ 更多
240
+ </wd-button>
241
+ </view>
192
242
  </view>
193
243
  </template>
194
244
  </wd-card>
195
245
  <wd-toast />
196
246
  <wd-message-box />
197
- <WFormMessageBox ref="wFormMessageBoxRef" :itemData="props.itemData" @refresh="emits('refresh')"/>
247
+ <WFormMessageBox ref="wFormMessageBoxRef" :itemData="props.itemData" @refresh="emits('refresh')" />
248
+ <!-- 更多按钮 -->
249
+ <wd-action-sheet v-model="showMoreButns" :actions="moreBtns" @select="moreBtnsSelect" />
198
250
  </template>
199
251
 
200
252
  <style lang="scss" scoped>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <view>
3
- <wd-message-box selector="wd-message-box-slot">
3
+ <wd-message-box selector="wd-message-box-slot" custom-class="wd-message-box-slot">
4
4
  <wd-form ref="form" :model="model">
5
5
  <wFromControl :subItem="subItem" v-for="(subItem,subIndex) in page.formItem" :key="subIndex" :model="model" :Enumcolumn="Enumcolumn"
6
6
  v-model:model-value="model[subItem.id]" />
@@ -10,6 +10,14 @@
10
10
  </view>
11
11
  </template>
12
12
 
13
+ <script lang="ts">
14
+ //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
15
+ export default {
16
+ options: {
17
+ styleIsolation: 'shared'//使css :deep()生效
18
+ }
19
+ }
20
+ </script>
13
21
  <script setup lang="ts">
14
22
  import wFromControl from '../w-form-control/w-form-control.vue'
15
23
  import {reactive,ref,defineProps,defineExpose,computed,watch,defineEmits} from 'vue'
@@ -45,7 +53,6 @@ const props=defineProps({
45
53
  })
46
54
 
47
55
  const page=computed(()=>{
48
-
49
56
  return {
50
57
  formItem: pageConf.value.writes,
51
58
  sourceId: pageConf.value.id
@@ -55,7 +62,7 @@ const page=computed(()=>{
55
62
  watch(page,(value)=>{
56
63
  if (!value) return
57
64
  value.formItem.forEach((item: any) => {
58
- model[item.id] = item.defaultValue || ''
65
+ model[item.id] =props.itemData.fieldMap[item.id] || ''
59
66
  })
60
67
  getEnumer()
61
68
  })
@@ -103,4 +110,11 @@ defineExpose({
103
110
  })
104
111
  </script>
105
112
 
106
- <style scoped lang="scss"></style>
113
+ <style scoped lang="scss">
114
+ :deep(.wd-message-box-slot){
115
+ width: 95vw !important;
116
+ }
117
+ :deep( .wd-message-box-slot .wd-message-box__flex){
118
+ justify-content: space-between !important;
119
+ }
120
+ </style>