vue2-client 1.2.94 → 1.2.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/CHANGELOG.md +3 -1
- package/package.json +1 -1
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +9 -4
- package/src/base-client/components/common/Upload/Upload.vue +152 -151
- package/src/base-client/components/common/XForm/XFormItem.vue +11 -7
- package/src/config/CreateQueryConfig.js +5 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
</a-col>
|
|
183
183
|
<a-col v-if="item.formType" :span="9">
|
|
184
184
|
<a-card :bodyStyle="bodyStyle" title="扩展属性">
|
|
185
|
-
<template v-if="(dataMode.addOrEditForm || dataMode.queryForm ) && (item.formType === 'input' || item.formType === 'select' || item.formType === 'selects')">
|
|
185
|
+
<template v-if="(dataMode.addOrEditForm || dataMode.queryForm ) && (item.formType === 'input' || item.formType === 'select' || item.formType === 'selects' || item.formType === 'cascader')">
|
|
186
186
|
<a-divider style="font-size: 14px;margin-top: 0">提示相关</a-divider>
|
|
187
187
|
<a-form-model-item label="表单水印" prop="placeholder">
|
|
188
188
|
<a-input v-model="item.placeholder" placeholder="表单水印(placeholder)" />
|
|
@@ -299,6 +299,11 @@
|
|
|
299
299
|
:min="1"
|
|
300
300
|
/>
|
|
301
301
|
</a-form-model-item>
|
|
302
|
+
<a-form-model-item label="附件用途" prop="useType">
|
|
303
|
+
<a-select v-model="item.useType" placeholder="指定文件用途,同表单不同用途">
|
|
304
|
+
<a-select-option v-for="userTypeItem in $appdata.getDictionaryList('useType')" :key="userTypeItem.value">{{ userTypeItem.value }}</a-select-option>
|
|
305
|
+
</a-select>
|
|
306
|
+
</a-form-model-item>
|
|
302
307
|
<a-form-model-item label="上传的仓库" prop="resUploadStock">
|
|
303
308
|
<a-select v-model="item.resUploadStock" placeholder="选择文件上传到的仓库" @change="changeStock">
|
|
304
309
|
<a-select-option v-for="stock in stockList" :key="stock.id">{{ stock.f_name }}</a-select-option>
|
|
@@ -325,7 +330,7 @@
|
|
|
325
330
|
style="margin-top: 5px"
|
|
326
331
|
type="error"/>
|
|
327
332
|
<a-alert
|
|
328
|
-
v-if="dataMode.addOrEditForm && !dataMode.sqlQueryItem && item.formType !== 'file' && item.formType !== 'image' && item.formType !== 'personSetting' "
|
|
333
|
+
v-if="dataMode.addOrEditForm && !dataMode.sqlQueryItem && item.formType !== 'file' && item.formType !== 'image' && item.formType !== 'personSetting' && item.formType !== 'cascader' "
|
|
329
334
|
message="错误:如果要生成新增/修改表单项,必须勾选生成SQL查询项"
|
|
330
335
|
show-icon
|
|
331
336
|
style="margin-top: 5px"
|
|
@@ -375,7 +380,7 @@ export default {
|
|
|
375
380
|
computed: {
|
|
376
381
|
// 是否展示数据源相关字段
|
|
377
382
|
selectDataShow () {
|
|
378
|
-
return this.item.formType === 'select' || (this.item.formType === 'selects' && this.item.groupIndexView === '1') || this.item.formType === 'checkbox' || this.item.formType === 'radio'
|
|
383
|
+
return this.item.formType === 'select' || this.item.formType === 'cascader' || (this.item.formType === 'selects' && this.item.groupIndexView === '1') || this.item.formType === 'checkbox' || this.item.formType === 'radio'
|
|
379
384
|
},
|
|
380
385
|
// 作用域插槽是否禁用
|
|
381
386
|
slotTypeDisabled () {
|
|
@@ -587,7 +592,7 @@ export default {
|
|
|
587
592
|
this.$message.error('请至少选择一种数据模式')
|
|
588
593
|
return
|
|
589
594
|
}
|
|
590
|
-
if (!fileBool && (this.dataMode.addOrEditForm && !this.dataMode.sqlQueryItem) && this.item.formType !== 'personSetting') {
|
|
595
|
+
if (!fileBool && (this.dataMode.addOrEditForm && !this.dataMode.sqlQueryItem) && this.item.formType !== 'personSetting' && this.item.formType !== 'cascader') {
|
|
591
596
|
this.$message.error('如果要生成新增/修改表单项,必须勾选生成SQL查询项')
|
|
592
597
|
return
|
|
593
598
|
}
|
|
@@ -1,151 +1,152 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-upload-dragger
|
|
4
|
-
v-if="model.type === 'file'"
|
|
5
|
-
name="file"
|
|
6
|
-
:multiple="true"
|
|
7
|
-
:accept="model.accept.join('')"
|
|
8
|
-
:remove="deleteFileItem"
|
|
9
|
-
:customRequest="uploadFiles"
|
|
10
|
-
:file-list="uploadedFileList">
|
|
11
|
-
<p class="ant-upload-drag-icon">
|
|
12
|
-
<a-icon type="inbox"/>
|
|
13
|
-
</p>
|
|
14
|
-
<p class="ant-upload-text">
|
|
15
|
-
点击或拖动文件到该区域上传
|
|
16
|
-
</p>
|
|
17
|
-
<p class="ant-upload-hint">
|
|
18
|
-
支持单个或多个文件
|
|
19
|
-
</p>
|
|
20
|
-
</a-upload-dragger>
|
|
21
|
-
<a-upload
|
|
22
|
-
v-if=" model.type === 'image'"
|
|
23
|
-
list-type="picture-card"
|
|
24
|
-
:accept="model.accept.join('')"
|
|
25
|
-
:customRequest="uploadFiles"
|
|
26
|
-
:remove="deleteFileItem"
|
|
27
|
-
:file-list="uploadedFileList">
|
|
28
|
-
<a-icon type="plus"/>
|
|
29
|
-
<div class="ant-upload-text">
|
|
30
|
-
Upload
|
|
31
|
-
</div>
|
|
32
|
-
</a-upload>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
|
|
38
|
-
import { post } from '@vue2-client/services/api'
|
|
39
|
-
import { mapState } from 'vuex'
|
|
40
|
-
|
|
41
|
-
export default {
|
|
42
|
-
name: 'uploads',
|
|
43
|
-
data () {
|
|
44
|
-
return {
|
|
45
|
-
uploadedFileList: [],
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
props: {
|
|
49
|
-
// 表单属性
|
|
50
|
-
model: {
|
|
51
|
-
type: Object,
|
|
52
|
-
default: () => {
|
|
53
|
-
return {}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
files: {
|
|
57
|
-
type: Array,
|
|
58
|
-
default: () => {
|
|
59
|
-
return []
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
images: {
|
|
63
|
-
type: Array,
|
|
64
|
-
default: () => {
|
|
65
|
-
return []
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
computed: {
|
|
70
|
-
...mapState('account', { currUser: 'user' })
|
|
71
|
-
},
|
|
72
|
-
created () {
|
|
73
|
-
this.uploadedFileList = this.model.type === 'file' ? [...this.files] : [...this.images]
|
|
74
|
-
},
|
|
75
|
-
methods: {
|
|
76
|
-
uploadFiles (info) {
|
|
77
|
-
if (this.uploadedFileList.length >= this.model.acceptCount) {
|
|
78
|
-
this.$message.error(`当前表单限制仅可上传 ${this.model.acceptCount} 个文件`)
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
// 初始化文件信息
|
|
82
|
-
const fileInfo = {
|
|
83
|
-
uid: info.file.uid,
|
|
84
|
-
name: info.file.name,
|
|
85
|
-
status: 'uploading',
|
|
86
|
-
response: '',
|
|
87
|
-
url: '',
|
|
88
|
-
}
|
|
89
|
-
// 放入上传列表中,以便于显示上传进度
|
|
90
|
-
this.uploadedFileList.push(fileInfo)
|
|
91
|
-
// 组装上传数据
|
|
92
|
-
const headers = {
|
|
93
|
-
'Content-Type': 'multipart/form-data',
|
|
94
|
-
}
|
|
95
|
-
// TODO 暂时给默认值 基础表单调整好后处理
|
|
96
|
-
const formData = new FormData()
|
|
97
|
-
formData.append('avatar', info.file)
|
|
98
|
-
formData.append('resUploadMode', this.model.resUploadMode ?? 'server')
|
|
99
|
-
if (this.model.pathKey) {
|
|
100
|
-
formData.append('pathKey', this.model.pathKey ?? 'Default')
|
|
101
|
-
}
|
|
102
|
-
// formData.append('stockAlias', this.model.stockAlias)
|
|
103
|
-
formData.append('formType', this.model.type)
|
|
104
|
-
formData.append('
|
|
105
|
-
formData.append('
|
|
106
|
-
formData.append('
|
|
107
|
-
formData.append('
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
// }
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
fileInfo.
|
|
118
|
-
fileInfo.
|
|
119
|
-
fileInfo.
|
|
120
|
-
|
|
121
|
-
this.$
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
fileInfo.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
fileInfo.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}).
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-upload-dragger
|
|
4
|
+
v-if="model.type === 'file'"
|
|
5
|
+
name="file"
|
|
6
|
+
:multiple="true"
|
|
7
|
+
:accept="model.accept.join('')"
|
|
8
|
+
:remove="deleteFileItem"
|
|
9
|
+
:customRequest="uploadFiles"
|
|
10
|
+
:file-list="uploadedFileList">
|
|
11
|
+
<p class="ant-upload-drag-icon">
|
|
12
|
+
<a-icon type="inbox"/>
|
|
13
|
+
</p>
|
|
14
|
+
<p class="ant-upload-text">
|
|
15
|
+
点击或拖动文件到该区域上传
|
|
16
|
+
</p>
|
|
17
|
+
<p class="ant-upload-hint">
|
|
18
|
+
支持单个或多个文件
|
|
19
|
+
</p>
|
|
20
|
+
</a-upload-dragger>
|
|
21
|
+
<a-upload
|
|
22
|
+
v-if=" model.type === 'image'"
|
|
23
|
+
list-type="picture-card"
|
|
24
|
+
:accept="model.accept.join('')"
|
|
25
|
+
:customRequest="uploadFiles"
|
|
26
|
+
:remove="deleteFileItem"
|
|
27
|
+
:file-list="uploadedFileList">
|
|
28
|
+
<a-icon type="plus"/>
|
|
29
|
+
<div class="ant-upload-text">
|
|
30
|
+
Upload
|
|
31
|
+
</div>
|
|
32
|
+
</a-upload>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
|
|
38
|
+
import { post } from '@vue2-client/services/api'
|
|
39
|
+
import { mapState } from 'vuex'
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: 'uploads',
|
|
43
|
+
data () {
|
|
44
|
+
return {
|
|
45
|
+
uploadedFileList: [],
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
// 表单属性
|
|
50
|
+
model: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return {}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
files: {
|
|
57
|
+
type: Array,
|
|
58
|
+
default: () => {
|
|
59
|
+
return []
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
images: {
|
|
63
|
+
type: Array,
|
|
64
|
+
default: () => {
|
|
65
|
+
return []
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
...mapState('account', { currUser: 'user' })
|
|
71
|
+
},
|
|
72
|
+
created () {
|
|
73
|
+
this.uploadedFileList = this.model.type === 'file' ? [...this.files] : [...this.images]
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
uploadFiles (info) {
|
|
77
|
+
if (this.uploadedFileList.length >= this.model.acceptCount) {
|
|
78
|
+
this.$message.error(`当前表单限制仅可上传 ${this.model.acceptCount} 个文件`)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
// 初始化文件信息
|
|
82
|
+
const fileInfo = {
|
|
83
|
+
uid: info.file.uid,
|
|
84
|
+
name: info.file.name,
|
|
85
|
+
status: 'uploading',
|
|
86
|
+
response: '',
|
|
87
|
+
url: '',
|
|
88
|
+
}
|
|
89
|
+
// 放入上传列表中,以便于显示上传进度
|
|
90
|
+
this.uploadedFileList.push(fileInfo)
|
|
91
|
+
// 组装上传数据
|
|
92
|
+
const headers = {
|
|
93
|
+
'Content-Type': 'multipart/form-data',
|
|
94
|
+
}
|
|
95
|
+
// TODO 暂时给默认值 基础表单调整好后处理
|
|
96
|
+
const formData = new FormData()
|
|
97
|
+
formData.append('avatar', info.file)
|
|
98
|
+
formData.append('resUploadMode', this.model.resUploadMode ?? 'server')
|
|
99
|
+
if (this.model.pathKey) {
|
|
100
|
+
formData.append('pathKey', this.model.pathKey ?? 'Default')
|
|
101
|
+
}
|
|
102
|
+
// formData.append('stockAlias', this.model.stockAlias)
|
|
103
|
+
formData.append('formType', this.model.type)
|
|
104
|
+
formData.append('useType', this.model.useType ?? 'Default')
|
|
105
|
+
formData.append('resUploadStock', this.model.resUploadStock)
|
|
106
|
+
formData.append('filename', info.file.name)
|
|
107
|
+
formData.append('filesize', (info.file.size / 1024 / 1024).toFixed(4))
|
|
108
|
+
formData.append('f_operator', this.currUser ? this.currUser.username : '')
|
|
109
|
+
|
|
110
|
+
// const url = '/webmeteruploadapi/resource'
|
|
111
|
+
// if (process.env.NODE_ENV === 'production') {
|
|
112
|
+
// url = `/${this.model.stockAlias}/webmeteruploadapi/resource`
|
|
113
|
+
// }
|
|
114
|
+
post('/webmeterresourceapi/upload', formData, { headers }).then(res => {
|
|
115
|
+
// 根据服务端返回的结果判断成功与否,设置文件条目的状态
|
|
116
|
+
if (res.success) {
|
|
117
|
+
fileInfo.status = 'done'
|
|
118
|
+
fileInfo.response = JSON.parse(res.data)
|
|
119
|
+
fileInfo.id = JSON.parse(res.data).id
|
|
120
|
+
fileInfo.url = JSON.parse(res.data).f_downloadpath
|
|
121
|
+
this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
|
|
122
|
+
this.$message.success('上传成功!')
|
|
123
|
+
} else {
|
|
124
|
+
fileInfo.status = 'error'
|
|
125
|
+
fileInfo.response = res.data
|
|
126
|
+
this.$message.error('上传失败!')
|
|
127
|
+
}
|
|
128
|
+
}).catch((e) => {
|
|
129
|
+
fileInfo.status = 'error'
|
|
130
|
+
fileInfo.response = e
|
|
131
|
+
this.$message.error(`请求失败!${e}`)
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
// 删除文件
|
|
135
|
+
deleteFileItem (file) {
|
|
136
|
+
if (file.id) {
|
|
137
|
+
post('/rs/entity/t_files', { id: file.id, f_state: '删除' }).then(res => {
|
|
138
|
+
}).catch(e => { })
|
|
139
|
+
}
|
|
140
|
+
// 找到当前文件所在列表的索引
|
|
141
|
+
const index = this.uploadedFileList.indexOf(file)
|
|
142
|
+
// 从列表中移除该文件
|
|
143
|
+
this.uploadedFileList.splice(index, 1)
|
|
144
|
+
this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
|
|
145
|
+
return true
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
<style lang="less" scoped>
|
|
151
|
+
|
|
152
|
+
</style>
|
|
@@ -170,12 +170,13 @@
|
|
|
170
170
|
:xl="xl"
|
|
171
171
|
:xxl="xxl">
|
|
172
172
|
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
<a-cascader
|
|
174
|
+
:disabled="disabled"
|
|
175
|
+
change-on-select
|
|
176
|
+
:options="option"
|
|
177
|
+
v-model="form[attr.model]"
|
|
178
|
+
:placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
|
|
179
|
+
:rows="4"/>
|
|
179
180
|
</a-form-model-item>
|
|
180
181
|
</x-form-col>
|
|
181
182
|
<!-- 文本域 -->
|
|
@@ -323,7 +324,10 @@ export default {
|
|
|
323
324
|
},
|
|
324
325
|
// 文件框时设置上传组件的值
|
|
325
326
|
setFiles (fileIds) {
|
|
326
|
-
this.form[this.attr.model]
|
|
327
|
+
if (!this.form[this.attr.model]) {
|
|
328
|
+
this.form[this.attr.model] = []
|
|
329
|
+
}
|
|
330
|
+
this.form[this.attr.model] = [...this.form[this.attr.model], ...fileIds]
|
|
327
331
|
},
|
|
328
332
|
// 懒加载检索方法
|
|
329
333
|
fetchFunction (value) {
|
|
@@ -38,6 +38,9 @@ module.exports = {
|
|
|
38
38
|
{
|
|
39
39
|
label: '级联选择框', key: 'selects'
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
label: 'cascader选择框', key: 'cascader'
|
|
43
|
+
},
|
|
41
44
|
{
|
|
42
45
|
label: '多选框', key: 'checkbox'
|
|
43
46
|
},
|
|
@@ -288,12 +291,12 @@ module.exports = {
|
|
|
288
291
|
{
|
|
289
292
|
label: '字典键',
|
|
290
293
|
key: 'key',
|
|
291
|
-
noMatch: ['selects']
|
|
294
|
+
noMatch: ['selects', 'cascader']
|
|
292
295
|
},
|
|
293
296
|
{
|
|
294
297
|
label: '固定集合',
|
|
295
298
|
key: 'fixArray',
|
|
296
|
-
noMatch: ['selects']
|
|
299
|
+
noMatch: ['selects', 'cascader']
|
|
297
300
|
},
|
|
298
301
|
{
|
|
299
302
|
label: '业务逻辑',
|