w-ui-v1 1.0.30 → 1.0.32
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/index.ts +3 -1
- package/package.json +1 -1
- package/w-add/w-add.vue +45 -25
- package/w-audio/w-audio.vue +207 -0
- package/w-card/utils/utils.ts +111 -80
- package/w-card/w-card.vue +50 -24
- package/w-detail/w-detail.vue +112 -37
- package/w-edit/w-edit.vue +106 -54
- package/w-form-control/w-form-control.vue +30 -11
- package/w-search/w-search.vue +4 -1
package/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import WUser from './w-user/w-user.vue'
|
|
|
12
12
|
import wEdit from './w-edit/w-edit.vue'
|
|
13
13
|
import wSelectTable from './w-table/w-selectTable.vue'
|
|
14
14
|
import WFormMessageBox from './w-form-message-box/w-form-message-box.vue'
|
|
15
|
+
import WAudio from './w-audio/w-audio.vue'
|
|
15
16
|
const coms: any[] = [
|
|
16
17
|
wTest,
|
|
17
18
|
wLogin,
|
|
@@ -25,7 +26,8 @@ const coms: any[] = [
|
|
|
25
26
|
WUser,
|
|
26
27
|
wEdit,
|
|
27
28
|
wSelectTable,
|
|
28
|
-
WFormMessageBox
|
|
29
|
+
WFormMessageBox,
|
|
30
|
+
WAudio
|
|
29
31
|
]
|
|
30
32
|
// 批量组件注册
|
|
31
33
|
function install(Vue: App) {
|
package/package.json
CHANGED
package/w-add/w-add.vue
CHANGED
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
|
|
41
41
|
<!-- 卡片 -->
|
|
42
42
|
<view v-else class="card-list">
|
|
43
|
-
<w-card @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
|
|
43
|
+
<w-card @edit="()=>{editItem(item, subitem, subindex)}" @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
|
|
44
44
|
v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
|
|
45
45
|
:page="{
|
|
46
46
|
rowActions: item.rowActions || [],
|
|
@@ -109,36 +109,21 @@ const pointSourceId = ref('')
|
|
|
109
109
|
onLoad((option: any) => {
|
|
110
110
|
sourceId.value = props.sourceId || option.sourceId
|
|
111
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
112
|
})
|
|
124
113
|
|
|
125
114
|
watch(checkboxvalue, (value) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
let codes = ''
|
|
129
|
-
value.forEach((item: any) => {
|
|
130
|
-
codes += `codes=${item}&`
|
|
131
|
-
})
|
|
132
|
-
getSelectDataPxoy(codes)
|
|
115
|
+
|
|
116
|
+
getSelectDataPxoy(value)
|
|
133
117
|
}, {
|
|
134
|
-
immediate: false
|
|
118
|
+
immediate: false,
|
|
119
|
+
deep: true
|
|
120
|
+
|
|
135
121
|
})
|
|
136
122
|
|
|
137
123
|
onUnload(() => {
|
|
138
124
|
// 取消监听勾选列表页面事件
|
|
139
125
|
uni.$off('getCheckData')
|
|
140
|
-
|
|
141
|
-
uni.$off('addDataSAC')
|
|
126
|
+
|
|
142
127
|
})
|
|
143
128
|
|
|
144
129
|
// 获取页面配置
|
|
@@ -230,7 +215,7 @@ async function handleSubmit() {
|
|
|
230
215
|
toast.success("保存成功")
|
|
231
216
|
uni.navigateBack({
|
|
232
217
|
success: () => {
|
|
233
|
-
uni.$emit('addDataSAC', { entityCode:res.data.entityCode,sourceId:res.data.sourceId })
|
|
218
|
+
uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
234
219
|
}
|
|
235
220
|
})
|
|
236
221
|
} else {
|
|
@@ -252,6 +237,10 @@ async function handleSubmit() {
|
|
|
252
237
|
|
|
253
238
|
//跳转勾选页面数据
|
|
254
239
|
function selectrow(item: any) {
|
|
240
|
+
//监听勾选列表页面事件
|
|
241
|
+
uni.$on('getCheckData', function (data: any) {
|
|
242
|
+
checkboxvalue.value = data.checkData
|
|
243
|
+
})
|
|
255
244
|
relationID.value = item.id
|
|
256
245
|
pointSourceId.value = item.pointSourceId
|
|
257
246
|
let data = selectData.value[relationID.value]?.map((item) => {
|
|
@@ -266,8 +255,16 @@ function selectrow(item: any) {
|
|
|
266
255
|
}
|
|
267
256
|
const selectData = ref({})
|
|
268
257
|
//获取勾选数据
|
|
269
|
-
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
|
+
|
|
270
266
|
relationLoading[relationID.value] = true
|
|
267
|
+
if (!relationID.value) return
|
|
271
268
|
const res = await getSelectData(relationID.value, codes)
|
|
272
269
|
selectData.value[relationID.value] = res.data.entities
|
|
273
270
|
model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
|
|
@@ -278,6 +275,7 @@ async function getSelectDataPxoy(codes: string) {
|
|
|
278
275
|
|
|
279
276
|
//删除勾选数据
|
|
280
277
|
const deletItem = (item: any, subitem: any, index: any) => {
|
|
278
|
+
relationID.value = item.id
|
|
281
279
|
selectData.value[item.id].splice(index, 1)
|
|
282
280
|
let data = selectData.value[item.id].map((item: any) => {
|
|
283
281
|
return item.code
|
|
@@ -285,8 +283,30 @@ const deletItem = (item: any, subitem: any, index: any) => {
|
|
|
285
283
|
checkboxvalue.value = data || []
|
|
286
284
|
}
|
|
287
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
|
+
|
|
288
300
|
//新增
|
|
289
|
-
const add=(item:any)=>{
|
|
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
|
+
//跳转新增页面
|
|
290
310
|
uni.navigateTo({
|
|
291
311
|
url: `/pages/add/add?sourceId=${item.pointSourceId}`,
|
|
292
312
|
})
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="mini-audio-player">
|
|
3
|
+
<!-- 播放/暂停按钮 -->
|
|
4
|
+
<button class="mini-play-btn" @click="togglePlay">
|
|
5
|
+
<wd-icon name="pause" size="22px" color="#fff" v-if="isPlaying"></wd-icon>
|
|
6
|
+
<wd-icon name="play" size="22px" color="#fff" v-else></wd-icon>
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<!-- 时间显示 -->
|
|
10
|
+
<text class="time-display">{{ formatTime(currentTime) }}</text>
|
|
11
|
+
|
|
12
|
+
<!-- 迷你进度条 -->
|
|
13
|
+
<view class="mini-progress">
|
|
14
|
+
<view class="mini-progress-bar" :style="{ width: progressPercent + '%' }"></view>
|
|
15
|
+
</view>
|
|
16
|
+
|
|
17
|
+
<!-- 总时间 -->
|
|
18
|
+
<text class="time-display">{{ formatTime(duration) }}</text>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { ref, computed, watch } from 'vue'
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
src: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
autoplay: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const emit = defineEmits(['play', 'pause'])
|
|
37
|
+
|
|
38
|
+
const innerAudioContext = ref(null)
|
|
39
|
+
const isPlaying = ref(false)
|
|
40
|
+
const currentTime = ref(0)
|
|
41
|
+
const duration = ref(0)
|
|
42
|
+
|
|
43
|
+
// 计算进度百分比
|
|
44
|
+
const progressPercent = computed(() => {
|
|
45
|
+
return duration.value > 0 ? (currentTime.value / duration.value) * 100 : 0
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
// 格式化时间显示
|
|
49
|
+
const formatTime = (seconds) => {
|
|
50
|
+
if (isNaN(seconds)) return '00:00'
|
|
51
|
+
const mins = Math.floor(seconds / 60)
|
|
52
|
+
const secs = Math.floor(seconds % 60)
|
|
53
|
+
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 初始化音频
|
|
57
|
+
const initAudio = () => {
|
|
58
|
+
innerAudioContext.value = uni.createInnerAudioContext()
|
|
59
|
+
innerAudioContext.value.src = props.src
|
|
60
|
+
innerAudioContext.value.autoplay = props.autoplay
|
|
61
|
+
|
|
62
|
+
innerAudioContext.value.onPlay(() => {
|
|
63
|
+
isPlaying.value = true
|
|
64
|
+
emit('play')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
innerAudioContext.value.onPause(() => {
|
|
68
|
+
isPlaying.value = false
|
|
69
|
+
emit('pause')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
innerAudioContext.value.onTimeUpdate(() => {
|
|
73
|
+
currentTime.value = innerAudioContext.value.currentTime
|
|
74
|
+
duration.value = innerAudioContext.value.duration
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
innerAudioContext.value.onError((err) => {
|
|
78
|
+
isPlaying.value = false
|
|
79
|
+
console.error('播放错误:', err)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
innerAudioContext.value.onEnded(() => {
|
|
83
|
+
isPlaying.value = false; // 更新状态
|
|
84
|
+
currentTime.value = 0; // 重置进度
|
|
85
|
+
// emit('ended'); // 通知父组件
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// 播放控制
|
|
92
|
+
const play = () => {
|
|
93
|
+
if (!innerAudioContext.value) initAudio()
|
|
94
|
+
innerAudioContext.value.play()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const pause = () => {
|
|
98
|
+
if (innerAudioContext.value) {
|
|
99
|
+
innerAudioContext.value.pause()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const togglePlay = () => {
|
|
104
|
+
isPlaying.value ? pause() : play()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 监听src变化
|
|
108
|
+
watch(() => props.src, (newVal) => {
|
|
109
|
+
if (innerAudioContext.value) {
|
|
110
|
+
innerAudioContext.value.src = newVal
|
|
111
|
+
} else {
|
|
112
|
+
initAudio()
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// 暴露方法
|
|
117
|
+
defineExpose({
|
|
118
|
+
play,
|
|
119
|
+
pause,
|
|
120
|
+
isPlaying
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// 初始化
|
|
124
|
+
initAudio()
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.mini-audio-player {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
height: 36px;
|
|
132
|
+
background-color: #f5f5f5;
|
|
133
|
+
border-radius: 18px;
|
|
134
|
+
padding: 0 5px;
|
|
135
|
+
width: 180px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.mini-play-btn {
|
|
139
|
+
width: 28px;
|
|
140
|
+
height: 28px;
|
|
141
|
+
border-radius: 50%;
|
|
142
|
+
background: #1890ff;
|
|
143
|
+
border: none;
|
|
144
|
+
padding: 0;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
margin-right: 8px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.mini-icon {
|
|
152
|
+
width: 12px;
|
|
153
|
+
height: 12px;
|
|
154
|
+
position: relative;
|
|
155
|
+
margin-left: 1px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.mini-icon::before {
|
|
159
|
+
content: '';
|
|
160
|
+
position: absolute;
|
|
161
|
+
left: 0;
|
|
162
|
+
top: 0;
|
|
163
|
+
border-top: 6px solid transparent;
|
|
164
|
+
border-bottom: 6px solid transparent;
|
|
165
|
+
border-left: 10px solid white;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.mini-icon.playing::before,
|
|
169
|
+
.mini-icon.playing::after {
|
|
170
|
+
content: '';
|
|
171
|
+
position: absolute;
|
|
172
|
+
width: 3px;
|
|
173
|
+
height: 12px;
|
|
174
|
+
background: white;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.mini-icon.playing::before {
|
|
178
|
+
left: 3px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.mini-icon.playing::after {
|
|
182
|
+
left: 8px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.mini-progress {
|
|
186
|
+
flex: 1;
|
|
187
|
+
height: 3px;
|
|
188
|
+
background: #d9d9d9;
|
|
189
|
+
border-radius: 2px;
|
|
190
|
+
overflow: hidden;
|
|
191
|
+
margin: 0 8px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.mini-progress-bar {
|
|
195
|
+
height: 100%;
|
|
196
|
+
background: #1890ff;
|
|
197
|
+
transition: width 0.3s ease;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.time-display {
|
|
201
|
+
font-size: 10px;
|
|
202
|
+
color: #666;
|
|
203
|
+
min-width: 32px;
|
|
204
|
+
text-align: center;
|
|
205
|
+
font-family: monospace;
|
|
206
|
+
}
|
|
207
|
+
</style>
|
package/w-card/utils/utils.ts
CHANGED
|
@@ -3,7 +3,8 @@ const token = uni.getStorageSync('token') || ''
|
|
|
3
3
|
const baseUrl = uni.getStorageSync('baseUrl') || '/'
|
|
4
4
|
// 单项数据转换
|
|
5
5
|
export function getValue(content: any, title: any): any {
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
// 判断title 是否为字符串,是否有 '时间'字符
|
|
7
8
|
if (typeof title === 'string') {
|
|
8
9
|
// 判断title 是否有 '时间'字符
|
|
9
10
|
if (title.includes('时间')) {
|
|
@@ -22,16 +23,6 @@ export function getValue(content: any, title: any): any {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
// 判断是否为数组
|
|
26
|
-
if (Array.isArray(content)) {
|
|
27
|
-
const newArr = content.map((item) => {
|
|
28
|
-
return splitString(item)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// 数组转换为字符串
|
|
32
|
-
return newArr.join(',')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
// 判断是否为JSON字符串
|
|
36
27
|
if (typeof content === 'string' && content.startsWith('{') && content.endsWith('}')) {
|
|
37
28
|
// 解析JSON字符串
|
|
@@ -47,7 +38,7 @@ export function getValue(content: any, title: any): any {
|
|
|
47
38
|
}
|
|
48
39
|
|
|
49
40
|
//文件链接
|
|
50
|
-
if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat'))) {
|
|
41
|
+
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
42
|
|
|
52
43
|
return {
|
|
53
44
|
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
@@ -62,18 +53,33 @@ export function getValue(content: any, title: any): any {
|
|
|
62
53
|
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
63
54
|
name: obj.base.fileName,
|
|
64
55
|
type: '音频',
|
|
65
|
-
author:uni.getStorageSync('userInfo').name
|
|
56
|
+
author: uni.getStorageSync('userInfo').name
|
|
66
57
|
}
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
|
|
70
61
|
}
|
|
71
62
|
|
|
72
|
-
//
|
|
63
|
+
// 判断是否为数组
|
|
64
|
+
if (Array.isArray(content)) {
|
|
65
|
+
|
|
66
|
+
const newArr = content.map((item) => {
|
|
67
|
+
return splitString(item)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
//判断newArr[0] 是否为对象类型
|
|
71
|
+
if (newArr[0] && typeof newArr[0] === 'object') {
|
|
72
|
+
return newArr
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 数组转换为字符串
|
|
76
|
+
return newArr.join(',')
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
return splitString(content)
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
// 根据 "@R@"
|
|
82
|
+
// 根据 "@R@" 分割字符串,取{key,value}/any
|
|
77
83
|
function splitString(str: string) {
|
|
78
84
|
// 判断是否为字符串类型
|
|
79
85
|
if (typeof str !== 'string') {
|
|
@@ -81,21 +87,46 @@ function splitString(str: string) {
|
|
|
81
87
|
return str
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
if (str) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (str.includes('@,@')) {
|
|
91
|
+
let arr = splitStringtoArr(str)
|
|
92
|
+
return arr.map((item: any) => {
|
|
93
|
+
// 判断是否有 "@R@"
|
|
94
|
+
if (item.includes('@R@')) {
|
|
95
|
+
// 分割字符串
|
|
96
|
+
const splitStr = item.split('@R@')
|
|
97
|
+
|
|
98
|
+
return { value: splitStr[0], label: splitStr[1] }
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
|
|
102
|
+
return item
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
|
|
96
106
|
}
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
|
|
108
|
+
// 判断是否有 "@R@"
|
|
109
|
+
if (str.includes('@R@')) {
|
|
110
|
+
// 分割字符串
|
|
111
|
+
const splitStr = str.split('@R@')
|
|
112
|
+
// 返回分割后的字符串
|
|
113
|
+
return { value: splitStr[0], label: splitStr[1] }
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// 返回原字符串
|
|
117
|
+
return str
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 根据 "@,@" 分割字符串,得到数组
|
|
123
|
+
function splitStringtoArr(str: string) {
|
|
124
|
+
|
|
125
|
+
// 分割字符串
|
|
126
|
+
const splitStr = str.split('@,@')
|
|
127
|
+
// 返回分割后的数组
|
|
128
|
+
return splitStr
|
|
129
|
+
|
|
99
130
|
}
|
|
100
131
|
|
|
101
132
|
// 判断字符串中是否存在'y'字符
|
|
@@ -118,55 +149,55 @@ function formatTime(str: string) {
|
|
|
118
149
|
|
|
119
150
|
//下载文件
|
|
120
151
|
export const downloadFile = (url: any) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
152
|
+
uni.downloadFile({
|
|
153
|
+
url: url, // 文件的网络地址
|
|
154
|
+
success: (res) => {
|
|
155
|
+
if (res.statusCode === 200) {
|
|
156
|
+
console.log('下载成功', res.tempFilePath);
|
|
157
|
+
// 打开文件(如PDF、Word等)
|
|
158
|
+
uni.openDocument({
|
|
159
|
+
filePath: res.tempFilePath,
|
|
160
|
+
showMenu: true,
|
|
161
|
+
success: () => console.log('打开文件成功')
|
|
162
|
+
});
|
|
163
|
+
// // 将临时文件保存到本地
|
|
164
|
+
// uni.saveFile({
|
|
165
|
+
// tempFilePath: res.tempFilePath,
|
|
166
|
+
// success: (saveRes) => {
|
|
167
|
+
// console.log('文件保存成功', saveRes.savedFilePath);
|
|
168
|
+
// const savedFilePath = saveRes.savedFilePath; // 保存后的路径
|
|
169
|
+
// // 打开文件(如PDF、Word等)
|
|
170
|
+
// uni.openDocument({
|
|
171
|
+
// filePath: savedFilePath,
|
|
172
|
+
// success: () => console.log('打开文件成功')
|
|
173
|
+
// });
|
|
174
|
+
// uni.showToast({
|
|
175
|
+
// title: '文件保存成功',
|
|
176
|
+
// icon: 'success'
|
|
177
|
+
// });
|
|
178
|
+
// },
|
|
179
|
+
// fail: (saveErr) => {
|
|
180
|
+
// console.error('文件保存失败', saveErr);
|
|
181
|
+
// uni.showToast({
|
|
182
|
+
// title: '文件保存失败',
|
|
183
|
+
// icon: 'none'
|
|
184
|
+
// });
|
|
185
|
+
// }
|
|
186
|
+
// });
|
|
187
|
+
} else {
|
|
188
|
+
console.error('下载失败', res);
|
|
189
|
+
uni.showToast({
|
|
190
|
+
title: '下载失败',
|
|
191
|
+
icon: 'none'
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
fail: (err) => {
|
|
196
|
+
console.error('下载失败', err);
|
|
197
|
+
uni.showToast({
|
|
198
|
+
title: '下载失败',
|
|
199
|
+
icon: 'none'
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
172
203
|
}
|
package/w-card/w-card.vue
CHANGED
|
@@ -9,7 +9,8 @@ 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
|
-
|
|
12
|
+
import WAudio from '../w-audio/w-audio.vue'
|
|
13
|
+
const emits = defineEmits(['refresh', 'delet', 'edit'])
|
|
13
14
|
const toast = useToast()
|
|
14
15
|
const message = useMessage()
|
|
15
16
|
const props = defineProps({
|
|
@@ -110,7 +111,7 @@ function toggleExpand() {
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
// 跳转页页面
|
|
113
|
-
function goto(type: string, item: any = {}, subItem:
|
|
114
|
+
function goto(type: string, item: any = {}, subItem: any = {}) {
|
|
114
115
|
|
|
115
116
|
switch (type) {
|
|
116
117
|
case 'detail':
|
|
@@ -119,20 +120,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
|
|
|
119
120
|
})
|
|
120
121
|
break
|
|
121
122
|
case 'link':
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
data = item.data.find((item: any) => {
|
|
125
|
-
return item.includes(subItem)
|
|
126
|
-
}).split('@R@')[0]
|
|
127
|
-
} else {
|
|
128
|
-
data = item.data.split('@R@')[0]
|
|
129
|
-
}
|
|
123
|
+
let code = subItem.value
|
|
124
|
+
|
|
130
125
|
|
|
131
126
|
uni.navigateTo({
|
|
132
|
-
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${
|
|
127
|
+
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${code}`,
|
|
133
128
|
})
|
|
134
129
|
break
|
|
135
130
|
case 'edit':
|
|
131
|
+
if (props.actionType === 'relation') {
|
|
132
|
+
emits('edit')
|
|
133
|
+
}
|
|
136
134
|
uni.navigateTo({
|
|
137
135
|
url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
|
|
138
136
|
})
|
|
@@ -190,18 +188,38 @@ const moreBtnsSelect = (item: any) => {
|
|
|
190
188
|
const actionBtn = (item: any) => {
|
|
191
189
|
wFormMessageBoxRef.value.openFormMessageBox(item)
|
|
192
190
|
}
|
|
191
|
+
|
|
192
|
+
//格式化title
|
|
193
|
+
const getTitleValue = (value: any, title: string) => {
|
|
194
|
+
let data=getValue(value, title)?.content
|
|
195
|
+
if(!data) return ' '
|
|
196
|
+
// 是否为数组
|
|
197
|
+
if(Array.isArray(data)){
|
|
198
|
+
return getValue(value, title).content.map((item:any)=>{
|
|
199
|
+
return item.label
|
|
200
|
+
}).join(',')
|
|
201
|
+
}
|
|
202
|
+
//是否为对象
|
|
203
|
+
if(typeof data === 'object'){
|
|
204
|
+
return data?.label?data.label:''
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
return data
|
|
208
|
+
}
|
|
193
209
|
</script>
|
|
194
210
|
|
|
195
211
|
<template>
|
|
196
212
|
<wd-card
|
|
197
|
-
:title="
|
|
213
|
+
:title="getTitleValue(visibleItems.find((item) => item.id === page.primaryColumn?.id), page.primaryColumn?.title) || ' '">
|
|
198
214
|
<view class="table_collapse">
|
|
199
215
|
<view v-for="(item, index) in visibleItems" :key="index" class="cloum">
|
|
200
216
|
|
|
217
|
+
<!-- // 标题 -->
|
|
201
218
|
<view class="lable">
|
|
202
219
|
<text>{{ item.title }}:</text>
|
|
203
220
|
</view>
|
|
204
221
|
|
|
222
|
+
<!-- // 图片 -->
|
|
205
223
|
<wd-img v-if="item.content?.type === '图片'" width="100rpx" height="100rpx" :src="item.content.url"
|
|
206
224
|
:enable-preview="true" />
|
|
207
225
|
<view v-else-if="item.title === '序号'">
|
|
@@ -209,25 +227,32 @@ const actionBtn = (item: any) => {
|
|
|
209
227
|
carIndex + 1
|
|
210
228
|
}}
|
|
211
229
|
</view>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
v-for="(subItem, subIndex) in item.content?.split(',')" :key="subIndex">
|
|
215
|
-
<text> {{ subItem }}</text>
|
|
216
|
-
</view>
|
|
217
|
-
</view>
|
|
230
|
+
|
|
231
|
+
<!-- //文件 -->
|
|
218
232
|
<view v-else-if="item.content?.type === '文件'" class="value">
|
|
219
233
|
<wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
|
|
220
234
|
</view>
|
|
221
235
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
236
|
+
<!-- // 音频 -->
|
|
237
|
+
<WAudio v-else-if="item.content?.type === '音频'" :src="item.content?.url" />
|
|
238
|
+
<!-- // 链接 -->
|
|
239
|
+
<view v-else-if="item.buttons.includes('detail')" class="link">
|
|
240
|
+
<view v-if="Array.isArray(item.content)" @click="goto('link', item, subItem)"
|
|
241
|
+
v-for="(subItem, subIndex) in item.content" :key="subIndex">
|
|
242
|
+
<text> {{ subItem.label }}</text>
|
|
243
|
+
</view>
|
|
244
|
+
<view v-else @click="goto('link', item, item.content)">{{ item.content?.label ? item.content?.label :
|
|
245
|
+
item.content }}</view>
|
|
246
|
+
</view>
|
|
227
247
|
|
|
248
|
+
<view v-else-if="Array.isArray(item.content)">
|
|
249
|
+
<view v-for="(subItem, subIndex) in item.content" :key="subIndex">
|
|
250
|
+
<text> {{ subItem.label }}</text>
|
|
251
|
+
</view>
|
|
252
|
+
</view>
|
|
228
253
|
|
|
229
254
|
<view v-else class="value">
|
|
230
|
-
{{ item.content }}
|
|
255
|
+
{{ item.content?.label ? item.content?.label : item.content }}
|
|
231
256
|
</view>
|
|
232
257
|
|
|
233
258
|
</view>
|
|
@@ -287,6 +312,7 @@ const actionBtn = (item: any) => {
|
|
|
287
312
|
padding: 15rpx 10rpx;
|
|
288
313
|
|
|
289
314
|
.lable {
|
|
315
|
+
white-space: nowrap;
|
|
290
316
|
// font-weight: 600;
|
|
291
317
|
text-align: left;
|
|
292
318
|
margin-right: 20rpx;
|
package/w-detail/w-detail.vue
CHANGED
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
}
|
|
8
8
|
</script>
|
|
9
9
|
<script setup lang="ts">
|
|
10
|
+
import WAudio from '../w-audio/w-audio.vue'
|
|
10
11
|
import { onLoad } from '@dcloudio/uni-app'
|
|
11
12
|
import { getValue, downloadFile } from '../w-card/utils/utils'
|
|
12
13
|
import {
|
|
@@ -59,10 +60,23 @@ function getPageData() {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
// 跳转详情页
|
|
62
|
-
function goto(PItem: any, item: any) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
function goto(type = '', PItem: any, item: any) {
|
|
64
|
+
|
|
65
|
+
if (type == 'link') {
|
|
66
|
+
uni.navigateTo({
|
|
67
|
+
url: `/pages/detail/detail?sourceId=${PItem.sourceId}&code=${item.value}`
|
|
68
|
+
})
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (type == 'detail') {
|
|
73
|
+
|
|
74
|
+
uni.navigateTo({
|
|
75
|
+
url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
</script>
|
|
@@ -83,11 +97,12 @@ function goto(PItem: any, item: any) {
|
|
|
83
97
|
<view class="label">
|
|
84
98
|
{{ subItem.title }}:
|
|
85
99
|
</view>
|
|
86
|
-
|
|
100
|
+
<!-- //图片 -->
|
|
87
101
|
<wd-img v-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
88
102
|
width="100rpx" height="100rpx"
|
|
89
103
|
:src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
|
|
90
104
|
:enable-preview="true" />
|
|
105
|
+
<!-- 文件 -->
|
|
91
106
|
<view
|
|
92
107
|
v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
|
|
93
108
|
class="value">
|
|
@@ -95,14 +110,41 @@ function goto(PItem: any, item: any) {
|
|
|
95
110
|
@click="downloadFile(getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url)"
|
|
96
111
|
:text="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name" />
|
|
97
112
|
</view>
|
|
98
|
-
|
|
113
|
+
<!-- //音频 -->
|
|
114
|
+
<WAudio
|
|
99
115
|
v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
|
|
100
|
-
:src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
:src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url" />
|
|
117
|
+
|
|
118
|
+
<!-- //链接 -->
|
|
119
|
+
<view v-else-if="subItem.buttons.includes('detail')" class="link">
|
|
120
|
+
|
|
121
|
+
<view v-if="Array.isArray(getValue(pageData.fieldMap[subItem.sourceId], subItem.title))"
|
|
122
|
+
@click="goto('link', subItem, bItem)"
|
|
123
|
+
v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
|
|
124
|
+
:key="bIndex">
|
|
125
|
+
<text> {{ bItem.label }}</text>
|
|
126
|
+
</view>
|
|
127
|
+
<view v-else
|
|
128
|
+
@click="goto('link', subItem, getValue(pageData.fieldMap[subItem.sourceId], subItem.title))">
|
|
129
|
+
{{
|
|
130
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label ?
|
|
131
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label :
|
|
132
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}</view>
|
|
133
|
+
</view>
|
|
134
|
+
<!-- //数组 -->
|
|
135
|
+
<view
|
|
136
|
+
v-else-if="Array.isArray(getValue(pageData.fieldMap[subItem.sourceId], subItem.title))">
|
|
137
|
+
<view
|
|
138
|
+
v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
|
|
139
|
+
:key="bIndex">
|
|
140
|
+
<text> {{ bItem.label }}</text>
|
|
141
|
+
</view>
|
|
142
|
+
</view>
|
|
104
143
|
<view v-else class="value">
|
|
105
|
-
{{
|
|
144
|
+
{{
|
|
145
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label ?
|
|
146
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label :
|
|
147
|
+
getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
|
|
106
148
|
</view>
|
|
107
149
|
|
|
108
150
|
</view>
|
|
@@ -119,38 +161,66 @@ function goto(PItem: any, item: any) {
|
|
|
119
161
|
v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
|
|
120
162
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
|
|
121
163
|
<view v-if="!subItem.hidden" class="row">
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
164
|
+
|
|
165
|
+
<view class="label">
|
|
166
|
+
{{ subItem.title }}:
|
|
167
|
+
</view>
|
|
168
|
+
|
|
169
|
+
<!-- //图片 -->
|
|
170
|
+
<wd-img v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
171
|
+
width="100rpx" height="100rpx"
|
|
172
|
+
:src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
|
|
173
|
+
:enable-preview="true" />
|
|
174
|
+
<!-- // 文件 -->
|
|
175
|
+
<view
|
|
176
|
+
v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
|
|
177
|
+
class="value">
|
|
178
|
+
<wd-text type="primary"
|
|
179
|
+
@click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)"
|
|
180
|
+
:text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name" />
|
|
181
|
+
</view>
|
|
182
|
+
<!-- // 音频 -->
|
|
183
|
+
<WAudio
|
|
184
|
+
v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
|
|
185
|
+
:src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url" />
|
|
186
|
+
<!-- //链接 -->
|
|
187
|
+
<view v-else-if="subItem.buttons.includes('detail')" class="link">
|
|
132
188
|
<view
|
|
133
|
-
v-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
189
|
+
v-if="Array.isArray(getValue(PItem.fieldMap[subItem.sourceId], subItem.title))"
|
|
190
|
+
@click="goto('link', subItem, bItem)"
|
|
191
|
+
v-for="(bItem, bIndex) in getValue(PItem.fieldMap[subItem.sourceId], subItem.title)"
|
|
192
|
+
:key="bIndex">
|
|
193
|
+
<text> {{ bItem.label }}</text>
|
|
138
194
|
</view>
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
195
|
+
<view v-else
|
|
196
|
+
@click="goto('link', subItem, getValue(PItem.fieldMap[subItem.sourceId], subItem.title))">
|
|
197
|
+
{{
|
|
198
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label ?
|
|
199
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label :
|
|
200
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}</view>
|
|
201
|
+
</view>
|
|
202
|
+
|
|
203
|
+
<!-- //数组 -->
|
|
204
|
+
<view
|
|
205
|
+
v-else-if="Array.isArray(getValue(PItem.fieldMap[subItem.sourceId], subItem.title))">
|
|
206
|
+
<view
|
|
207
|
+
v-for="(bItem, bIndex) in getValue(PItem.fieldMap[subItem.sourceId], subItem.title)"
|
|
208
|
+
:key="bIndex">
|
|
209
|
+
<text> {{ bItem.label }}</text>
|
|
147
210
|
</view>
|
|
148
|
-
|
|
211
|
+
</view>
|
|
212
|
+
<view v-else class="value">
|
|
213
|
+
{{
|
|
214
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label ?
|
|
215
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label :
|
|
216
|
+
getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
|
|
217
|
+
</view>
|
|
218
|
+
|
|
149
219
|
</view>
|
|
150
220
|
</view>
|
|
151
221
|
|
|
152
222
|
<template #footer>
|
|
153
|
-
<wd-button @click="goto(PItem, item)" size="small" icon="view-module" type="text"
|
|
223
|
+
<wd-button @click="goto('detail', PItem, item)" size="small" icon="view-module" type="text"
|
|
154
224
|
v-if="item.buttons.includes('detail')">详情</wd-button>
|
|
155
225
|
</template>
|
|
156
226
|
</wd-card>
|
|
@@ -179,13 +249,18 @@ function goto(PItem: any, item: any) {
|
|
|
179
249
|
word-break: break-all;
|
|
180
250
|
color: #333;
|
|
181
251
|
}
|
|
252
|
+
|
|
253
|
+
.link {
|
|
254
|
+
color: #4d80f0;
|
|
255
|
+
}
|
|
182
256
|
}
|
|
183
257
|
|
|
184
258
|
|
|
185
259
|
:deep(.card-custom-class) {
|
|
186
260
|
margin: 0 !important;
|
|
187
261
|
}
|
|
188
|
-
|
|
262
|
+
|
|
263
|
+
:deep(.card-custom-class-relation) {
|
|
189
264
|
margin: 0 0 8px 0 !important;
|
|
190
265
|
}
|
|
191
266
|
|
package/w-edit/w-edit.vue
CHANGED
|
@@ -12,24 +12,25 @@ export default {
|
|
|
12
12
|
<wd-loading />
|
|
13
13
|
</view>
|
|
14
14
|
<view v-else>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
v-if="item.type === 'fieldGroup'">
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<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
|
+
|
|
27
|
+
</view>
|
|
28
|
+
<view v-if="item.type === 'relation'">
|
|
29
|
+
<view class="row-add">
|
|
29
30
|
<wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
|
|
30
31
|
icon="add" @click="selectrow(item)">选择</wd-button>
|
|
31
32
|
<wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
|
|
32
|
-
icon="add" @click="
|
|
33
|
+
icon="add" @click="add(item)">新增</wd-button>
|
|
33
34
|
</view>
|
|
34
35
|
|
|
35
36
|
<view v-if="relationLoading[item.id]"
|
|
@@ -39,7 +40,8 @@ export default {
|
|
|
39
40
|
|
|
40
41
|
<!-- 卡片 -->
|
|
41
42
|
<view v-else class="card-list">
|
|
42
|
-
<w-card
|
|
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"
|
|
43
45
|
:page="{
|
|
44
46
|
rowActions: item.rowActions || [],
|
|
45
47
|
buttons: item.buttons || [],
|
|
@@ -53,15 +55,15 @@ export default {
|
|
|
53
55
|
@click="addrow(item.id)">加一条</wd-button>
|
|
54
56
|
</view>
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
</view>
|
|
57
59
|
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
</wd-collapse-item>
|
|
62
|
+
</wd-collapse>
|
|
63
|
+
<view class="footer-button">
|
|
64
|
+
<wd-button block @click="handleSubmit" icon="save">保存</wd-button>
|
|
65
|
+
</view>
|
|
63
66
|
</view>
|
|
64
|
-
</view>
|
|
65
67
|
<wd-message-box />
|
|
66
68
|
<wd-popup safe-area-inset-bottom position="right" v-model="showSelectRow" custom-style="width: 100vw;">
|
|
67
69
|
<WSelectTable :sourceId="pointSourceId">
|
|
@@ -81,8 +83,8 @@ export default {
|
|
|
81
83
|
import wCard from '../w-card/w-card.vue'
|
|
82
84
|
import wFromControl from '../w-form-control/w-form-control.vue'
|
|
83
85
|
import WSelectTable from '../w-table/w-selectTable.vue';
|
|
84
|
-
import { onLoad
|
|
85
|
-
import { ref, defineProps, reactive
|
|
86
|
+
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
|
87
|
+
import { ref, defineProps, reactive, watch } from 'vue';
|
|
86
88
|
import {
|
|
87
89
|
editPageConfig,
|
|
88
90
|
getEnum,
|
|
@@ -102,9 +104,9 @@ const props = defineProps({
|
|
|
102
104
|
type: String,
|
|
103
105
|
default: ''
|
|
104
106
|
},
|
|
105
|
-
code:{
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
code: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ''
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
})
|
|
@@ -125,32 +127,30 @@ const relationID = ref('')
|
|
|
125
127
|
const selectData = ref({})
|
|
126
128
|
onLoad((option: any) => {
|
|
127
129
|
sourceId.value = props.sourceId || option.sourceId
|
|
128
|
-
code.value = props.code|| option.code
|
|
130
|
+
code.value = props.code || option.code
|
|
129
131
|
getPageConfig()
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
//监听勾选列表页面事件
|
|
133
|
+
uni.$on('getCheckData', function (data: any) {
|
|
132
134
|
checkboxvalue.value = data.checkData
|
|
135
|
+
// 取消监听勾选列表页面事件
|
|
136
|
+
uni.$off('getCheckData')
|
|
133
137
|
})
|
|
138
|
+
|
|
134
139
|
})
|
|
135
140
|
watch(checkboxvalue, (value) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
let codes = ''
|
|
139
|
-
value.forEach((item: any) => {
|
|
140
|
-
codes += `codes=${item}&`
|
|
141
|
-
})
|
|
142
|
-
getSelectDataPxoy(codes)
|
|
141
|
+
|
|
142
|
+
getSelectDataPxoy(value)
|
|
143
143
|
}, {
|
|
144
|
-
immediate: false
|
|
144
|
+
immediate: false,
|
|
145
|
+
deep: true
|
|
145
146
|
})
|
|
146
147
|
onUnload(() => {
|
|
147
|
-
|
|
148
|
-
uni.$off('getCheckData')
|
|
148
|
+
|
|
149
149
|
})
|
|
150
150
|
//获取页面配置
|
|
151
151
|
function getPageConfig() {
|
|
152
152
|
loading.value = true
|
|
153
|
-
editPageConfig(sourceId.value,code.value).then((res: any) => {
|
|
153
|
+
editPageConfig(sourceId.value, code.value).then((res: any) => {
|
|
154
154
|
pageConf.value = res.data.dtmplConfig
|
|
155
155
|
let fieldGroup = {}
|
|
156
156
|
let relation = {}
|
|
@@ -158,7 +158,7 @@ function getPageConfig() {
|
|
|
158
158
|
value.value.push(item.id)
|
|
159
159
|
if (item.type === 'relation') {
|
|
160
160
|
let t = []
|
|
161
|
-
t=res.data.dtmplConfig.entity?.arrayMap[item.id]?.map((item:any)=>item.code)
|
|
161
|
+
t = res.data.dtmplConfig.entity?.arrayMap[item.id]?.map((item: any) => item.code)
|
|
162
162
|
relation[item.id] = t
|
|
163
163
|
relationLoading[item.id] = false
|
|
164
164
|
selectData.value[item.id] = res.data.dtmplConfig.entity?.arrayMap[item.id] || []
|
|
@@ -167,14 +167,14 @@ function getPageConfig() {
|
|
|
167
167
|
item.fields.forEach((subItem: any) => {
|
|
168
168
|
fieldGroup[subItem.id] = res.data.dtmplConfig.entity?.fieldMap[subItem.id] || ''
|
|
169
169
|
})
|
|
170
|
-
fieldGroup['唯一编码']=res.data.dtmplConfig.entity?.code
|
|
170
|
+
fieldGroup['唯一编码'] = res.data.dtmplConfig.entity?.code
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
})
|
|
174
174
|
model.value = {
|
|
175
175
|
...relation,
|
|
176
176
|
...fieldGroup,//一般为基本信息
|
|
177
|
-
唯一编码:res.data.dtmplConfig.entity?.code
|
|
177
|
+
唯一编码: res.data.dtmplConfig.entity?.code
|
|
178
178
|
}
|
|
179
179
|
getEnumer()
|
|
180
180
|
loading.value = false
|
|
@@ -197,8 +197,16 @@ async function getEnumer() {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
//获取勾选数据
|
|
200
|
-
async function getSelectDataPxoy(
|
|
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
|
+
})
|
|
207
|
+
|
|
201
208
|
relationLoading[relationID.value] = true
|
|
209
|
+
if (!relationID.value) return
|
|
202
210
|
const res = await getSelectData(relationID.value, codes)
|
|
203
211
|
selectData.value[relationID.value] = res.data.entities
|
|
204
212
|
model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
|
|
@@ -232,21 +240,25 @@ async function handleSubmit() {
|
|
|
232
240
|
})
|
|
233
241
|
}
|
|
234
242
|
})
|
|
235
|
-
data['唯一编码']=model.value['唯一编码']
|
|
243
|
+
data['唯一编码'] = model.value['唯一编码']
|
|
236
244
|
try {
|
|
237
245
|
const res = await addPageDataSave(sourceId.value, data)
|
|
238
|
-
if (res.data.status==='success'){
|
|
246
|
+
if (res.data.status === 'success') {
|
|
239
247
|
toast.success("保存成功")
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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 || '保存失败"')
|
|
243
255
|
}
|
|
244
|
-
|
|
256
|
+
|
|
245
257
|
} catch (error) {
|
|
246
258
|
toast.error(error)
|
|
247
259
|
}
|
|
248
260
|
|
|
249
|
-
|
|
261
|
+
|
|
250
262
|
}
|
|
251
263
|
})
|
|
252
264
|
.catch((error) => {
|
|
@@ -259,17 +271,57 @@ async function handleSubmit() {
|
|
|
259
271
|
function selectrow(item: any) {
|
|
260
272
|
relationID.value = item.id
|
|
261
273
|
pointSourceId.value = item.pointSourceId
|
|
262
|
-
let data=selectData.value[relationID.value]?.map((item)=>{
|
|
274
|
+
let data = selectData.value[relationID.value]?.map((item) => {
|
|
263
275
|
return item.code
|
|
264
276
|
})
|
|
265
277
|
uni.navigateTo({
|
|
266
278
|
url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
|
|
267
279
|
success: () => {
|
|
268
|
-
uni.$emit('checkeDData', { checkData: data||[] })
|
|
280
|
+
uni.$emit('checkeDData', { checkData: data || [] })
|
|
269
281
|
}
|
|
270
282
|
})
|
|
271
283
|
}
|
|
272
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
|
+
})
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
|
|
273
325
|
//新加一行
|
|
274
326
|
function addrow(key: any) {
|
|
275
327
|
|
|
@@ -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;
|