| | |
| | | /** |
| | | * @description 文件上传 |
| | | */ |
| | | getFileUpload (file) { |
| | | const param = new FormData() |
| | | param.append('file', file) |
| | | param.append('RootPath', 'Content/images/upload/') |
| | | |
| | | getFileUpload (param) { |
| | | return axios({ |
| | | url: '/zh-CN/Home/Upload', |
| | | data: param |
| | |
| | | </div> |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'picture') { |
| | | let photos = '' |
| | | if (item.field && record.hasOwnProperty(item.field)) { |
| | | photos = record[item.field].split(',') |
| | | } else { |
| | | photos = '' |
| | | } |
| | | return ( |
| | | <div className="picture-col" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | {photos && photos.map((url, i) => { |
| | | return <img key={`${i}`} src={url} alt=""/> |
| | | })} |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'action') { |
| | | return ( |
| | | <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | .picture-col { |
| | | img { |
| | | max-width: 100%; |
| | | } |
| | | } |
| | | } |
| | | .ant-table-tbody > tr > td.ant-table-column-has-actions { |
| | | position: relative; |
| | |
| | | |
| | | let LText = `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` |
| | | let DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | console.log(LText) |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.DateCount = Utils.formatOptions(DateCount) |
| | | console.log(param) |
| | | |
| | | return param |
| | | } |
| | | |
| | |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | const { setting } = this.props |
| | | |
| | | if (btn.intertype === 'inner') { |
| | | // 使用内部接口时,内部函数和数据源不可同时为空, 使用系统函数时,类型不可为空 |
| | | if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { |
| | |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = (data[0] && data[0][setting.primaryKey]) || '' |
| | | } |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | let ID = '' |
| | | if (btn.Ot === 'notRequired') { |
| | |
| | | ID = ids.join(',') |
| | | } |
| | | |
| | | param.ID = ID |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = ID |
| | | } |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | if (setting.primaryKey) { |
| | | if (!param.hasOwnProperty(setting.primaryKey) && data[0] && data[0][setting.primaryKey]) { |
| | | param[setting.primaryKey] = data[0][setting.primaryKey] |
| | | } |
| | | } |
| | | if (!param.hasOwnProperty('ID') && setting.primaryKey && data[0] && data[0][setting.primaryKey]) { |
| | | param.ID = data[0][setting.primaryKey] |
| | | } |
| | | |
| | | } else if (btn.sql && btn.sqlType === 'insert') { |
| | | param.ID = Utils.getguid() |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = Utils.getguid() |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | | param.ID = data[0][setting.primaryKey] |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = cell[setting.primaryKey] || '' |
| | | } |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | param.ID = cell[setting.primaryKey] |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | if (!param.hasOwnProperty(setting.primaryKey) && cell[setting.primaryKey]) { |
| | | |
| | | } else if (btn.sql) { |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | if (!param.hasOwnProperty('ID') && cell[setting.primaryKey]) { |
| | | param.ID = cell[setting.primaryKey] |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = cell[setting.primaryKey] |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | } else if (btn.intertype === 'outer') { |
| | | /** *********************调用外部接口************************* */ |
| | | let param = { |
| | | ID: '', |
| | | BID: this.props.BID |
| | | } |
| | | |
| | |
| | | // 获取id |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } else if (btn.Ot === 'requiredSgl') { |
| | | param.ID = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce') { |
| | | } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { |
| | | param[setting.primaryKey] = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey]}) |
| | | param.ID = ids.join(',') |
| | | param[setting.primaryKey] = ids.join(',') |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | |
| | | BID: this.props.BID, |
| | | func: btn.innerFunc |
| | | } |
| | | _param.ID = cell[setting.primaryKey] |
| | | if (setting.primaryKey) { |
| | | _param[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(_param).then(res => { |
| | | resolve(res) |
| | |
| | | }) |
| | | } else { |
| | | let params = data.map(cell => { |
| | | return { |
| | | let _cell = { |
| | | BID: this.props.BID, |
| | | ID: cell[setting.primaryKey] |
| | | } |
| | | if (setting.primaryKey) { |
| | | _cell[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | |
| | | return _cell |
| | | }) |
| | | resolve(params) |
| | | } |
| | |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res) => { |
| | | if (btn.OpenType === 'excelOut') { |
| | | if (btn.OpenType === 'excelOut') { // 导出excel |
| | | this.setState({ |
| | | loadingUuid: '' |
| | | }) |
| | | } else if (res && res.ErrCode === 'S') { |
| | | } else if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } else if (res.Relogin === 'true') { // 切换用户功能 |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('SessionUid', Utils.getuuid()) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { |
| | |
| | | } |
| | | } |
| | | |
| | | shardupload = (file, shardSize, shardCount, i) => { |
| | | shardupload = (file, shardSize, shardCount, i, fileList) => { |
| | | let start = i * shardSize |
| | | let end = Math.min(file.size, start + shardSize) |
| | | let form = new FormData() |
| | | |
| | | form.append('data', file.slice(start, end)) //slice方法用于切出文件的一部分 |
| | | form.append('file', file.slice(start, end)) //slice方法用于切出文件的一部分 |
| | | form.append('RootPath', 'Content/images/upload/') |
| | | form.append('name', file.name) |
| | | form.append('total', shardCount) |
| | | form.append('index', i + 1) |
| | | |
| | | if (i < shardCount) { |
| | | i++ |
| | | Api.getFileUpload(file).then(res => { |
| | | Api.getFileUpload(form).then(res => { |
| | | if (res) { |
| | | this.setState({ |
| | | percent: Math.floor(100 * (i / shardCount)) |
| | | }) |
| | | this.shardupload(file, shardSize, shardCount, i) |
| | | this.shardupload(file, shardSize, shardCount, i, fileList) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | beforeUpload = (file, fileList) => { |
| | | let shardSize = 200 * 1024 * 1024 |
| | | // console.log(file) |
| | | let shardSize = 2 * 1024 * 1024 |
| | | // let shardSize = 3 * 1024 |
| | | |
| | | if (file.size > shardSize) { |
| | | this.setState({ |
| | |
| | | percent: 0 |
| | | }) |
| | | let shardCount = Math.ceil(file.size / shardSize) |
| | | this.shardupload(file, shardSize, shardCount, 0) |
| | | this.shardupload(file, shardSize, shardCount, 0, fileList) |
| | | return false |
| | | } else { |
| | | return true |
| | |
| | | delActions: [], // 删除按钮列表 |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [] // 所有标签页 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false // 验证信息模态框 |
| | | } |
| | | |
| | | /** |
| | |
| | | fields: fields, |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config.columns)) |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } else { |
| | |
| | | fields: '', |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config.columns)) |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 验证信息配置 |
| | | */ |
| | | profileAction = (element) => { |
| | | console.log(element) |
| | | // this.setState({ |
| | | // profileVisible: true, |
| | | // card: element |
| | | // }) |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单切换模板 |
| | | */ |
| | | changeTemplate = () => { |
| | | this.props.handleConfig('template') |
| | | } |
| | |
| | | <Empty /> |
| | | } |
| | | </Modal> |
| | | {/* 按钮使用系统存储过程时,验证信息模态框 */} |
| | | <Modal |
| | | wrapClassName="common-table-fields-modal" |
| | | title={'验证信息'} |
| | | visible={this.state.profileVisible} |
| | | width={'65vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | | onCancel={() => { // 取消添加 |
| | | this.setState({ |
| | | tableVisible: false, |
| | | addType: '' |
| | | }) |
| | | }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.addType && this.state.fields.length > 0 ? |
| | | <EditCard data={this.state.fields} ref="searchcard" type={this.state.addType} dict={this.state.dict} /> : null |
| | | } |
| | | </Modal> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | |
| | | fields: fields, |
| | | menuNo: _config.tabNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config.columns)) |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } else { |
| | |
| | | fields: '', |
| | | menuNo: _config.tabNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config.columns)) |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } |
| | |
| | | let _datasource = item.dataSource |
| | | let sql = '' |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | if (/\s/.test(_datasource)) { // 拼接别名 |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | |
| | | * @return {String} table 表名 |
| | | */ |
| | | static getSysDefaultSql (btn, setting, formdata) { |
| | | let primaryKey = setting.primaryKey || 'id' |
| | | let _sql = '' |
| | | if (btn.OpenType === 'pop' && btn.sqlType === 'insert') { |
| | | let keys = [] |
| | |
| | | } |
| | | }) |
| | | _form = _form.join(',') |
| | | _sql = `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid where ${setting.primaryKey}=@id` |
| | | _sql = `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'LogicDelete') { // 逻辑删除 |
| | | _sql = `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${setting.primaryKey}=@id` |
| | | _sql = `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey}` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete') { |
| | | _sql = `insert into snote (remark,createuserid) select '删除表:${btn.sql} 数据: id='+@id,@userid delete ${btn.sql} where ${setting.primaryKey}=@id` |
| | | _sql = `insert into snote (remark,createuserid) select '删除表:${btn.sql} 数据: ${primaryKey}='+@${primaryKey},@userid delete ${btn.sql} where ${primaryKey}=@${primaryKey}` |
| | | } |
| | | |
| | | return _sql |
| | |
| | | let form = '' |
| | | let formParam = '' |
| | | let _columns = [] |
| | | let primaryKey = config.setting.primaryKey || 'ID' |
| | | |
| | | if (config.search && config.search.length > 0) { |
| | | let _fields = new Map() |
| | |
| | | let Ltext = `create proc ${param.innerFunc} |
| | | ( /*${menu.MenuName}*/ |
| | | @BID nvarchar(50)='', |
| | | @ID nvarchar(50)='',${formParam} |
| | | @${primaryKey} nvarchar(50)='',${formParam} |
| | | @PageIndex nvarchar(50)='', |
| | | @PageSize nvarchar(50)='', |
| | | @OrderCol nvarchar(50)='', |
| | |
| | | * @description 创建存储过程 |
| | | * @return {String} |
| | | */ |
| | | static getfunc (param, btn, menu, columns) { |
| | | static getfunc (param, btn, menu, config) { |
| | | console.log(menu) |
| | | let form = '' |
| | | let formParam = '' |
| | | let columns = config.columns |
| | | let primaryKey = config.setting.primaryKey || 'ID' |
| | | |
| | | if (param.fields && param.fields.length > 0) { |
| | | let _fields = [] |
| | |
| | | let Ltext = `create proc ${param.funcName} |
| | | ( /*${menu.MenuName} ${btn.label}*/ |
| | | @BID nvarchar(50)='', |
| | | @ID nvarchar(50)='',${formParam} |
| | | @${primaryKey} nvarchar(50)='',${formParam} |
| | | @sEPTMenuNo nvarchar(50)='${param.menuNo}', |
| | | @lang nvarchar(50)='', |
| | | @debug nvarchar(50)='', |