Commit f9e39353 authored by 何虹's avatar 何虹 💬

加上db_name

parent d1b267cc
......@@ -49,7 +49,7 @@ class Control {
const { appCode, pageName, controlName, controlType, querySql, mockData, userId, dbName, dbCode, config, data, configType } = param
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_Save @sAppCode='${appCode}',@sPage='${pageName}',@sControl='${controlName}',@sControlType='${controlType || ''}',@sConfig=:sConfig,@sData=:sData,@sQuerySql='${querySql || ''}',@bMockData='${mockData || ''}',@iUserId='${userId}',@iConfigType='${configType}'`,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode,
param: {
sConfig: JSON.stringify(config),
......@@ -78,7 +78,7 @@ class Control {
const { appCode, pageName, controlName, userId, dbName, dbCode, configType } = data
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_Query @sAppCode='${appCode}',@sPage='${pageName}',@sControl='${controlName}',@iUserId='${userId}',@iConfigType='${configType}'`,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode
}
return this.requestClient.post(WEB_QUERY_QUERY, postData)
......@@ -89,7 +89,7 @@ class Control {
const { appCode, pageName, dbName, dbCode } = data
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_SaveAs @sAppCode='${appCode}',@sPage='${pageName}'`,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode
}
return this.requestClient.post(WEB_QUERY_QUERY_VALUE, postData)
......@@ -124,7 +124,7 @@ class Control {
const { execSql, dbName, dbCode } = data
const postData = {
exec_sql: execSql,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode
}
return this.requestClient.post(WEB_QUERY_QUERY, postData)
......@@ -134,7 +134,7 @@ class Control {
const { appCode, pageName, controlName, dbName, dbCode } = data
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='${appCode}',@sPageName='${pageName}',@sControlName='${controlName}'`,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode
}
return this.requestClient.post(WEB_QUERY_QUERY, postData)
......@@ -144,7 +144,7 @@ class Control {
const { appCode, pageName, dbName, dbCode, controlName, version } = data
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_Revert @sAppCode='${appCode}',@sPageName='${pageName}',@sControlName='${controlName}',@iVersion='${version}'`,
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
db_code: dbCode
}
return this.requestClient.post(WEB_QUERY, postData)
......@@ -154,7 +154,7 @@ class Control {
this.packParamHandle(data)
const { dbName, pageName, param, appCode, controlName, returnType, dbCode, userId, configType } = data
const postData = {
db_name: dbName,
db_name: dbName || this.requestClient.getDbName(),
app_code: appCode,
page: pageName,
param: JSON.stringify(param || {}),
......
import axios from 'axios'
import hsUtil from 'hs-util-js'
const urlParam = hsUtil.SystemModule.getUrlParams()
const parseGlobalParams = hsUtil.SystemModule.parseGlobalParams()
class Root {
constructor(_axios) {
this.moduleName = 'rootModule'
......@@ -31,7 +34,7 @@ class Root {
requestConfig (config) {
return axios(config)
}
handleParams(params){
handleParams (params) {
if (params) {
delete params.token
delete params._user_info
......@@ -59,6 +62,11 @@ class Root {
}
}
getDbName () {
if (urlParam.dbName) return urlParam.dbName
if (parseGlobalParams.db_name) return parseGlobalParams.db_name
return ''
}
request (method, url, data, params, headers = null, config = {}) {
this.filterEmptyValue(data)
// 公共头设置
......@@ -70,6 +78,10 @@ class Root {
params && (aixosCtx.params = params)
if (aixosCtx.params && aixosCtx.params.token) delete aixosCtx.params.token
if (aixosCtx.params && aixosCtx.params._user_info) delete aixosCtx.params._user_info
// 给问号参数加上db_name,逻辑是 session中没有 就去取url上的
if (!aixosCtx.params.db_name) {
aixosCtx.params.db_name = this.getDbName()
}
data && (aixosCtx.data = data)
headers && (aixosCtx.headers = headers)
const result = this.axios(aixosCtx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment