w-ui-v1 1.0.29 → 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/w-add/w-add.vue +110 -27
- package/w-card/w-card.vue +21 -6
- package/w-edit/w-edit.vue +110 -38
- 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 @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([])
|
|
@@ -99,19 +113,35 @@ onLoad((option: any) => {
|
|
|
99
113
|
//监听勾选列表页面事件
|
|
100
114
|
uni.$on('getCheckData', function (data: any) {
|
|
101
115
|
checkboxvalue.value = data.checkData
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
//监听添加数据完成事件
|
|
119
|
+
uni.$on('addDataSAC', function (data: any) {
|
|
120
|
+
console.log(data,'addDataSAC')
|
|
121
|
+
checkboxvalue.value.push(data.entityCode)
|
|
108
122
|
})
|
|
109
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
|
+
|
|
110
137
|
onUnload(() => {
|
|
111
138
|
// 取消监听勾选列表页面事件
|
|
112
139
|
uni.$off('getCheckData')
|
|
140
|
+
// 取消监听添加数据完成事件
|
|
141
|
+
uni.$off('addDataSAC')
|
|
113
142
|
})
|
|
114
143
|
|
|
144
|
+
// 获取页面配置
|
|
115
145
|
function getPageConfig() {
|
|
116
146
|
loading.value = true
|
|
117
147
|
addPageConfig(sourceId.value).then((res: any) => {
|
|
@@ -123,12 +153,11 @@ function getPageConfig() {
|
|
|
123
153
|
value.value.push(item.id)
|
|
124
154
|
if (item.type === 'relation') {
|
|
125
155
|
let t = []
|
|
126
|
-
// item.fields.forEach((subItem: any) => {
|
|
127
|
-
// t[0][subItem.id] = subItem.defaultValue || ''
|
|
128
|
-
// })
|
|
129
156
|
relation[item.id] = t
|
|
130
|
-
|
|
157
|
+
relationLoading[item.id] = false
|
|
131
158
|
}
|
|
159
|
+
|
|
160
|
+
|
|
132
161
|
if (item.type === 'fieldGroup') {
|
|
133
162
|
|
|
134
163
|
item.fields.forEach((subItem: any) => {
|
|
@@ -169,6 +198,7 @@ async function getEnumer() {
|
|
|
169
198
|
|
|
170
199
|
//保存
|
|
171
200
|
async function handleSubmit() {
|
|
201
|
+
|
|
172
202
|
form.value[0]
|
|
173
203
|
.validate()
|
|
174
204
|
.then(async ({ valid, errors }) => {
|
|
@@ -177,12 +207,32 @@ async function handleSubmit() {
|
|
|
177
207
|
message: '保存中...',
|
|
178
208
|
duration: 0
|
|
179
209
|
})
|
|
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
|
+
})
|
|
180
226
|
|
|
181
227
|
try {
|
|
182
|
-
const res = await addPageDataSave(sourceId.value,
|
|
228
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
183
229
|
if (res.data.status === 'success') {
|
|
184
230
|
toast.success("保存成功")
|
|
185
|
-
uni.navigateBack(
|
|
231
|
+
uni.navigateBack({
|
|
232
|
+
success: () => {
|
|
233
|
+
uni.$emit('addDataSAC', { entityCode:res.data.entityCode,sourceId:res.data.sourceId })
|
|
234
|
+
}
|
|
235
|
+
})
|
|
186
236
|
} else {
|
|
187
237
|
toast.error(res.data.message || '保存失败"')
|
|
188
238
|
}
|
|
@@ -204,15 +254,42 @@ async function handleSubmit() {
|
|
|
204
254
|
function selectrow(item: any) {
|
|
205
255
|
relationID.value = item.id
|
|
206
256
|
pointSourceId.value = item.pointSourceId
|
|
257
|
+
let data = selectData.value[relationID.value]?.map((item) => {
|
|
258
|
+
return item.code
|
|
259
|
+
})
|
|
207
260
|
uni.navigateTo({
|
|
208
|
-
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}
|
|
261
|
+
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
262
|
+
success: () => {
|
|
263
|
+
uni.$emit('checkeDData', { checkData: data || [] })
|
|
264
|
+
}
|
|
209
265
|
})
|
|
210
266
|
}
|
|
211
267
|
const selectData = ref({})
|
|
212
268
|
//获取勾选数据
|
|
213
269
|
async function getSelectDataPxoy(codes: string) {
|
|
270
|
+
relationLoading[relationID.value] = true
|
|
214
271
|
const res = await getSelectData(relationID.value, codes)
|
|
215
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}`,
|
|
292
|
+
})
|
|
216
293
|
}
|
|
217
294
|
|
|
218
295
|
|
|
@@ -258,8 +335,14 @@ function remove(key: any, index: any, title: string) {
|
|
|
258
335
|
|
|
259
336
|
.row-add {
|
|
260
337
|
// background-color: #fff;
|
|
261
|
-
|
|
338
|
+
padding: 8px 0;
|
|
262
339
|
display: flex;
|
|
263
340
|
justify-content: center;
|
|
341
|
+
gap: 5px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
:deep(.collapse-custom-class) {
|
|
345
|
+
background-color: #F6F7FB;
|
|
346
|
+
padding: 0.5px 0 !important;
|
|
264
347
|
}
|
|
265
348
|
</style>
|
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
|
|
@@ -142,6 +146,13 @@ function goto(type: string, item: any = {}, subItem: string = '') {
|
|
|
142
146
|
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
//删除勾选项
|
|
150
|
+
const delerelation = () => {
|
|
151
|
+
if (props.actionType === 'relation') {
|
|
152
|
+
emits('delet')
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
//删除
|
|
146
157
|
const dele = () => {
|
|
147
158
|
message
|
|
@@ -208,10 +219,10 @@ const actionBtn = (item: any) => {
|
|
|
208
219
|
<wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
|
|
209
220
|
</view>
|
|
210
221
|
|
|
211
|
-
<audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url"
|
|
212
|
-
: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>
|
|
213
224
|
|
|
214
|
-
|
|
225
|
+
<!-- <audio style="width: 50px;" v-else-if="item.controlType==='file'" :src="item.content"
|
|
215
226
|
controls></audio> -->
|
|
216
227
|
|
|
217
228
|
|
|
@@ -235,8 +246,12 @@ const actionBtn = (item: any) => {
|
|
|
235
246
|
@click="goto('edit')">
|
|
236
247
|
编辑
|
|
237
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>
|
|
238
253
|
<wd-button size="small" class="btn" plain type="error" @click="dele"
|
|
239
|
-
v-if="props.page.buttons.includes('singleDelete')">
|
|
254
|
+
v-else-if="props.page.buttons.includes('singleDelete')">
|
|
240
255
|
删除
|
|
241
256
|
</wd-button>
|
|
242
257
|
<view v-if="moreBtns.length > 0">
|
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>
|
|
@@ -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
|
}
|