three-trees-ui 1.0.95 → 1.0.97
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/LICENSE +21 -21
- package/lib/three-trees-ui.common.js +335 -247
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +335 -247
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +2 -4
- package/packages/OnlineForm/src/Form.vue +99 -1
- package/packages/Preview/src/FrameViewer.vue +5 -11
- package/packages/TemplateForm/src/main.vue +1 -0
- package/src/mixins/onlineSubtable.js +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-trees-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.97",
|
|
4
4
|
"publicPath": "/ui",
|
|
5
5
|
"author": "hotent",
|
|
6
6
|
"private": false,
|
|
@@ -33,9 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"element-resize-detector": "^1.2.3",
|
|
36
|
-
"
|
|
37
|
-
"vee-validate": "2.1.7",
|
|
38
|
-
"viewerjs": "^1.11.7"
|
|
36
|
+
"vee-validate": "2.1.7"
|
|
39
37
|
},
|
|
40
38
|
"peerDependencies": {
|
|
41
39
|
"axios": "^0.21.1",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
import regionValidator from '@/mixins/regionValidator.js'
|
|
33
33
|
import emitter from '@/mixins/emitter.js'
|
|
34
34
|
import mobileMode from '@/mixins/mobileMode.js'
|
|
35
|
+
import { Notification } from 'element-ui'
|
|
36
|
+
import { Notify } from 'vant'
|
|
35
37
|
|
|
36
38
|
import Vue from 'vue'
|
|
37
39
|
export default {
|
|
@@ -80,6 +82,9 @@
|
|
|
80
82
|
type: Boolean,
|
|
81
83
|
default: false,
|
|
82
84
|
},
|
|
85
|
+
formExpand: {
|
|
86
|
+
type: String,
|
|
87
|
+
},
|
|
83
88
|
},
|
|
84
89
|
data() {
|
|
85
90
|
return {
|
|
@@ -129,10 +134,16 @@
|
|
|
129
134
|
} else {
|
|
130
135
|
// 执行校验逻辑
|
|
131
136
|
this.validateRegion(`[name='${this.formName}']`).then(
|
|
132
|
-
(errorItems) => {
|
|
137
|
+
async (errorItems) => {
|
|
133
138
|
if (errorItems.length > 0) {
|
|
134
139
|
reject(errorItems)
|
|
135
140
|
} else {
|
|
141
|
+
// 如果有子表,需要检验子表必填
|
|
142
|
+
let result = await this.validateTable()
|
|
143
|
+
if (result === false) {
|
|
144
|
+
reject(8)
|
|
145
|
+
return
|
|
146
|
+
}
|
|
136
147
|
this.broadcast('HtGlobalValidate', 'global-validate')
|
|
137
148
|
}
|
|
138
149
|
}
|
|
@@ -140,6 +151,93 @@
|
|
|
140
151
|
}
|
|
141
152
|
})
|
|
142
153
|
},
|
|
154
|
+
// 校验子表必填
|
|
155
|
+
validateTable() {
|
|
156
|
+
return new Promise((resolve) => {
|
|
157
|
+
if (!this.formExpand) {
|
|
158
|
+
resolve(true)
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
const expandList = JSON.parse(this.formExpand)
|
|
162
|
+
|
|
163
|
+
if (!expandList.list) {
|
|
164
|
+
resolve(true)
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
const subTableList = expandList.list.filter((it) => {
|
|
168
|
+
return (
|
|
169
|
+
(this.isMobile && it.ctrlType == 'subDiv') ||
|
|
170
|
+
(!this.isMobile && it.ctrlType === 'subtable')
|
|
171
|
+
)
|
|
172
|
+
})
|
|
173
|
+
if (!this.isMobile) {
|
|
174
|
+
// pc端找到 分页的子表 校验
|
|
175
|
+
const havePageSub = subTableList.filter((k) => {
|
|
176
|
+
return k.subtablePagination
|
|
177
|
+
})
|
|
178
|
+
if (!havePageSub.length) {
|
|
179
|
+
resolve(true)
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const mainAlias = Object.keys(this.data)[0]
|
|
184
|
+
const mainData = this.data[mainAlias]
|
|
185
|
+
const errorResult = []
|
|
186
|
+
|
|
187
|
+
Object.keys(mainData).forEach((key) => {
|
|
188
|
+
if (key.startsWith('sub_')) {
|
|
189
|
+
const curSubConfig = subTableList.find((sub) => {
|
|
190
|
+
return sub.name == key.replace('sub_', '')
|
|
191
|
+
})
|
|
192
|
+
const subAlias = key.replace('sub_', '')
|
|
193
|
+
const subPermission = this.permission.fields[subAlias]
|
|
194
|
+
mainData[key].forEach((item, index) => {
|
|
195
|
+
Object.keys(item).forEach((subKey) => {
|
|
196
|
+
if (subPermission[subKey] == 'b' && !item[subKey]) {
|
|
197
|
+
const subItem = curSubConfig.list.find((l) => {
|
|
198
|
+
return l.name === subKey
|
|
199
|
+
})
|
|
200
|
+
let haveIndex = errorResult.findIndex((it) => {
|
|
201
|
+
return (
|
|
202
|
+
it.tableName === curSubConfig.desc &&
|
|
203
|
+
it.fieldName === subItem.desc
|
|
204
|
+
)
|
|
205
|
+
})
|
|
206
|
+
if (haveIndex === -1) {
|
|
207
|
+
errorResult.push({
|
|
208
|
+
tableName: curSubConfig.desc,
|
|
209
|
+
index: index + 1,
|
|
210
|
+
fieldName: subItem.desc,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
if (errorResult.length > 0) {
|
|
219
|
+
const messages = errorResult.map((k) => {
|
|
220
|
+
return `${k.tableName},【${k.fieldName}】必填`
|
|
221
|
+
})
|
|
222
|
+
// 判断是移动端还是pc
|
|
223
|
+
if (utils.isMobile()) {
|
|
224
|
+
Notify({
|
|
225
|
+
message: messages.join('\n'),
|
|
226
|
+
background: '#f25130',
|
|
227
|
+
})
|
|
228
|
+
} else {
|
|
229
|
+
Notification.error({
|
|
230
|
+
title: this.$t('ht.common.warmTips'),
|
|
231
|
+
dangerouslyUseHTMLString: true,
|
|
232
|
+
message: messages.join('<br/>'),
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
resolve(false)
|
|
236
|
+
} else {
|
|
237
|
+
resolve(true)
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
},
|
|
143
241
|
init() {
|
|
144
242
|
this.currentComponent = 'runtimeTemplate_' + this.scopeName
|
|
145
243
|
this.loadStatus = 1
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<loading v-if="loading" />
|
|
5
5
|
<div
|
|
6
6
|
v-else-if="contentType.indexOf('image') > -1"
|
|
7
|
-
v-viewer="{ movable: false }"
|
|
8
7
|
class="frame-viewer__img"
|
|
9
8
|
>
|
|
10
|
-
<
|
|
9
|
+
<el-image
|
|
10
|
+
style="width: 100px; height: 100px"
|
|
11
11
|
:src="dataSrc"
|
|
12
|
-
:
|
|
13
|
-
|
|
12
|
+
:preview-src-list="[dataSrc]"
|
|
13
|
+
></el-image>
|
|
14
14
|
</div>
|
|
15
15
|
<iframe
|
|
16
16
|
v-else
|
|
@@ -31,17 +31,10 @@
|
|
|
31
31
|
import watermark from './watermark'
|
|
32
32
|
import { createObjectURL } from '../../../src/util/brower.js'
|
|
33
33
|
import utils from '../../../src/utils.js'
|
|
34
|
-
import 'viewerjs/dist/viewer.css'
|
|
35
|
-
import { directive as viewer } from 'v-viewer'
|
|
36
34
|
|
|
37
35
|
export default {
|
|
38
36
|
name: 'FrameViewer',
|
|
39
37
|
components: { Loading },
|
|
40
|
-
directives: {
|
|
41
|
-
viewer: viewer({
|
|
42
|
-
debug: true,
|
|
43
|
-
}),
|
|
44
|
-
},
|
|
45
38
|
props: {
|
|
46
39
|
src: {
|
|
47
40
|
type: String,
|
|
@@ -74,6 +67,7 @@
|
|
|
74
67
|
loading: false,
|
|
75
68
|
contentType: '',
|
|
76
69
|
utils,
|
|
70
|
+
srcList: [],
|
|
77
71
|
}
|
|
78
72
|
},
|
|
79
73
|
mounted() {
|
|
@@ -15,6 +15,19 @@ export default {
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
computed: {
|
|
18
|
+
showMobileEdit() {
|
|
19
|
+
return (subName) => {
|
|
20
|
+
if (this.permission && this.permission.fields[subName]) {
|
|
21
|
+
return Object.keys(this.permission.fields[subName]).some((k) => {
|
|
22
|
+
return (
|
|
23
|
+
this.permission.fields[subName][k] == 'b' ||
|
|
24
|
+
this.permission.fields[subName][k] == 'w'
|
|
25
|
+
)
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
18
31
|
// 子表前端分页过滤器
|
|
19
32
|
pagingSubData() {
|
|
20
33
|
const me = this
|