n20-common-lib 2.9.83 → 2.9.84
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
CHANGED
|
@@ -2,11 +2,56 @@
|
|
|
2
2
|
<cl-page class="customFormOptions" style="height: calc(100% - 8px)">
|
|
3
3
|
<div slot="header">
|
|
4
4
|
<div class="flex-box flex-r m-t-s">
|
|
5
|
-
<el-button
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<el-button
|
|
6
|
+
v-if="type === 1"
|
|
7
|
+
icon="n20-icon-shuaxin"
|
|
8
|
+
plain
|
|
9
|
+
onlyicon
|
|
10
|
+
size="mini"
|
|
11
|
+
@click="getData"
|
|
12
|
+
/>
|
|
13
|
+
<el-button
|
|
14
|
+
v-if="type === 1"
|
|
15
|
+
size="mini"
|
|
16
|
+
type="primary"
|
|
17
|
+
@click="option('新增')"
|
|
18
|
+
>新增</el-button
|
|
19
|
+
>
|
|
20
|
+
<el-button
|
|
21
|
+
v-if="type === 1"
|
|
22
|
+
size="mini"
|
|
23
|
+
type="danger"
|
|
24
|
+
plain
|
|
25
|
+
@click="option('删除')"
|
|
26
|
+
>删除</el-button
|
|
27
|
+
>
|
|
28
|
+
<el-button
|
|
29
|
+
v-if="hasTransform"
|
|
30
|
+
size="mini"
|
|
31
|
+
plain
|
|
32
|
+
onlyicon
|
|
33
|
+
@click="option('下载Json配置')"
|
|
34
|
+
>下载Json配置</el-button
|
|
35
|
+
>
|
|
8
36
|
<!-- <el-button v-if="type === 1" size="mini" plain @click="option('导出')">导出</el-button> -->
|
|
9
|
-
<el-button
|
|
37
|
+
<el-button
|
|
38
|
+
v-if="hasTransform"
|
|
39
|
+
v-title="'转换'"
|
|
40
|
+
size="mini"
|
|
41
|
+
icon="n20-icon-caidan"
|
|
42
|
+
plain
|
|
43
|
+
onlyicon
|
|
44
|
+
@click="option('转换')"
|
|
45
|
+
/>
|
|
46
|
+
<el-button
|
|
47
|
+
v-if="hasTableOption"
|
|
48
|
+
v-title="'生成table配置'"
|
|
49
|
+
size="mini"
|
|
50
|
+
icon="n20-icon-wenjian"
|
|
51
|
+
plain
|
|
52
|
+
onlyicon
|
|
53
|
+
@click="option('生成table配置')"
|
|
54
|
+
/>
|
|
10
55
|
</div>
|
|
11
56
|
</div>
|
|
12
57
|
<transition name="el-zoom-in-center">
|
|
@@ -15,7 +60,7 @@
|
|
|
15
60
|
ref="xTable"
|
|
16
61
|
:loading="loading"
|
|
17
62
|
:data="tableData"
|
|
18
|
-
:columns="
|
|
63
|
+
:columns="checkColumns"
|
|
19
64
|
height="100%"
|
|
20
65
|
class="m-t-s Tabledrag"
|
|
21
66
|
@selection-change-method="handleSelectionChange"
|
|
@@ -39,17 +84,50 @@
|
|
|
39
84
|
size="normal"
|
|
40
85
|
clearable
|
|
41
86
|
/>
|
|
42
|
-
<el-button
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
<el-button
|
|
88
|
+
v-else
|
|
89
|
+
type="text"
|
|
90
|
+
size="small"
|
|
91
|
+
@click="pz(row, $rowIndex)"
|
|
92
|
+
>{{ row[column.prop] || '配置' }}</el-button
|
|
93
|
+
>
|
|
45
94
|
</template>
|
|
46
95
|
</vxe-column>
|
|
47
|
-
<vxe-column
|
|
48
|
-
|
|
96
|
+
<vxe-column
|
|
97
|
+
slot="input"
|
|
98
|
+
slot-scope="{ column }"
|
|
99
|
+
v-bind="column"
|
|
100
|
+
:field="column.prop"
|
|
101
|
+
:title="column.label"
|
|
102
|
+
>
|
|
103
|
+
<el-input
|
|
104
|
+
v-model="row[column.prop]"
|
|
105
|
+
slot-scope="{ row }"
|
|
106
|
+
placeholder="请输入"
|
|
107
|
+
size="normal"
|
|
108
|
+
clearable
|
|
109
|
+
/>
|
|
49
110
|
</vxe-column>
|
|
50
|
-
<vxe-column
|
|
51
|
-
|
|
52
|
-
|
|
111
|
+
<vxe-column
|
|
112
|
+
slot="select"
|
|
113
|
+
slot-scope="{ column }"
|
|
114
|
+
v-bind="column"
|
|
115
|
+
:field="column.prop"
|
|
116
|
+
:title="column.label"
|
|
117
|
+
>
|
|
118
|
+
<el-select
|
|
119
|
+
v-model="row[column.prop]"
|
|
120
|
+
slot-scope="{ row }"
|
|
121
|
+
placeholder="请选择"
|
|
122
|
+
clearable
|
|
123
|
+
filterable
|
|
124
|
+
>
|
|
125
|
+
<el-option
|
|
126
|
+
v-for="item in options[column.prop]"
|
|
127
|
+
:key="item.code"
|
|
128
|
+
:label="item.name"
|
|
129
|
+
:value="item.code"
|
|
130
|
+
/>
|
|
53
131
|
</el-select>
|
|
54
132
|
</vxe-column>
|
|
55
133
|
<!-- 控件类型 -->
|
|
@@ -60,17 +138,37 @@
|
|
|
60
138
|
:field="column.prop"
|
|
61
139
|
:title="column.label"
|
|
62
140
|
>
|
|
63
|
-
<el-select
|
|
64
|
-
|
|
141
|
+
<el-select
|
|
142
|
+
v-model="row[column.prop]"
|
|
143
|
+
slot-scope="{ row }"
|
|
144
|
+
placeholder="请选择"
|
|
145
|
+
clearable
|
|
146
|
+
filterable
|
|
147
|
+
>
|
|
148
|
+
<el-option
|
|
149
|
+
v-for="item in fieldType"
|
|
150
|
+
:key="item.code"
|
|
151
|
+
:label="item.name"
|
|
152
|
+
:value="item.code"
|
|
153
|
+
/>
|
|
65
154
|
</el-select>
|
|
66
155
|
</vxe-column>
|
|
67
|
-
<vxe-column
|
|
156
|
+
<vxe-column
|
|
157
|
+
slot="check"
|
|
158
|
+
slot-scope="{ column }"
|
|
159
|
+
v-bind="column"
|
|
160
|
+
:field="column.prop"
|
|
161
|
+
:title="column.label"
|
|
162
|
+
>
|
|
68
163
|
<el-switch
|
|
69
164
|
v-model="row[column.prop]"
|
|
70
165
|
slot-scope="{ row }"
|
|
71
166
|
:active-value="true"
|
|
72
167
|
:inactive-value="false"
|
|
73
|
-
:disabled="
|
|
168
|
+
:disabled="
|
|
169
|
+
column.prop === 'isMultiple' &&
|
|
170
|
+
!['searchSelect', 'select'].includes(row.fieldType)
|
|
171
|
+
"
|
|
74
172
|
/>
|
|
75
173
|
</vxe-column>
|
|
76
174
|
</cl-table-pro>
|
|
@@ -90,7 +188,11 @@
|
|
|
90
188
|
@valueChange="valueChange"
|
|
91
189
|
@formItemClick="formItemClick"
|
|
92
190
|
>
|
|
93
|
-
<el-radio-group
|
|
191
|
+
<el-radio-group
|
|
192
|
+
slot="input1"
|
|
193
|
+
v-model="formValue.select"
|
|
194
|
+
class="m-t-s"
|
|
195
|
+
>
|
|
94
196
|
<el-radio :label="3">备选项</el-radio>
|
|
95
197
|
<el-radio :label="6">备选项</el-radio>
|
|
96
198
|
<el-radio :label="9" disabled>备选项</el-radio>
|
|
@@ -102,9 +204,19 @@
|
|
|
102
204
|
<el-button type="primary" @click="option('保存')">保存</el-button>
|
|
103
205
|
<el-button plain @click="option('重置')">重置</el-button>
|
|
104
206
|
</div>
|
|
105
|
-
<cl-dialog
|
|
106
|
-
|
|
207
|
+
<cl-dialog
|
|
208
|
+
v-drag
|
|
209
|
+
:visible.sync="visible"
|
|
210
|
+
title="数据引用"
|
|
211
|
+
:destroy-on-open="true"
|
|
212
|
+
>
|
|
213
|
+
<content-pop
|
|
214
|
+
v-model="selectFieldValue"
|
|
215
|
+
:visible.sync="visible"
|
|
216
|
+
@save="dialogSave"
|
|
217
|
+
/>
|
|
107
218
|
</cl-dialog>
|
|
219
|
+
<tableView ref="tableView" />
|
|
108
220
|
</cl-page>
|
|
109
221
|
</template>
|
|
110
222
|
|
|
@@ -115,15 +227,20 @@ import DynamicField from './DynamicField.vue'
|
|
|
115
227
|
import DynamicFieldMixin from './DynamicFieldMixin.js'
|
|
116
228
|
import { deepClone } from './utils'
|
|
117
229
|
import contentPop from './contentPop.vue'
|
|
230
|
+
import tableView from './tableView.vue'
|
|
118
231
|
export default {
|
|
119
232
|
name: 'DynamicFieldOptions',
|
|
120
|
-
components: { DynamicField, contentPop },
|
|
233
|
+
components: { DynamicField, contentPop, tableView },
|
|
121
234
|
mixins: [DynamicFieldMixin],
|
|
122
235
|
props: {
|
|
123
236
|
hasTransform: {
|
|
124
237
|
type: Boolean,
|
|
125
238
|
default: false
|
|
126
239
|
},
|
|
240
|
+
hasTableOption: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: false
|
|
243
|
+
},
|
|
127
244
|
showItems: {
|
|
128
245
|
type: Array,
|
|
129
246
|
default: () => {
|
|
@@ -132,7 +249,7 @@ export default {
|
|
|
132
249
|
'序号',
|
|
133
250
|
'栏目',
|
|
134
251
|
'字段名称',
|
|
135
|
-
'
|
|
252
|
+
'是否在列表显示',
|
|
136
253
|
'是否启用',
|
|
137
254
|
'是否必填',
|
|
138
255
|
'是否可编辑',
|
|
@@ -226,14 +343,14 @@ export default {
|
|
|
226
343
|
width: '150',
|
|
227
344
|
'show-overflow-tooltip': true
|
|
228
345
|
},
|
|
229
|
-
|
|
346
|
+
{
|
|
230
347
|
slotName: 'check',
|
|
231
|
-
label: '
|
|
232
|
-
prop: '
|
|
348
|
+
label: '是否在列表显示',
|
|
349
|
+
prop: 'isTableShow',
|
|
233
350
|
align: 'center',
|
|
234
351
|
width: '120',
|
|
235
352
|
'show-overflow-tooltip': true
|
|
236
|
-
},
|
|
353
|
+
},
|
|
237
354
|
{
|
|
238
355
|
slotName: 'check',
|
|
239
356
|
label: '是否启用',
|
|
@@ -324,6 +441,7 @@ export default {
|
|
|
324
441
|
pz(row, index) {
|
|
325
442
|
this.selectFieldValue = row.fieldValue || []
|
|
326
443
|
this.selectIndex = index
|
|
444
|
+
this.title = '数据来源'
|
|
327
445
|
this.visible = true
|
|
328
446
|
},
|
|
329
447
|
dialogSave(value) {
|
|
@@ -371,10 +489,29 @@ export default {
|
|
|
371
489
|
this.setRules()
|
|
372
490
|
},
|
|
373
491
|
option(key) {
|
|
492
|
+
// 将本地数据转换为 JSON 字符串
|
|
493
|
+
const jsonData = JSON.stringify(this.value, null, 2)
|
|
494
|
+
// 创建一个 Blob 对象
|
|
495
|
+
const blob = new Blob([jsonData], { type: 'application/json' })
|
|
496
|
+
// 创建一个下载链接
|
|
497
|
+
const url = window.URL.createObjectURL(blob)
|
|
498
|
+
const a = document.createElement('a')
|
|
374
499
|
const selectIds = this.selectData.map((item) => {
|
|
375
500
|
return item.selectId
|
|
376
501
|
})
|
|
377
502
|
switch (key) {
|
|
503
|
+
case '下载Json配置':
|
|
504
|
+
a.href = url
|
|
505
|
+
a.download = '动态字段配置.json'
|
|
506
|
+
document.body.appendChild(a)
|
|
507
|
+
a.click()
|
|
508
|
+
// 释放 URL 对象
|
|
509
|
+
window.URL.revokeObjectURL(url)
|
|
510
|
+
document.body.removeChild(a)
|
|
511
|
+
break
|
|
512
|
+
case '生成table配置':
|
|
513
|
+
this.$refs.tableView.setView(this.tableData)
|
|
514
|
+
break
|
|
378
515
|
case '转换':
|
|
379
516
|
if (this.type === 2) {
|
|
380
517
|
this.type = 1
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<cl-dialog
|
|
3
|
+
v-drag
|
|
4
|
+
width="85%"
|
|
5
|
+
max-dialog
|
|
6
|
+
:visible.sync="tableVisible"
|
|
7
|
+
title="数据展示"
|
|
8
|
+
:destroy-on-open="true"
|
|
9
|
+
>
|
|
10
|
+
<cl-page class="contentPop">
|
|
11
|
+
<div class="flex-box flex-lr flex-v m-b-s">
|
|
12
|
+
<div></div>
|
|
13
|
+
<div>
|
|
14
|
+
<el-button type="primary" size="mini" @click="option('导出json')"
|
|
15
|
+
>导出json</el-button
|
|
16
|
+
>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<cl-table-pro
|
|
20
|
+
ref="xTable"
|
|
21
|
+
:loading="loading"
|
|
22
|
+
:data="value"
|
|
23
|
+
:columns="TableHeader"
|
|
24
|
+
:height="'300px'"
|
|
25
|
+
>
|
|
26
|
+
<vxe-column
|
|
27
|
+
slot="input"
|
|
28
|
+
slot-scope="{ column }"
|
|
29
|
+
v-bind="column"
|
|
30
|
+
:field="column.prop"
|
|
31
|
+
:title="column.label"
|
|
32
|
+
>
|
|
33
|
+
<el-input
|
|
34
|
+
v-model="row[column.prop]"
|
|
35
|
+
slot-scope="{ row }"
|
|
36
|
+
placeholder="请输入"
|
|
37
|
+
size="normal"
|
|
38
|
+
clearable
|
|
39
|
+
/>
|
|
40
|
+
</vxe-column>
|
|
41
|
+
<vxe-column
|
|
42
|
+
slot="delete"
|
|
43
|
+
slot-scope="{ column }"
|
|
44
|
+
v-bind="column"
|
|
45
|
+
:field="column.prop"
|
|
46
|
+
:title="column.label"
|
|
47
|
+
>
|
|
48
|
+
<el-link
|
|
49
|
+
slot-scope="{ row, $rowIndex }"
|
|
50
|
+
class="m-r-s"
|
|
51
|
+
:underline="false"
|
|
52
|
+
icon="n20-icon-a-shanchuxuanzhong"
|
|
53
|
+
@click="option('删除', row, $rowIndex)"
|
|
54
|
+
/>
|
|
55
|
+
</vxe-column>
|
|
56
|
+
</cl-table-pro>
|
|
57
|
+
|
|
58
|
+
<div slot="footer" class="page-button-shadow flex-box flex-c flex-v">
|
|
59
|
+
<!-- <el-button type="primary" @click="option('保存')">保存</el-button> -->
|
|
60
|
+
<!-- <el-button plain @click="option('重置')">重置</el-button> -->
|
|
61
|
+
</div>
|
|
62
|
+
</cl-page>
|
|
63
|
+
</cl-dialog>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
export default {
|
|
68
|
+
name: 'ContentPop',
|
|
69
|
+
components: {},
|
|
70
|
+
props: {
|
|
71
|
+
value: {
|
|
72
|
+
type: Array,
|
|
73
|
+
default: () => {
|
|
74
|
+
return []
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
tableVisible: false,
|
|
81
|
+
TableHeader: [
|
|
82
|
+
{
|
|
83
|
+
slotName: 'input',
|
|
84
|
+
label: '枚举名',
|
|
85
|
+
prop: 'label',
|
|
86
|
+
align: 'left',
|
|
87
|
+
minWidth: '120',
|
|
88
|
+
'show-overflow-tooltip': true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
slotName: 'input',
|
|
92
|
+
label: '枚举值',
|
|
93
|
+
prop: 'value',
|
|
94
|
+
width: '260'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
slotName: 'delete',
|
|
98
|
+
width: '50'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
loading: false
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
computed: {},
|
|
105
|
+
watch: {},
|
|
106
|
+
created() {},
|
|
107
|
+
mounted() {},
|
|
108
|
+
methods: {
|
|
109
|
+
setView(data) {
|
|
110
|
+
console.log(data)
|
|
111
|
+
let TableHeader = [
|
|
112
|
+
{
|
|
113
|
+
type: 'checkbox',
|
|
114
|
+
static: 'pre' // 静态不被"显示列"显示的,且最终会被拼接到"显示列"排序后的表格的"前面"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'seq',
|
|
118
|
+
label: '序号',
|
|
119
|
+
width: '56',
|
|
120
|
+
align: 'center'
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
data
|
|
124
|
+
.filter((item) => {
|
|
125
|
+
return item.isTableShow
|
|
126
|
+
})
|
|
127
|
+
.forEach((i) => {
|
|
128
|
+
TableHeader.push({
|
|
129
|
+
label: i.fieldName,
|
|
130
|
+
prop: i.fieldCode,
|
|
131
|
+
align: i.fieldType === 'input-number' ? 'right' : 'center',
|
|
132
|
+
sortable: i.fieldType === 'input-number',
|
|
133
|
+
formatter: i.fieldType === 'input-number' ? 'formatAmount' : '', // 金额格式化
|
|
134
|
+
minWidth: '120',
|
|
135
|
+
'show-overflow-tooltip': true
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
this.TableHeader = TableHeader
|
|
139
|
+
console.log(this.TableHeader)
|
|
140
|
+
this.tableVisible = true
|
|
141
|
+
},
|
|
142
|
+
option(key, row, index) {
|
|
143
|
+
// 将本地数据转换为 JSON 字符串
|
|
144
|
+
const jsonData = JSON.stringify(this.TableHeader, null, 2)
|
|
145
|
+
// 创建一个 Blob 对象
|
|
146
|
+
const blob = new Blob([jsonData], { type: 'application/json' })
|
|
147
|
+
// 创建一个下载链接
|
|
148
|
+
const url = window.URL.createObjectURL(blob)
|
|
149
|
+
const a = document.createElement('a')
|
|
150
|
+
switch (key) {
|
|
151
|
+
case '导出json':
|
|
152
|
+
a.href = url
|
|
153
|
+
a.download = 'TableHeader.json'
|
|
154
|
+
document.body.appendChild(a)
|
|
155
|
+
a.click()
|
|
156
|
+
// 释放 URL 对象
|
|
157
|
+
window.URL.revokeObjectURL(url)
|
|
158
|
+
document.body.removeChild(a)
|
|
159
|
+
break
|
|
160
|
+
|
|
161
|
+
default:
|
|
162
|
+
break
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</script>
|
|
168
|
+
<style scoped>
|
|
169
|
+
.contentPop {
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
}
|
|
172
|
+
</style>
|