w-ui-v1 1.0.29 → 1.0.31
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 +135 -32
- package/w-card/utils/utils.ts +29 -8
- package/w-card/w-card.vue +30 -18
- package/w-detail/w-detail.vue +55 -28
- package/w-edit/w-edit.vue +190 -66
- package/w-form-control/w-form-control.vue +30 -11
- package/w-search/w-search.vue +4 -1
- package/w-table/w-selectTable.vue +12 -2
package/package.json
CHANGED
package/w-add/w-add.vue
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
//在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
|
|
3
|
+
export default {
|
|
4
|
+
options: {
|
|
5
|
+
styleIsolation: 'shared'//使css :deep()生效
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
1
9
|
<template>
|
|
2
10
|
<view>
|
|
3
11
|
<view v-if="loading" style="height: 100px;display: flex;justify-content: center;align-items: center;">
|
|
@@ -5,8 +13,8 @@
|
|
|
5
13
|
</view>
|
|
6
14
|
<view v-else>
|
|
7
15
|
<wd-collapse v-model="value">
|
|
8
|
-
<wd-collapse-item :title="item.title" :name="item.id"
|
|
9
|
-
:key="index">
|
|
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">
|
|
10
18
|
<view v-if="item.type === 'fieldGroup'">
|
|
11
19
|
<wd-form ref="form" :model="model">
|
|
12
20
|
<wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
|
|
@@ -22,18 +30,24 @@
|
|
|
22
30
|
<wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
|
|
23
31
|
icon="add" @click="selectrow(item)">选择</wd-button>
|
|
24
32
|
<wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
|
|
25
|
-
icon="add" @click="
|
|
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 />
|
|
26
39
|
</view>
|
|
27
40
|
|
|
28
41
|
<!-- 卡片 -->
|
|
29
|
-
<view class="card-list"
|
|
30
|
-
<w-card
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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" />
|
|
37
51
|
</view>
|
|
38
52
|
|
|
39
53
|
<view class="row-add" v-if="item.buttons.includes('rowAdd')">
|
|
@@ -56,7 +70,7 @@
|
|
|
56
70
|
import wCard from '../w-card/w-card.vue'
|
|
57
71
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
58
72
|
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
|
59
|
-
import { ref, defineProps, reactive } from 'vue';
|
|
73
|
+
import { ref, defineProps, reactive, watch } from 'vue';
|
|
60
74
|
import {
|
|
61
75
|
addPageConfig,
|
|
62
76
|
getEnum,
|
|
@@ -86,7 +100,7 @@ const relationID = ref('')
|
|
|
86
100
|
const modelsRef = {
|
|
87
101
|
|
|
88
102
|
}
|
|
89
|
-
|
|
103
|
+
const relationLoading = reactive({})
|
|
90
104
|
const checkboxvalue = ref([])
|
|
91
105
|
const loading = ref(false)
|
|
92
106
|
const value = ref([])
|
|
@@ -95,23 +109,24 @@ const pointSourceId = ref('')
|
|
|
95
109
|
onLoad((option: any) => {
|
|
96
110
|
sourceId.value = props.sourceId || option.sourceId
|
|
97
111
|
getPageConfig()
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
watch(checkboxvalue, (value) => {
|
|
115
|
+
|
|
116
|
+
getSelectDataPxoy(value)
|
|
117
|
+
}, {
|
|
118
|
+
immediate: false,
|
|
119
|
+
deep: true
|
|
98
120
|
|
|
99
|
-
//监听勾选列表页面事件
|
|
100
|
-
uni.$on('getCheckData', function (data: any) {
|
|
101
|
-
checkboxvalue.value = data.checkData
|
|
102
|
-
//获取勾选数据
|
|
103
|
-
let codes = ''
|
|
104
|
-
checkboxvalue.value.forEach((item: any) => {
|
|
105
|
-
codes += `codes=${item}&`
|
|
106
|
-
})
|
|
107
|
-
getSelectDataPxoy(codes)
|
|
108
|
-
})
|
|
109
121
|
})
|
|
122
|
+
|
|
110
123
|
onUnload(() => {
|
|
111
124
|
// 取消监听勾选列表页面事件
|
|
112
125
|
uni.$off('getCheckData')
|
|
126
|
+
|
|
113
127
|
})
|
|
114
128
|
|
|
129
|
+
// 获取页面配置
|
|
115
130
|
function getPageConfig() {
|
|
116
131
|
loading.value = true
|
|
117
132
|
addPageConfig(sourceId.value).then((res: any) => {
|
|
@@ -123,12 +138,11 @@ function getPageConfig() {
|
|
|
123
138
|
value.value.push(item.id)
|
|
124
139
|
if (item.type === 'relation') {
|
|
125
140
|
let t = []
|
|
126
|
-
// item.fields.forEach((subItem: any) => {
|
|
127
|
-
// t[0][subItem.id] = subItem.defaultValue || ''
|
|
128
|
-
// })
|
|
129
141
|
relation[item.id] = t
|
|
130
|
-
|
|
142
|
+
relationLoading[item.id] = false
|
|
131
143
|
}
|
|
144
|
+
|
|
145
|
+
|
|
132
146
|
if (item.type === 'fieldGroup') {
|
|
133
147
|
|
|
134
148
|
item.fields.forEach((subItem: any) => {
|
|
@@ -169,6 +183,7 @@ async function getEnumer() {
|
|
|
169
183
|
|
|
170
184
|
//保存
|
|
171
185
|
async function handleSubmit() {
|
|
186
|
+
|
|
172
187
|
form.value[0]
|
|
173
188
|
.validate()
|
|
174
189
|
.then(async ({ valid, errors }) => {
|
|
@@ -177,12 +192,32 @@ async function handleSubmit() {
|
|
|
177
192
|
message: '保存中...',
|
|
178
193
|
duration: 0
|
|
179
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
|
+
})
|
|
180
211
|
|
|
181
212
|
try {
|
|
182
|
-
const res = await addPageDataSave(sourceId.value,
|
|
213
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
183
214
|
if (res.data.status === 'success') {
|
|
184
215
|
toast.success("保存成功")
|
|
185
|
-
uni.navigateBack(
|
|
216
|
+
uni.navigateBack({
|
|
217
|
+
success: () => {
|
|
218
|
+
uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
219
|
+
}
|
|
220
|
+
})
|
|
186
221
|
} else {
|
|
187
222
|
toast.error(res.data.message || '保存失败"')
|
|
188
223
|
}
|
|
@@ -202,17 +237,79 @@ async function handleSubmit() {
|
|
|
202
237
|
|
|
203
238
|
//跳转勾选页面数据
|
|
204
239
|
function selectrow(item: any) {
|
|
240
|
+
//监听勾选列表页面事件
|
|
241
|
+
uni.$on('getCheckData', function (data: any) {
|
|
242
|
+
checkboxvalue.value = data.checkData
|
|
243
|
+
})
|
|
205
244
|
relationID.value = item.id
|
|
206
245
|
pointSourceId.value = item.pointSourceId
|
|
246
|
+
let data = selectData.value[relationID.value]?.map((item) => {
|
|
247
|
+
return item.code
|
|
248
|
+
})
|
|
207
249
|
uni.navigateTo({
|
|
208
|
-
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}
|
|
250
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
251
|
+
success: () => {
|
|
252
|
+
uni.$emit('checkeDData', { checkData: data || [] })
|
|
253
|
+
}
|
|
209
254
|
})
|
|
210
255
|
}
|
|
211
256
|
const selectData = ref({})
|
|
212
257
|
//获取勾选数据
|
|
213
|
-
async function getSelectDataPxoy(
|
|
258
|
+
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
|
|
214
268
|
const res = await getSelectData(relationID.value, codes)
|
|
215
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
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
//删除勾选数据
|
|
277
|
+
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 || []
|
|
284
|
+
}
|
|
285
|
+
|
|
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
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
//新增
|
|
301
|
+
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
|
+
})
|
|
216
313
|
}
|
|
217
314
|
|
|
218
315
|
|
|
@@ -258,8 +355,14 @@ function remove(key: any, index: any, title: string) {
|
|
|
258
355
|
|
|
259
356
|
.row-add {
|
|
260
357
|
// background-color: #fff;
|
|
261
|
-
|
|
358
|
+
padding: 8px 0;
|
|
262
359
|
display: flex;
|
|
263
360
|
justify-content: center;
|
|
361
|
+
gap: 5px;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
:deep(.collapse-custom-class) {
|
|
365
|
+
background-color: #F6F7FB;
|
|
366
|
+
padding: 0.5px 0 !important;
|
|
264
367
|
}
|
|
265
368
|
</style>
|
package/w-card/utils/utils.ts
CHANGED
|
@@ -47,7 +47,7 @@ export function getValue(content: any, title: any): any {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//文件链接
|
|
50
|
-
if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat'))) {
|
|
50
|
+
if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat')|| obj.base?.type.includes('md'))) {
|
|
51
51
|
|
|
52
52
|
return {
|
|
53
53
|
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
@@ -81,21 +81,42 @@ function splitString(str: string) {
|
|
|
81
81
|
return str
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
// 判断是否有 "@R@"
|
|
86
86
|
if (str.includes('@R@')) {
|
|
87
87
|
// 分割字符串
|
|
88
|
-
const splitStr =
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const splitStr =splitStringtoArr(str).map((item:string)=>{
|
|
89
|
+
let splitItem = item.split('@R@')
|
|
90
|
+
return {
|
|
91
|
+
label:splitItem[1],
|
|
92
|
+
value:splitItem[0]
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
// 返回分割后的对象数组
|
|
96
|
+
return splitStr
|
|
91
97
|
}
|
|
92
98
|
else {
|
|
93
99
|
// 返回原字符串
|
|
94
100
|
return str
|
|
95
101
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 根据 "@,@" 分割字符串,得到数组
|
|
106
|
+
function splitStringtoArr(str: string) {
|
|
107
|
+
|
|
108
|
+
// 判断是否有 "@,@" 字符串
|
|
109
|
+
if (str.includes('@,@')) {
|
|
110
|
+
// 分割字符串
|
|
111
|
+
const splitStr = str.split('@,@')
|
|
112
|
+
// 返回分割后的数组
|
|
113
|
+
return splitStr
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// 返回原字符串
|
|
117
|
+
return [str]
|
|
118
|
+
}
|
|
119
|
+
|
|
99
120
|
}
|
|
100
121
|
|
|
101
122
|
// 判断字符串中是否存在'y'字符
|
package/w-card/w-card.vue
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { hasY, getValue, downloadFile } from './utils/utils'
|
|
10
10
|
import { deletePageData } from '../utils/apis/pageConfig'
|
|
11
11
|
import { useMessage, useToast } from 'wot-design-uni'
|
|
12
|
-
const emits = defineEmits(['refresh'])
|
|
12
|
+
const emits = defineEmits(['refresh', 'delet','edit'])
|
|
13
13
|
const toast = useToast()
|
|
14
14
|
const message = useMessage()
|
|
15
15
|
const props = defineProps({
|
|
@@ -29,6 +29,10 @@ const props = defineProps({
|
|
|
29
29
|
type: String,
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
|
+
applicationType: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ''
|
|
35
|
+
}
|
|
32
36
|
})
|
|
33
37
|
|
|
34
38
|
//更多按钮
|
|
@@ -56,7 +60,7 @@ const moreBtns = computed(() => {
|
|
|
56
60
|
|
|
57
61
|
props.page.ractions?.forEach((item: any) => {
|
|
58
62
|
data.push({
|
|
59
|
-
actionType:"openPage",
|
|
63
|
+
actionType: "openPage",
|
|
60
64
|
name: item.title,
|
|
61
65
|
color: '#4D81F1',
|
|
62
66
|
...item
|
|
@@ -106,7 +110,7 @@ function toggleExpand() {
|
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
// 跳转页页面
|
|
109
|
-
function goto(type: string, item: any = {}, subItem:
|
|
113
|
+
function goto(type: string, item: any = {}, subItem: any) {
|
|
110
114
|
|
|
111
115
|
switch (type) {
|
|
112
116
|
case 'detail':
|
|
@@ -115,20 +119,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
|
|
|
115
119
|
})
|
|
116
120
|
break
|
|
117
121
|
case 'link':
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
data = item.data.find((item: any) => {
|
|
121
|
-
return item.includes(subItem)
|
|
122
|
-
}).split('@R@')[0]
|
|
123
|
-
} else {
|
|
124
|
-
data = item.data.split('@R@')[0]
|
|
125
|
-
}
|
|
122
|
+
let code = subItem.value
|
|
123
|
+
|
|
126
124
|
|
|
127
125
|
uni.navigateTo({
|
|
128
|
-
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${
|
|
126
|
+
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${code}`,
|
|
129
127
|
})
|
|
130
128
|
break
|
|
131
129
|
case 'edit':
|
|
130
|
+
if (props.actionType === 'relation') {
|
|
131
|
+
emits('edit')
|
|
132
|
+
}
|
|
132
133
|
uni.navigateTo({
|
|
133
134
|
url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
|
|
134
135
|
})
|
|
@@ -142,6 +143,13 @@ function goto(type: string, item: any = {}, subItem: string = '') {
|
|
|
142
143
|
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
//删除勾选项
|
|
147
|
+
const delerelation = () => {
|
|
148
|
+
if (props.actionType === 'relation') {
|
|
149
|
+
emits('delet')
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
145
153
|
//删除
|
|
146
154
|
const dele = () => {
|
|
147
155
|
message
|
|
@@ -200,18 +208,18 @@ const actionBtn = (item: any) => {
|
|
|
200
208
|
</view>
|
|
201
209
|
<view v-else-if="item.buttons.includes('detail')">
|
|
202
210
|
<view @click="goto('link', item, subItem)" class="link"
|
|
203
|
-
v-for="(subItem, subIndex) in item.content
|
|
204
|
-
<text> {{ subItem }}</text>
|
|
211
|
+
v-for="(subItem, subIndex) in item.content" :key="subIndex">
|
|
212
|
+
<text> {{ subItem.label }}</text>
|
|
205
213
|
</view>
|
|
206
214
|
</view>
|
|
207
215
|
<view v-else-if="item.content?.type === '文件'" class="value">
|
|
208
216
|
<wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
|
|
209
217
|
</view>
|
|
210
218
|
|
|
211
|
-
<audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url"
|
|
212
|
-
:name="item.content?.name" controls></audio>
|
|
219
|
+
<audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url"
|
|
220
|
+
:author="item.content?.author" :name="item.content?.name" controls></audio>
|
|
213
221
|
|
|
214
|
-
|
|
222
|
+
<!-- <audio style="width: 50px;" v-else-if="item.controlType==='file'" :src="item.content"
|
|
215
223
|
controls></audio> -->
|
|
216
224
|
|
|
217
225
|
|
|
@@ -235,8 +243,12 @@ const actionBtn = (item: any) => {
|
|
|
235
243
|
@click="goto('edit')">
|
|
236
244
|
编辑
|
|
237
245
|
</wd-button>
|
|
246
|
+
<wd-button size="small" class="btn" plain type="error" @click="delerelation"
|
|
247
|
+
v-if="props.actionType === 'relation'">
|
|
248
|
+
删除
|
|
249
|
+
</wd-button>
|
|
238
250
|
<wd-button size="small" class="btn" plain type="error" @click="dele"
|
|
239
|
-
v-if="props.page.buttons.includes('singleDelete')">
|
|
251
|
+
v-else-if="props.page.buttons.includes('singleDelete')">
|
|
240
252
|
删除
|
|
241
253
|
</wd-button>
|
|
242
254
|
<view v-if="moreBtns.length > 0">
|
package/w-detail/w-detail.vue
CHANGED
|
@@ -59,7 +59,15 @@ function getPageData() {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// 跳转详情页
|
|
62
|
-
function goto(PItem: any, item: any) {
|
|
62
|
+
function goto(type = '', PItem: any, item: any) {
|
|
63
|
+
|
|
64
|
+
if (type == 'link') {
|
|
65
|
+
uni.navigateTo({
|
|
66
|
+
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${PItem.value}`
|
|
67
|
+
})
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
63
71
|
uni.navigateTo({
|
|
64
72
|
url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
|
|
65
73
|
})
|
|
@@ -101,6 +109,14 @@ function goto(PItem: any, item: any) {
|
|
|
101
109
|
:author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
|
|
102
110
|
:name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
|
|
103
111
|
controls></audio>
|
|
112
|
+
|
|
113
|
+
<view v-else-if="subItem.buttons.includes('detail')">
|
|
114
|
+
<view @click="goto('link', bItem, subItem)" class="link"
|
|
115
|
+
v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
|
|
116
|
+
:key="bIndex">
|
|
117
|
+
<text> {{ bItem.label }}</text>
|
|
118
|
+
</view>
|
|
119
|
+
</view>
|
|
104
120
|
<view v-else class="value">
|
|
105
121
|
{{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
|
|
106
122
|
</view>
|
|
@@ -119,33 +135,39 @@ function goto(PItem: any, item: any) {
|
|
|
119
135
|
v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
|
|
120
136
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
|
|
121
137
|
<view v-if="!subItem.hidden" class="row">
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<view
|
|
146
|
-
|
|
138
|
+
|
|
139
|
+
<view class="label">
|
|
140
|
+
{{ subItem.title }}:
|
|
141
|
+
</view>
|
|
142
|
+
|
|
143
|
+
<wd-img v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
144
|
+
width="100rpx" height="100rpx"
|
|
145
|
+
:src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
|
|
146
|
+
:enable-preview="true" />
|
|
147
|
+
<view
|
|
148
|
+
v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
|
|
149
|
+
class="value">
|
|
150
|
+
<wd-text type="primary"
|
|
151
|
+
@click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)"
|
|
152
|
+
:text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name" />
|
|
153
|
+
</view>
|
|
154
|
+
<audio
|
|
155
|
+
v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
|
|
156
|
+
:src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
|
|
157
|
+
:author="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).author"
|
|
158
|
+
:name="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name"
|
|
159
|
+
controls></audio>
|
|
160
|
+
<view v-else-if="subItem.buttons.includes('detail')">
|
|
161
|
+
<view @click="goto('link', bItem, subItem)" class="link"
|
|
162
|
+
v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
|
|
163
|
+
:key="bIndex">
|
|
164
|
+
<text> {{ bItem.label }}</text>
|
|
147
165
|
</view>
|
|
148
|
-
|
|
166
|
+
</view>
|
|
167
|
+
<view v-else class="value">
|
|
168
|
+
{{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
|
|
169
|
+
</view>
|
|
170
|
+
|
|
149
171
|
</view>
|
|
150
172
|
</view>
|
|
151
173
|
|
|
@@ -179,13 +201,18 @@ function goto(PItem: any, item: any) {
|
|
|
179
201
|
word-break: break-all;
|
|
180
202
|
color: #333;
|
|
181
203
|
}
|
|
204
|
+
|
|
205
|
+
.link {
|
|
206
|
+
color: #4d80f0;
|
|
207
|
+
}
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
|
|
185
211
|
:deep(.card-custom-class) {
|
|
186
212
|
margin: 0 !important;
|
|
187
213
|
}
|
|
188
|
-
|
|
214
|
+
|
|
215
|
+
:deep(.card-custom-class-relation) {
|
|
189
216
|
margin: 0 0 8px 0 !important;
|
|
190
217
|
}
|
|
191
218
|
|
package/w-edit/w-edit.vue
CHANGED
|
@@ -1,62 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
//在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
|
|
3
|
+
export default {
|
|
4
|
+
options: {
|
|
5
|
+
styleIsolation: 'shared'//使css :deep()生效
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
1
9
|
<template>
|
|
2
10
|
<view>
|
|
3
11
|
<view v-if="loading" style="height: 100px;display: flex;justify-content: center;align-items: center;">
|
|
4
12
|
<wd-loading />
|
|
5
13
|
</view>
|
|
6
14
|
<view v-else>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
v-if="item.type === 'fieldGroup'">
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<view v-if="item.type === 'relation'">
|
|
20
|
-
<view v-if="item.pointSourceId">
|
|
21
|
-
<view class="row-add" v-if="item.buttons.includes('selectAdd')">
|
|
22
|
-
<wd-button hairline type="info" size="small" icon="add"
|
|
23
|
-
@click="selectrow(item)">选择</wd-button>
|
|
24
|
-
</view>
|
|
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
|
+
|
|
25
27
|
</view>
|
|
26
|
-
<view v-
|
|
27
|
-
<
|
|
28
|
-
v-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
|
|
45
53
|
<view class="row-add" v-if="item.buttons.includes('rowAdd')">
|
|
46
54
|
<wd-button hairline type="info" size="small" icon="add"
|
|
47
55
|
@click="addrow(item.id)">加一条</wd-button>
|
|
48
56
|
</view>
|
|
49
|
-
</view>
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
</view>
|
|
52
59
|
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
</wd-collapse-item>
|
|
62
|
+
</wd-collapse>
|
|
63
|
+
<view class="footer-button">
|
|
64
|
+
<wd-button block @click="handleSubmit" icon="save">保存</wd-button>
|
|
65
|
+
</view>
|
|
58
66
|
</view>
|
|
59
|
-
</view>
|
|
60
67
|
<wd-message-box />
|
|
61
68
|
<wd-popup safe-area-inset-bottom position="right" v-model="showSelectRow" custom-style="width: 100vw;">
|
|
62
69
|
<WSelectTable :sourceId="pointSourceId">
|
|
@@ -73,14 +80,16 @@
|
|
|
73
80
|
</template>
|
|
74
81
|
|
|
75
82
|
<script setup lang="ts">
|
|
83
|
+
import wCard from '../w-card/w-card.vue'
|
|
76
84
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
77
85
|
import WSelectTable from '../w-table/w-selectTable.vue';
|
|
78
|
-
import { onLoad } from '@dcloudio/uni-app'
|
|
79
|
-
import { ref, defineProps, reactive } from 'vue';
|
|
86
|
+
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
|
87
|
+
import { ref, defineProps, reactive, watch } from 'vue';
|
|
80
88
|
import {
|
|
81
89
|
editPageConfig,
|
|
82
90
|
getEnum,
|
|
83
|
-
addPageDataSave
|
|
91
|
+
addPageDataSave,
|
|
92
|
+
getSelectData
|
|
84
93
|
} from '../utils/apis/pageConfig'
|
|
85
94
|
import { useMessage } from 'wot-design-uni'
|
|
86
95
|
import dayjs from 'dayjs/esm/index'
|
|
@@ -95,9 +104,9 @@ const props = defineProps({
|
|
|
95
104
|
type: String,
|
|
96
105
|
default: ''
|
|
97
106
|
},
|
|
98
|
-
code:{
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
code: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ''
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
})
|
|
@@ -112,16 +121,36 @@ const value = ref([])
|
|
|
112
121
|
const Enumcolumn = ref({})
|
|
113
122
|
const showSelectRow = ref(false)
|
|
114
123
|
const pointSourceId = ref('')
|
|
124
|
+
const relationLoading = reactive({})
|
|
125
|
+
const checkboxvalue = ref([])
|
|
126
|
+
const relationID = ref('')
|
|
127
|
+
const selectData = ref({})
|
|
115
128
|
onLoad((option: any) => {
|
|
116
129
|
sourceId.value = props.sourceId || option.sourceId
|
|
117
|
-
code.value = props.code|| option.code
|
|
130
|
+
code.value = props.code || option.code
|
|
118
131
|
getPageConfig()
|
|
119
|
-
|
|
132
|
+
//监听勾选列表页面事件
|
|
133
|
+
uni.$on('getCheckData', function (data: any) {
|
|
134
|
+
checkboxvalue.value = data.checkData
|
|
135
|
+
// 取消监听勾选列表页面事件
|
|
136
|
+
uni.$off('getCheckData')
|
|
137
|
+
})
|
|
120
138
|
|
|
139
|
+
})
|
|
140
|
+
watch(checkboxvalue, (value) => {
|
|
141
|
+
|
|
142
|
+
getSelectDataPxoy(value)
|
|
143
|
+
}, {
|
|
144
|
+
immediate: false,
|
|
145
|
+
deep: true
|
|
146
|
+
})
|
|
147
|
+
onUnload(() => {
|
|
121
148
|
|
|
149
|
+
})
|
|
150
|
+
//获取页面配置
|
|
122
151
|
function getPageConfig() {
|
|
123
152
|
loading.value = true
|
|
124
|
-
editPageConfig(sourceId.value,code.value).then((res: any) => {
|
|
153
|
+
editPageConfig(sourceId.value, code.value).then((res: any) => {
|
|
125
154
|
pageConf.value = res.data.dtmplConfig
|
|
126
155
|
let fieldGroup = {}
|
|
127
156
|
let relation = {}
|
|
@@ -129,20 +158,23 @@ function getPageConfig() {
|
|
|
129
158
|
value.value.push(item.id)
|
|
130
159
|
if (item.type === 'relation') {
|
|
131
160
|
let t = []
|
|
132
|
-
|
|
161
|
+
t = res.data.dtmplConfig.entity?.arrayMap[item.id]?.map((item: any) => item.code)
|
|
133
162
|
relation[item.id] = t
|
|
163
|
+
relationLoading[item.id] = false
|
|
164
|
+
selectData.value[item.id] = res.data.dtmplConfig.entity?.arrayMap[item.id] || []
|
|
134
165
|
}
|
|
135
166
|
if (item.type === 'fieldGroup') {
|
|
136
167
|
item.fields.forEach((subItem: any) => {
|
|
137
168
|
fieldGroup[subItem.id] = res.data.dtmplConfig.entity?.fieldMap[subItem.id] || ''
|
|
138
169
|
})
|
|
139
|
-
fieldGroup['唯一编码']=res.data.dtmplConfig.entity?.code
|
|
170
|
+
fieldGroup['唯一编码'] = res.data.dtmplConfig.entity?.code
|
|
140
171
|
}
|
|
141
172
|
|
|
142
173
|
})
|
|
143
174
|
model.value = {
|
|
144
175
|
...relation,
|
|
145
|
-
...fieldGroup
|
|
176
|
+
...fieldGroup,//一般为基本信息
|
|
177
|
+
唯一编码: res.data.dtmplConfig.entity?.code
|
|
146
178
|
}
|
|
147
179
|
getEnumer()
|
|
148
180
|
loading.value = false
|
|
@@ -164,7 +196,24 @@ async function getEnumer() {
|
|
|
164
196
|
Enumcolumn.value = res.data?.enumMap || {}
|
|
165
197
|
}
|
|
166
198
|
|
|
199
|
+
//获取勾选数据
|
|
200
|
+
async function getSelectDataPxoy(values: string[]) {
|
|
201
|
+
if (values.length === 0) return model.value[relationID.value]=[]
|
|
202
|
+
//获取勾选数据
|
|
203
|
+
let codes = ''
|
|
204
|
+
values.forEach((item: any) => {
|
|
205
|
+
codes += `codes=${item}&`
|
|
206
|
+
})
|
|
167
207
|
|
|
208
|
+
relationLoading[relationID.value] = true
|
|
209
|
+
if (!relationID.value) return
|
|
210
|
+
const res = await getSelectData(relationID.value, codes)
|
|
211
|
+
selectData.value[relationID.value] = res.data.entities
|
|
212
|
+
model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
|
|
213
|
+
return item.code
|
|
214
|
+
})
|
|
215
|
+
relationLoading[relationID.value] = false
|
|
216
|
+
}
|
|
168
217
|
//保存
|
|
169
218
|
async function handleSubmit() {
|
|
170
219
|
form.value[0]
|
|
@@ -175,21 +224,41 @@ async function handleSubmit() {
|
|
|
175
224
|
message: '保存中...',
|
|
176
225
|
duration: 0
|
|
177
226
|
})
|
|
178
|
-
|
|
227
|
+
let data = {}
|
|
228
|
+
pageConf.value.groups?.forEach((item: any) => {
|
|
229
|
+
if (item.type === 'fieldGroup') {
|
|
230
|
+
item.fields?.forEach((subItem: any) => {
|
|
231
|
+
data[subItem.id] = model.value[subItem.id]
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (item.type === 'relation') {
|
|
236
|
+
data[`${item.id}.$$flag$$`] = true
|
|
237
|
+
model.value[item.id]?.forEach((subItem: any, index: number) => {
|
|
238
|
+
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
239
|
+
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
data['唯一编码'] = model.value['唯一编码']
|
|
179
244
|
try {
|
|
180
|
-
const res = await addPageDataSave(sourceId.value,
|
|
181
|
-
if (res.data.status==='success'){
|
|
245
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
246
|
+
if (res.data.status === 'success') {
|
|
182
247
|
toast.success("保存成功")
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
248
|
+
uni.navigateBack({
|
|
249
|
+
success: () => {
|
|
250
|
+
uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
} else {
|
|
254
|
+
toast.error(res.data.message || '保存失败"')
|
|
186
255
|
}
|
|
187
|
-
|
|
256
|
+
|
|
188
257
|
} catch (error) {
|
|
189
258
|
toast.error(error)
|
|
190
259
|
}
|
|
191
260
|
|
|
192
|
-
|
|
261
|
+
|
|
193
262
|
}
|
|
194
263
|
})
|
|
195
264
|
.catch((error) => {
|
|
@@ -200,10 +269,59 @@ async function handleSubmit() {
|
|
|
200
269
|
|
|
201
270
|
//选择数据
|
|
202
271
|
function selectrow(item: any) {
|
|
272
|
+
relationID.value = item.id
|
|
203
273
|
pointSourceId.value = item.pointSourceId
|
|
204
|
-
|
|
274
|
+
let data = selectData.value[relationID.value]?.map((item) => {
|
|
275
|
+
return item.code
|
|
276
|
+
})
|
|
277
|
+
uni.navigateTo({
|
|
278
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
279
|
+
success: () => {
|
|
280
|
+
uni.$emit('checkeDData', { checkData: data || [] })
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
//删除勾选数据
|
|
286
|
+
const deletItem = (item: any, subitem: any, index: any) => {
|
|
287
|
+
relationID.value = item.id
|
|
288
|
+
selectData.value[item.id].splice(index, 1)
|
|
289
|
+
let data = selectData.value[item.id].map((item: any) => {
|
|
290
|
+
return item.code
|
|
291
|
+
})
|
|
292
|
+
checkboxvalue.value = data || []
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
//点击编辑勾选数据按钮
|
|
296
|
+
const editItem=( item: any, subitem: any, index: any )=>{
|
|
297
|
+
relationID.value = item.id
|
|
298
|
+
//监听编辑页面事件
|
|
299
|
+
uni.$on('editeDataSAC', function (data: any) {
|
|
300
|
+
|
|
301
|
+
checkboxvalue.value=selectData.value[item.id].map((item: any) => {
|
|
302
|
+
return item.code
|
|
303
|
+
})
|
|
304
|
+
// 取消监听编辑页面事件
|
|
305
|
+
uni.$off('editeDataSAC')
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
//新增
|
|
310
|
+
const add = (item: any) => {
|
|
311
|
+
relationID.value = item.id
|
|
312
|
+
//监听添加数据完成事件
|
|
313
|
+
uni.$on('addDataSAC', function (data: any) {
|
|
314
|
+
checkboxvalue.value.push(data.entityCode)
|
|
315
|
+
// 取消监听添加数据完成事件
|
|
316
|
+
uni.$off('addDataSAC')
|
|
317
|
+
})
|
|
318
|
+
//跳转新增页面
|
|
319
|
+
uni.navigateTo({
|
|
320
|
+
url: `/pages/add/add?sourceId=${item.pointSourceId}`,
|
|
321
|
+
})
|
|
205
322
|
}
|
|
206
323
|
|
|
324
|
+
|
|
207
325
|
//新加一行
|
|
208
326
|
function addrow(key: any) {
|
|
209
327
|
|
|
@@ -246,8 +364,14 @@ function remove(key: any, index: any, title: string) {
|
|
|
246
364
|
|
|
247
365
|
.row-add {
|
|
248
366
|
// background-color: #fff;
|
|
249
|
-
|
|
367
|
+
padding: 8px 0;
|
|
250
368
|
display: flex;
|
|
251
369
|
justify-content: center;
|
|
370
|
+
gap: 5px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
:deep(.collapse-custom-class) {
|
|
374
|
+
background-color: #F6F7FB;
|
|
375
|
+
padding: 0.5px 0 !important;
|
|
252
376
|
}
|
|
253
377
|
</style>
|
|
@@ -9,23 +9,26 @@
|
|
|
9
9
|
label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
|
|
10
10
|
:placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
|
|
11
11
|
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :columns="Enumcolumn[subItem.mstrucId]"
|
|
12
|
-
@confirm="(e) => { change(e) }" @clear="clear"/>
|
|
12
|
+
@confirm="(e) => { change(e) }" @clear="clear" />
|
|
13
13
|
<wd-textarea auto-height v-else-if="subItem.extControlType === 'textarea'" :disabled="subItem.disabled"
|
|
14
14
|
:label="subItem.title" label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
|
|
15
15
|
:placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
|
|
16
|
-
:rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
|
|
16
|
+
:rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
|
|
17
|
+
@clear="clear" />
|
|
17
18
|
<wd-input v-else-if="subItem.extControlType === 'decimal' || subItem.extControlType === 'int'"
|
|
18
19
|
:disabled="subItem.disabled" :label="subItem.title" label-width="100px" :prop="subItem.id" clearable
|
|
19
20
|
:modelValue="modelValue" type="number" :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
|
|
20
|
-
:rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
|
|
21
|
+
:rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
|
|
22
|
+
@clear="clear" />
|
|
21
23
|
<wd-calendar v-else-if="subItem.extControlType === 'datetime'" :disabled="subItem.disabled" :label="subItem.title"
|
|
22
24
|
label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue" type="datetime"
|
|
23
25
|
:placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
|
|
24
|
-
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
|
|
26
|
+
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
|
|
27
|
+
@clear="clear" />
|
|
25
28
|
<wSelectPicker @confirm="wSelectPickerconfirm" :prop="subItem.id" v-else-if="subItem.extControlType === 'relselect'"
|
|
26
|
-
:modelValue="modelValue" :disabled="subItem.disabled" :label="subItem.title" type="radio"
|
|
29
|
+
:modelValue="modelValue" :disabled="subItem.disabled" :label="subItem.title" :type="subItem.max===1?'radio':'checkbox'"
|
|
27
30
|
:placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`" :source-id="subItem.sourceId" filterable
|
|
28
|
-
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @clear="clear"/>
|
|
31
|
+
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @clear="clear" />
|
|
29
32
|
<wd-cell v-else-if="subItem.extControlType === 'file'"
|
|
30
33
|
:rules="[{ required: subItem.required, message: `请选择${subItem.title}文件` }]" :title="subItem.title"
|
|
31
34
|
title-width="100px" :prop="subItem.id">
|
|
@@ -34,9 +37,8 @@
|
|
|
34
37
|
:file-list="modelValue" :disabled="subItem.disabled" :action="`${baseUrl}/v3/upload`"
|
|
35
38
|
@success="success"></wd-upload>
|
|
36
39
|
</wd-cell>
|
|
37
|
-
<wd-input v-else :disabled="subItem.disabled" :label="subItem.title"
|
|
38
|
-
|
|
39
|
-
:placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
|
|
40
|
+
<wd-input v-else :disabled="subItem.disabled" :label="subItem.title" label-width="100px" :prop="subItem.id"
|
|
41
|
+
clearable :modelValue="modelValue" :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
|
|
40
42
|
:rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
|
|
41
43
|
@clear="clear" />
|
|
42
44
|
</view>
|
|
@@ -75,7 +77,20 @@ const modelValue = computed(() => {
|
|
|
75
77
|
return props.model[props.subItem.id] ? dayjs(props.model[props.subItem.id]).valueOf() : null
|
|
76
78
|
|
|
77
79
|
case 'relselect':
|
|
78
|
-
|
|
80
|
+
if (props.subItem.max === 1) {
|
|
81
|
+
return props.model[props.subItem.id] ? props.model[props.subItem.id].split('@R@')[0] : ''
|
|
82
|
+
} else {
|
|
83
|
+
if(!props.model[props.subItem.id]) return []
|
|
84
|
+
|
|
85
|
+
let selectArr= props.model[props.subItem.id].split('@,@')
|
|
86
|
+
|
|
87
|
+
let selectArr2= selectArr.map((item:any)=>{
|
|
88
|
+
return item.split('@R@')[0]
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
return selectArr2
|
|
92
|
+
}
|
|
93
|
+
|
|
79
94
|
case 'file':
|
|
80
95
|
return props.model[props.subItem.id] ? JSON.parse(props.model[props.subItem.id]).valid === 'new' ? [{ url: JSON.parse(props.model[props.subItem.id]).base.path }] : [{ url: baseUrl + "/v3/files" + JSON.parse(props.model[props.subItem.id]).base.path }] : []
|
|
81
96
|
|
|
@@ -97,7 +112,11 @@ const success = (e: any) => {
|
|
|
97
112
|
const wSelectPickerconfirm = (e) => {
|
|
98
113
|
console.log(e)
|
|
99
114
|
if (Array.isArray(e.selectedItems)) {
|
|
100
|
-
|
|
115
|
+
let selectArr1= e.selectedItems.map((item:any)=>{
|
|
116
|
+
return `${item.value}@R@${item.label}`
|
|
117
|
+
})
|
|
118
|
+
let selectArr= selectArr1.join('@,@')
|
|
119
|
+
emit('update:modelValue', selectArr)
|
|
101
120
|
} else {
|
|
102
121
|
emit('update:modelValue', `${e.selectedItems.value}@R@${e.selectedItems.label}`)
|
|
103
122
|
}
|
package/w-search/w-search.vue
CHANGED
|
@@ -114,8 +114,11 @@ const search = () => {
|
|
|
114
114
|
data.push(d)
|
|
115
115
|
break;
|
|
116
116
|
case 'entity-select':
|
|
117
|
+
d = `c_${key}=${element.value}@R@${element.label}`
|
|
118
|
+
data.push(d)
|
|
119
|
+
break;
|
|
117
120
|
case 'relselectvalue':
|
|
118
|
-
|
|
121
|
+
|
|
119
122
|
d = `c_${key}=${element.label}`
|
|
120
123
|
data.push(d)
|
|
121
124
|
break;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onLoad } from '@dcloudio/uni-app'
|
|
2
|
+
import { onLoad,onUnload } from '@dcloudio/uni-app'
|
|
3
3
|
import {
|
|
4
4
|
computed,
|
|
5
5
|
ref,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
} from '../utils/apis/pageConfig'
|
|
15
15
|
import wCard from '../w-card/w-card.vue'
|
|
16
|
+
import {getValue} from '../w-card/utils/utils'
|
|
16
17
|
import wSearch from '../w-search/w-search.vue'
|
|
17
18
|
defineOptions({
|
|
18
19
|
name: 'WSelectTable',
|
|
@@ -34,6 +35,15 @@ const pageData = ref<{
|
|
|
34
35
|
onLoad((option: any) => {
|
|
35
36
|
sourceId.value = props.sourceId || option.sourceId
|
|
36
37
|
getPageConfig()
|
|
38
|
+
//监听页
|
|
39
|
+
uni.$on('checkeDData', function (data: any) {
|
|
40
|
+
console.log('checkeDData', data)
|
|
41
|
+
checkboxvalue.value = data.checkData
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
onUnload(()=>{
|
|
46
|
+
uni.$off('checkeDData')
|
|
37
47
|
})
|
|
38
48
|
|
|
39
49
|
watch(() => props.sourceId, (value) => {
|
|
@@ -55,7 +65,7 @@ const checkData = computed(() => {
|
|
|
55
65
|
})
|
|
56
66
|
if(it){
|
|
57
67
|
data.push({
|
|
58
|
-
label:it.fieldMap[pageData.value.primaryColumn.id],
|
|
68
|
+
label:getValue(it.fieldMap[pageData.value.primaryColumn.id]),
|
|
59
69
|
value:it.code
|
|
60
70
|
})
|
|
61
71
|
}
|