diff --git a/src/components/CustomPages/PF/PFCommonApprove.js b/src/components/CustomPages/PF/PFCommonApprove.js index 6e5e223..a5745fc 100644 --- a/src/components/CustomPages/PF/PFCommonApprove.js +++ b/src/components/CustomPages/PF/PFCommonApprove.js @@ -94,7 +94,7 @@ class PFCommonApprove extends React.Component { } onsubmit = () => { this.props.form.validateFields((err, values) => { - console.log(this.state.data) + // console.log(this.state.data) //console.log('Received values of form: ', values); if (err) { return; @@ -369,10 +369,9 @@ class PFCommonApprove extends React.Component { stepDisplay: 'block' }); } - debugger const json = initFilter(that.props.login.OrgId) extendRule(json, 'ID', 1, dataId); - json.Parameter1 = that.props.data.TASK_ORGID + json.Parameter22 = that.props.data.TASK_ORGID json.Parameter2 = that.props.data.TaskID extendInclude(json, "Nav_ApproveDetails") @@ -388,6 +387,7 @@ class PFCommonApprove extends React.Component { data: { id: re.Data.DATA_ID, isShow: true, enums: that.props.app.enums, + TASK_ORGID: that.props.data?.TASK_ORGID // loadDataDeal: this.loadDataDeal, // btnDisplay : 'none' }, diff --git a/src/components/CustomPages/SK/SK033ShowPrint.js b/src/components/CustomPages/SK/SK033ShowPrint.js index 8082092..3146406 100644 --- a/src/components/CustomPages/SK/SK033ShowPrint.js +++ b/src/components/CustomPages/SK/SK033ShowPrint.js @@ -12,6 +12,7 @@ import moment from 'moment'; import Item from "antd/lib/list/Item"; class SK033ShowPrint extends React.Component { constructor(props) { + debugger super(props); this.state = { data: null, @@ -42,6 +43,7 @@ class SK033ShowPrint extends React.Component { loadData = (dataId, taskID) => { let json = initFilter(this.props.login.OrgId); + json.Parameter22 = this.props.data?.TASK_ORGID extendRule(json, 'ID', 1, dataId); // extendRule(json, 'TASK_ID', 1, taskID); // extendInclude(json, 'Nav_ApplyUser'); diff --git a/src/utils/request.js b/src/utils/request.js index e87fb03..e338579 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -26,7 +26,7 @@ export function request(url, options, onlyData, requestKey, onException) { data.IsSuccessful !== undefined && !data.IsSuccessful && message.error(data.ErrorMessage) return onlyData ? data.Data : data }).catch(err => { - + requestKey && window.localStorage.removeItem(requestKey) onException instanceof Function && onException(err) throw err; // 重新抛出错误,确保错误被正确传播 @@ -40,7 +40,7 @@ export function request(url, options, onlyData, requestKey, onException) { * @param {*} isIgnoreTenant * @returns */ -export function getRequestHeaders(url, type = 'post', isIgnoreTenant) { +export function getRequestHeaders(url, type = 'post', data, isIgnoreTenant) { // 请求参数 const addHeader = 'Bearer ' + storage('lacal').getItem('accessToken').val const userId = storage('lacal').getItem('userid').val @@ -72,9 +72,6 @@ export function getRequestHeaders(url, type = 'post', isIgnoreTenant) { const latestOrgid = storage('lacal').getItem('Orgid').val const latestUserid = storage('lacal').getItem('Userid').val const latestUsername = storage('lacal').getItem('Username').val - - - if (latestTenant) { headers.Tenant = latestTenant } @@ -93,6 +90,13 @@ export function getRequestHeaders(url, type = 'post', isIgnoreTenant) { } else if (url.indexOf('OP') != 0 && !isIgnoreTenant) { headers.Tenant = Tenant } + + //wyw + if (Tenant && Tenant == '003' && data && data.Parameter22 && data.Parameter22.length > 20) { + //总公司 Parameter22 存入子公司的ORG_ID 自动切换数据库链接 + headers.Tenant = data.Parameter22.substring(0, 3) + } + return headers } @@ -122,7 +126,7 @@ export function httpPost(url, data, onlyData = true, ignoreThrottle, onException // 发起请求 return request(url, { method: 'POST', - headers: getRequestHeaders(url, 'post', isIgnoreTenant), + headers: getRequestHeaders(url, 'post', data, isIgnoreTenant), body: dataStr, }, onlyData, requestKey, onException) } @@ -142,6 +146,6 @@ export function httpGet(url, data, onlyData = true, onException) { url = formParams ? formUrl : url return request(url, { method: 'GET', - headers: getRequestHeaders(url, 'get'), + headers: getRequestHeaders(url, 'get', data), }, onlyData, null, onException) }