From f4b9504cad034ddcdef21c2081d14a4984fcd2d3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 七月 2024 17:14:48 +0800
Subject: [PATCH] 2024-07-15
---
src/utils/utils-datamanage.js | 848 +++++++++++++++++++++++++------------------------------
1 files changed, 389 insertions(+), 459 deletions(-)
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index bfd8b07..0415658 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -1,28 +1,21 @@
import md5 from 'md5'
import moment from 'moment'
-import options from '@/store/options.js'
+import { notification, Modal } from 'antd'
+
+import MKEmitter from '@/utils/events.js'
import Utils from './utils.js'
export default class DataUtils {
/**
- * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ
- * @param {Object} setting 鏁版嵁婧愯缃�
- * @param {String} arrFields 鏌ヨ瀛楁
- * @param {Array} search 鎼滅储鏉′欢
- * @param {String} orderBy 鎺掑簭鏂瑰紡
- * @param {Number} pageIndex 椤电爜
- * @param {Number} pageSize 姣忛〉鏁伴噺
- * @param {String} BID 涓婄骇ID
- * @param {String} menuType 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曚笌HS
- * @return {Object} param
+ * @description 鏁版嵁婧愮粺涓�鏌ヨ
*/
- static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, id) {
+ static getQueryDataParams (setting, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id, year) {
let param = null
- if (setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) {
- param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, menuType, id)
+ if (setting.interType === 'system') {
+ param = this.getDefaultQueryParam(setting, search, orderBy, pageIndex, pageSize, id, BID, year)
} else {
- param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, menuType, id)
+ param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id, year)
}
if (BID) {
@@ -39,7 +32,7 @@
/**
* @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙�
*/
- static getCustomQueryParam (setting, search, orderBy, pageIndex, pageSize, menuType, id) {
+ static getCustomQueryParam (setting, search, orderBy, pageIndex, pageSize, id, year) {
let param = Utils.formatCustomMainSearch(search)
if (orderBy) {
@@ -51,22 +44,47 @@
} else if (setting.laypage) {
param.PageIndex = pageIndex
param.PageSize = pageSize
+ } else if (setting.$re_year) {
+ param.mk_year = year
}
- if (setting.interType === 'inner' || (setting.interType === 'custom' && setting.requestMode === 'inner')) {
+ if (setting.hasExtend) {
+ param.mk_time = setting.extendTime
+ }
+
+ if (setting.interType === 'inner') {
param.func = setting.innerFunc
+
+ if (setting.recordUser === 'true') {
+ param.username = sessionStorage.getItem('User_Name') || ''
+ param.fullname = sessionStorage.getItem('Full_Name') || ''
+ }
} else {
- if (menuType === 'HS') {
- if (setting.sysInterface === 'true' && options.cloudServiceApi) {
- param.rduri = options.cloudServiceApi
- } else if (setting.sysInterface !== 'true') {
+ if (setting.sysInterface === 'true') {
+ if (window.GLOB.mainSystemApi) {
+ param.rduri = window.GLOB.mainSystemApi
+ }
+ } else if (setting.sysInterface === 'external') {
+ if (window.GLOB.systemType === 'production') {
+ param.$token = setting.exProInterface || ''
+ } else {
+ param.$token = setting.exInterface || ''
+ }
+ } else if (setting.sysInterface === 'custom') {
+ if (window.GLOB.systemType === 'production') {
+ param.rduri = setting.proInterface
+ } else {
param.rduri = setting.interface
}
} else {
- if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) {
- param.rduri = window.GLOB.mainSystemApi
- } else if (setting.sysInterface !== 'true') {
- param.rduri = window.GLOB.systemType === 'production' ? (setting.proInterface || setting.interface) : setting.interface
+ if (window.GLOB.systemType === 'production' && setting.proInterface) {
+ param.rduri = setting.proInterface
+ } else {
+ param.rduri = setting.interface
+ }
+ let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+ if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) {
+ param.$login = true
}
}
@@ -79,148 +97,247 @@
}
/**
- * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁�
+ * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁�
*/
- static getDefaultQueryParam (setting, arrFields, search, orderBy, pageIndex, pageSize, menuType, id) {
+ static getDefaultQueryParam (setting, search, orderBy, pageIndex, pageSize, id, BID, year) {
let param = {
func: 'sPC_Get_TableData',
obj_name: 'data',
- exec_type: 'y',
- arr_field: arrFields,
+ exec_type: window.GLOB.execType || 'y',
+ arr_field: setting.arr_field,
default_sql: setting.execute ? 'true' : 'false'
}
let userName = sessionStorage.getItem('User_Name') || ''
let fullName = sessionStorage.getItem('Full_Name') || ''
+ let RoleID = sessionStorage.getItem('role_id') || ''
+ let departmentcode = sessionStorage.getItem('departmentcode') || ''
+ let organization = sessionStorage.getItem('organization') || ''
+ let mk_user_type = sessionStorage.getItem('mk_user_type') || ''
+ let nation = sessionStorage.getItem('nation') || ''
+ let province = sessionStorage.getItem('province') || ''
let city = sessionStorage.getItem('city') || ''
-
- if (sessionStorage.getItem('isEditState') === 'true') {
- userName = sessionStorage.getItem('CloudUserName') || ''
- fullName = sessionStorage.getItem('CloudFullName') || ''
- }
+ let district = sessionStorage.getItem('district') || ''
+ let address = sessionStorage.getItem('address') || ''
let _dataresource = setting.dataresource
let _customScript = ''
+ let _tailScript = setting.tailScript || ''
if (setting.customScript) {
- _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
- Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
+ _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
${setting.customScript}
`
}
- _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '')
- _customScript = _customScript.replace(/@select\$|\$select@/ig, '')
- _dataresource = _dataresource.replace(/\$sum@/ig, '/*')
- _dataresource = _dataresource.replace(/@sum\$/ig, '*/')
- _customScript = _customScript.replace(/\$sum@/ig, '/*')
- _customScript = _customScript.replace(/@sum\$/ig, '*/')
+ let allSearch = Utils.getAllSearchOptions(search)
+ let regoptions = allSearch.map(item => {
+ return {
+ reg: new RegExp('@' + item.key + '@', 'ig'),
+ value: `'${item.value}'`
+ }
+ })
+ regoptions.push(
+ { reg: /@orderBy@/ig, value: orderBy },
+ { reg: /@pageSize@/ig, value: setting.laypage ? pageSize : '9999' },
+ { reg: /@pageIndex@/ig, value: pageIndex},
+ { reg: /@select\$|\$select@/ig, value: ''},
+ { reg: /\$sum@/ig, value: '/*'},
+ { reg: /@sum\$/ig, value: '*/'},
+ { reg: /@ID@/ig, value: `'${id || ''}'`},
+ { reg: /@BID@/ig, value: `'${BID || ''}'`},
+ { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`},
+ { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`},
+ { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`},
+ { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`},
+ { reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`},
+ { reg: /@typename@/ig, value: `'admin'`},
+ )
- let regoptions = null
- if (setting.queryType === 'statistics' || _customScript) {
- let allSearch = Utils.getAllSearchOptions(search)
- regoptions = allSearch.map(item => {
- return {
- reg: new RegExp('@' + item.key + '@', 'ig'),
- value: `'${item.value}'`
- }
- })
- regoptions.push({
- reg: new RegExp('@orderBy@', 'ig'),
- value: orderBy
- }, {
- reg: new RegExp('@pageSize@', 'ig'),
- value: setting.laypage ? pageSize : '9999'
- }, {
- reg: new RegExp('@pageIndex@', 'ig'),
- value: pageIndex
- })
+ if (setting.hasExtend) {
+ regoptions.push({ reg: /@mk_time@/ig, value: setting.extendTime })
}
+ if (setting.$re_year) {
+ regoptions.push({ reg: /@mk_year@/ig, value: year })
+ }
+
+ regoptions.forEach(item => {
+ _dataresource = _dataresource.replace(item.reg, item.value)
+ _customScript = _customScript.replace(item.reg, item.value)
+ _tailScript = _tailScript.replace(item.reg, item.value)
+ })
let _search = ''
- if (setting.queryType === 'statistics' && _dataresource) { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
- regoptions.forEach(item => {
- _dataresource = _dataresource.replace(item.reg, item.value)
- })
- } else if (_dataresource && !id) {
- _search = Utils.joinMainSearchkey(search)
- if (_search) {
- _search = 'where ' + _search
+ if (_dataresource) {
+ let id_search = ''
+ if (id) {
+ if (/^excel:/.test(id)) {
+ id_search = `${setting.primaryKey} in (select ID from dbo.SplitComma('${id.replace(/^excel:/, '')}'))`
+ } else {
+ id_search = `${setting.primaryKey || 'ID'}='${id}'`
+ orderBy = ''
+ }
}
- } else if (_dataresource && id) {
- _search = Utils.joinMainSearchkey(search)
- _search = `where ${_search ? _search + ' AND ' : ''} ${setting.primaryKey || 'ID'}='${id}'`
+
+ if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
+ if (id) {
+ _dataresource = _dataresource + ` where ${id_search}`
+ }
+ } else if (id) {
+ _search = Utils.joinMainSearchkey(search)
+ _search = `where ${_search ? _search + ' AND ' : ''} ${id_search}`
+ } else {
+ _search = Utils.joinMainSearchkey(search)
+ _search = _search ? 'where ' + _search : ''
+ }
}
if (_customScript) {
- regoptions.forEach(item => {
- _customScript = _customScript.replace(item.reg, item.value)
- })
+ if (window.GLOB.breakpoint) {
+ _customScript = _customScript.replace(/\$breakpoint_proc@/ig, window.GLOB.breakpoint)
+ param.func = 'sPC_Get_TableData_debug'
+ }
}
let LText = ''
let DateCount = ''
+ let arr_field = setting.all_field || setting.arr_field
- if (_dataresource && setting.laypage && orderBy && !id) {
- LText = ` select top ${pageSize} ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows `
- DateCount = `select count(1) as total from ${_dataresource} ${_search}`
- } else if (_dataresource && orderBy) {
- LText = ` select ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows `
- } else if (_dataresource) {
- LText = ` select ${arrFields} from ${_dataresource} ${_search} `
- }
-
- if (_customScript) {
- if (LText) {
- LText = `${LText}
- aaa:
- if @ErrorCode!=''
- insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
- `
+ if (_dataresource) {
+ if (setting.custompage) {
+ LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} `
+ } else if (setting.laypage && orderBy) {
+ LText = `/*system_query*/select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows `
+ if (setting.sub_field) {
+ DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a`
+ } else {
+ DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}`
+ }
+ } else if (setting.$top) {
+ if (orderBy) {
+ LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by ${orderBy} `
+ } else {
+ LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} `
+ }
+ } else if (orderBy) {
+ LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by ${orderBy} `
} else {
- _customScript = `${_customScript}
- aaa:
- if @ErrorCode!=''
- insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
- `
+ LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} `
}
}
+ if (_customScript) {
+ if (DateCount) {
+ DateCount = `${DateCount}
+ ${_tailScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ } else if (LText) {
+ LText = `${LText}
+ ${_tailScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ } else {
+ _customScript = `${_customScript}
+ ${_tailScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ }
+ } else if (_tailScript && DateCount) {
+ LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+ ${LText}
+ `
+ DateCount = `${DateCount}
+ ${_tailScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ } else if (_tailScript) {
+ LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+ ${LText}
+ ${_tailScript}
+ aaa:
+ if @ErrorCode!=''
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ } else {
+ LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+ ${LText}
+ `
+ }
+
// 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
- if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
- _customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
- LText && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧�*/\n` : ''}` + LText)
+ if (window.GLOB.debugger === true) {
+ _customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
+ LText && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧�*/\n` : ''}` + LText.replace(/\n\s{8}/ig, '\n'))
+ DateCount && console.info(`${setting.$name ? `/*${setting.$name} 鎬绘暟鏌ヨ*/\n` : ''}` + DateCount.replace(/\n\s{8}/ig, '\n'))
}
if (setting.$name) {
param.menuname = setting.$name
}
- param.custom_script = Utils.formatOptions(_customScript)
- param.LText = Utils.formatOptions(LText)
- param.DateCount = Utils.formatOptions(DateCount)
+ param.custom_script = Utils.formatOptions(_customScript, param.exec_type)
+ param.LText = Utils.formatOptions(LText, param.exec_type)
+ param.DateCount = Utils.formatOptions(DateCount, param.exec_type)
- // exec_type: 'y' 瑙g爜瀛楁锛歀Text銆丩Text1銆丩Text2銆乧ustom_script銆丏ateCount
+ if (setting.sub_field) {
+ param.sub_name = setting.subdata
+ param.tabid = setting.primaryKey || ''
+ param.parid = setting.subBID || ''
+ param.sub_field = setting.sub_field
+ }
- param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+ // exec_type 瑙g爜瀛楁锛歀Text銆丩Text1銆丩Text2銆乧ustom_script銆丏ateCount
+
+ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss.SSS')
param.secretkey = Utils.encrypt('', param.timestamp)
- if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉
+ param.username = userName
+ param.fullname = fullName
+
+ if (window.GLOB.probation) {
+ param.s_debug_type = 'Y'
+ }
+
+ if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉
param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
+
+ // special HS鑷畾涔夊嚱鏁版煡璇�
+ if (setting.tableName === 's_custom_script' && window.GLOB.mainSystemApi) {
+ param.rduri = window.GLOB.mainSystemApi
+ }
+ } else if (window.GLOB.forcedUpdate) {
+ param.s_version_up = 'true'
+ }
+
+ if (setting.database === 'sso' && window.GLOB.mainSystemApi) {
+ param.rduri = window.GLOB.mainSystemApi
}
return param
}
/**
- * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鍚堣鍊肩殑鍙傛暟
+ * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鍚堣鍊肩殑鍙傛暟
*/
- static getStatQueryDataParams (setting, statFields, search, orderBy, BID, menuType) {
+ static getStatQueryDataParams (setting, statFields, search, orderBy, BID) {
let param = {
func: 'sPC_Get_TableData',
obj_name: 'data',
- exec_type: 'y',
+ exec_type: window.GLOB.execType || 'y',
arr_field: statFields.map(col => col.field).join(','),
default_sql: setting.execute ? 'true' : 'false'
}
@@ -229,95 +346,98 @@
let _customScript = ''
let userName = sessionStorage.getItem('User_Name') || ''
let fullName = sessionStorage.getItem('Full_Name') || ''
+ let RoleID = sessionStorage.getItem('role_id') || ''
+ let departmentcode = sessionStorage.getItem('departmentcode') || ''
+ let organization = sessionStorage.getItem('organization') || ''
+ let mk_user_type = sessionStorage.getItem('mk_user_type') || ''
+ let nation = sessionStorage.getItem('nation') || ''
+ let province = sessionStorage.getItem('province') || ''
let city = sessionStorage.getItem('city') || ''
-
- if (sessionStorage.getItem('isEditState') === 'true') {
- userName = sessionStorage.getItem('CloudUserName') || ''
- fullName = sessionStorage.getItem('CloudFullName') || ''
- }
+ let district = sessionStorage.getItem('district') || ''
+ let address = sessionStorage.getItem('address') || ''
if (setting.customScript) {
- _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
- Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
+ _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
${setting.customScript}
`
}
- _dataresource = _dataresource.replace(/@sum\$|\$sum@/ig, '')
- _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '')
- _dataresource = _dataresource.replace(/\$select@/ig, '/*')
- _dataresource = _dataresource.replace(/@select\$/ig, '*/')
- _customScript = _customScript.replace(/\$select@/ig, '/*')
- _customScript = _customScript.replace(/@select\$/ig, '*/')
+ let allSearch = Utils.getAllSearchOptions(search)
+ let regoptions = allSearch.map(item => {
+ return {
+ reg: new RegExp('@' + item.key + '@', 'ig'),
+ value: `'${item.value}'`
+ }
+ })
- let regoptions = null
- if (setting.queryType === 'statistics' || _customScript) {
- let allSearch = Utils.getAllSearchOptions(search)
+ regoptions.push(
+ { reg: /@orderBy@/ig, value: orderBy },
+ { reg: /@pageSize@/ig, value: 999999 },
+ { reg: /@pageIndex@/ig, value: 1},
+ { reg: /\$select@/ig, value: '/*'},
+ { reg: /@select\$/ig, value: '*/'},
+ { reg: /@sum\$|\$sum@/ig, value: ''},
+ { reg: /@ID@/ig, value: `''`},
+ { reg: /@BID@/ig, value: `'${BID || ''}'`},
+ { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`},
+ { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`},
+ { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`},
+ { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`},
+ { reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`},
+ { reg: /@typename@/ig, value: `'admin'`},
+ )
- regoptions = allSearch.map(item => {
- return {
- reg: new RegExp('@' + item.key + '@', 'ig'),
- value: `'${item.value}'`
- }
- })
- regoptions.push({
- reg: new RegExp('@orderBy@', 'ig'),
- value: orderBy
- }, {
- reg: new RegExp('@pageSize@', 'ig'),
- value: 999999
- }, {
- reg: new RegExp('@pageIndex@', 'ig'),
- value: 1
- })
- }
+ regoptions.forEach(item => {
+ _dataresource = _dataresource.replace(item.reg, item.value)
+ _customScript = _customScript.replace(item.reg, item.value)
+ })
- let _search = Utils.joinMainSearchkey(search)
- if (_search) {
- _search = 'where ' + _search
- }
+ let _search = ''
- if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
- regoptions.forEach(item => {
- _dataresource = _dataresource.replace(item.reg, item.value)
- })
- _search = ''
+ if (setting.queryType !== 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
+ _search = Utils.joinMainSearchkey(search)
+ if (_search) {
+ _search = 'where ' + _search
+ }
}
- if (_customScript) {
- regoptions.forEach(item => {
- _customScript = _customScript.replace(item.reg, item.value)
- })
- }
-
- let LText = ` select ${statFields.map(col => `isnull(sum(${col.field}),0) as ${col.field}`).join(',')} from ${_dataresource} ${_search} `
+ let LText = ` /*system_query*/select ${statFields.map(col => `isnull(sum(${col.field}),0) as ${col.field}`).join(',')} from ${_dataresource} ${_search} `
if (_customScript) {
LText = `${LText}
aaa:
if @ErrorCode!=''
- insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
+ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}'
+ `
+ } else {
+ LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+ ${LText}
`
}
// 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
- if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
+ if (window.GLOB.debugger === true) {
_customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈� 缁熻鏌ヨ*/\n` : ''}${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
- LText && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧� 缁熻鏌ヨ*/\n` : ''}` + LText)
+ LText && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧� 缁熻鏌ヨ*/\n` : ''}` + LText.replace(/\n\s{8}/ig, '\n'))
}
if (setting.$name) {
param.menuname = setting.$name
}
- param.custom_script = Utils.formatOptions(_customScript)
- param.LText = Utils.formatOptions(LText)
+ param.custom_script = Utils.formatOptions(_customScript, param.exec_type)
+ param.LText = Utils.formatOptions(LText, param.exec_type)
param.DateCount = ''
param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
param.secretkey = Utils.encrypt('', param.timestamp)
- if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉
+ param.username = userName
+ param.fullname = fullName
+
+ if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉
param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
}
@@ -334,291 +454,67 @@
}
/**
- * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ
- * @param {Object} setting 鏁版嵁婧愯缃�
- * @param {String} arrFields 鏌ヨ瀛楁
- * @param {Array} search 鎼滅储鏉′欢
- * @param {String} orderBy 鎺掑簭鏂瑰紡
- * @param {Number} pageIndex 椤电爜
- * @param {Number} pageSize 姣忛〉鏁伴噺
- * @param {String} BID 涓婄骇ID
- * @param {String} menuType 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曚笌HS
- * @return {Object} param
+ * @description 鏁版嵁鑾峰彇鎴愬姛
*/
- static getPrevQueryParams (setting, search = [], BID, menuType) {
- let param = null
+ static querySuccess (result) {
+ if (!result.message) return
- if (setting.procMode !== 'inner') {
- param = this.getDefaultPrevQueryParam(setting, search, menuType)
- } else {
- param = Utils.formatCustomMainSearch(search)
- param.func = setting.prevFunc || ''
+ if (result.ErrCode === 'Y') {
+ Modal.success({
+ title: result.message
+ })
+ } else if (result.ErrCode === 'S') {
+ notification.success({
+ top: 92,
+ message: result.message,
+ duration: 2
+ })
}
-
- if (BID) {
- param.BID = BID
- }
-
- return param
}
/**
- * @description 鑾峰彇绯荤粺鍓嶇疆鑴氭湰
+ * @description 鏁版嵁鑾峰彇澶辫触
*/
- static getDefaultPrevQueryParam (setting, search, menuType) {
- let param = {
- func: 'sPC_TableData_InUpDe',
- exec_type: 'y',
- script_type: 'Y'
- }
-
- let sql = ''
- let userName = sessionStorage.getItem('User_Name') || ''
- let fullName = sessionStorage.getItem('Full_Name') || ''
- let city = sessionStorage.getItem('city') || ''
-
- if (sessionStorage.getItem('isEditState') === 'true') {
- userName = sessionStorage.getItem('CloudUserName') || ''
- fullName = sessionStorage.getItem('CloudFullName') || ''
- }
-
- setting.preScripts.forEach(item => {
- if (item.status === 'false') return
- sql += `${item.sql}
- `
- })
-
- if (sql) {
- sql = `/*鍓嶇疆鑴氭湰*/
- declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
- Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
- ${sql}
- aaa:
- if @ErrorCode!=''
- insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
- `
-
- let allSearch = Utils.getAllSearchOptions(search)
- let regoptions = allSearch.map(item => {
- return {
- reg: new RegExp('@' + item.key + '@', 'ig'),
- value: `'${item.value}'`
- }
- })
- regoptions.push({
- reg: new RegExp('@login_city@', 'ig'),
- value: `'${city}'`
- }, {
- reg: new RegExp('@userName@', 'ig'),
- value: `'${userName}'`
- }, {
- reg: new RegExp('@fullName@', 'ig'),
- value: `'${fullName}'`
- })
-
- regoptions.forEach(item => {
- sql = sql.replace(item.reg, item.value)
- })
-
- // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
- if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
- console.info(sql.replace(/\n\s{8}/ig, '\n'))
- }
- }
-
- if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
- sql = sql.replace(/\$@/ig, '/*')
- sql = sql.replace(/@\$/ig, '*/')
- } else {
- sql = sql.replace(/@\$|\$@/ig, '')
- }
-
- param.LText = Utils.formatOptions(sql)
- param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
- param.secretkey = Utils.encrypt('', param.timestamp)
-
- if (menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
- param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
- }
-
- param.menuname = setting.MenuName || ''
-
- return param
- }
-
- /**
- * @description 鑾峰彇绯荤粺鍥炶皟鑴氭湰
- */
- static getCallBackQueryParams (setting, sql, errSql) {
- let param = {
- func: 'sPC_TableData_InUpDe',
- exec_type: 'y',
- }
-
- let userName = sessionStorage.getItem('User_Name') || ''
- let fullName = sessionStorage.getItem('Full_Name') || ''
- let city = sessionStorage.getItem('city') || ''
-
- if (sessionStorage.getItem('isEditState') === 'true') {
- userName = sessionStorage.getItem('CloudUserName') || ''
- fullName = sessionStorage.getItem('CloudFullName') || ''
- }
-
- let _prevCustomScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
- Select @ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
- ${errSql}
- `
- let _backCustomScript = `
- `
-
- setting.cbScripts.forEach(script => {
- if (script.status === 'false') return
-
- if (script.position === 'front') {
- _prevCustomScript += `
- /* 鑷畾涔夎剼鏈� */
- ${script.sql}
- `
- } else {
- _backCustomScript += `
- /* 鑷畾涔夎剼鏈� */
- ${script.sql}
- `
- }
- })
-
- _backCustomScript += `
- aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
-
- sql = _prevCustomScript + sql
- sql = sql + _backCustomScript
-
- if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
- console.info(sql.replace(/\n\s{8}/ig, '\n'))
- }
-
- param.LText = sql
+ static queryFail (result) {
+ if (!result.message && result.ErrCode !== 'version_up') return
- if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
- param.LText = param.LText.replace(/\$@/ig, '/*')
- param.LText = param.LText.replace(/@\$/ig, '*/')
- } else {
- param.LText = param.LText.replace(/@\$|\$@/ig, '')
- }
-
- param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
- param.secretkey = Utils.encrypt('', param.timestamp)
- param.LText = Utils.formatOptions(param.LText)
- param.menuname = setting.MenuName || ''
-
- return param
- }
-
- /**
- * @description 鑾峰彇鍥炶皟sql
- */
- static getCallBackSql (setting, result) {
- let lines = []
- let pre = setting.callbackType === 'script' ? '@' : ''
-
- let getDefaultSql = (obj, tb, bid, level) => {
- let keys = []
- let vals = []
- let subObjs = []
- let id = Utils.getuuid()
-
- delete obj.$$key
-
- Object.keys(obj).forEach(key => {
- let val = obj[key]
- if (val === null || val === undefined) return
- if (typeof(val) === 'object') {
- if (Array.isArray(val)) {
- val.forEach(item => {
- if (typeof(item) !== 'object' || Array.isArray(item)) return
- if (Object.keys(item).length > 0) {
- item.$$key = tb + '_' + key
- subObjs.push(item)
- }
- })
- } else if (Object.keys(val).length > 0) {
- val.$$key = tb + '_' + key
- subObjs.push(val)
- }
- } else {
- if (typeof(val) === 'string') {
- val = val.replace(/'/ig, '"')
- }
- keys.push(key)
- vals.push(`'${val}'`)
- }
+ if (result.ErrCode === 'N') {
+ Modal.error({
+ title: result.message,
})
-
- lines.push({
- table: tb,
- insert: `Insert into ${pre}${tb} (${keys.join(',')},mk_level,mk_id,mk_bid)`,
- select: `Select ${vals.join(',')},'${level}','${id}','${bid}'`
- })
-
- subObjs.forEach(item => {
- getDefaultSql(item, item.$$key, id, level + 1)
+ } else if (result.ErrCode === 'version_up') {
+ MKEmitter.emit('reloadTabs')
+ } else if (result.ErrCode !== '-2') {
+ notification.error({
+ top: 92,
+ message: result.message,
+ duration: 10
})
}
-
- getDefaultSql(result, setting.cbTable, '', 1)
-
- let lineMap = new Map()
- lines.forEach(line => {
- if (lineMap.has(line.table)) {
- let _line = lineMap.get(line.table)
- _line.selects.push(line.select)
- lineMap.set(line.table, _line)
- } else {
- lineMap.set(line.table, {
- table: line.table,
- insert: line.insert,
- selects: [line.select]
- })
- }
- })
-
- return [...lineMap.values()]
}
}
/**
* @description 鐢熸垚鍗曚釜缁勪欢sPC_Get_structured_data璇锋眰鍙傛暟
*/
-export function getStructDefaultParam (component, searchlist) {
- const { columns, setting, dataName, format } = component
+export function getStructDefaultParam (component, searchlist, first) {
+ const { columns, setting, dataName, format, uuid } = component
- let arr_field = columns.map(col => col.field)
let _dataresource = setting.dataresource
let _customScript = setting.customScript
- if (setting.queryType === 'statistics' || _customScript) {
- let allSearch = Utils.getAllSearchOptions(searchlist)
- let regoptions = allSearch.map(item => {
- return {
- reg: new RegExp('@' + item.key + '@', 'ig'),
- value: `'${item.value}'`
- }
- })
+ let allSearch = Utils.getAllSearchOptions(searchlist)
+ let regoptions = allSearch.map(item => {
+ return {
+ reg: new RegExp('@' + item.key + '@', 'ig'),
+ value: `'${item.value}'`
+ }
+ })
- regoptions.forEach(item => {
- if (_dataresource && setting.queryType === 'statistics') {
- _dataresource = _dataresource.replace(item.reg, item.value)
- }
- _customScript = _customScript.replace(item.reg, item.value)
- })
- }
-
- _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '')
- _customScript = _customScript.replace(/@select\$|\$select@/ig, '')
- _dataresource = _dataresource.replace(/\$sum@/ig, '/*')
- _dataresource = _dataresource.replace(/@sum\$/ig, '*/')
- _customScript = _customScript.replace(/\$sum@/ig, '/*')
- _customScript = _customScript.replace(/@sum\$/ig, '*/')
+ regoptions.forEach(item => {
+ _dataresource = _dataresource.replace(item.reg, item.value)
+ _customScript = _customScript.replace(item.reg, item.value)
+ })
let _search = ''
if (setting.queryType !== 'statistics' && _dataresource) {
@@ -626,22 +522,44 @@
_search = _search ? 'where ' + _search : ''
}
- if (setting.order && _dataresource) {
- _dataresource = `select top 1000 ${arr_field.join(',')} from (select ${arr_field.join(',')} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows `
+ if (setting.$top) {
+ if (setting.order && _dataresource) {
+ _dataresource = `select top 1 ${setting.arr_field} from ${_dataresource} ${_search} order by ${setting.order} `
+ } else if (_dataresource) {
+ _dataresource = `select top 1 ${setting.arr_field} from ${_dataresource} ${_search} `
+ }
+ } else if (setting.order && _dataresource) {
+ _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ${_search} order by ${setting.order} `
} else if (_dataresource) {
- _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ${_search} `
+ _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ${_search} `
}
- // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
- if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
- _customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
- _dataresource && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧�*/\n` : ''}` + _dataresource)
+ if (first) {
+ let userName = sessionStorage.getItem('User_Name') || ''
+ let fullName = sessionStorage.getItem('Full_Name') || ''
+ let RoleID = sessionStorage.getItem('role_id') || ''
+ let departmentcode = sessionStorage.getItem('departmentcode') || ''
+ let organization = sessionStorage.getItem('organization') || ''
+ let mk_user_type = sessionStorage.getItem('mk_user_type') || ''
+ let nation = sessionStorage.getItem('nation') || ''
+ let province = sessionStorage.getItem('province') || ''
+ let city = sessionStorage.getItem('city') || ''
+ let district = sessionStorage.getItem('district') || ''
+ let address = sessionStorage.getItem('address') || ''
+
+ _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+ select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+ ${_customScript}
+ `
}
return {
+ uuid: uuid,
name: dataName,
+ $name: setting.$name,
columns: columns,
par_tablename: '',
+ order: setting.order || '',
type: format === 'array' ? format : '',
primaryKey: setting.primaryKey || '',
foreign_key: '',
@@ -652,52 +570,64 @@
/**
* @description 鐢熸垚sPC_Get_structured_data璇锋眰鍙傛暟
- * 1銆佹妸澶ф帴鍙PC_Get_structured_data鐨刲text鎷嗘垚涓変唤锛岀涓�娈碉細@LText1锛岀浜屾@LText锛岀涓夋@LText2
*/
-export function getStructuredParams (params, config, BID = '') {
+export function getStructuredParams (params, config, BID) {
let LText_field = []
let diffUser = false
- let userName = sessionStorage.getItem('User_Name') || ''
- let fullName = sessionStorage.getItem('Full_Name') || ''
- let city = sessionStorage.getItem('city') || ''
- if (sessionStorage.getItem('isEditState') === 'true') {
- userName = sessionStorage.getItem('CloudUserName') || ''
- fullName = sessionStorage.getItem('CloudFullName') || ''
- }
-
+ let regoptions = [
+ { reg: /@pageSize@/ig, value: 9999 },
+ { reg: /@pageIndex@/ig, value: 1},
+ { reg: /@ID@/ig, value: `''`},
+ { reg: /@BID@/ig, value: `'${BID || ''}'`},
+ { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`},
+ { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`},
+ { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`},
+ { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`},
+ { reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`},
+ { reg: /@typename@/ig, value: `'admin'`},
+ ]
+
let _LText = params.map((item, index) => {
let _script = item.script
+ let _sql = item.sql
- if (index === 0) {
- _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@login_city nvarchar(50)
- select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @login_city='${city}'
- ${_script}
- `
- }
if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) {
diffUser = true
+ }
+
+ _sql = _sql.replace(/@orderBy@/ig, item.order)
+ _script = _script.replace(/@orderBy@/ig, item.order)
+
+ regoptions.forEach(cell => {
+ _sql = _sql.replace(cell.reg, cell.value)
+ _script = _script.replace(cell.reg, cell.value)
+ })
+
+ // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
+ if (window.GLOB.debugger === true) {
+ _script && console.info(`${item.$name ? `/*${item.$name} 鑷畾涔夎剼鏈紙鍚屾鏌ヨ锛�*/\n` : ''}${_sql ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_script}`)
+ _sql && console.info(`${item.$name ? `/*${item.$name} 鏁版嵁婧愶紙鍚屾鏌ヨ锛�*/\n` : ''}` + _sql)
}
item.columns.forEach(cell => {
LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`)
})
- return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(item.sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
+ return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
})
let param = {
func: 'sPC_Get_structured_data',
- LText: _LText.join(' union all '),
- LText_field: LText_field.join(' union all '),
- BID: BID
+ BID: BID,
+ username: sessionStorage.getItem('User_Name') || '',
+ fullName: sessionStorage.getItem('Full_Name') || ''
}
- let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
+ param.menuname = config.MenuName || config.$menuname || ''
- param.LText1 = LText1
- param.LText = LText
- param.LText2 = LText2
- param.LText_field = Utils.formatOptions(param.LText_field)
+ param.exec_type = window.GLOB.execType || 'y'
+ param.LText = Utils.formatOptions(_LText.join(' union all '), param.exec_type)
+ param.custom_script = Utils.formatOptions(LText_field.join(' union all '), param.exec_type)
if (config.cacheUseful === 'true') {
param.time_type = config.timeUnit
@@ -709,7 +639,7 @@
}
param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
- param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+ param.secretkey = Utils.encrypt('', param.timestamp)
return param
}
\ No newline at end of file
--
Gitblit v1.8.0