w-ui-v1 1.0.36 → 1.0.38

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.36",
3
+ "version": "1.0.38",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
package/w-add/w-add.vue CHANGED
@@ -1,69 +1,71 @@
1
1
  <script lang="ts">
2
2
  //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
3
  export default {
4
- options: {
5
- styleIsolation: 'shared'//使css :deep()生效
6
- }
4
+ options: {
5
+ styleIsolation: 'shared'//使css :deep()生效
6
+ }
7
7
  }
8
8
  </script>
9
9
  <template>
10
- <view>
11
- <view v-if="loading" style="height: 100px;display: flex;justify-content: center;align-items: center;">
12
- <wd-loading />
13
- </view>
14
- <view v-else>
15
- <wd-collapse v-model="value">
16
- <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
17
- v-for="(item, index) in pageConf.groups" :key="index">
18
- <view v-if="item.type === 'fieldGroup'">
19
- <wd-form ref="form" :model="model">
20
- <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
21
- <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
22
- v-model:model-value="model[subItem.id]" />
23
- </wd-cell-group>
24
-
25
- </wd-form>
26
-
27
- </view>
28
- <view v-if="item.type === 'relation'">
29
- <view class="row-add">
30
- <wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
31
- icon="add" @click="selectrow(item)">选择</wd-button>
32
- <wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
33
- icon="add" @click="add(item)">新增</wd-button>
34
- </view>
35
-
36
- <view v-if="relationLoading[item.id]"
37
- style="height: 100px;display: flex;justify-content: center;align-items: center;">
38
- <wd-loading />
39
- </view>
40
-
41
- <!-- 卡片 -->
42
- <view v-else class="card-list">
43
- <w-card @edit="()=>{editItem(item, subitem, subindex)}" @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
44
- v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
45
- :page="{
46
- rowActions: item.rowActions || [],
47
- buttons: item.buttons || [],
48
- ractions: item.ractions || [],
49
- columns: item.fields || []
50
- }" :item-data="subitem" :source-id="item.pointSourceId" />
51
- </view>
52
-
53
- <view class="row-add" v-if="item.buttons.includes('rowAdd')">
54
- <wd-button hairline type="info" size="small" icon="add"
55
- @click="addrow(item.id)">加一条</wd-button>
56
- </view>
57
- </view>
58
- </wd-collapse-item>
59
- </wd-collapse>
60
- <view class="footer-button">
61
- <wd-button :round="false" block @click="handleSubmit" icon="save">保存</wd-button>
62
- </view>
63
- </view>
64
- <wd-message-box />
65
- <wd-toast />
66
- </view>
10
+ <view>
11
+ <view v-if="loading" style="height: 100px;display: flex;justify-content: center;align-items: center;">
12
+ <wd-loading />
13
+ </view>
14
+ <view v-else>
15
+ <wd-collapse v-model="value">
16
+ <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
17
+ v-for="(item, index) in pageConf.groups" :key="index">
18
+ <view v-if="item.type === 'fieldGroup'">
19
+ <wd-card>
20
+ <wd-form ref="form" :model="model">
21
+ <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
22
+ <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
23
+ v-model:model-value="model[subItem.id]" />
24
+ </wd-cell-group>
25
+
26
+ </wd-form>
27
+ </wd-card>
28
+ </view>
29
+ <view v-if="item.type === 'relation'">
30
+ <view class="row-add">
31
+ <wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
32
+ icon="add" @click="selectrow(item)">选择</wd-button>
33
+ <wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
34
+ icon="add" @click="add(item)">新增</wd-button>
35
+ </view>
36
+
37
+ <view v-if="relationLoading[item.id]"
38
+ style="height: 100px;display: flex;justify-content: center;align-items: center;">
39
+ <wd-loading />
40
+ </view>
41
+
42
+ <!-- 卡片 -->
43
+ <view v-else class="card-list">
44
+ <w-card @edit="() => { editItem(item, subitem, subindex) }"
45
+ @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
46
+ v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
47
+ :page="{
48
+ rowActions: item.rowActions || [],
49
+ buttons: item.buttons || [],
50
+ ractions: item.ractions || [],
51
+ columns: item.fields || []
52
+ }" :item-data="subitem" :source-id="item.pointSourceId" />
53
+ </view>
54
+
55
+ <view class="row-add" v-if="item.buttons.includes('rowAdd')">
56
+ <wd-button hairline type="info" size="small" icon="add"
57
+ @click="addrow(item.id)">加一条</wd-button>
58
+ </view>
59
+ </view>
60
+ </wd-collapse-item>
61
+ </wd-collapse>
62
+ <view class="footer-button">
63
+ <wd-button :round="false" block @click="handleSubmit" icon="save">保存</wd-button>
64
+ </view>
65
+ </view>
66
+ <wd-message-box />
67
+ <wd-toast />
68
+ </view>
67
69
  </template>
