app-form-view 0.0.9 → 0.1.1
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/dist/css/style.css +15 -3
- package/dist/index.js +86 -103
- package/package.json +1 -1
- package/src/api/app-form.js +37 -60
- package/src/api/dict/app-data.js +2 -2
- package/src/app-index.js +3 -0
- package/src/assets/scss/app-form.scss +15 -3
- package/src/components/appForm/Checkbox.vue +1 -1
- package/src/components/appForm/Form.vue +2 -3
- package/src/components/appForm/Radio.vue +1 -1
- package/src/components/appForm/apiPopup.vue +1 -1
- package/src/components/appForm/select.vue +2 -2
- package/src/views/build/viewAppForm.vue +11 -28
package/package.json
CHANGED
package/src/api/app-form.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const BASE = 'sjyy/sjczgl/form/bdgl/config/'
|
|
3
2
|
const API = {
|
|
4
3
|
scene: BASE + 'getFromConfigScene',
|
|
@@ -19,91 +18,69 @@ export const APIOPTIONS = [
|
|
|
19
18
|
{ label: '数据查询应用数据表JSON', url: 'sjyy/zycx/getZycxDataList', fhType: 'json', method: 'post', paramsList: [{ label: '选择模式', name: 'xzms', value: '' }, { label: '数据表ID', name: 'id', value: '' }], xtgllx: 'sjcxyy-table' }
|
|
20
19
|
]
|
|
21
20
|
export const TYPEMAPPINGS = {
|
|
22
|
-
input: {
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
select: {
|
|
35
|
-
widget: 'select',
|
|
36
|
-
},
|
|
37
|
-
date: {
|
|
38
|
-
widget: 'datetime',
|
|
39
|
-
},
|
|
40
|
-
rqsjfw: {
|
|
41
|
-
widget: 'datetimeRange',
|
|
42
|
-
},
|
|
43
|
-
password: {
|
|
44
|
-
widget: 'password',
|
|
45
|
-
},
|
|
46
|
-
number: {
|
|
47
|
-
widget: 'inputNumber'
|
|
48
|
-
},
|
|
49
|
-
upload: {
|
|
50
|
-
widget: 'inputUpload'
|
|
51
|
-
},
|
|
52
|
-
tree_select: {
|
|
53
|
-
widget: 'inputTree'
|
|
54
|
-
}
|
|
21
|
+
input: { widget: 'input' },
|
|
22
|
+
radio: { widget: 'radio' },
|
|
23
|
+
checkbox: { widget: 'checkbox' },
|
|
24
|
+
textarea: { widget: 'textarea' },
|
|
25
|
+
select: { widget: 'select' },
|
|
26
|
+
date: { widget: 'datetime' },
|
|
27
|
+
rqsjfw: { widget: 'datetimeRange' },
|
|
28
|
+
password: { widget: 'password' },
|
|
29
|
+
number: { widget: 'inputNumber' },
|
|
30
|
+
upload: { widget: 'inputUpload' },
|
|
31
|
+
tree_select: { widget: 'inputTree' }
|
|
55
32
|
}
|
|
56
|
-
|
|
57
|
-
export function getFormConfig(data) {
|
|
33
|
+
|
|
34
|
+
export function getFormConfig(request, data) {
|
|
58
35
|
|
|
59
36
|
}
|
|
60
|
-
export function getFormConfigScene(data) {
|
|
61
|
-
return
|
|
37
|
+
export function getFormConfigScene(request, data) {
|
|
38
|
+
return request({
|
|
62
39
|
url: API.scene,
|
|
63
40
|
method: 'post',
|
|
64
41
|
data: data
|
|
65
42
|
})
|
|
66
43
|
}
|
|
67
44
|
|
|
68
|
-
export function saveFormData(data) {
|
|
69
|
-
return
|
|
45
|
+
export function saveFormData(request, data) {
|
|
46
|
+
return request({
|
|
70
47
|
url: data.id !== undefined ? API.editSave : API.addSave,
|
|
71
48
|
method: 'post',
|
|
72
49
|
data: data
|
|
73
50
|
})
|
|
74
51
|
}
|
|
75
|
-
export function getTableData(data) {
|
|
76
|
-
return
|
|
52
|
+
export function getTableData(request, data) {
|
|
53
|
+
return request({
|
|
77
54
|
url: API.getData,
|
|
78
55
|
method: 'post',
|
|
79
56
|
data: data
|
|
80
57
|
})
|
|
81
58
|
}
|
|
82
59
|
|
|
83
|
-
export function getUserInfo() {
|
|
84
|
-
return
|
|
60
|
+
export function getUserInfo(request) {
|
|
61
|
+
return request({
|
|
85
62
|
url: '/sjyy/sjczgl/form/bdgl/config/getDqyh',
|
|
86
63
|
method: 'get'
|
|
87
64
|
})
|
|
88
65
|
}
|
|
89
66
|
|
|
90
|
-
export function getFormData(data) {
|
|
91
|
-
return
|
|
67
|
+
export function getFormData(request, data) {
|
|
68
|
+
return request({
|
|
92
69
|
url: API.view,
|
|
93
70
|
method: 'post',
|
|
94
71
|
data: data
|
|
95
72
|
})
|
|
96
73
|
}
|
|
97
74
|
|
|
98
|
-
export function getSjyyFields(data) {
|
|
99
|
-
return
|
|
75
|
+
export function getSjyyFields(request, data) {
|
|
76
|
+
return request({
|
|
100
77
|
url: API.getSjyyFields,
|
|
101
78
|
method: 'post',
|
|
102
79
|
data: data
|
|
103
80
|
})
|
|
104
81
|
}
|
|
105
|
-
export function getDict(dictType, dictLylx) {
|
|
106
|
-
return
|
|
82
|
+
export function getDict(request, dictType, dictLylx) {
|
|
83
|
+
return request({
|
|
107
84
|
url: API.getDict,
|
|
108
85
|
method: 'post',
|
|
109
86
|
data: { dictType, dictLylx: dictLylx || 'sys' }
|
|
@@ -111,40 +88,40 @@ export function getDict(dictType, dictLylx) {
|
|
|
111
88
|
}
|
|
112
89
|
|
|
113
90
|
// 接口列表
|
|
114
|
-
export function apiList(query) {
|
|
115
|
-
return
|
|
91
|
+
export function apiList(request, query) {
|
|
92
|
+
return request({
|
|
116
93
|
url: '/gzt/jkgl/getGztJklist',
|
|
117
94
|
method: 'post',
|
|
118
95
|
data: query
|
|
119
96
|
})
|
|
120
97
|
}
|
|
121
98
|
// 接口详情
|
|
122
|
-
export function apiView(id) {
|
|
123
|
-
return
|
|
99
|
+
export function apiView(request, id) {
|
|
100
|
+
return request({
|
|
124
101
|
url: '/gzt/jkgl/jkglView',
|
|
125
102
|
method: 'post',
|
|
126
103
|
data: { id }
|
|
127
104
|
})
|
|
128
105
|
}
|
|
129
106
|
|
|
130
|
-
export function getViewData(data) {
|
|
131
|
-
return
|
|
107
|
+
export function getViewData(request, data) {
|
|
108
|
+
return request({
|
|
132
109
|
url: API.getViewData,
|
|
133
110
|
method: 'post',
|
|
134
111
|
data: data
|
|
135
112
|
})
|
|
136
113
|
}
|
|
137
114
|
|
|
138
|
-
export function getFormInitData(data) {
|
|
139
|
-
return
|
|
115
|
+
export function getFormInitData(request, data) {
|
|
116
|
+
return request({
|
|
140
117
|
url: API.getFormInitData,
|
|
141
118
|
method: 'post',
|
|
142
119
|
data: data
|
|
143
120
|
})
|
|
144
121
|
}
|
|
145
122
|
|
|
146
|
-
export function getData(url, data) {
|
|
147
|
-
return
|
|
123
|
+
export function getData(request, url, data) {
|
|
124
|
+
return request({
|
|
148
125
|
url: url,
|
|
149
126
|
method: 'post',
|
|
150
127
|
data: data
|
package/src/api/dict/app-data.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
// 根据字典类型查询字典数据信息
|
|
4
|
-
export function getDicts(dictType, dictLylx) {
|
|
4
|
+
export function getDicts(request, dictType, dictLylx) {
|
|
5
5
|
let type = dictType.split('/')[0]
|
|
6
|
-
return
|
|
6
|
+
return request({
|
|
7
7
|
url: '/sjyy/sjczgl/form/bdgl/config/getFormDictData',
|
|
8
8
|
data: { dictType: type, dictLylx: dictLylx || dictType.split('/')[1] || 'sys' },
|
|
9
9
|
method: 'post'
|
package/src/app-index.js
CHANGED
|
@@ -50,6 +50,9 @@ const install = function (Vue, options) {
|
|
|
50
50
|
if (options.request) {
|
|
51
51
|
Vue.prototype.$request = options.request
|
|
52
52
|
}
|
|
53
|
+
if (options.goBack) {
|
|
54
|
+
Vue.prototype.goBack = options.goBack
|
|
55
|
+
}
|
|
53
56
|
Object.values(components).forEach(comp => {
|
|
54
57
|
// 增加判断:comp存在 + name是有效字符串
|
|
55
58
|
if (comp && comp.name && typeof comp.name === 'string') {
|
|
@@ -258,6 +258,9 @@ button[disabled]{
|
|
|
258
258
|
.app-page{
|
|
259
259
|
height:100%;
|
|
260
260
|
overflow:hidden;
|
|
261
|
+
.app-page-wrap{
|
|
262
|
+
padding:15px;
|
|
263
|
+
}
|
|
261
264
|
.bottom-btns{
|
|
262
265
|
gap:15px;
|
|
263
266
|
padding-left: 10px;
|
|
@@ -315,7 +318,7 @@ button[disabled]{
|
|
|
315
318
|
}
|
|
316
319
|
.sub-item-title{ background: #fff;border-bottom:none}
|
|
317
320
|
.sub-item-title .title{
|
|
318
|
-
font-size:
|
|
321
|
+
font-size: 1rem;
|
|
319
322
|
font-weight: 600;
|
|
320
323
|
color: var(--title-text-color);
|
|
321
324
|
}
|
|
@@ -324,7 +327,7 @@ button[disabled]{
|
|
|
324
327
|
.last-cell-child{
|
|
325
328
|
border-bottom-left-radius:10px;
|
|
326
329
|
border-bottom-right-radius:10px;
|
|
327
|
-
margin-bottom:
|
|
330
|
+
margin-bottom: 15px;
|
|
328
331
|
&.van-cell{
|
|
329
332
|
padding-bottom: 10px;
|
|
330
333
|
&:after{
|
|
@@ -335,8 +338,17 @@ button[disabled]{
|
|
|
335
338
|
.first-cell-child{
|
|
336
339
|
border-top-left-radius:10px;
|
|
337
340
|
border-top-right-radius:10px;
|
|
338
|
-
margin-top:
|
|
341
|
+
margin-top: 15px;
|
|
339
342
|
}
|
|
340
343
|
.van-nav-bar .van-icon {
|
|
341
344
|
color: var(--nav-bar-icon-color);
|
|
342
345
|
}
|
|
346
|
+
|
|
347
|
+
.sub-item-title {
|
|
348
|
+
padding: 15px 5px;
|
|
349
|
+
.title{
|
|
350
|
+
font-size: 1rem;
|
|
351
|
+
font-weight: 600;
|
|
352
|
+
color: var(--title-text-color);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -56,7 +56,7 @@ export default {
|
|
|
56
56
|
// 加载字典数据
|
|
57
57
|
async loadDictData(dictType, dictLylx) {
|
|
58
58
|
try {
|
|
59
|
-
const response = await getDicts(dictType, dictLylx);
|
|
59
|
+
const response = await getDicts(this.$request, dictType, dictLylx);
|
|
60
60
|
this.selectOptions = (response.rows || response.data || []).map(item => ({
|
|
61
61
|
value: item.dictValue,
|
|
62
62
|
label: item.dictLabel,
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import request from '@/utils/request'
|
|
13
12
|
import Vue from 'vue'
|
|
14
13
|
import { isString } from '@/utils/index'
|
|
15
14
|
import eventsMixin from '../form/form-event-mixin.js'
|
|
@@ -134,7 +133,7 @@ export default {
|
|
|
134
133
|
// 2. 转换 Vue 响应式 formData 为原生 FormData
|
|
135
134
|
//const nativeFormData = this.convertVueFormToNativeFormData(JSON.parse(JSON.stringify(this.formModel)));
|
|
136
135
|
if (this.ywid && !this.formModel[this.conf.primaryKeyName]) nativeFormData.append(this.conf.primaryKeyName || 'id', this.ywid)
|
|
137
|
-
request({
|
|
136
|
+
this.$request({
|
|
138
137
|
url: this.saveUrl,
|
|
139
138
|
// cache: false,
|
|
140
139
|
// contentType: false,
|
|
@@ -177,7 +176,7 @@ export default {
|
|
|
177
176
|
message: '保存中…',
|
|
178
177
|
});
|
|
179
178
|
if (this.ywid && !this.formModel[this.conf.primaryKeyName]) nativeFormData.append(this.conf.primaryKeyName || 'id', this.ywid)
|
|
180
|
-
request({
|
|
179
|
+
this.$request({
|
|
181
180
|
url: this.saveUrl,
|
|
182
181
|
method: 'POST',
|
|
183
182
|
data: nativeFormData
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
// 加载字典数据
|
|
49
49
|
async loadDictData(dictType, dictLylx) {
|
|
50
50
|
try {
|
|
51
|
-
const response = await getDicts(dictType, dictLylx);
|
|
51
|
+
const response = await getDicts(this.$request, dictType, dictLylx);
|
|
52
52
|
this.selectOptions = (response.rows || response.data || []).map(item => ({
|
|
53
53
|
value: item.dictValue,
|
|
54
54
|
label: item.dictLabel,
|
|
@@ -114,7 +114,7 @@ export default {
|
|
|
114
114
|
this.$emit('close')
|
|
115
115
|
},
|
|
116
116
|
getTableData() {
|
|
117
|
-
getData(this.tableApi.url, this.tableApi.params).then(res => {
|
|
117
|
+
getData(this.$request, this.tableApi.url, this.tableApi.params).then(res => {
|
|
118
118
|
if (res.code == 0) {
|
|
119
119
|
this.tableData = res.rows
|
|
120
120
|
// this.tableData = res.rows.map((item, index) => {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script>
|
|
37
|
-
import { getDicts } from '@/api/dict/data'
|
|
37
|
+
import { getDicts } from '@/api/dict/app-data'
|
|
38
38
|
import baseMixin from './baseMixin.js'
|
|
39
39
|
import eventsMixin from '../form/form-event-mixin.js'
|
|
40
40
|
|
|
@@ -116,7 +116,7 @@ export default {
|
|
|
116
116
|
// 加载字典数据
|
|
117
117
|
async loadDictData(dictType, dictLylx) {
|
|
118
118
|
try {
|
|
119
|
-
const response = await getDicts(dictType, dictLylx);
|
|
119
|
+
const response = await getDicts(this.$request, dictType, dictLylx);
|
|
120
120
|
this.selectOptions = (response.rows || response.data || []).map(item => ({
|
|
121
121
|
value: item.dictValue,
|
|
122
122
|
label: item.dictLabel,
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
<c-app-form :conf="formConf" ref="cform" :model="formConf.model || {}" :openType="openType"
|
|
5
5
|
:singleUploadList="singleUploadList" :multiplySingleUploadList="multiplySingleUploadList"
|
|
6
6
|
@updateItem="updateItem" class="app-form">
|
|
7
|
-
<div class="app-wrap scroll-wrap">
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</div>
|
|
7
|
+
<div class="app-page-wrap scroll-wrap">
|
|
8
|
+
<app-form-item v-for="element in hiddenList" :key="element.renderKey" :element="element"
|
|
9
|
+
:form-conf="formConf" @updateItem="updateItem" />
|
|
10
|
+
<app-form-item v-for="element in filterDrawingList" :key="element.renderKey" :element="element"
|
|
11
|
+
:form-conf="formConf" @updateItem="updateItem" />
|
|
12
|
+
|
|
14
13
|
</div>
|
|
15
14
|
<van-goods-action ref="detailBtns" v-if="formConf.buttons" class="bottom-btns">
|
|
16
15
|
<app-form-item v-for="element in formConf.buttons" :key="element.renderKey" :element="element"
|
|
@@ -21,7 +20,6 @@
|
|
|
21
20
|
</template>
|
|
22
21
|
<script>
|
|
23
22
|
import { baseComponents } from '@/utils/generator/config'
|
|
24
|
-
import { mapActions, mapState } from 'vuex'
|
|
25
23
|
import AppFormItem from './AppFormItem.vue'
|
|
26
24
|
import { getFormData, getFormInitData, getViewData } from '@/api/app-form'
|
|
27
25
|
import { findFirstNodeByNameAndSjbName } from '@/utils/index'
|
|
@@ -56,7 +54,6 @@ export default {
|
|
|
56
54
|
}
|
|
57
55
|
},
|
|
58
56
|
computed: {
|
|
59
|
-
...mapState('user', ['userInfo']),
|
|
60
57
|
hiddenList() {
|
|
61
58
|
return this.drawingList.filter(item => item.noDrag)
|
|
62
59
|
},
|
|
@@ -123,9 +120,7 @@ export default {
|
|
|
123
120
|
}
|
|
124
121
|
},
|
|
125
122
|
created() {
|
|
126
|
-
|
|
127
|
-
this.fetchUserInfo()
|
|
128
|
-
}
|
|
123
|
+
|
|
129
124
|
if (this.formData) {
|
|
130
125
|
this.formConf = this.formData
|
|
131
126
|
this.drawingList = this.formData.fields
|
|
@@ -145,10 +140,9 @@ export default {
|
|
|
145
140
|
|
|
146
141
|
},
|
|
147
142
|
methods: {
|
|
148
|
-
...mapActions('user', ['fetchUserInfo']),
|
|
149
143
|
initData(formId, buttonCode, ywid) {
|
|
150
144
|
// 原有接口请求逻辑不变
|
|
151
|
-
getFormData({ id: formId }).then(res => {
|
|
145
|
+
getFormData(this.$request, { id: formId }).then(res => {
|
|
152
146
|
if (res.code == 0) {
|
|
153
147
|
const data = res.data;
|
|
154
148
|
const formCode = data.formCode
|
|
@@ -178,7 +172,7 @@ export default {
|
|
|
178
172
|
this.paddingBottom = '0px';
|
|
179
173
|
}
|
|
180
174
|
if (this.formConf.mode == 'add') {
|
|
181
|
-
if (formCode) getFormInitData({ formCode }).then(res => {
|
|
175
|
+
if (formCode) getFormInitData(this.$request, { formCode }).then(res => {
|
|
182
176
|
if (res.code == 0) {
|
|
183
177
|
this.formConf.model = res.data
|
|
184
178
|
}
|
|
@@ -187,21 +181,10 @@ export default {
|
|
|
187
181
|
else if (this.formConf.mode == 'edit' || this.formConf.mode == 'view') {
|
|
188
182
|
//编辑
|
|
189
183
|
if (!ywid) {
|
|
190
|
-
|
|
191
|
-
//关闭当前页面
|
|
192
|
-
//根据页面打开方式
|
|
193
|
-
if (this.openType == 'dialog') {
|
|
194
|
-
var index = parent.layer.getFrameIndex(window.name); // 获取当前层的索引
|
|
195
|
-
parent.layer.close(index);
|
|
196
|
-
} else if (this.openType == 'blank') {
|
|
197
|
-
window.close();
|
|
198
|
-
} else {
|
|
199
|
-
$.modal.closeTab();
|
|
200
|
-
}
|
|
201
|
-
})
|
|
184
|
+
this.goBack();
|
|
202
185
|
} else if (formCode && ywid) {
|
|
203
186
|
//获取表单数据
|
|
204
|
-
getViewData({ formCode, id: ywid }).then(res => {
|
|
187
|
+
getViewData(this.$request, { formCode, id: ywid }).then(res => {
|
|
205
188
|
if (res.code == 0) {
|
|
206
189
|
this.formConf.model = res.data
|
|
207
190
|
let uploadData = {}
|