w-ui-v1 1.0.28 → 1.0.30
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/utils/apis/pageConfig.ts +9 -2
- package/w-add/w-add.vue +167 -66
- package/w-card/utils/utils.ts +1 -1
- package/w-card/w-card.vue +26 -6
- package/w-detail/w-detail.vue +65 -57
- package/w-edit/w-edit.vue +110 -38
- package/w-search/w-search.vue +5 -7
- package/w-table/w-selectTable.vue +83 -26
- package/w-table/w-table.vue +9 -3
package/package.json
CHANGED
package/utils/apis/pageConfig.ts
CHANGED
|
@@ -54,9 +54,9 @@ export function editPageConfig(sourceId: string,code: string) {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
// 获取页面数据key
|
|
57
|
-
export function getPageKey(sourceId: string, query: string='') {
|
|
57
|
+
export function getPageKey(sourceId: string,mainCode:string='', query: string='') {
|
|
58
58
|
return request({
|
|
59
|
-
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&menuId=${sourceId}&${query}`,
|
|
59
|
+
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}&${query}`,
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -102,4 +102,11 @@ export function customButtonSave(sourceId: string,codes:string, data: any) {
|
|
|
102
102
|
...data
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//获取勾选数据
|
|
108
|
+
export function getSelectData(sourceId: string,codes:string) {
|
|
109
|
+
return request({
|
|
110
|
+
url: `/v3/field-group/data/selected?sourceId=${sourceId}&${codes}`,
|
|
111
|
+
})
|
|
105
112
|
}
|
package/w-add/w-add.vue
CHANGED
|
@@ -1,76 +1,81 @@
|
|
|
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 @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
57
|
</view>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</
|
|
55
|
-
</wd-collapse>
|
|
56
|
-
<view class="footer-button">
|
|
57
|
-
<wd-button block @click="handleSubmit" icon="save">保存</wd-button>
|
|
58
|
+
</wd-collapse-item>
|
|
59
|
+
</wd-collapse>
|
|
60
|
+
<view class="footer-button">
|
|
61
|
+
<wd-button block @click="handleSubmit" icon="save">保存</wd-button>
|
|
62
|
+
</view>
|
|
58
63
|
</view>
|
|
59
|
-
</view>
|
|
60
64
|
<wd-message-box />
|
|
61
65
|
<wd-toast />
|
|
62
66
|
</view>
|
|
63
67
|
</template>
|
|
64
68
|
|
|
65
69
|
<script setup lang="ts">
|
|
70
|
+
import wCard from '../w-card/w-card.vue'
|
|
66
71
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
67
|
-
import
|
|
68
|
-
import {
|
|
69
|
-
import { ref, defineProps, reactive } from 'vue';
|
|
72
|
+
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
|
73
|
+
import { ref, defineProps, reactive, watch } from 'vue';
|
|
70
74
|
import {
|
|
71
75
|
addPageConfig,
|
|
72
76
|
getEnum,
|
|
73
|
-
addPageDataSave
|
|
77
|
+
addPageDataSave,
|
|
78
|
+
getSelectData
|
|
74
79
|
} from '../utils/apis/pageConfig'
|
|
75
80
|
import { useMessage } from 'wot-design-uni'
|
|
76
81
|
import { useToast } from 'wot-design-uni'
|
|
@@ -91,9 +96,12 @@ const pageConf = ref({ groups: [] })
|
|
|
91
96
|
const form = ref()//基本数据表单
|
|
92
97
|
//表单数据
|
|
93
98
|
const model = ref({})
|
|
94
|
-
const
|
|
95
|
-
|
|
99
|
+
const relationID = ref('')
|
|
100
|
+
const modelsRef = {
|
|
101
|
+
|
|
96
102
|
}
|
|
103
|
+
const relationLoading = reactive({})
|
|
104
|
+
const checkboxvalue = ref([])
|
|
97
105
|
const loading = ref(false)
|
|
98
106
|
const value = ref([])
|
|
99
107
|
const Enumcolumn = ref({})
|
|
@@ -101,8 +109,39 @@ const pointSourceId = ref('')
|
|
|
101
109
|
onLoad((option: any) => {
|
|
102
110
|
sourceId.value = props.sourceId || option.sourceId
|
|
103
111
|
getPageConfig()
|
|
112
|
+
|
|
113
|
+
//监听勾选列表页面事件
|
|
114
|
+
uni.$on('getCheckData', function (data: any) {
|
|
115
|
+
checkboxvalue.value = data.checkData
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
//监听添加数据完成事件
|
|
119
|
+
uni.$on('addDataSAC', function (data: any) {
|
|
120
|
+
console.log(data,'addDataSAC')
|
|
121
|
+
checkboxvalue.value.push(data.entityCode)
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
watch(checkboxvalue, (value) => {
|
|
126
|
+
if (value.length === 0) return
|
|
127
|
+
//获取勾选数据
|
|
128
|
+
let codes = ''
|
|
129
|
+
value.forEach((item: any) => {
|
|
130
|
+
codes += `codes=${item}&`
|
|
131
|
+
})
|
|
132
|
+
getSelectDataPxoy(codes)
|
|
133
|
+
}, {
|
|
134
|
+
immediate: false
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
onUnload(() => {
|
|
138
|
+
// 取消监听勾选列表页面事件
|
|
139
|
+
uni.$off('getCheckData')
|
|
140
|
+
// 取消监听添加数据完成事件
|
|
141
|
+
uni.$off('addDataSAC')
|
|
104
142
|
})
|
|
105
143
|
|
|
144
|
+
// 获取页面配置
|
|
106
145
|
function getPageConfig() {
|
|
107
146
|
loading.value = true
|
|
108
147
|
addPageConfig(sourceId.value).then((res: any) => {
|
|
@@ -114,11 +153,11 @@ function getPageConfig() {
|
|
|
114
153
|
value.value.push(item.id)
|
|
115
154
|
if (item.type === 'relation') {
|
|
116
155
|
let t = []
|
|
117
|
-
// item.fields.forEach((subItem: any) => {
|
|
118
|
-
// t[0][subItem.id] = subItem.defaultValue || ''
|
|
119
|
-
// })
|
|
120
156
|
relation[item.id] = t
|
|
157
|
+
relationLoading[item.id] = false
|
|
121
158
|
}
|
|
159
|
+
|
|
160
|
+
|
|
122
161
|
if (item.type === 'fieldGroup') {
|
|
123
162
|
|
|
124
163
|
item.fields.forEach((subItem: any) => {
|
|
@@ -159,6 +198,7 @@ async function getEnumer() {
|
|
|
159
198
|
|
|
160
199
|
//保存
|
|
161
200
|
async function handleSubmit() {
|
|
201
|
+
|
|
162
202
|
form.value[0]
|
|
163
203
|
.validate()
|
|
164
204
|
.then(async ({ valid, errors }) => {
|
|
@@ -167,21 +207,41 @@ async function handleSubmit() {
|
|
|
167
207
|
message: '保存中...',
|
|
168
208
|
duration: 0
|
|
169
209
|
})
|
|
170
|
-
|
|
210
|
+
let data = {}
|
|
211
|
+
pageConf.value.groups?.forEach((item: any) => {
|
|
212
|
+
if (item.type === 'fieldGroup') {
|
|
213
|
+
item.fields?.forEach((subItem: any) => {
|
|
214
|
+
data[subItem.id] = model.value[subItem.id]
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (item.type === 'relation') {
|
|
219
|
+
data[`${item.id}.$$flag$$`] = true
|
|
220
|
+
model.value[item.id]?.forEach((subItem: any, index: number) => {
|
|
221
|
+
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
222
|
+
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
171
227
|
try {
|
|
172
|
-
const res = await addPageDataSave(sourceId.value,
|
|
173
|
-
if (res.data.status==='success'){
|
|
228
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
229
|
+
if (res.data.status === 'success') {
|
|
174
230
|
toast.success("保存成功")
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
231
|
+
uni.navigateBack({
|
|
232
|
+
success: () => {
|
|
233
|
+
uni.$emit('addDataSAC', { entityCode:res.data.entityCode,sourceId:res.data.sourceId })
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
} else {
|
|
237
|
+
toast.error(res.data.message || '保存失败"')
|
|
178
238
|
}
|
|
179
|
-
|
|
239
|
+
|
|
180
240
|
} catch (error) {
|
|
181
241
|
toast.error(error)
|
|
182
242
|
}
|
|
183
243
|
|
|
184
|
-
|
|
244
|
+
|
|
185
245
|
}
|
|
186
246
|
})
|
|
187
247
|
.catch((error) => {
|
|
@@ -190,14 +250,49 @@ async function handleSubmit() {
|
|
|
190
250
|
|
|
191
251
|
}
|
|
192
252
|
|
|
193
|
-
|
|
253
|
+
//跳转勾选页面数据
|
|
194
254
|
function selectrow(item: any) {
|
|
255
|
+
relationID.value = item.id
|
|
195
256
|
pointSourceId.value = item.pointSourceId
|
|
257
|
+
let data = selectData.value[relationID.value]?.map((item) => {
|
|
258
|
+
return item.code
|
|
259
|
+
})
|
|
196
260
|
uni.navigateTo({
|
|
197
|
-
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}
|
|
261
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
262
|
+
success: () => {
|
|
263
|
+
uni.$emit('checkeDData', { checkData: data || [] })
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
const selectData = ref({})
|
|
268
|
+
//获取勾选数据
|
|
269
|
+
async function getSelectDataPxoy(codes: string) {
|
|
270
|
+
relationLoading[relationID.value] = true
|
|
271
|
+
const res = await getSelectData(relationID.value, codes)
|
|
272
|
+
selectData.value[relationID.value] = res.data.entities
|
|
273
|
+
model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
|
|
274
|
+
return item.code
|
|
275
|
+
})
|
|
276
|
+
relationLoading[relationID.value] = false
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
//删除勾选数据
|
|
280
|
+
const deletItem = (item: any, subitem: any, index: any) => {
|
|
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 || []
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
//新增
|
|
289
|
+
const add=(item:any)=>{
|
|
290
|
+
uni.navigateTo({
|
|
291
|
+
url: `/pages/add/add?sourceId=${item.pointSourceId}`,
|
|
198
292
|
})
|
|
199
293
|
}
|
|
200
294
|
|
|
295
|
+
|
|
201
296
|
//新加一行
|
|
202
297
|
function addrow(key: any) {
|
|
203
298
|
|
|
@@ -240,8 +335,14 @@ function remove(key: any, index: any, title: string) {
|
|
|
240
335
|
|
|
241
336
|
.row-add {
|
|
242
337
|
// background-color: #fff;
|
|
243
|
-
|
|
338
|
+
padding: 8px 0;
|
|
244
339
|
display: flex;
|
|
245
340
|
justify-content: center;
|
|
341
|
+
gap: 5px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
:deep(.collapse-custom-class) {
|
|
345
|
+
background-color: #F6F7FB;
|
|
346
|
+
padding: 0.5px 0 !important;
|
|
246
347
|
}
|
|
247
348
|
</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'))) {
|
|
50
|
+
if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat'))) {
|
|
51
51
|
|
|
52
52
|
return {
|
|
53
53
|
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
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'])
|
|
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
|
|
@@ -77,6 +81,7 @@ const items = computed(() => {
|
|
|
77
81
|
}).map((item: any) => {
|
|
78
82
|
return {
|
|
79
83
|
title: item.title,
|
|
84
|
+
controlType: item.controlType,
|
|
80
85
|
content: getValue(props.itemData?.fieldMap[item.id], item.title),
|
|
81
86
|
data: props.itemData?.fieldMap[item.id],
|
|
82
87
|
id: item.id,
|
|
@@ -134,13 +139,20 @@ function goto(type: string, item: any = {}, subItem: string = '') {
|
|
|
134
139
|
break
|
|
135
140
|
case 'openPage':
|
|
136
141
|
uni.navigateTo({
|
|
137
|
-
url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}`,
|
|
142
|
+
url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}&mainCode=${props.itemData.code}`,
|
|
138
143
|
})
|
|
139
144
|
break
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
}
|
|
143
148
|
|
|
149
|
+
//删除勾选项
|
|
150
|
+
const delerelation = () => {
|
|
151
|
+
if (props.actionType === 'relation') {
|
|
152
|
+
emits('delet')
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
144
156
|
//删除
|
|
145
157
|
const dele = () => {
|
|
146
158
|
message
|
|
@@ -207,8 +219,12 @@ const actionBtn = (item: any) => {
|
|
|
207
219
|
<wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
|
|
208
220
|
</view>
|
|
209
221
|
|
|
210
|
-
<audio v-else-if="item.content?.type === '音频'" :src="item.content?.url"
|
|
211
|
-
:name="item.content?.name" controls></audio>
|
|
222
|
+
<audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url"
|
|
223
|
+
:author="item.content?.author" :name="item.content?.name" controls></audio>
|
|
224
|
+
|
|
225
|
+
<!-- <audio style="width: 50px;" v-else-if="item.controlType==='file'" :src="item.content"
|
|
226
|
+
controls></audio> -->
|
|
227
|
+
|
|
212
228
|
|
|
213
229
|
<view v-else class="value">
|
|
214
230
|
{{ item.content }}
|
|
@@ -230,8 +246,12 @@ const actionBtn = (item: any) => {
|
|
|
230
246
|
@click="goto('edit')">
|
|
231
247
|
编辑
|
|
232
248
|
</wd-button>
|
|
249
|
+
<wd-button size="small" class="btn" plain type="error" @click="delerelation"
|
|
250
|
+
v-if="props.actionType === 'relation'">
|
|
251
|
+
删除
|
|
252
|
+
</wd-button>
|
|
233
253
|
<wd-button size="small" class="btn" plain type="error" @click="dele"
|
|
234
|
-
v-if="props.page.buttons.includes('singleDelete')">
|
|
254
|
+
v-else-if="props.page.buttons.includes('singleDelete')">
|
|
235
255
|
删除
|
|
236
256
|
</wd-button>
|
|
237
257
|
<view v-if="moreBtns.length > 0">
|
package/w-detail/w-detail.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
<script setup lang="ts">
|
|
10
10
|
import { onLoad } from '@dcloudio/uni-app'
|
|
11
|
-
import { getValue
|
|
11
|
+
import { getValue, downloadFile } from '../w-card/utils/utils'
|
|
12
12
|
import {
|
|
13
13
|
computed,
|
|
14
14
|
ref,
|
|
@@ -73,40 +73,39 @@ function goto(PItem: any, item: any) {
|
|
|
73
73
|
<wd-loading />
|
|
74
74
|
</view>
|
|
75
75
|
<wd-collapse v-model="value" v-else>
|
|
76
|
-
<wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
|
|
77
|
-
|
|
76
|
+
<wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
|
|
77
|
+
v-for="(item, index) in pageConf.groups" :key="index">
|
|
78
|
+
|
|
78
79
|
<wd-card title=" " v-if="item.type === 'fieldGroup'" custom-class="card-custom-class">
|
|
79
80
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<wd-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</wd-col>
|
|
109
|
-
</wd-row>
|
|
81
|
+
<view v-if="!subItem.hidden" class="row">
|
|
82
|
+
|
|
83
|
+
<view class="label">
|
|
84
|
+
{{ subItem.title }}:
|
|
85
|
+
</view>
|
|
86
|
+
|
|
87
|
+
<wd-img v-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
88
|
+
width="100rpx" height="100rpx"
|
|
89
|
+
:src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
|
|
90
|
+
:enable-preview="true" />
|
|
91
|
+
<view
|
|
92
|
+
v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
|
|
93
|
+
class="value">
|
|
94
|
+
<wd-text type="primary"
|
|
95
|
+
@click="downloadFile(getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url)"
|
|
96
|
+
:text="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name" />
|
|
97
|
+
</view>
|
|
98
|
+
<audio
|
|
99
|
+
v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
|
|
100
|
+
:src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
|
|
101
|
+
:author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
|
|
102
|
+
:name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
|
|
103
|
+
controls></audio>
|
|
104
|
+
<view v-else class="value">
|
|
105
|
+
{{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
|
|
106
|
+
</view>
|
|
107
|
+
|
|
108
|
+
</view>
|
|
110
109
|
</view>
|
|
111
110
|
|
|
112
111
|
<template #footer>
|
|
@@ -114,17 +113,17 @@ function goto(PItem: any, item: any) {
|
|
|
114
113
|
v-if="item.buttons.includes('detail')">详情</wd-button>
|
|
115
114
|
</template>
|
|
116
115
|
</wd-card>
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
<view v-if="item.type === 'relation'">
|
|
119
|
-
<wd-card custom-class="card-custom-class" title=" "
|
|
118
|
+
<wd-card custom-class="card-custom-class-relation" title=" "
|
|
119
|
+
v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
|
|
120
120
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
|
|
121
|
-
<
|
|
122
|
-
|
|
121
|
+
<view v-if="!subItem.hidden" class="row">
|
|
122
|
+
|
|
123
123
|
<view class="label">
|
|
124
124
|
{{ subItem.title }}:
|
|
125
125
|
</view>
|
|
126
|
-
|
|
127
|
-
<wd-col :span="18">
|
|
126
|
+
|
|
128
127
|
<wd-img
|
|
129
128
|
v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
130
129
|
width="100rpx" height="100rpx"
|
|
@@ -146,8 +145,8 @@ function goto(PItem: any, item: any) {
|
|
|
146
145
|
<view v-else class="value">
|
|
147
146
|
{{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
|
|
148
147
|
</view>
|
|
149
|
-
|
|
150
|
-
</
|
|
148
|
+
|
|
149
|
+
</view>
|
|
151
150
|
</view>
|
|
152
151
|
|
|
153
152
|
<template #footer>
|
|
@@ -164,24 +163,33 @@ function goto(PItem: any, item: any) {
|
|
|
164
163
|
</template>
|
|
165
164
|
|
|
166
165
|
<style scoped lang="scss">
|
|
167
|
-
.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
.row {
|
|
167
|
+
display: flex;
|
|
168
|
+
|
|
169
|
+
.label {
|
|
170
|
+
//文字换行
|
|
171
|
+
white-space: normal;
|
|
172
|
+
word-break: break-all;
|
|
173
|
+
margin-right: 20rpx;
|
|
174
|
+
}
|
|
172
175
|
|
|
173
|
-
.value {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
.value {
|
|
177
|
+
//文字换行
|
|
178
|
+
white-space: normal;
|
|
179
|
+
word-break: break-all;
|
|
180
|
+
color: #333;
|
|
181
|
+
}
|
|
178
182
|
}
|
|
179
183
|
|
|
180
|
-
|
|
184
|
+
|
|
185
|
+
:deep(.card-custom-class) {
|
|
181
186
|
margin: 0 !important;
|
|
182
187
|
}
|
|
188
|
+
:deep(.card-custom-class-relation){
|
|
189
|
+
margin: 0 0 8px 0 !important;
|
|
190
|
+
}
|
|
183
191
|
|
|
184
|
-
:deep(.collapse-custom-class){
|
|
185
|
-
background-color
|
|
192
|
+
:deep(.collapse-custom-class) {
|
|
193
|
+
background-color: #F6F7FB;
|
|
186
194
|
}
|
|
187
195
|
</style>
|
package/w-edit/w-edit.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,7 +13,7 @@
|
|
|
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" v-for="(item, index) in pageConf.groups" :key="index">
|
|
16
|
+
<wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
|
|
9
17
|
<view
|
|
10
18
|
v-if="item.type === 'fieldGroup'">
|
|
11
19
|
<wd-form ref="form" :model="model">
|
|
@@ -17,36 +25,33 @@
|
|
|
17
25
|
|
|
18
26
|
</view>
|
|
19
27
|
<view v-if="item.type === 'relation'">
|
|
20
|
-
<view
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
<view class="row-add">
|
|
29
|
+
<wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
|
|
30
|
+
icon="add" @click="selectrow(item)">选择</wd-button>
|
|
31
|
+
<wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
|
|
32
|
+
icon="add" @click="addrow(item.id)">新增</wd-button>
|
|
24
33
|
</view>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</template>
|
|
44
|
-
</wd-card>
|
|
34
|
+
|
|
35
|
+
<view v-if="relationLoading[item.id]"
|
|
36
|
+
style="height: 100px;display: flex;justify-content: center;align-items: center;">
|
|
37
|
+
<wd-loading />
|
|
38
|
+
</view>
|
|
39
|
+
|
|
40
|
+
<!-- 卡片 -->
|
|
41
|
+
<view v-else class="card-list">
|
|
42
|
+
<w-card v-for="(subitem, index) in selectData[item.id]" :key="index" :car-index="index"
|
|
43
|
+
:page="{
|
|
44
|
+
rowActions: item.rowActions || [],
|
|
45
|
+
buttons: item.buttons || [],
|
|
46
|
+
ractions: item.ractions || [],
|
|
47
|
+
columns: item.fields || []
|
|
48
|
+
}" :item-data="subitem" :source-id="item.pointSourceId" />
|
|
49
|
+
</view>
|
|
50
|
+
|
|
45
51
|
<view class="row-add" v-if="item.buttons.includes('rowAdd')">
|
|
46
52
|
<wd-button hairline type="info" size="small" icon="add"
|
|
47
53
|
@click="addrow(item.id)">加一条</wd-button>
|
|
48
54
|
</view>
|
|
49
|
-
</view>
|
|
50
55
|
|
|
51
56
|
</view>
|
|
52
57
|
|
|
@@ -73,14 +78,16 @@
|
|
|
73
78
|
</template>
|
|
74
79
|
|
|
75
80
|
<script setup lang="ts">
|
|
81
|
+
import wCard from '../w-card/w-card.vue'
|
|
76
82
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
77
83
|
import WSelectTable from '../w-table/w-selectTable.vue';
|
|
78
|
-
import { onLoad } from '@dcloudio/uni-app'
|
|
79
|
-
import { ref, defineProps, reactive } from 'vue';
|
|
84
|
+
import { onLoad ,onUnload} from '@dcloudio/uni-app'
|
|
85
|
+
import { ref, defineProps, reactive ,watch} from 'vue';
|
|
80
86
|
import {
|
|
81
87
|
editPageConfig,
|
|
82
88
|
getEnum,
|
|
83
|
-
addPageDataSave
|
|
89
|
+
addPageDataSave,
|
|
90
|
+
getSelectData
|
|
84
91
|
} from '../utils/apis/pageConfig'
|
|
85
92
|
import { useMessage } from 'wot-design-uni'
|
|
86
93
|
import dayjs from 'dayjs/esm/index'
|
|
@@ -112,13 +119,35 @@ const value = ref([])
|
|
|
112
119
|
const Enumcolumn = ref({})
|
|
113
120
|
const showSelectRow = ref(false)
|
|
114
121
|
const pointSourceId = ref('')
|
|
122
|
+
const relationLoading = reactive({})
|
|
123
|
+
const checkboxvalue = ref([])
|
|
124
|
+
const relationID = ref('')
|
|
125
|
+
const selectData = ref({})
|
|
115
126
|
onLoad((option: any) => {
|
|
116
127
|
sourceId.value = props.sourceId || option.sourceId
|
|
117
128
|
code.value = props.code|| option.code
|
|
118
129
|
getPageConfig()
|
|
130
|
+
//监听勾选列表页面事件
|
|
131
|
+
uni.$on('getCheckData', function (data: any) {
|
|
132
|
+
checkboxvalue.value = data.checkData
|
|
133
|
+
})
|
|
119
134
|
})
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
watch(checkboxvalue, (value) => {
|
|
136
|
+
if (value.length === 0) return
|
|
137
|
+
//获取勾选数据
|
|
138
|
+
let codes = ''
|
|
139
|
+
value.forEach((item: any) => {
|
|
140
|
+
codes += `codes=${item}&`
|
|
141
|
+
})
|
|
142
|
+
getSelectDataPxoy(codes)
|
|
143
|
+
}, {
|
|
144
|
+
immediate: false
|
|
145
|
+
})
|
|
146
|
+
onUnload(() => {
|
|
147
|
+
// 取消监听勾选列表页面事件
|
|
148
|
+
uni.$off('getCheckData')
|
|
149
|
+
})
|
|
150
|
+
//获取页面配置
|
|
122
151
|
function getPageConfig() {
|
|
123
152
|
loading.value = true
|
|
124
153
|
editPageConfig(sourceId.value,code.value).then((res: any) => {
|
|
@@ -129,8 +158,10 @@ 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) => {
|
|
@@ -142,7 +173,8 @@ function getPageConfig() {
|
|
|
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,16 @@ async function getEnumer() {
|
|
|
164
196
|
Enumcolumn.value = res.data?.enumMap || {}
|
|
165
197
|
}
|
|
166
198
|
|
|
167
|
-
|
|
199
|
+
//获取勾选数据
|
|
200
|
+
async function getSelectDataPxoy(codes: string) {
|
|
201
|
+
relationLoading[relationID.value] = true
|
|
202
|
+
const res = await getSelectData(relationID.value, codes)
|
|
203
|
+
selectData.value[relationID.value] = res.data.entities
|
|
204
|
+
model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
|
|
205
|
+
return item.code
|
|
206
|
+
})
|
|
207
|
+
relationLoading[relationID.value] = false
|
|
208
|
+
}
|
|
168
209
|
//保存
|
|
169
210
|
async function handleSubmit() {
|
|
170
211
|
form.value[0]
|
|
@@ -175,9 +216,25 @@ async function handleSubmit() {
|
|
|
175
216
|
message: '保存中...',
|
|
176
217
|
duration: 0
|
|
177
218
|
})
|
|
178
|
-
|
|
219
|
+
let data = {}
|
|
220
|
+
pageConf.value.groups?.forEach((item: any) => {
|
|
221
|
+
if (item.type === 'fieldGroup') {
|
|
222
|
+
item.fields?.forEach((subItem: any) => {
|
|
223
|
+
data[subItem.id] = model.value[subItem.id]
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (item.type === 'relation') {
|
|
228
|
+
data[`${item.id}.$$flag$$`] = true
|
|
229
|
+
model.value[item.id]?.forEach((subItem: any, index: number) => {
|
|
230
|
+
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
231
|
+
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
data['唯一编码']=model.value['唯一编码']
|
|
179
236
|
try {
|
|
180
|
-
const res = await addPageDataSave(sourceId.value,
|
|
237
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
181
238
|
if (res.data.status==='success'){
|
|
182
239
|
toast.success("保存成功")
|
|
183
240
|
uni.navigateBack()
|
|
@@ -200,8 +257,17 @@ async function handleSubmit() {
|
|
|
200
257
|
|
|
201
258
|
//选择数据
|
|
202
259
|
function selectrow(item: any) {
|
|
260
|
+
relationID.value = item.id
|
|
203
261
|
pointSourceId.value = item.pointSourceId
|
|
204
|
-
|
|
262
|
+
let data=selectData.value[relationID.value]?.map((item)=>{
|
|
263
|
+
return item.code
|
|
264
|
+
})
|
|
265
|
+
uni.navigateTo({
|
|
266
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
267
|
+
success: () => {
|
|
268
|
+
uni.$emit('checkeDData', { checkData: data||[] })
|
|
269
|
+
}
|
|
270
|
+
})
|
|
205
271
|
}
|
|
206
272
|
|
|
207
273
|
//新加一行
|
|
@@ -246,8 +312,14 @@ function remove(key: any, index: any, title: string) {
|
|
|
246
312
|
|
|
247
313
|
.row-add {
|
|
248
314
|
// background-color: #fff;
|
|
249
|
-
|
|
315
|
+
padding: 8px 0;
|
|
250
316
|
display: flex;
|
|
251
317
|
justify-content: center;
|
|
318
|
+
gap: 5px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:deep(.collapse-custom-class) {
|
|
322
|
+
background-color: #F6F7FB;
|
|
323
|
+
padding: 0.5px 0 !important;
|
|
252
324
|
}
|
|
253
325
|
</style>
|
package/w-search/w-search.vue
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<wd-drop-menu-item ref="dropMenu" title="搜索" @opened="handleOpened">
|
|
10
10
|
<view v-for="(item, index) in props.criterias" :key="index">
|
|
11
11
|
<wSelectPicker :model-value="searchData[item.sourceId] ? searchData[item.sourceId].value : ''"
|
|
12
|
-
v-if="item.extControlType === 'relselectvalue'" type="radio"
|
|
12
|
+
v-if="item.extControlType === 'relselectvalue' || item.extControlType === 'entity-select'" type="radio"
|
|
13
13
|
@confirm="(e) => { searchData[item.sourceId] = e.selectedItems }" :label="item.title"
|
|
14
14
|
:placeholder="`请选择${item.title}`" :source-id="item.sourceId" filterable />
|
|
15
15
|
<wd-input v-else-if="item.extControlType === 'text'" type="text" :label="item.title"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
:label="item.title" v-model="searchData[item.sourceId]" clearable />
|
|
29
29
|
</view>
|
|
30
30
|
|
|
31
|
-
<wd-input v-else type="text" :label="item.title"
|
|
32
|
-
|
|
31
|
+
<wd-input v-else type="text" :label="item.title" v-model="searchData[item.sourceId]"
|
|
32
|
+
:placeholder="`请输入${item.title}`" clearable />
|
|
33
33
|
</view>
|
|
34
34
|
<view class="search-btn">
|
|
35
35
|
<wd-button size="small" icon="refresh" @click="clear" type="info">重置</wd-button>
|
|
@@ -76,9 +76,6 @@ onBeforeMount(() => {
|
|
|
76
76
|
case 'daterange':
|
|
77
77
|
data[`${item.sourceId}`] = []
|
|
78
78
|
break;
|
|
79
|
-
case 'relselectvalue':
|
|
80
|
-
data[`${item.sourceId}`] = ''
|
|
81
|
-
break;
|
|
82
79
|
default:
|
|
83
80
|
data[`${item.sourceId}`] = ''
|
|
84
81
|
}
|
|
@@ -116,6 +113,7 @@ const search = () => {
|
|
|
116
113
|
d = `c_${key}=${dayjs(element).format('YYYY-MM-DD HH')}`
|
|
117
114
|
data.push(d)
|
|
118
115
|
break;
|
|
116
|
+
case 'entity-select':
|
|
119
117
|
case 'relselectvalue':
|
|
120
118
|
console.log(element)
|
|
121
119
|
d = `c_${key}=${element.label}`
|
|
@@ -149,7 +147,7 @@ const clear = () => {
|
|
|
149
147
|
async function getEnumer() {
|
|
150
148
|
let params = []
|
|
151
149
|
props.criterias.forEach((item: any) => {
|
|
152
|
-
if (item.
|
|
150
|
+
if (item.extControlType === 'select') {
|
|
153
151
|
params.push(`mstrucIds=${item.mstrucId}`)
|
|
154
152
|
}
|
|
155
153
|
|
|
@@ -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',
|
|
@@ -26,6 +27,7 @@ const props = defineProps({
|
|
|
26
27
|
const query = ref('')
|
|
27
28
|
const sourceId = ref('')
|
|
28
29
|
const radiovalue = ref()
|
|
30
|
+
const checkboxvalue = ref([])
|
|
29
31
|
const pageData = ref<{
|
|
30
32
|
criterias: []
|
|
31
33
|
buttons: string[]
|
|
@@ -33,6 +35,15 @@ const pageData = ref<{
|
|
|
33
35
|
onLoad((option: any) => {
|
|
34
36
|
sourceId.value = props.sourceId || option.sourceId
|
|
35
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')
|
|
36
47
|
})
|
|
37
48
|
|
|
38
49
|
watch(() => props.sourceId, (value) => {
|
|
@@ -44,6 +55,33 @@ watch(() => props.sourceId, (value) => {
|
|
|
44
55
|
immediate: false
|
|
45
56
|
})
|
|
46
57
|
|
|
58
|
+
//选择的数据
|
|
59
|
+
const checkData = computed(() => {
|
|
60
|
+
let data=[]
|
|
61
|
+
checkboxvalue.value.forEach((item:any)=>{
|
|
62
|
+
let it=dataList.value.find((subitem:any)=>{
|
|
63
|
+
|
|
64
|
+
return subitem.code === item
|
|
65
|
+
})
|
|
66
|
+
if(it){
|
|
67
|
+
data.push({
|
|
68
|
+
label:getValue(it.fieldMap[pageData.value.primaryColumn.id]),
|
|
69
|
+
value:it.code
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
return data
|
|
75
|
+
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
//关闭tag
|
|
79
|
+
function handletagClose(item: any) {
|
|
80
|
+
checkboxvalue.value = checkboxvalue.value.filter((subitem: any) => {
|
|
81
|
+
return subitem !== item.value
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
47
85
|
// 获取页面配置
|
|
48
86
|
function getPageConfig() {
|
|
49
87
|
selectPageConfig(sourceId.value).then((res: any) => {
|
|
@@ -81,10 +119,10 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
81
119
|
const key = await getPageKey(sourceId.value, query.value)// 获取key
|
|
82
120
|
const data = await getPageData(key.data?.key, pageNo, pageSize)// 获取数据
|
|
83
121
|
// const count = await getPageTotal(key.data?.key)// 获取总数
|
|
84
|
-
paging.value.complete(data.data.entities)
|
|
122
|
+
paging.value.complete && paging.value.complete(data.data.entities)
|
|
85
123
|
}
|
|
86
124
|
catch (error) {
|
|
87
|
-
paging.value.complete(false)
|
|
125
|
+
paging.value.complete && paging.value.complete(false)
|
|
88
126
|
console.error(error)
|
|
89
127
|
}
|
|
90
128
|
}
|
|
@@ -95,18 +133,18 @@ function add() {
|
|
|
95
133
|
url: `/pages/add/add?sourceId=${sourceId.value}`,
|
|
96
134
|
})
|
|
97
135
|
}
|
|
136
|
+
|
|
98
137
|
// 点击确定按钮
|
|
99
138
|
function SubmitHanld() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
uni.setStorageSync('selectItem', item)
|
|
139
|
+
uni.navigateBack({
|
|
140
|
+
success:()=>{
|
|
141
|
+
uni.$emit('getCheckData',{checkData: checkboxvalue.value})
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//点击取消按钮
|
|
147
|
+
function handleCansle() {
|
|
110
148
|
uni.navigateBack()
|
|
111
149
|
}
|
|
112
150
|
|
|
@@ -124,25 +162,32 @@ function SubmitHanld() {
|
|
|
124
162
|
<wd-button v-if="pageData.buttons.includes('dtmplAdd')" type="icon" icon="add" @click="add" />
|
|
125
163
|
</view>
|
|
126
164
|
<view class="button-container">
|
|
127
|
-
<wd-button type="info" size="small"
|
|
128
|
-
<wd-button size="small" @click="SubmitHanld">确定</wd-button>
|
|
165
|
+
<wd-button type="info" size="small" @click="handleCansle">取消</wd-button>
|
|
166
|
+
<wd-button size="small" @click="SubmitHanld" >确定</wd-button>
|
|
129
167
|
</view>
|
|
130
168
|
</view>
|
|
131
|
-
|
|
169
|
+
<!-- 选择的数据 -->
|
|
170
|
+
<view class="select-container">
|
|
171
|
+
<wd-tag @close="handletagClose(item)" closable round type="primary" v-for="(item, index) in checkData" :key="index">{{ item.label }}</wd-tag>
|
|
172
|
+
</view>
|
|
132
173
|
</template>
|
|
133
174
|
<!-- 卡片 -->
|
|
134
|
-
<view
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
175
|
+
<view class="card-container">
|
|
176
|
+
<!-- 复选框 -->
|
|
177
|
+
<wd-checkbox-group v-model="checkboxvalue">
|
|
178
|
+
<view v-for="(item, index) in dataList" :key="index">
|
|
179
|
+
<view >
|
|
180
|
+
<view style="padding:10px 0 0 30px;">
|
|
181
|
+
<wd-checkbox :modelValue="item.code"></wd-checkbox>
|
|
182
|
+
</view>
|
|
183
|
+
<w-card style="background: none;" :car-index="index" :page="pageData" :item-data="item"
|
|
184
|
+
:source-id="sourceId" />
|
|
185
|
+
</view>
|
|
140
186
|
</view>
|
|
141
|
-
|
|
142
|
-
</view>
|
|
143
|
-
|
|
187
|
+
</wd-checkbox-group>
|
|
144
188
|
</view>
|
|
145
189
|
|
|
190
|
+
|
|
146
191
|
</z-paging>
|
|
147
192
|
</template>
|
|
148
193
|
|
|
@@ -153,9 +198,21 @@ function SubmitHanld() {
|
|
|
153
198
|
justify-content: space-between;
|
|
154
199
|
background-color: #fff;
|
|
155
200
|
padding: 10px;
|
|
156
|
-
|
|
201
|
+
|
|
202
|
+
.button-container {
|
|
157
203
|
display: flex;
|
|
158
204
|
gap: 10px;
|
|
159
205
|
}
|
|
160
206
|
}
|
|
207
|
+
.select-container{
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-wrap: wrap;
|
|
210
|
+
gap: 5px;
|
|
211
|
+
padding:0 10px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.card-container {
|
|
215
|
+
padding:10px;
|
|
216
|
+
background-color: #F6F7FB;
|
|
217
|
+
}
|
|
161
218
|
</style>
|
package/w-table/w-table.vue
CHANGED
|
@@ -21,16 +21,22 @@ const props = defineProps({
|
|
|
21
21
|
sourceId: {
|
|
22
22
|
type: String,
|
|
23
23
|
default: ''
|
|
24
|
+
},
|
|
25
|
+
mainCode:{
|
|
26
|
+
type: String,
|
|
27
|
+
default: ''
|
|
24
28
|
}
|
|
25
29
|
})
|
|
26
30
|
const query = ref('')
|
|
27
31
|
const sourceId = ref('')
|
|
32
|
+
const mainCode = ref('')
|
|
28
33
|
const pageData = ref<{
|
|
29
34
|
criterias: []
|
|
30
35
|
buttons: string[]
|
|
31
36
|
}>({ criterias: [], buttons: [] })
|
|
32
37
|
onLoad((option: any) => {
|
|
33
38
|
sourceId.value = props.sourceId || option.sourceId
|
|
39
|
+
mainCode.value = props.mainCode ||option.mainCode
|
|
34
40
|
uni.setNavigationBarTitle({ title: option.pageTitle })
|
|
35
41
|
|
|
36
42
|
})
|
|
@@ -81,13 +87,13 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
81
87
|
// })
|
|
82
88
|
try {
|
|
83
89
|
|
|
84
|
-
const key = await getPageKey(sourceId.value, query.value)// 获取key
|
|
90
|
+
const key = await getPageKey(sourceId.value, mainCode.value,query.value)// 获取key
|
|
85
91
|
const data = await getPageData(key.data?.key, pageNo, pageSize)// 获取数据
|
|
86
92
|
// const count = await getPageTotal(key.data?.key)// 获取总数
|
|
87
|
-
paging.value.complete(data.data.entities)
|
|
93
|
+
paging.value.complete&&paging.value.complete(data.data.entities)
|
|
88
94
|
}
|
|
89
95
|
catch (error) {
|
|
90
|
-
paging.value&&paging.value.complete(false)
|
|
96
|
+
paging.value.complete&&paging.value&&paging.value.complete(false)
|
|
91
97
|
console.error(error)
|
|
92
98
|
}
|
|
93
99
|
}
|