68
70
 
69
71
  <script setup lang="ts">
@@ -72,23 +74,23 @@ import wFromControl from '../w-form-control/w-form-control.vue'
72
74
  import { onLoad, onUnload } from '@dcloudio/uni-app'
73
75
  import { ref, defineProps, reactive, watch } from 'vue';
74
76
  import {
75
- addPageConfig,
76
- getEnum,
77
- addPageDataSave,
78
- getSelectData
77
+ addPageConfig,
78
+ getEnum,
79
+ addPageDataSave,
80
+ getSelectData
79
81
  } from '../utils/apis/pageConfig'
80
82
  import { useMessage } from 'wot-design-uni'
81
83
  import { useToast } from 'wot-design-uni'
82
84
  const toast = useToast()
83
85
  const message = useMessage()
84
86
  defineOptions({
85
- name: 'w-add'
87
+ name: 'w-add'
86
88
  })
87
89
  const props = defineProps({
88
- sourceId: {
89
- type: String,
90
- default: ''
91
- },
90
+ sourceId: {
91
+ type: String,
92
+ default: ''
93
+ },
92
94
 
93
95
  })
94
96
  const sourceId = ref('')
@@ -107,262 +109,264 @@ const value = ref([])
107
109
  const Enumcolumn = ref({})
108
110
  const pointSourceId = ref('')
109
111
  onLoad((option: any) => {
110
- sourceId.value = props.sourceId || option.sourceId
111
- getPageConfig()
112
+ sourceId.value = props.sourceId || option.sourceId
113
+ getPageConfig()
112
114
  })
113
115
 
114
116
  watch(checkboxvalue, (value) => {
115
-
116
- getSelectDataPxoy(value)
117
+
118
+ getSelectDataPxoy(value)
117
119
  }, {
118
- immediate: false,
119
- deep: true
120
+ immediate: false,
121
+ deep: true
120
122
 
121
123
  })
122
124
 
123
125
  onUnload(() => {
124
- // 取消监听勾选列表页面事件
125
- uni.$off('getCheckData')
126
+ // 取消监听勾选列表页面事件
127
+ uni.$off('getCheckData')
126
128
 
127
129
  })
128
130
 
129
131
  // 获取页面配置
130
132
  function getPageConfig() {
131
- loading.value = true
132
- addPageConfig(sourceId.value).then((res: any) => {
133
- pageConf.value = res.data.dtmplConfig
134
-
135
- let fieldGroup = {}
136
- let relation = {}
137
- res.data.dtmplConfig.groups.forEach((item: any) => {
138
- value.value.push(item.id)
139
- if (item.type === 'relation') {
140
- let t = []
141
- relation[item.id] = t
142
- relationLoading[item.id] = false
143
- }
144
-
145
-
146
- if (item.type === 'fieldGroup') {
147
-
148
- item.fields.forEach((subItem: any) => {
149
- if (subItem.extControlType === 'datetime') {
150
- fieldGroup[subItem.id] = null
151
- return
152
- }
153
- fieldGroup[subItem.id] = subItem.defaultValue || ''
154
-
155
- })
156
- }
157
-
158
- })
159
- model.value = {
160
- ...relation,
161
- ...fieldGroup//一般为基本信息
162
- }
163
- getEnumer()
164
- loading.value = false
165
- })
133
+ loading.value = true
134
+ addPageConfig(sourceId.value).then((res: any) => {
135
+ pageConf.value = res.data.dtmplConfig
136
+
137
+ let fieldGroup = {}
138
+ let relation = {}
139
+ res.data.dtmplConfig.groups.forEach((item: any) => {
140
+ value.value.push(item.id)
141
+ if (item.type === 'relation') {
142
+ let t = []
143
+ relation[item.id] = t
144
+ relationLoading[item.id] = false
145
+ }
146
+
147
+
148
+ if (item.type === 'fieldGroup') {
149
+
150
+ item.fields.forEach((subItem: any) => {
151
+ if (subItem.extControlType === 'datetime') {
152
+ fieldGroup[subItem.id] = null
153
+ return
154
+ }
155
+ fieldGroup[subItem.id] = subItem.defaultValue || ''
156
+
157
+ })
158
+ }
159
+
160
+ })
161
+ model.value = {
162
+ ...relation,
163
+ ...fieldGroup//一般为基本信息
164
+ }
165
+ getEnumer()
166
+ loading.value = false
167
+ })
166
168
 
167
169
  }
