w-ui-v1 1.0.37 → 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 +1 -1
- package/w-add/w-add.vue +267 -263
- package/w-card/w-card.vue +7 -2
- package/w-edit/w-edit.vue +31 -25
- package/w-form-control/w-form-control.vue +20 -13
package/package.json
CHANGED
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
options: {
|
|
5
|
+
styleIsolation: 'shared'//使css :deep()生效
|
|
6
|
+
}
|
|
7
7
|
}
|
|
8
8
|
</script>
|
|
9
9
|
<template>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
87
|
+
name: 'w-add'
|
|
86
88
|
})
|
|
87
89
|
const props = defineProps({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
+
sourceId.value = props.sourceId || option.sourceId
|
|
113
|
+
getPageConfig()
|
|
112
114
|
})
|
|
113
115
|
|
|
114
116
|
watch(checkboxvalue, (value) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
|
|
118
|
+
getSelectDataPxoy(value)
|
|
117
119
|
}, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
immediate: false,
|
|
121
|
+
deep: true
|
|
120
122
|
|
|
121
123
|
})
|
|
122
124
|
|
|
123
125
|
onUnload(() => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
// 取消监听勾选列表页面事件
|
|
127
|
+
uni.$off('getCheckData')
|
|
126
128
|
|
|
127
129
|
})
|
|
128
130
|
|
|
129
131
|
// 获取页面配置
|
|
130
132
|
function getPageConfig() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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=(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
366
|
-
|
|
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-
|
|
20
|
-
<wd-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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="()
|
|
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=(
|
|
298
|
+
//点击编辑按钮
|
|
299
|
+
const editItem = (item: any, subitem: any, index: any) => {
|
|
297
300
|
relationID.value = item.id
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
|
|
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.
|
|
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: #
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
:
|
|
31
|
-
|
|
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])
|
|
90
|
+
if (!props.model[props.subItem.id]) return []
|
|
84
91
|
|
|
85
|
-
let selectArr=
|
|
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
|
-
|
|
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}`)
|