提交 8f9204ad 编写于 作者: 雨爱无痕

Fix preview random error

上级 02af129b
...@@ -32,6 +32,12 @@ func (c *DataCtrl) GenerateByFile(ctx iris.Context) { ...@@ -32,6 +32,12 @@ func (c *DataCtrl) GenerateByFile(ctx iris.Context) {
vari.GlobalVars.OutputFormat = "txt" vari.GlobalVars.OutputFormat = "txt"
} }
vari.GlobalVars.ExportFields = nil
field := ctx.URLParamDefault("field", "")
if field != "" {
vari.GlobalVars.ExportFields = strings.Split(field, ",")
}
//root := ctx.URLParam("root") //root := ctx.URLParam("root")
//if root != "" { //if root != "" {
// configUtils.UpdateRootDir(root) // configUtils.UpdateRootDir(root)
...@@ -53,7 +59,7 @@ func (c *DataCtrl) GenerateByFile(ctx iris.Context) { ...@@ -53,7 +59,7 @@ func (c *DataCtrl) GenerateByFile(ctx iris.Context) {
} }
vari.GlobalVars.DefData = domain.DefData{} vari.GlobalVars.DefData = domain.DefData{}
vari.GlobalVars.ExportFields = nil
if defaultFile != "" { if defaultFile != "" {
vari.GlobalVars.ConfigFileDir = fileUtils.GetAbsDir(defaultFile) vari.GlobalVars.ConfigFileDir = fileUtils.GetAbsDir(defaultFile)
} else { } else {
......
...@@ -124,12 +124,11 @@ export function previewDefData (params) { ...@@ -124,12 +124,11 @@ export function previewDefData (params) {
}) })
} }
export function previewFieldData (fieldId, type) { export function previewFieldData (params) {
const data = {'action': 'previewFieldData', id: fieldId, mode: type}
return request({ return request({
url: api.admin, url: `/data/generate`,
method: 'post', method: 'get',
data: data params: params
}) })
} }
......
...@@ -464,9 +464,9 @@ export default { ...@@ -464,9 +464,9 @@ export default {
this.tabKey = activeKey this.tabKey = activeKey
if (this.tabKey === 'preview') { if (this.tabKey === 'preview') {
previewFieldData(this.modelData.id, this.type).then(json => { previewFieldData({config: this.modelProp.referName.replace(/\\/g, "/"), field: this.modelData.field, format: 'txt'}).then(data => {
console.log('previewFieldData', json) console.log('previewFieldData', data)
this.previewData = json.data this.previewData = data
}) })
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册