168
170
  //获取枚举
169
171
  async function getEnumer() {
170
- let params = []
171
- pageConf.value.groups?.forEach((item: any) => {
172
- item.fields?.forEach((subItem: any) => {
173
- if (subItem.extControlType === 'select') {
174
- params.push(`mstrucIds=${subItem.mstrucId}`)
175
- }
176
- })
177
- });
178
- if (!params.length) return
179
- const res = await getEnum(params.join("&"))
180
- Enumcolumn.value = res.data?.enumMap || {}
172
+ let params = []
173
+ pageConf.value.groups?.forEach((item: any) => {
174
+ item.fields?.forEach((subItem: any) => {
175
+ if (subItem.extControlType === 'select') {
176
+ params.push(`mstrucIds=${subItem.mstrucId}`)
177
+ }
178
+ })
179
+ });
180
+ if (!params.length) return
181
+ const res = await getEnum(params.join("&"))
182
+ Enumcolumn.value = res.data?.enumMap || {}
181
183
  }
182
184
 
183
185
 
184
186
  //保存
185
187
  async function handleSubmit() {
186
188
 
187
- form.value[0]
188
- .validate()
189
- .then(async ({ valid, errors }) => {
190
- if (valid) {
191
- toast.loading({
192
- message: '保存中...',
193
- duration: 0
194
- })
195
- let data = {}
196
- pageConf.value.groups?.forEach((item: any) => {
197
- if (item.type === 'fieldGroup') {
198
- item.fields?.forEach((subItem: any) => {
199
- data[subItem.id] = model.value[subItem.id]
200
- })
201
- }
202
-
203
- if (item.type === 'relation') {
204
- data[`${item.id}.$$flag$$`] = true
205
- model.value[item.id]?.forEach((subItem: any, index: number) => {
206
- data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
207
- data[`${item.id}[${index}].唯一编码`] = subItem
208
- })
209
- }
210
- })
211
-
212
- try {
213
- const res = await addPageDataSave(sourceId.value, data)
214
- if (res.data.status === 'success') {
215
- toast.success("保存成功")
216
- uni.navigateBack({
217
- success: () => {
218
- uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
219
- }
220
- })
221
- } else {
222
- toast.error(res.data.message || '保存失败"')
223
- }
224
-
225
- } catch (error) {
226
- toast.error(error)
227
- }
228
-
229
-
230
- }
231
- })
232
- .catch((error) => {
233
- console.log(error, 'error')
234
- })
189
+ form.value[0]
190
+ .validate()
191
+ .then(async ({ valid, errors }) => {
192
+ if (valid) {
193
+ toast.loading({
194
+ message: '保存中...',
195
+ duration: 0
196
+ })
197
+ let data = {}
198
+ pageConf.value.groups?.forEach((item: any) => {
199
+ if (item.type === 'fieldGroup') {
200
+ item.fields?.forEach((subItem: any) => {
201
+ data[subItem.id] = model.value[subItem.id]
202
+ })
203
+ }
204
+
205
+ if (item.type === 'relation') {
206
+ data[`${item.id}.$$flag$$`] = true
207
+ model.value[item.id]?.forEach((subItem: any, index: number) => {
208
+ data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
209
+ data[`${item.id}[${index}].唯一编码`] = subItem
210
+ })
211
+ }
212
+ })
213
+
214
+ try {
215
+ const res = await addPageDataSave(sourceId.value, data)
216
+ if (res.data.status === 'success') {
217
+ toast.success("保存成功")
218
+ uni.navigateBack({
219
+ success: () => {
220
+ uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
221
+ }
222
+ })
223
+ } else {
224
+ toast.error(res.data.message || '保存失败"')
225
+ }
226
+
227
+ } catch (error) {
228
+ toast.error(error)
229
+ }
230
+
231
+
232
+ }
233
+ })
234
+ .catch((error) => {
235
+ console.log(error, 'error')
236
+ })
235
237
 
236
238
  }
