|
@@ -433,7 +433,9 @@ export default {
|
|
|
position: null,
|
|
position: null,
|
|
|
importList: [],
|
|
importList: [],
|
|
|
importVlaue: null,
|
|
importVlaue: null,
|
|
|
- snapshotFile: ''
|
|
|
|
|
|
|
+ snapshotFile: '',
|
|
|
|
|
+ hadDoSearch: false
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -757,8 +759,49 @@ export default {
|
|
|
*/
|
|
*/
|
|
|
getFormatParams (outerKey) {
|
|
getFormatParams (outerKey) {
|
|
|
let formParams = {}
|
|
let formParams = {}
|
|
|
- if (this.$refs['searchForm']) {
|
|
|
|
|
- formParams = this.$refs['searchForm'].getSearcFormData() || {}
|
|
|
|
|
|
|
+ const refSerchForm = this.$refs['searchForm']
|
|
|
|
|
+ if (refSerchForm) {
|
|
|
|
|
+ // 首次查询使用模板配置的默认查询条件
|
|
|
|
|
+ if (!this.hadDoSearch) {
|
|
|
|
|
+ const range = ['datePicker', 'dateRange', 'numberRange']
|
|
|
|
|
+ const multiple = ['radio', 'checkbox', 'select']
|
|
|
|
|
+ const { query_columns = [] } = this.template || {}
|
|
|
|
|
+ const defaultValueField = query_columns.filter(i => i.default_value)
|
|
|
|
|
+ defaultValueField.forEach(item => {
|
|
|
|
|
+ const getBuildSearchForm = this.buildSearchForm(item)
|
|
|
|
|
+ const val = item.default_value.split('&')
|
|
|
|
|
+ if (range.includes(item.field_type)) {
|
|
|
|
|
+ // 用于渲染查询表单值
|
|
|
|
|
+ const index = query_columns.findIndex(i => i.name === item.name)
|
|
|
|
|
+ switch (item.field_options.datefmt) {
|
|
|
|
|
+ case 'yyyy':
|
|
|
|
|
+ // 非多选,传值为数组类型控件
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[0]] = val[0] + '-01-01'
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[1]] = val[1] + '-12-31'
|
|
|
|
|
+ refSerchForm.params['daterange-prefix' + index] = val[0]
|
|
|
|
|
+ break
|
|
|
|
|
+ case 'yyyy-MM':
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[0]] = val[0] + '-01'
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[1]] = val[1] + '-31'
|
|
|
|
|
+ refSerchForm.params['daterange-prefix' + index] = val[0]
|
|
|
|
|
+ break
|
|
|
|
|
+ default:
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[0]] = val[0]
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop[1]] = val[1]
|
|
|
|
|
+ refSerchForm.params['daterange-prefix' + index] = [val[0], val[1]]
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ // refSerchForm.params[getBuildSearchForm.modelValue] = val
|
|
|
|
|
+ } else if (multiple.includes(item.field_type)) {
|
|
|
|
|
+ // 多选,且传值为数组类型控件
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop] = val
|
|
|
|
|
+ } else {
|
|
|
|
|
+ refSerchForm.params[getBuildSearchForm.prop] = this.replaceAll(item.default_value, '&', ',')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ formParams = refSerchForm.getSearcFormData() || {}
|
|
|
}
|
|
}
|
|
|
if (this.$utils.isNotEmpty(this.composeParam) && outerKey === 'outside') {
|
|
if (this.$utils.isNotEmpty(this.composeParam) && outerKey === 'outside') {
|
|
|
for (var i in this.composeParam) {
|
|
for (var i in this.composeParam) {
|
|
@@ -790,6 +833,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 查询数据
|
|
// 查询数据
|
|
|
search () {
|
|
search () {
|
|
|
|
|
+ this.hadDoSearch = true
|
|
|
this.loadData()
|
|
this.loadData()
|
|
|
this.addDataCont = {}
|
|
this.addDataCont = {}
|
|
|
},
|
|
},
|
|
@@ -1469,6 +1513,9 @@ export default {
|
|
|
modelValue: `Q^${field.name}^${querySuffix}`
|
|
modelValue: `Q^${field.name}^${querySuffix}`
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ searchColumn = Object.assign(searchColumn, {
|
|
|
|
|
+ itemWidth:field.item_width?field.item_width:''
|
|
|
|
|
+ })
|
|
|
return searchColumn
|
|
return searchColumn
|
|
|
},
|
|
},
|
|
|
buildDisplayColumn (field) {
|
|
buildDisplayColumn (field) {
|
|
@@ -1686,7 +1733,6 @@ export default {
|
|
|
try {
|
|
try {
|
|
|
script.appendChild(document.createTextNode(codeScript))
|
|
script.appendChild(document.createTextNode(codeScript))
|
|
|
} catch (ex) {
|
|
} catch (ex) {
|
|
|
- console.error(ex)
|
|
|
|
|
script.text = codeScript
|
|
script.text = codeScript
|
|
|
}
|
|
}
|
|
|
document.body.appendChild(script)
|
|
document.body.appendChild(script)
|
|
@@ -1720,7 +1766,14 @@ export default {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
JTemplate._afterSubmit(this, action, position, selection, data, callback)
|
|
JTemplate._afterSubmit(this, action, position, selection, data, callback)
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ // 替换字符串中指定的字符
|
|
|
|
|
+ replaceAll (str, find, replace) {
|
|
|
|
|
+ if (str.indexOf(find) === -1) {
|
|
|
|
|
+ return str
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.replaceAll(str.replace(find, replace), find, replace)
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|