three-trees-ui 1.0.72 → 1.0.73
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/lib/three-trees-ui.common.js +15770 -17046
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +15770 -17046
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +12 -74
- package/packages/DataLists/src/main.vue +3 -2
- package/packages/Global/src/GlobalQuery.vue +5 -5
- package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +1 -43
- package/packages/Subtable/src/SubExportDialog.vue +1 -92
- package/packages/Subtable/src/SubImportDialog.vue +8 -171
- package/packages/TableSearchField/src/main.vue +0 -5
- package/packages/TemplatePreview/src/TemplatePreview.vue +0 -43
- package/src/directive/formulas.js +1 -1
- package/src/mixins/onlineSubtable.js +0 -301
- package/src/mixins/querySqlPreview.js +32 -354
- package/src/mixins/templatePreview.js +42 -525
- package/src/services/SubPagination.js +1 -40
- package/src/utils.js +1 -32
package/package.json
CHANGED
|
@@ -1137,11 +1137,8 @@
|
|
|
1137
1137
|
}
|
|
1138
1138
|
const pInst = utils.getOnlineFormInstance(this)
|
|
1139
1139
|
this.selectOrgs = this.convertComment2Field(str, field)
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
let bindValue = ''
|
|
1143
|
-
//改造,绑定值,表单列表查询字段绑定对话框时,新增的绑定字段选项
|
|
1144
|
-
const bindValueField = con.bindValue && con.bindValue.toLowerCase()
|
|
1140
|
+
this.custdialog.custDialog.mappingConf.forEach((con) => {
|
|
1141
|
+
var val = ''
|
|
1145
1142
|
str.forEach((item, index) => {
|
|
1146
1143
|
// 此处添加url跳转参数保存逻辑
|
|
1147
1144
|
if (
|
|
@@ -1162,10 +1159,6 @@
|
|
|
1162
1159
|
},`
|
|
1163
1160
|
} else {
|
|
1164
1161
|
val += item[con.from] + ','
|
|
1165
|
-
//绑定字段处理
|
|
1166
|
-
if (bindValueField) {
|
|
1167
|
-
bindValue += item[bindValueField] + ','
|
|
1168
|
-
}
|
|
1169
1162
|
}
|
|
1170
1163
|
})
|
|
1171
1164
|
if (this.modelName == 'data.' + con['target'][0]) {
|
|
@@ -1176,29 +1169,12 @@
|
|
|
1176
1169
|
thisIndex
|
|
1177
1170
|
)
|
|
1178
1171
|
} else if (this.modelName == 'searchForm.' + con['target'][0]) {
|
|
1179
|
-
const bInst = pInst['searchForm'] ? pInst: pInst.data
|
|
1180
1172
|
utils.setValueByPath(
|
|
1181
|
-
|
|
1173
|
+
pInst,
|
|
1182
1174
|
'searchForm.' + con['target'][0],
|
|
1183
1175
|
val.substring(0, val.length - 1),
|
|
1184
1176
|
thisIndex
|
|
1185
1177
|
)
|
|
1186
|
-
//绑定字段值处理,bindValue: {target: {id: xxx}}, bindKey: {target: id }
|
|
1187
|
-
if (bindValue && bindValueField) {
|
|
1188
|
-
const bindValueObj = {}
|
|
1189
|
-
//显示value对象
|
|
1190
|
-
bindValueObj[bindValueField] = bindValue.substring(0, bindValue.length - 1)
|
|
1191
|
-
|
|
1192
|
-
const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
|
|
1193
|
-
//若bindKey不存在,则默认空对象,若存在,则取出bindKey
|
|
1194
|
-
anInst.bindKey = anInst.bindKey || {}
|
|
1195
|
-
//格式 {target: id }
|
|
1196
|
-
anInst.bindKey[con['target'][0]] = bindValueField
|
|
1197
|
-
//若bindValue不存在,则默认空对象,若存在,则取出bindValue
|
|
1198
|
-
anInst.bindValue = anInst.bindValue || {}
|
|
1199
|
-
//格式 {target: {id: xxx}}
|
|
1200
|
-
anInst.bindValue[con['target'][0]] = bindValueObj
|
|
1201
|
-
}
|
|
1202
1178
|
} else {
|
|
1203
1179
|
let configAttr = con['target'][0].split('.')
|
|
1204
1180
|
let path = con['target'][0]
|
|
@@ -1223,26 +1199,10 @@
|
|
|
1223
1199
|
}
|
|
1224
1200
|
utils.setValueByPath(
|
|
1225
1201
|
pInst,
|
|
1226
|
-
`${pInst.data ? 'data.' : 'model.'}${
|
|
1202
|
+
`${pInst.data ? 'data.' : 'model.'}${path}`,
|
|
1227
1203
|
_val,
|
|
1228
1204
|
thisIndex
|
|
1229
1205
|
)
|
|
1230
|
-
//绑定字段值处理,bindValue: {target: {id: xxx}}, bindKey: {target: id }
|
|
1231
|
-
if (bindValue && bindValueField) {
|
|
1232
|
-
const bindValueObj = {}
|
|
1233
|
-
//显示value对象
|
|
1234
|
-
bindValueObj[bindValueField] = bindValue.substring(0, bindValue.length - 1)
|
|
1235
|
-
|
|
1236
|
-
const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
|
|
1237
|
-
//若bindKey不存在,则默认空对象,若存在,则取出bindKey
|
|
1238
|
-
anInst.bindKey = anInst.bindKey || {}
|
|
1239
|
-
//格式 {target: id }
|
|
1240
|
-
anInst.bindKey[con['target'][0]] = bindValueField
|
|
1241
|
-
//若bindValue不存在,则默认空对象,若存在,则取出bindValue
|
|
1242
|
-
anInst.bindValue = anInst.bindValue || {}
|
|
1243
|
-
//格式 {target: {id: xxx}}
|
|
1244
|
-
anInst.bindValue[con['target'][0]] = bindValueObj
|
|
1245
|
-
}
|
|
1246
1206
|
}
|
|
1247
1207
|
}
|
|
1248
1208
|
})
|
|
@@ -1896,11 +1856,8 @@
|
|
|
1896
1856
|
}
|
|
1897
1857
|
const pInst = utils.getOnlineFormInstance(this)
|
|
1898
1858
|
this.custdialog.custDialog.mappingConf.forEach((con) => {
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
const from = con.from.toLowerCase()
|
|
1902
|
-
//改造,绑定值,表单列表查询字段绑定对话框时,新增的绑定字段选项
|
|
1903
|
-
const bindValueField = con.bindValue && con.bindValue.toLowerCase()
|
|
1859
|
+
var val = ''
|
|
1860
|
+
var from = con.from.toLowerCase()
|
|
1904
1861
|
str.forEach((item) => {
|
|
1905
1862
|
// 如果有绑定url跳转参数 需获取跳转参数的key
|
|
1906
1863
|
if (item) {
|
|
@@ -1928,10 +1885,6 @@
|
|
|
1928
1885
|
)}¯${jumpParamKey}:${decodeURIComponent(item[returnMapKey])},`
|
|
1929
1886
|
} else {
|
|
1930
1887
|
val += decodeURIComponent(item[from]) + ','
|
|
1931
|
-
//绑定字段处理
|
|
1932
|
-
if (bindValueField) {
|
|
1933
|
-
bindValue += decodeURIComponent(item[bindValueField]) + ','
|
|
1934
|
-
}
|
|
1935
1888
|
}
|
|
1936
1889
|
}
|
|
1937
1890
|
})
|
|
@@ -1947,28 +1900,13 @@
|
|
|
1947
1900
|
this.modelName &&
|
|
1948
1901
|
this.modelName.startsWith('searchForm.')
|
|
1949
1902
|
) {
|
|
1950
|
-
const currentValue = val.substring(0, val.length - 1)
|
|
1951
|
-
if (this.modelName && this.modelName.endsWith(con['target'][0])) {
|
|
1952
|
-
this.$emit('updateInput', currentValue);
|
|
1953
|
-
}
|
|
1954
1903
|
let prePath = pInst['searchForm'] ? '' : 'data.'
|
|
1955
|
-
utils.setValueByPath(
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
|
|
1963
|
-
//若bindKey不存在,则默认空对象,若存在,则取出bindKey
|
|
1964
|
-
anInst.bindKey = anInst.bindKey || {}
|
|
1965
|
-
//格式 {target: id }
|
|
1966
|
-
anInst.bindKey[con['target'][0]] = bindValueField
|
|
1967
|
-
//若bindValue不存在,则默认空对象,若存在,则取出bindValue
|
|
1968
|
-
anInst.bindValue = anInst.bindValue || {}
|
|
1969
|
-
//格式 {target: {id: xxx}}
|
|
1970
|
-
anInst.bindValue[con['target'][0]] = bindValueObj
|
|
1971
|
-
}
|
|
1904
|
+
utils.setValueByPath(
|
|
1905
|
+
pInst,
|
|
1906
|
+
prePath + 'searchForm.' + con['target'][0],
|
|
1907
|
+
val.substring(0, val.length - 1),
|
|
1908
|
+
thisIndex
|
|
1909
|
+
)
|
|
1972
1910
|
} else {
|
|
1973
1911
|
let configAttr = con['target'][0].split('.')
|
|
1974
1912
|
let path = con['target'][0]
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
<script>
|
|
35
35
|
import permission from '@/mixins/permission.js'
|
|
36
|
-
|
|
36
|
+
export default {
|
|
37
37
|
name: 'HtDataLists',
|
|
38
38
|
mixins: [permission],
|
|
39
39
|
props: {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
watch: {
|
|
57
57
|
options: {
|
|
58
58
|
handler(val) {
|
|
59
|
+
debugger
|
|
59
60
|
if (val) {
|
|
60
61
|
this.tabPaneList = JSON.parse(val)
|
|
61
62
|
this.activeName = this.tabPaneList[0].dataTemplateKey
|
|
@@ -113,4 +114,4 @@
|
|
|
113
114
|
margin-top: 24px;
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
</style>
|
|
117
|
+
</style>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<script>
|
|
6
6
|
import utils from '@/utils.js'
|
|
7
7
|
import CustomQuery from '@/services/CustomQuery.js'
|
|
8
|
+
import _ from 'lodash'
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
name: 'HtGlobalQuery',
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
//主表
|
|
48
49
|
_this.formInst.$watch(
|
|
49
50
|
item.triggerField,
|
|
50
|
-
function(newVal, oldVal) {
|
|
51
|
+
_.debounce(function (newVal, oldVal) {
|
|
51
52
|
if (
|
|
52
53
|
(newVal != '' || oldVal != undefined) &&
|
|
53
54
|
newVal !== oldVal
|
|
@@ -59,8 +60,7 @@
|
|
|
59
60
|
null
|
|
60
61
|
)
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
-
// { immediate: true }
|
|
63
|
+
}, 500)
|
|
64
64
|
)
|
|
65
65
|
} else {
|
|
66
66
|
//子表
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
_this.formInst.$watch(
|
|
85
85
|
'data.' + item.subPath,
|
|
86
|
-
function(newVal) {
|
|
86
|
+
_.debounce(function (newVal) {
|
|
87
87
|
let myOldVal = _this.subOldValueMap[item.subPath]
|
|
88
88
|
_this.subQueryConfig
|
|
89
89
|
.filter((i) => {
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
)
|
|
152
152
|
}
|
|
153
153
|
})
|
|
154
|
-
},
|
|
154
|
+
}, 500),
|
|
155
155
|
{ deep: true }
|
|
156
156
|
)
|
|
157
157
|
}
|
|
@@ -163,46 +163,4 @@ export default {
|
|
|
163
163
|
font-weight: bold;
|
|
164
164
|
color: #f56c6c;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
margin: 0 24px;
|
|
168
|
-
float: left;
|
|
169
|
-
padding: 10px 0;
|
|
170
|
-
}
|
|
171
|
-
::v-deep .page-btn-total {
|
|
172
|
-
margin: 5px 0px;
|
|
173
|
-
float: left;
|
|
174
|
-
padding: 11px 0px;
|
|
175
|
-
color: #606266;
|
|
176
|
-
font-weight: normal;
|
|
177
|
-
font-size: 13px;
|
|
178
|
-
}
|
|
179
|
-
::v-deep .pagination {
|
|
180
|
-
display: flex;
|
|
181
|
-
justify-content: flex-end;
|
|
182
|
-
padding: 10px 0;
|
|
183
|
-
float: right;
|
|
184
|
-
.el-select {
|
|
185
|
-
width: 100px;
|
|
186
|
-
}
|
|
187
|
-
.page-btn {
|
|
188
|
-
margin: 0 24px;
|
|
189
|
-
}
|
|
190
|
-
.target-page {
|
|
191
|
-
display: flex;
|
|
192
|
-
align-items: center;
|
|
193
|
-
color: #606266;
|
|
194
|
-
font-weight: normal;
|
|
195
|
-
font-size: 13px;
|
|
196
|
-
.el-input {
|
|
197
|
-
width: 50px;
|
|
198
|
-
margin: 0 3px;
|
|
199
|
-
}
|
|
200
|
-
//::v-deep input::-webkit-outer-spin-button, ::v-deep input::-webkit-inner-spin-button {
|
|
201
|
-
// -webkit-appearance: none !important;
|
|
202
|
-
//}
|
|
203
|
-
//::v-deep input[type='number'] {
|
|
204
|
-
// -moz-appearnce: textfield !important
|
|
205
|
-
//}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
</style>
|
|
166
|
+
</style>
|
|
@@ -35,16 +35,6 @@
|
|
|
35
35
|
type: String,
|
|
36
36
|
default: '子表数据',
|
|
37
37
|
},
|
|
38
|
-
exportMaxRow: {
|
|
39
|
-
type: [String, Number],
|
|
40
|
-
},
|
|
41
|
-
exportField: {
|
|
42
|
-
// 禁止导出的字段集合
|
|
43
|
-
type: String,
|
|
44
|
-
},
|
|
45
|
-
exportFieldTransformData: {
|
|
46
|
-
type: String,
|
|
47
|
-
},
|
|
48
38
|
},
|
|
49
39
|
computed: {
|
|
50
40
|
columns: function() {
|
|
@@ -57,46 +47,6 @@
|
|
|
57
47
|
}
|
|
58
48
|
},
|
|
59
49
|
methods: {
|
|
60
|
-
async sqlChange(config, value = '') {
|
|
61
|
-
return new Promise((resolve) => {
|
|
62
|
-
let sqlStr = config.relevancyValue
|
|
63
|
-
? config.relevancyValue.replace(/{val}/g, value)
|
|
64
|
-
: ''
|
|
65
|
-
sqlStr = sqlStr ? sqlStr.replace(/\n/g, '') : ''
|
|
66
|
-
let params = {
|
|
67
|
-
dsName: config.dataSource,
|
|
68
|
-
sql: sqlStr,
|
|
69
|
-
}
|
|
70
|
-
this.$requestConfig.getValueBySql(params).then((res) => {
|
|
71
|
-
resolve(res)
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
},
|
|
75
|
-
transformFieldData(data) {
|
|
76
|
-
return new Promise(async (resolve) => {
|
|
77
|
-
let fieldTransformData = JSON.parse(
|
|
78
|
-
decode(this.exportFieldTransformData)
|
|
79
|
-
)
|
|
80
|
-
for (let i = 0; i < data.length; i++) {
|
|
81
|
-
for (let j = 0; j < fieldTransformData.length; j++) {
|
|
82
|
-
if (fieldTransformData[j].relevancyType == 'value') {
|
|
83
|
-
data[i][fieldTransformData[j].field] =
|
|
84
|
-
fieldTransformData[j].relevancyValue
|
|
85
|
-
} else {
|
|
86
|
-
// 动态时 请求接口修改数据
|
|
87
|
-
let result = await this.sqlChange(
|
|
88
|
-
fieldTransformData[j],
|
|
89
|
-
data[i][fieldTransformData[j].field]
|
|
90
|
-
)
|
|
91
|
-
if (result) {
|
|
92
|
-
data[i][fieldTransformData[j].field] = result
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
resolve(data)
|
|
98
|
-
})
|
|
99
|
-
},
|
|
100
50
|
// 配置的数据字典 导出时翻译为汉字
|
|
101
51
|
changeDictionary(data) {
|
|
102
52
|
return new Promise(async (resolve, reject) => {
|
|
@@ -126,18 +76,10 @@
|
|
|
126
76
|
},
|
|
127
77
|
changeRowKey(rows) {
|
|
128
78
|
var exportData = []
|
|
129
|
-
let exportFieldArr = null
|
|
130
|
-
if (this.exportField) {
|
|
131
|
-
exportFieldArr = this.exportField.split(',')
|
|
132
|
-
}
|
|
133
79
|
rows.forEach((row) => {
|
|
134
80
|
var exportRow = {}
|
|
135
81
|
this.columns.forEach((col) => {
|
|
136
|
-
if (
|
|
137
|
-
col.ctrlType != 'suntable' &&
|
|
138
|
-
(!exportFieldArr ||
|
|
139
|
-
(exportFieldArr && !exportFieldArr.includes(col.name)))
|
|
140
|
-
) {
|
|
82
|
+
if (col.ctrlType != 'suntable') {
|
|
141
83
|
exportRow[col.desc] = row[col.name]
|
|
142
84
|
}
|
|
143
85
|
})
|
|
@@ -145,25 +87,6 @@
|
|
|
145
87
|
})
|
|
146
88
|
return exportData
|
|
147
89
|
},
|
|
148
|
-
getConfirmValue(rows, count) {
|
|
149
|
-
return new Promise((resolve) => {
|
|
150
|
-
this.$confirm(
|
|
151
|
-
`导出数据量超出导出限制【${count}】,将导出${count}条,是否继续?`,
|
|
152
|
-
'提示',
|
|
153
|
-
{
|
|
154
|
-
confirmButtonText: '确定',
|
|
155
|
-
cancelButtonText: '取消',
|
|
156
|
-
type: 'warning',
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
.then(() => {
|
|
160
|
-
resolve(rows.slice(0, count))
|
|
161
|
-
})
|
|
162
|
-
.catch(() => {
|
|
163
|
-
resolve(false)
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
},
|
|
167
90
|
handleCommand(type) {
|
|
168
91
|
const pInst = utils.getOnlineFormInstance(this)
|
|
169
92
|
SubPagination.exportData(
|
|
@@ -174,20 +97,6 @@
|
|
|
174
97
|
)
|
|
175
98
|
.then(async (data) => {
|
|
176
99
|
data = JSON.parse(JSON.stringify(data))
|
|
177
|
-
if (this.exportMaxRow && Number(this.exportMaxRow) < data.length) {
|
|
178
|
-
let result = await this.getConfirmValue(
|
|
179
|
-
data,
|
|
180
|
-
Number(this.exportMaxRow)
|
|
181
|
-
)
|
|
182
|
-
if (result === false) {
|
|
183
|
-
return
|
|
184
|
-
}
|
|
185
|
-
data = result
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (this.exportFieldTransformData) {
|
|
189
|
-
data = await this.transformFieldData(data)
|
|
190
|
-
}
|
|
191
100
|
// 导出时 字典转换
|
|
192
101
|
await this.changeDictionary(data)
|
|
193
102
|
let exportData = this.changeRowKey(data)
|
|
@@ -102,45 +102,6 @@
|
|
|
102
102
|
type: String,
|
|
103
103
|
required: true,
|
|
104
104
|
},
|
|
105
|
-
importMaxRow: {
|
|
106
|
-
type: [String, Number],
|
|
107
|
-
default: null,
|
|
108
|
-
},
|
|
109
|
-
templateType: {
|
|
110
|
-
// 导入模板类型 default 系统默认 custom 自定义
|
|
111
|
-
type: String,
|
|
112
|
-
default: 'default',
|
|
113
|
-
},
|
|
114
|
-
customTemplate: {
|
|
115
|
-
// 自定义的导入模板文件
|
|
116
|
-
type: String,
|
|
117
|
-
default: '',
|
|
118
|
-
},
|
|
119
|
-
importTransform: {
|
|
120
|
-
// 是否有转换字段
|
|
121
|
-
type: String,
|
|
122
|
-
default: '0',
|
|
123
|
-
},
|
|
124
|
-
importModes: {
|
|
125
|
-
// 导入模式选项显示
|
|
126
|
-
type: String,
|
|
127
|
-
default: 'append,override,merge',
|
|
128
|
-
},
|
|
129
|
-
fieldTransformData: {
|
|
130
|
-
// 转换字段配置
|
|
131
|
-
type: String,
|
|
132
|
-
default: '',
|
|
133
|
-
},
|
|
134
|
-
conditionRule: {
|
|
135
|
-
// 条件模式配置
|
|
136
|
-
type: String,
|
|
137
|
-
default: '',
|
|
138
|
-
},
|
|
139
|
-
conditionType: {
|
|
140
|
-
// 条件模式配置
|
|
141
|
-
type: String,
|
|
142
|
-
default: 'cover',
|
|
143
|
-
},
|
|
144
105
|
},
|
|
145
106
|
data() {
|
|
146
107
|
return {
|
|
@@ -149,6 +110,11 @@
|
|
|
149
110
|
showRowData: false,
|
|
150
111
|
mergeFunc: null,
|
|
151
112
|
mode: 'append',
|
|
113
|
+
modeOptions: [
|
|
114
|
+
{ mode: 'append', desc: '追加导入' },
|
|
115
|
+
{ mode: 'override', desc: '覆盖导入' },
|
|
116
|
+
{ mode: 'merge', desc: '合并导入', disabled: true },
|
|
117
|
+
],
|
|
152
118
|
cacheDicData: {}, // 缓存字典数据
|
|
153
119
|
}
|
|
154
120
|
},
|
|
@@ -156,30 +122,6 @@
|
|
|
156
122
|
columns: function() {
|
|
157
123
|
return eval(decode(this.dataColumns))
|
|
158
124
|
},
|
|
159
|
-
modeOptions() {
|
|
160
|
-
let options = [
|
|
161
|
-
{ mode: 'append', desc: '追加导入' },
|
|
162
|
-
{ mode: 'override', desc: '覆盖导入' },
|
|
163
|
-
{ mode: 'merge', desc: '合并导入' },
|
|
164
|
-
{ mode: 'condition', desc: '条件导入' },
|
|
165
|
-
]
|
|
166
|
-
return options.filter((k) => {
|
|
167
|
-
return this.importModes.includes(k.mode)
|
|
168
|
-
})
|
|
169
|
-
},
|
|
170
|
-
conditionConfig() {
|
|
171
|
-
let config = {}
|
|
172
|
-
if (this.conditionRule) {
|
|
173
|
-
config = JSON.parse(decode(this.conditionRule))
|
|
174
|
-
config.conditionArr.forEach((k) => {
|
|
175
|
-
k.exportField = this.getNameByDesc(k.exportField)
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
conditionType: this.conditionType,
|
|
180
|
-
...config,
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
125
|
},
|
|
184
126
|
watch: {
|
|
185
127
|
dialogVisible: {
|
|
@@ -197,7 +139,7 @@
|
|
|
197
139
|
handler: function(newVal) {
|
|
198
140
|
if (newVal) {
|
|
199
141
|
// 如果有导入合并的代码,则允许选择合并导入模式
|
|
200
|
-
|
|
142
|
+
this.$set(this.modeOptions[2], 'disabled', false)
|
|
201
143
|
// 并设置默认为 合并导入
|
|
202
144
|
this.mode = 'merge'
|
|
203
145
|
// 解码合并的代码
|
|
@@ -214,9 +156,6 @@
|
|
|
214
156
|
}
|
|
215
157
|
},
|
|
216
158
|
mounted() {
|
|
217
|
-
if (this.importModes) {
|
|
218
|
-
this.mode = this.importModes.split(',')[0]
|
|
219
|
-
}
|
|
220
159
|
// 初始化导入时需要的参数
|
|
221
160
|
const pInst = utils.getOnlineFormInstance(this)
|
|
222
161
|
let formUid = pInst && pInst._uid ? pInst._uid : ''
|
|
@@ -235,48 +174,6 @@
|
|
|
235
174
|
// SubPagination.clear(this.dataSubname, this)
|
|
236
175
|
// },
|
|
237
176
|
methods: {
|
|
238
|
-
transformFieldData(data) {
|
|
239
|
-
return new Promise(async (resolve) => {
|
|
240
|
-
if (this.importTransform === '0') {
|
|
241
|
-
resolve(data)
|
|
242
|
-
return
|
|
243
|
-
}
|
|
244
|
-
let fieldTransformData = JSON.parse(decode(this.fieldTransformData))
|
|
245
|
-
for (let i = 0; i < data.length; i++) {
|
|
246
|
-
for (let j = 0; j < fieldTransformData.length; j++) {
|
|
247
|
-
if (fieldTransformData[j].relevancyType == 'value') {
|
|
248
|
-
data[i][fieldTransformData[j].field] =
|
|
249
|
-
fieldTransformData[j].relevancyValue
|
|
250
|
-
} else {
|
|
251
|
-
// 动态时 请求接口修改数据
|
|
252
|
-
let result = await this.sqlChange(
|
|
253
|
-
fieldTransformData[j],
|
|
254
|
-
data[i][fieldTransformData[j].field]
|
|
255
|
-
)
|
|
256
|
-
if (result) {
|
|
257
|
-
data[i][fieldTransformData[j].field] = result
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
resolve(data)
|
|
263
|
-
})
|
|
264
|
-
},
|
|
265
|
-
async sqlChange(config, value = '') {
|
|
266
|
-
return new Promise((resolve) => {
|
|
267
|
-
let sqlStr = config.relevancyValue
|
|
268
|
-
? config.relevancyValue.replace(/{val}/g, value)
|
|
269
|
-
: ''
|
|
270
|
-
sqlStr = sqlStr ? sqlStr.replace(/\n/g, '') : ''
|
|
271
|
-
let params = {
|
|
272
|
-
dsName: config.dataSource,
|
|
273
|
-
sql: sqlStr,
|
|
274
|
-
}
|
|
275
|
-
this.$requestConfig.getValueBySql(params).then((res) => {
|
|
276
|
-
resolve(res)
|
|
277
|
-
})
|
|
278
|
-
})
|
|
279
|
-
},
|
|
280
177
|
changeDictionary(data) {
|
|
281
178
|
return new Promise(async (resolve) => {
|
|
282
179
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -317,28 +214,6 @@
|
|
|
317
214
|
},
|
|
318
215
|
//子表模板导出
|
|
319
216
|
exportFormSub() {
|
|
320
|
-
// 如果是自定义模板
|
|
321
|
-
if (this.templateType == 'custom' && this.customTemplate) {
|
|
322
|
-
let file = JSON.parse(decode(this.customTemplate))[0]
|
|
323
|
-
this.$requestConfig
|
|
324
|
-
.download(file.response.fileId)
|
|
325
|
-
.then(({ data, headers }) => {
|
|
326
|
-
if (data && headers) {
|
|
327
|
-
// 附件下载
|
|
328
|
-
const fileName = decodeURIComponent(
|
|
329
|
-
headers['content-disposition']
|
|
330
|
-
.split(';')[1]
|
|
331
|
-
.split('filename=')[1]
|
|
332
|
-
)
|
|
333
|
-
const blob = new Blob([data])
|
|
334
|
-
saveAs(blob, fileName)
|
|
335
|
-
}
|
|
336
|
-
})
|
|
337
|
-
.catch((err) => {
|
|
338
|
-
this.$message.error(`附件下载失败:${err}`)
|
|
339
|
-
})
|
|
340
|
-
return
|
|
341
|
-
}
|
|
342
217
|
let columns = this.columns.filter((item) => {
|
|
343
218
|
return !(
|
|
344
219
|
item.ctrlType &&
|
|
@@ -388,7 +263,6 @@
|
|
|
388
263
|
let count = this.importRows.length
|
|
389
264
|
if (count > maxRowInt && maxRowInt != 0) {
|
|
390
265
|
this.$message.error('子表数据已超过最大行数【' + maxRowInt + '】')
|
|
391
|
-
this.$refs.selectFile.value = ''
|
|
392
266
|
return
|
|
393
267
|
}
|
|
394
268
|
} else if (this.mode == 'append') {
|
|
@@ -416,16 +290,13 @@
|
|
|
416
290
|
}
|
|
417
291
|
}
|
|
418
292
|
}
|
|
419
|
-
const pInst = utils.getOnlineFormInstance(this.$parent.$parent)
|
|
420
293
|
let importRows = await this.changeDictionary(this.importRows)
|
|
421
|
-
|
|
422
|
-
importRows = await this.transformFieldData(importRows)
|
|
294
|
+
const pInst = utils.getOnlineFormInstance(this.$parent.$parent)
|
|
423
295
|
SubPagination.importData(
|
|
424
296
|
this.dataSubname,
|
|
425
297
|
importRows,
|
|
426
298
|
this.mode,
|
|
427
299
|
this.mergeFunc,
|
|
428
|
-
this.conditionConfig,
|
|
429
300
|
pInst
|
|
430
301
|
)
|
|
431
302
|
.then(() => {
|
|
@@ -433,7 +304,6 @@
|
|
|
433
304
|
this.dialogVisible = false
|
|
434
305
|
})
|
|
435
306
|
.catch((err) => {
|
|
436
|
-
this.$refs.selectFile.value = ''
|
|
437
307
|
this.$message.error(`数据导入失败:${err}`)
|
|
438
308
|
})
|
|
439
309
|
},
|
|
@@ -442,43 +312,10 @@
|
|
|
442
312
|
return
|
|
443
313
|
}
|
|
444
314
|
this.importRows = []
|
|
445
|
-
this.readWorkbookFromLocalFile(m.target.files[0],
|
|
446
|
-
if (this.importMaxRow) {
|
|
447
|
-
let count = rows.length
|
|
448
|
-
if (count > parseInt(this.importMaxRow)) {
|
|
449
|
-
let result = await this.getConfirmValue(
|
|
450
|
-
rows,
|
|
451
|
-
parseInt(this.importMaxRow)
|
|
452
|
-
)
|
|
453
|
-
if (result === false) {
|
|
454
|
-
this.$refs.selectFile.value = ''
|
|
455
|
-
return
|
|
456
|
-
}
|
|
457
|
-
rows = result
|
|
458
|
-
}
|
|
459
|
-
}
|
|
315
|
+
this.readWorkbookFromLocalFile(m.target.files[0], (rows) => {
|
|
460
316
|
this.importRows = this.changeRowKey(rows)
|
|
461
317
|
})
|
|
462
318
|
},
|
|
463
|
-
getConfirmValue(rows, count) {
|
|
464
|
-
return new Promise((resolve) => {
|
|
465
|
-
this.$confirm(
|
|
466
|
-
`导入数据量已超过最大限制,将默认导入前【${count}】条,是否继续?`,
|
|
467
|
-
'提示',
|
|
468
|
-
{
|
|
469
|
-
confirmButtonText: '确定',
|
|
470
|
-
cancelButtonText: '取消',
|
|
471
|
-
type: 'warning',
|
|
472
|
-
}
|
|
473
|
-
)
|
|
474
|
-
.then(() => {
|
|
475
|
-
resolve(rows.slice(0, count))
|
|
476
|
-
})
|
|
477
|
-
.catch(() => {
|
|
478
|
-
resolve(false)
|
|
479
|
-
})
|
|
480
|
-
})
|
|
481
|
-
},
|
|
482
319
|
// 读取本地excel文件
|
|
483
320
|
readWorkbookFromLocalFile(file, callback) {
|
|
484
321
|
const reader = new FileReader()
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
:class="{ 'is-align-right': isAlignRight }"
|
|
16
16
|
>
|
|
17
17
|
<label v-if="label" v-ellipsis :title="label" class="search-field-label">
|
|
18
|
-
<span v-if="isRequired" class="red-color">*</span>
|
|
19
18
|
{{ label }}
|
|
20
19
|
</label>
|
|
21
20
|
</div>
|
|
@@ -168,7 +167,6 @@
|
|
|
168
167
|
type: Boolean,
|
|
169
168
|
default: false,
|
|
170
169
|
},
|
|
171
|
-
isRequired: Boolean,
|
|
172
170
|
},
|
|
173
171
|
data() {
|
|
174
172
|
return {
|
|
@@ -319,9 +317,6 @@
|
|
|
319
317
|
display: inline-block;
|
|
320
318
|
max-width: calc(100% - 10px);
|
|
321
319
|
line-height: 100%;
|
|
322
|
-
.red-color {
|
|
323
|
-
color: #f56c6c;
|
|
324
|
-
}
|
|
325
320
|
|
|
326
321
|
&::after {
|
|
327
322
|
content: ':';
|