237
239
 
238
240
  //跳转勾选页面数据
239
241
  function selectrow(item: any) {
240
- //监听勾选列表页面事件
241
- uni.$on('getCheckData', function (data: any) {
242
- checkboxvalue.value = data.checkData
243
- })
244
- relationID.value = item.id
245
- pointSourceId.value = item.pointSourceId
246
- let data = selectData.value[relationID.value]?.map((item) => {
247
- return item.code
248
- })
249
- uni.navigateTo({
250
- url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
251
- success: () => {
252
- uni.$emit('checkeDData', { checkData: data || [] })
253
- }
254
- })
242
+ //监听勾选列表页面事件
243
+ uni.$on('getCheckData', function (data: any) {
244
+ checkboxvalue.value = data.checkData
245
+ })
246
+ relationID.value = item.id
247
+ pointSourceId.value = item.pointSourceId
248
+ let data = selectData.value[relationID.value]?.map((item) => {
249
+ return item.code
250
+ })
251
+ uni.navigateTo({
252
+ url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
253
+ success: () => {
254
+ uni.$emit('checkeDData', { checkData: data || [] })
255
+ }
256
+ })
255
257
  }
256
258
  const selectData = ref({})
257
259
  //获取勾选数据
258
260
  async function getSelectDataPxoy(values: string[]) {
259
- if (values.length === 0) return model.value[relationID.value]=[]
260
- //获取勾选数据
261
- let codes = ''
262
- values.forEach((item: any) => {
263
- codes += `codes=${item}&`
264
- })
265
-
266
- relationLoading[relationID.value] = true
267
- if (!relationID.value) return
268
- const res = await getSelectData(relationID.value, codes)
269
- selectData.value[relationID.value] = res.data.entities
270
- model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
271
- return item.code
272
- })
273
- relationLoading[relationID.value] = false
261
+ if (values.length === 0) return model.value[relationID.value] = []
262
+ //获取勾选数据
263
+ let codes = ''
264
+ values.forEach((item: any) => {
265
+ codes += `codes=${item}&`
266
+ })
267
+
268
+ relationLoading[relationID.value] = true
269
+ if (!relationID.value) return
270
+ const res = await getSelectData(relationID.value, codes)
271
+ selectData.value[relationID.value] = res.data.entities
272
+ model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
273
+ return item.code
274
+ })
275
+ relationLoading[relationID.value] = false
274
276
  }
275
277
 
276
278
  //删除勾选数据
277
279
  const deletItem = (item: any, subitem: any, index: any) => {
278
- relationID.value = item.id
279
- selectData.value[item.id].splice(index, 1)
280
- let data = selectData.value[item.id].map((item: any) => {
281
- return item.code
282
- })
283
- checkboxvalue.value = data || []
280
+ relationID.value = item.id
281
+ selectData.value[item.id].splice(index, 1)
282
+ let data = selectData.value[item.id].map((item: any) => {
283
+ return item.code
284
+ })
285
+ checkboxvalue.value = data || []
284
286
  }
285
287
 
286
- //点击编辑勾选数据按钮
287
- const editItem=( item: any, subitem: any, index: any )=>{
288
- relationID.value = item.id
289
- //监听编辑页面事件
290
- uni.$on('editeDataSAC', function (data: any) {
291
-
292
- checkboxvalue.value=selectData.value[item.id].map((item: any) => {
293
- return item.code
294
- })
295
- // 取消监听编辑页面事件
296
- uni.$off('editeDataSAC')
297
- })
288
+ //点击编辑按钮
289
+ const editItem = (item: any, subitem: any, index: any) => {
290
+ relationID.value = item.id
291
+ //监听编辑页面事件
292
+ uni.$on('editeDataSAC', function (data: any) {
293
+
294
+ checkboxvalue.value = selectData.value[item.id]?selectData.value[item.id].map((item: any) => {
295
+ return item.code
296
+ }):[data.entityCode]
297
+ // 取消监听编辑页面事件
298
+ uni.$off('editeDataSAC')
299
+ })
298
300
  }
299
301
 
300
- //新增
302
+ //新增按钮
301
303
  const add = (item: any) => {
302
- relationID.value = item.id
303
- //监听添加数据完成事件
304
- uni.$on('addDataSAC', function (data: any) {
305
- checkboxvalue.value.push(data.entityCode)
306
- // 取消监听添加数据完成事件
307
- uni.$off('addDataSAC')
308
- })
309
- //跳转新增页面
310
- uni.navigateTo({
311
- url: `/pages/add/add?sourceId=${item.pointSourceId}`,
312
- })
304
+ relationID.value = item.id
305
+ //监听添加数据完成事件
306
+ uni.$on('addDataSAC', function (data: any) {
307
+ checkboxvalue.value = selectData.value[item.id]?[...selectData.value[item.id].map((item: any) => {
308
+ return item.code
309
+ }), data.entityCode]:[data.entityCode]
310
+ // 取消监听添加数据完成事件
311
+ uni.$off('addDataSAC')
312
+ })
313
+ //跳转新增页面
314
+ uni.navigateTo({
315
+ url: `/pages/add/add?sourceId=${item.pointSourceId}`,
316
+ })
313
317
  }
314
318
 
315
319
 
316
320
  //新加一行
317
321
  function addrow(key: any) {
318
322
 
319
- let data = pageConf.value.groups.find((item: any) => {
320
- return item.id === key
321
- })
322
- let t = {}
323
- data.fields.forEach((subItem: any) => {
324
- t[subItem.id] = subItem.defaultValue || ''
325
- })
326
- model.value[key].push(t)
323
+ let data = pageConf.value.groups.find((item: any) => {
324
+ return item.id === key
325
+ })
326
+ let t = {}
327
+ data.fields.forEach((subItem: any) => {
328
+ t[subItem.id] = subItem.defaultValue || ''
329
+ })
330
+ model.value[key].push(t)
327
331
  }
328
332
  //删除一行
329
333
  function remove(key: any, index: any, title: string) {
330
- message
331
- .confirm({
332
- msg: `${title}--确定删除第${index + 1}条数据吗?`,
333
- title: '删除'
334
- })
335
- .then(() => {
336
- model.value[key].splice(index, 1)
337
- })
338
- .catch(() => {
339
- console.log('点击了取消按钮')
340
- })
334
+ message
335
+ .confirm({
336
+ msg: `${title}--确定删除第${index + 1}条数据吗?`,
337
+ title: '删除'
338
+ })
339
+ .then(() => {
340
+ model.value[key].splice(index, 1)
341
+ })
342
+ .catch(() => {
343
+ console.log('点击了取消按钮')
344
+ })
341
345
 
342
346
  }
343
347
  </script>
344
348
 
345
349
  <style scoped lang="scss">
346
350
  .footer-button {
347
- width: 100%;
348
- box-sizing: border-box;
349
- padding: 5px 10px 5px 10px;
350
- position: sticky;
351
- bottom: 0;
352
- background-color: #fff;
351
+ width: 100%;
352
+ box-sizing: border-box;
353
+ padding: 5px 10px 5px 10px;
354
+ position: sticky;
355
+ bottom: 0;
356
+ background-color: #fff;
353
357
 
354
358
  }
355
359
 
356
360
  .row-add {
357
- // background-color: #fff;
358
- padding: 8px 0;
359
- display: flex;
360
- justify-content: center;
361
- gap: 5px;
361
+ // background-color: #fff;
362
+ padding: 0 0 8px 0;
363
+ display: flex;
364
+ justify-content: center;
365
+ gap: 5px;
362
366
  }
363
367
 
364
368
  :deep(.collapse-custom-class) {
365
- background-color: #F6F7FB;
366
- padding: 0.5px 0 !important;
369
+ background-color: #f8f8f8;
370
+ padding: 15px 0 0.5px 0 !important;
367
371
  }
368
372
  </style>
package/w-card/w-card.vue CHANGED
@@ -41,6 +41,10 @@ const props = defineProps({
41
41
  applicationType: {
42
42
  type: String,
43
43
  default: ''
44
+ },
45
+ actionType: {
46
+ type: String,
47
+ default: ''
44
48
  }
45
49
  })
46
50
 
@@ -200,7 +204,7 @@ const actionBtn = (item: any) => {
200
204
  //格式化title
201
205
  const getTitleValue = (value: any, title: string) => {
202
206
  let data=getValue(value, title)?.content
203
- if(!data) return ' '
207
+ if(!data) return ''
204
208
  // 是否为数组
205
209
  if(Array.isArray(data)){
206
210
  return getValue(value, title).content.map((item:any)=>{
@@ -279,8 +283,9 @@ const getTitleValue = (value: any, title: string) => {
279
283
  @click="goto('edit')">
280
284
  编辑
281
285
  </wd-button>
286
+ <!-- //假删除按钮,在新增、编辑页面才会出现 -->
282
287
  <wd-button :round="false" size="small" class="btn" type="error" @click="delerelation"
283
- v-if="props.actionType === 'relation'">
288
+ v-if="props.actionType === 'relation'&&props.page.buttons.includes('singleDelete')">
284
289
  删除
285
290
  </wd-button>
286
291
  <wd-button :round="false" size="small" class="btn" type="error" @click="dele"
package/w-edit/w-edit.vue CHANGED
@@ -16,14 +16,15 @@ export default {
16
16
  <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
17
17
  v-for="(item, index) in pageConf.groups" :key="index">
18
18
  <view v-if="item.type === 'fieldGroup'">
19
- <wd-form ref="form" :model="model">
20
- <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
21
- <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
22
- v-model:model-value="model[subItem.id]" />
23
- </wd-cell-group>
24
-
25
- </wd-form>
26
-
19
+ <wd-card>
20
+ <wd-form ref="form" :model="model">
21
+ <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
22
+ <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
23
+ v-model:model-value="model[subItem.id]" />
24
+ </wd-cell-group>
25
+
26
+ </wd-form>
27
+ </wd-card>
27
28
  </view>
28
29
  <view v-if="item.type === 'relation'">
29
30
  <view class="row-add">
@@ -40,7 +41,8 @@ export default {
40
41
 
41
42
  <!-- 卡片 -->
42
43
  <view v-else class="card-list">
43
- <w-card @edit="()=>{editItem(item, subitem, subindex)}" @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
44
+ <w-card @edit="() => { editItem(item, subitem, subindex) }"
45
+ @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
44
46
  v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
45
47
  :page="{
46
48
  rowActions: item.rowActions || [],
@@ -138,7 +140,7 @@ onLoad((option: any) => {
138
140
 
139
141
  })
140
142
  watch(checkboxvalue, (value) => {
141
-
143
+
142
144
  getSelectDataPxoy(value)
143
145
  }, {
144
146
  immediate: false,
@@ -198,7 +200,7 @@ async function getEnumer() {
198
200
 
199
201
  //获取勾选数据
200
202
  async function getSelectDataPxoy(values: string[]) {
201
- if (values.length === 0) return model.value[relationID.value]=[]
203
+ if (values.length === 0) return model.value[relationID.value] = []
202
204
  //获取勾选数据
203
205
  let codes = ''
204
206
  values.forEach((item: any) => {
@@ -247,6 +249,7 @@ async function handleSubmit() {
247
249
  toast.success("保存成功")
248
250
  uni.navigateBack({
249
251
  success: () => {
252
+
250
253
  uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
251
254
  }
252
255
  })
@@ -292,26 +295,29 @@ const deletItem = (item: any, subitem: any, index: any) => {
292
295
  checkboxvalue.value = data || []
293
296
  }
294
297
 
295
- //点击编辑勾选数据按钮
296
- const editItem=( item: any, subitem: any, index: any )=>{
298
+ //点击编辑按钮
299
+ const editItem = (item: any, subitem: any, index: any) => {
297
300
  relationID.value = item.id
298
- //监听编辑页面事件
299
- uni.$on('editeDataSAC', function (data: any) {
300
-
301
- checkboxvalue.value=selectData.value[item.id].map((item: any) => {
301
+ //监听编辑页面事件
302
+ uni.$on('editeDataSAC', function (data: any) {
303
+
304
+ checkboxvalue.value = selectData.value[item.id]?selectData.value[item.id].map((item: any) => {
302
305
  return item.code
303
- })
304
- // 取消监听编辑页面事件
305
- uni.$off('editeDataSAC')
306
+ }):[data.entityCode]
307
+ // 取消监听编辑页面事件
308
+ uni.$off('editeDataSAC')
306
309
  })
307
310
  }
308
311
 
309
- //新增
312
+ //点击新增按钮
310
313
  const add = (item: any) => {
311
314
  relationID.value = item.id
315
+
312
316
  //监听添加数据完成事件
313
317
  uni.$on('addDataSAC', function (data: any) {
314
- checkboxvalue.value.push(data.entityCode)
318
+ checkboxvalue.value = selectData.value[item.id]?[...selectData.value[item.id].map((item: any) => {
319
+ return item.code
320
+ }), data.entityCode]:[data.entityCode]
315
321
  // 取消监听添加数据完成事件
316
322
  uni.$off('addDataSAC')
317
323
  })
@@ -364,14 +370,14 @@ function remove(key: any, index: any, title: string) {
364
370
 
365
371
  .row-add {
366
372
  // background-color: #fff;
367
- padding: 8px 0;
373
+ padding: 0 0 8px 0;
368
374
  display: flex;
369
375
  justify-content: center;
370
376
  gap: 5px;
371
377
  }
372
378
 
373
379
  :deep(.collapse-custom-class) {
374
- background-color: #F6F7FB;
375
- padding: 0.5px 0 !important;
380
+ background-color: #f8f8f8;
381
+ padding: 15px 0 0.5px 0 !important;
376
382
  }
377
383
  </style>
@@ -25,10 +25,17 @@
25
25
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
26
26
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
27
27
  @clear="clear" />
28
- <wSelectPicker @confirm="wSelectPickerconfirm" :prop="subItem.id" v-else-if="subItem.extControlType === 'relselect'"
29
- :modelValue="modelValue" :disabled="subItem.disabled" :label="subItem.title" :type="subItem.max===1?'radio':'checkbox'"
30
- :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`" :source-id="subItem.sourceId" filterable
31
- :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @clear="clear" />
28
+
29
+ <wd-cell v-else-if="subItem.extControlType === 'relselect'" title-width="100px" :prop="subItem.id"
30
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :title="subItem.title">
31
+ <view style="text-align: left">
32
+ <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
33
+ :type="subItem.max === 1 ? 'radio' : 'checkbox'"
34
+ :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`" :source-id="subItem.sourceId" filterable
35
+ @clear="clear" clearable />
36
+ </view>
37
+ </wd-cell>
38
+
32
39
  <wd-cell v-else-if="subItem.extControlType === 'file'"
33
40
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}文件` }]" :title="subItem.title"
34
41
  title-width="100px" :prop="subItem.id">
@@ -80,15 +87,15 @@ const modelValue = computed(() => {
80
87
  if (props.subItem.max === 1) {
81
88
  return props.model[props.subItem.id] ? props.model[props.subItem.id].split('@R@')[0] : ''
82
89
  } else {
83
- if(!props.model[props.subItem.id]) return []
90
+ if (!props.model[props.subItem.id]) return []
84
91
 
85
- let selectArr= props.model[props.subItem.id].split('@,@')
86
-
87
- let selectArr2= selectArr.map((item:any)=>{
92
+ let selectArr = props.model[props.subItem.id].split('@,@')
93
+
94
+ let selectArr2 = selectArr.map((item: any) => {
88
95
  return item.split('@R@')[0]
89
- })
90
-
91
- return selectArr2
96
+ })
97
+
98
+ return selectArr2
92
99
  }
93
100
 
94
101
  case 'file':
@@ -112,10 +119,10 @@ const success = (e: any) => {
112
119
  const wSelectPickerconfirm = (e) => {
113
120
  console.log(e)
114
121
  if (Array.isArray(e.selectedItems)) {
115
- let selectArr1= e.selectedItems.map((item:any)=>{
122
+ let selectArr1 = e.selectedItems.map((item: any) => {
116
123
  return `${item.value}@R@${item.label}`
117
124
  })
118
- let selectArr= selectArr1.join('@,@')
125
+ let selectArr = selectArr1.join('@,@')
119
126
  emit('update:modelValue', selectArr)
120
127
  } else {
121
128
  emit('update:modelValue', `${e.selectedItems.value}@R@${e.selectedItems.label}`)
package/w-menu/w-menu.vue CHANGED
@@ -133,6 +133,7 @@ function queryList() {
133
133
  </template>
134
134
  <view>
135
135
  <view v-if="filtermenu.length > 0" class="menu-list">
136
+ <slot name="topImg"></slot>
136
137
  <wd-card v-for="(item, index) in filtermenu" :key="index" :title="item.title"
137
138
  custom-title-class="menu-title-class">
138
139
  <template #default>