| | |
| | | */ |
| | | handleMenu = (menu) => { |
| | | const _this = this |
| | | console.log(menu) |
| | | if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | console.log(param) |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate(nextProps, nextState) { |
| | | // if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) || (!this.props.collapse && !is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews)))) { |
| | | // if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | // // 主菜单切换,或菜单展开下的tab页变化,不会刷新 |
| | | // return false |
| | | // } else { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | // } |
| | | } |
| | | |
| | | onOpenChange = openKeys => { |
| | |
| | | } |
| | | |
| | | state = { |
| | | selectedTabId: '', // 当前选中tab页面 |
| | | tabviews: null, // 标签集 |
| | | iFrameHeight: 0, |
| | | dict: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? mzhCN : menUS, |
| | | locale: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS |
| | | } |
| | | |
| | | handleTabview (menu) { |
| | | handleTabview (e, menu) { |
| | | e.stopPropagation() |
| | | // 关闭tab页,重新选择显示页 |
| | | let tabs = JSON.parse(JSON.stringify(this.props.tabviews)) |
| | | let tabs = JSON.parse(JSON.stringify(this.state.tabviews)) |
| | | tabs = tabs.filter(tab => { |
| | | if (tab.MenuID === this.state.selectedTabId) { |
| | | tab.selected = true |
| | | } else { |
| | | tab.selected = false |
| | | } |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | |
| | | if (menu.MenuID === this.state.selectedTabId) { |
| | | if (menu.selected) { |
| | | tabs[0] && (tabs[0].selected = true) |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | |
| | | changeTab (menu) { |
| | | changeTab (e, menu) { |
| | | e.stopPropagation() |
| | | // 窗口切换 |
| | | this.setState({ |
| | | selectedTabId: menu.MenuID |
| | | }) |
| | | let tabs = JSON.parse(JSON.stringify(this.props.tabviews)) |
| | | let tabs = JSON.parse(JSON.stringify(this.state.tabviews)) |
| | | tabs = tabs.map(tab => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === menu.MenuID) { |
| | | tab.selected = true |
| | | } else { |
| | | tab.selected = false |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | |
| | | this.setState({ |
| | | tabviews: tabs |
| | | }) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | this.resetWindow(menu) |
| | | } |
| | | |
| | | selectcomponent (view) { |
| | |
| | | } else { |
| | | moment.locale('en') |
| | | } |
| | | this.setState({ |
| | | tabviews: this.props.tabviews |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.tabviews && !is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { |
| | | if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { |
| | | // tab窗口页增加或删除 |
| | | if (nextProps.tabviews.length > this.props.tabviews.length) { |
| | | if (nextProps.tabviews.length > this.state.tabviews.length) { |
| | | // 查看新tab页需要组件是否加载 |
| | | let MenuIDs = this.props.tabviews.map(tab => {return tab.MenuID}) |
| | | let MenuIDs = this.state.tabviews.map(tab => {return tab.MenuID}) |
| | | let newtab = nextProps.tabviews.filter(tab => !MenuIDs.includes(tab.MenuID))[0] |
| | | if (!Comps.Home && newtab.type === 'Home') { |
| | | Comps.Home = asyncComponent(() => import('@/tabviews/home')) |
| | |
| | | } |
| | | } |
| | | |
| | | // 设置选中窗口 |
| | | let view = nextProps.tabviews.filter(tab => tab.selected)[0] |
| | | // 保存修改标签集 |
| | | this.setState({ |
| | | selectedTabId: view ? view.MenuID : '' |
| | | tabviews: nextProps.tabviews |
| | | }) |
| | | this.resetWindow(view) |
| | | |
| | | let node = document.getElementById('root').parentNode.parentNode |
| | | if (node) { |
| | | node.scrollTop = 0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate(nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | // shouldComponentUpdate(nextProps, nextState) { |
| | | // return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | // } |
| | | |
| | | render () { |
| | | const { tabviews } = this.state |
| | | let view = tabviews.filter(tab => tab.selected)[0] |
| | | this.resetWindow(view) |
| | | let selectedTabId = view ? view.MenuID : '' |
| | | |
| | | return ( |
| | | <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <ConfigProvider locale={this.state.locale}> |
| | | <div className="content-header"> |
| | | {this.props.tabviews && this.props.tabviews.length > 0 && |
| | | <Tabs activeKey={this.state.selectedTabId}> |
| | | {this.props.tabviews.map(view => { |
| | | {tabviews && tabviews.length > 0 && |
| | | <Tabs activeKey={selectedTabId}> |
| | | {tabviews.map(view => { |
| | | return ( |
| | | <Tabs.TabPane |
| | | className="test" |
| | | tab={ |
| | | <span className="tab-control"> |
| | | <span className="tab-name" onClick={() => {this.changeTab(view)}}> |
| | | <span className="tab-name" onClick={(e) => {this.changeTab(e, view)}}> |
| | | {view.MenuName} |
| | | </span> |
| | | {view.type !== 'Home' ? <Icon type="close" onClick={() => {this.handleTabview(view)}}/> : null} |
| | | {view.type !== 'Home' ? <Icon type="close" onClick={(e) => {this.handleTabview(e, view)}}/> : null} |
| | | </span> |
| | | } |
| | | key={view.MenuID} |
| | |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false // 弹框显示隐藏控制 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | tabBtn: null, // 表单标签按钮 |
| | | tabParam: null // 表单标签参数 |
| | | } |
| | | |
| | | /** |
| | |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | | |
| | | let param = { |
| | | PageIndex: pageIndex, |
| | | PageSize: pageSize, |
| | | OrderCol: orderColumn, |
| | | OrderType: orderType, |
| | | OrderCol: orderBy || setting.order, |
| | | ..._search |
| | | } |
| | | |
| | |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | if (!arr_field) { |
| | | notification.warning({ |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | |
| | | _search = '' |
| | | } |
| | | |
| | | 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 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) |
| | | console.log(DateCount) |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | loading: true, |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderColumn: sorter.field || this.state.setting.orderColumn, |
| | | orderType: sorter.order || 'asc' |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | orderBy: '', |
| | | search: '', |
| | | BIDs: {}, |
| | | setsingle: false, |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 表单操作完成后刷新主页面 |
| | | */ |
| | | refreshbyformtab = (type) => { |
| | | this.setState({ |
| | | view: 'commontable', |
| | | tabBtn: null, |
| | | tabParam: null |
| | | }, () => { |
| | | if (type === 'grid') { |
| | | this.reloadtable() |
| | | } else if (type === 'view') { |
| | | this.reloadview() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = () => { |
| | |
| | | */ |
| | | handleDefaultExcelout = (btn) => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderColumn, orderType, search, setting, config } = this.state |
| | | const { arr_field, orderBy, search, setting, config } = this.state |
| | | |
| | | let _arr_labels = [] // 列名称集 |
| | | let _arr_label_field = [] // 列名称字段集 |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | if (btn.OpenType === 'popview') { |
| | | this.setState({ |
| | | popAction: btn, |
| | | popData: data[0] ? data[0] : null, |
| | | popData: data[0] || null, |
| | | visible: true |
| | | }) |
| | | } else if (btn.OpenType === 'tab') { |
| | |
| | | type: btn.tabTemplate, |
| | | selected: true, |
| | | param: { |
| | | parentId: this.props.MenuID, |
| | | btn: btn, |
| | | data: data, |
| | | data: data[0] || null, |
| | | primaryId: _primaryId, |
| | | arr_field: this.state.arr_field |
| | | } |
| | | } |
| | | |
| | | let index = 0 |
| | | let isexit = false |
| | | let tabs = tabviews.map((tab, i) => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === MenuID) { |
| | | index = i |
| | | } else if (tab.MenuID === btn.uuid) { |
| | | tab.selected = true |
| | | isexit = true |
| | | } |
| | | tab.selected = false |
| | | |
| | | return tab |
| | | }) |
| | | |
| | | tabs.splice(index + 1, 0, newtab) |
| | | |
| | | if (!isexit) { |
| | | tabs.splice(index + 1, 0, newtab) |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } else if (btn.OpenType === 'blank') { |
| | | this.setState({ |
| | |
| | | tabBtn: btn, |
| | | tabParam: { |
| | | btn: btn, |
| | | data: data, |
| | | data: data[0] || null, |
| | | primaryId: _primaryId, |
| | | arr_field: this.state.arr_field |
| | | } |
| | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | if (nextProps.refreshTab.position === 'grid') { |
| | | this.reloadtable() |
| | | } else if (nextProps.refreshTab.position === 'view') { |
| | | this.reloadview() |
| | | } |
| | | this.props.refreshTabView('') |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | </Modal> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> : null} |
| | | {view === 'formtab' ? <FormTab MenuID={this.state.tabBtn.uuid} param={this.state.tabParam}/> : null} |
| | | {view === 'formtab' ? <FormTab MenuID={this.state.tabBtn.uuid} param={this.state.tabParam} refresh={this.refreshbyformtab}/> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | primaryId: PropTypes.string, // 主键 |
| | | actions: PropTypes.array, // 按钮组 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | data: PropTypes.any, // 数据 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | getFormData: PropTypes.func, // 获取表单值 |
| | | refreshdata: PropTypes.func, // 执行完成后数据刷新 |
| | | } |
| | | |
| | |
| | | |
| | | let _this = this |
| | | |
| | | if (item.OpenType === 'prompt') { |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(item, data, resolve) |
| | | if (item.btnType !== 'cancel') { |
| | | this.props.getFormData().then(res => { |
| | | if (item.OpenType === 'prompt') { |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(item, data, resolve, res) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | } else if (item.OpenType === 'exec') { |
| | | this.setState({loadingUuid: item.uuid}) |
| | | |
| | | this.execSubmit(item, data, () => { |
| | | this.setState({loadingUuid: ''}) |
| | | }, res) |
| | | } |
| | | }) |
| | | } else if (item.OpenType === 'exec') { |
| | | this.setState({loadingUuid: item.uuid}) |
| | | this.execSubmit(item, data, () => { |
| | | this.setState({loadingUuid: ''}) |
| | | }) |
| | | } else { |
| | | item.afterExecSuccess = 'close' |
| | | this.props.refreshdata(item, 'success', '') |
| | | } |
| | | } |
| | | |
| | |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | const { setting, logcolumns } = this.props |
| | | const { setting, logcolumns, primaryId } = this.props |
| | | |
| | | let _primaryId = primaryId |
| | | |
| | | if (btn.intertype === 'inner') { |
| | | // 使用内部接口时,内部函数和数据源不可同时为空, 使用系统函数时,类型不可为空 |
| | |
| | | return |
| | | } |
| | | |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加 |
| | | if ( |
| | | btn.Ot === 'notRequired' || |
| | | btn.Ot === 'requiredSgl' || |
| | | (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') || |
| | | (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert') |
| | | ) { |
| | | |
| | | // 创建凭证时,需要选择行时 |
| | | if (data.length === 0 && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = { // 系统存储过程 |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: '' |
| | | } |
| | | let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | let ID = '' |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } else if (btn.Ot === 'requiredSgl') { |
| | | ID = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce') { // id值拼接 |
| | | let ids = data.map(d => { return d[setting.primaryKey]}) |
| | | ID = ids.join(',') |
| | | } |
| | | |
| | | if (btn.innerFunc) { // 使用自定义函数 |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = ID |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | param.ID = Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | 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 = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(btn, res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | | _resolve() |
| | | // 创建凭证时,需要选择行时 |
| | | if (!data && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 10 |
| | | }) |
| | | } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { |
| | | let _params = data.map(cell => { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: '' |
| | | } |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | } |
| | | |
| | | return param |
| | | }) |
| | | |
| | | if (_params.length <= 20) { |
| | | let deffers = _params.map(param => { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(param).then(res => { |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let iserror = false |
| | | let errorMsg = '' |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | errorMsg = res |
| | | } else { |
| | | iserror = true |
| | | errorMsg = res |
| | | } |
| | | }) |
| | | if (!iserror) { |
| | | this.execSuccess(btn, errorMsg) |
| | | } else { |
| | | this.execError(errorMsg, btn) |
| | | } |
| | | _resolve() |
| | | }) |
| | | } else { // 超出20个请求时循环执行 |
| | | this.innerLoopRequest(_params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.actionSettingError() |
| | | _resolve() |
| | | return |
| | | } |
| | | |
| | | let param = { // 系统存储过程 |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: '' |
| | | } |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | param[setting.primaryKey] = primaryId |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | if (!param[setting.primaryKey]) { |
| | | param[setting.primaryKey] = Utils.getguid() |
| | | } |
| | | |
| | | _primaryId = param[setting.primaryKey] |
| | | |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | param.ID = Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | _primaryId = param.ID |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(btn, res, _primaryId) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | | _resolve() |
| | | }) |
| | | } else if (btn.intertype === 'outer') { |
| | | /** *********************调用外部接口************************* */ |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let _params = [] // 请求参数数组 |
| | | |
| | | if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | let param = { |
| | | BID: '' |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | // 获取id |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } 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[setting.primaryKey] = ids.join(',') |
| | | } |
| | | |
| | | _params.push(param) |
| | | } else if (btn.Ot === 'required') { |
| | | // 选择多行,循环调用 |
| | | |
| | | let _formparam = {} |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | _formparam[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | _params = data.map(cell => { |
| | | let _cell = { |
| | | BID: '', |
| | | } |
| | | if (setting.primaryKey) { |
| | | _cell[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | |
| | | _cell = {..._formparam, ..._cell} |
| | | |
| | | return _cell |
| | | }) |
| | | } else { |
| | | this.actionSettingError() |
| | | _resolve() |
| | | return |
| | | let param = { |
| | | BID: '' |
| | | } |
| | | |
| | | // 循环调用外部接口(包括内部及回调函数) |
| | | this.outerLoopRequest(_params, btn, _resolve) |
| | | param[setting.primaryKey] = primaryId |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | if (!param[setting.primaryKey]) { |
| | | param[setting.primaryKey] = Utils.getguid() |
| | | } |
| | | _primaryId = param[setting.primaryKey] |
| | | |
| | | let _outParam = null |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | resolve(res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | resolve(false) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | res.appkey = window.GLOB.appkey || '' // 外部请求时,统一添加appkey |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | // 回调请求 |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | this.execSuccess(btn, response, _primaryId) |
| | | _resolve() |
| | | } else { |
| | | this.execError(response, btn) |
| | | _resolve() |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(btn, res, _primaryId) |
| | | _resolve() |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | | |
| | | } else { |
| | | this.actionSettingError() |
| | | _resolve() |
| | | return |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 内部请求循环执行 |
| | | */ |
| | | innerLoopRequest = (params, btn, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | |
| | | let param = params.shift() |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | | } else { |
| | | this.innerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 外部请求循环执行 |
| | | */ |
| | | outerLoopRequest = (params, btn, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | |
| | | let param = params.shift() |
| | | let _outParam = null |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | resolve(res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | resolve(false) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | // res.method = btn.method |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | res.appkey = window.GLOB.appkey || '' // 外部请求时,统一添加appkey |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | // 回调请求 |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | // 一次请求成功,进行下一项请求 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, response) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(response, btn) |
| | | _resolve() |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(btn, res) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res) => { |
| | | if (btn.OpenType === 'excelOut') { // 导出excel |
| | | this.setState({ |
| | | loadingUuid: '' |
| | | }) |
| | | } else if (res && res.ErrCode === 'S') { // 执行成功 |
| | | execSuccess = (btn, res, primaryId) => { |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.props.dict['main.action.confirm.success'], |
| | |
| | | |
| | | } |
| | | |
| | | this.props.refreshdata(btn, 'success') |
| | | this.props.refreshdata(btn, 'success', primaryId) |
| | | } |
| | | |
| | | /** |
| | |
| | | state = { |
| | | datatype: null, |
| | | readtype: null, |
| | | readin: null, |
| | | fieldlen: null, |
| | | groups: null, |
| | | formlist: [], |
| | | record: {} |
| | |
| | | |
| | | let datatype = {} |
| | | let readtype = {} |
| | | let readin = {} |
| | | let fieldlen = {} |
| | | let _formlist = [] |
| | | |
| | | let _groups = groups.map(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | let _readin = item.readin !== 'false' |
| | | if (item.type === 'funcvar') { |
| | | _readin = false |
| | | } |
| | | |
| | | let _fieldlen = item.fieldlength || 50 |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } |
| | | |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | |
| | | if (!/^date/.test(item.type) && data && data.hasOwnProperty(item.field)) { |
| | | readin[item.field] = _readin |
| | | fieldlen[item.field] = _fieldlen |
| | | |
| | | if (_readin && !/^date/.test(item.type) && data && data.hasOwnProperty(item.field)) { |
| | | item.initval = data[item.field] |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | readtype: readtype, |
| | | datatype: datatype, |
| | | readin: readin, |
| | | fieldlen: fieldlen, |
| | | formlist: _formlist, |
| | | groups: _groups |
| | | }) |
| | |
| | | ) |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM-DD') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'days') : null |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | ) |
| | | } else if (item.type === 'datemonth') { |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'month') : null |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | ) |
| | | } else if (item.type === 'datetime') { |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM-DD HH:mm:ss') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'days') : null |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | ) |
| | | } else if (item.type === 'fileupload') { |
| | | let filelist = this.props.data ? this.props.data[item.field] : item.initval |
| | | if (filelist) { |
| | | if (filelist && this.state.readin[item.field]) { |
| | | try { |
| | | filelist = filelist.split(',').map((url, index) => { |
| | | return { |
| | |
| | | } catch { |
| | | filelist = [] |
| | | } |
| | | } else { |
| | | filelist = [] |
| | | } |
| | | |
| | | fields.push( |
| | |
| | | })( |
| | | <FileUpload /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'linkMain') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | search.push({ |
| | | type: 'funcvar', |
| | | readonly: 'true', |
| | | readin: false, |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: '' |
| | | }) |
| | | } else if (item.hidden === 'true') { |
| | | } else if (item.hidden === 'true' && item.field !== this.props.setting.primaryKey) { |
| | | let _val = item.initval |
| | | if (record.hasOwnProperty(item.field)) { |
| | | _val = record[item.field] |
| | |
| | | search.push({ |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | readin: this.state.readin[item.field], |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: _val |
| | | }) |
| | |
| | | }) |
| | | |
| | | Object.keys(values).forEach(key => { |
| | | let _value = '' |
| | | if (this.state.datatype[key] === 'datetime') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'datemonth') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'date') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'number') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } else if (this.state.datatype[key] === 'multiselect') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] ? values[key].join(',') : '' |
| | | }) |
| | | _value = values[key] ? values[key].join(',') : '' |
| | | |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | | let vals = [] |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | _value = vals.join(',') |
| | | } else if (this.state.datatype[key] === 'text') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$)/ig, '') |
| | | // value: values[key].replace(/[\x00-\xff]+/ig, '') |
| | | }) |
| | | _value = values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | }) |
| | | resolve(search) |
| | | } else { |
| | |
| | | import FormAction from './actionList' |
| | | import SubTable from '@/tabviews/subtable' |
| | | import NotFount from '@/components/404' |
| | | import {refreshTabView} from '@/store/action' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | |
| | | static propTpyes = { |
| | | // MenuNo: PropTypes.string, // 菜单参数 |
| | | // MenuName: PropTypes.string, // 菜单参数 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | param: PropTypes.any // 主表传递参数 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | param: PropTypes.any, // 主表传递参数 |
| | | refresh: PropTypes.any // 刷新主表页面 |
| | | } |
| | | |
| | | state = { |
| | |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false // 弹框显示隐藏控制 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | primaryId: null |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | let _arrField = [] // 字段集 |
| | | |
| | | if (this.props.param && this.props.param.arr_field) { |
| | | _arrField = this.props.param.arr_field |
| | | } else { |
| | | config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (!item.field) return |
| | | // if (this.props.param && this.props.param.arr_field) { // 使用显示列字段查询 |
| | | // _arrField = this.props.param.arr_field |
| | | // } else { |
| | | config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | _arrField.push(item.field) |
| | | }) |
| | | _arrField.push(item.field) |
| | | }) |
| | | _arrField = _arrField.join(',') |
| | | } |
| | | }) |
| | | _arrField = _arrField.join(',') |
| | | // } |
| | | |
| | | // 权限过滤 |
| | | config.action = config.action.filter(item => permAction[item.uuid]) |
| | |
| | | actions: config.action, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField, |
| | | data: config.setting.datatype === 'query' ? null : (this.props.param.data[0] || null), |
| | | primaryId: this.props.param.primaryId || '', |
| | | data: config.setting.datatype === 'query' ? null : this.props.param.data, |
| | | BIDs: { |
| | | mainTable: this.props.param.primaryId || '', |
| | | mainTabledata: config.setting.datatype === 'query' ? '' : (this.props.param.data[0] || '') |
| | | mainTabledata: config.setting.datatype === 'query' ? '' : this.props.param.data |
| | | } |
| | | }, () => { |
| | | this.improveSelectOption(config.groups) |
| | | |
| | | if (config.setting.datatype === 'query') { |
| | | if (config.setting.datatype === 'query' && this.props.param.primaryId) { |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting } = this.state |
| | | let param = this.getCustomParam() |
| | | |
| | | if (setting.datatype !== 'query') return |
| | | |
| | | let param = null |
| | | |
| | | if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { |
| | | param = this.getCustomParam() |
| | | } else { |
| | | param = this.getDefaultParam() |
| | | } |
| | | |
| | | if (!param) return // 未获取参数时,不发请求 |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let _data = result.data[0] || '' |
| | | let _primaryId = '' |
| | | |
| | | if (_data) { |
| | | _primaryId = _data[setting.primaryKey] || '' |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | data: _data, |
| | | primaryId: _primaryId, |
| | | BIDs: { |
| | | mainTable: (result.data[0] && result.data[0][setting.primaryKey]) || '', |
| | | mainTabledata: result.data[0] || '' |
| | | mainTable: _primaryId, |
| | | mainTabledata: _data |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, setting, primaryId } = this.state |
| | | |
| | | if (!arr_field) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置表单字段!', |
| | | duration: 10 |
| | | }) |
| | | return null |
| | | } else if (!primaryId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到主键值!', |
| | | duration: 10 |
| | | }) |
| | | return null |
| | | } |
| | | |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() from ${_dataresource}) tmptable where ${setting.primaryKey}=${primaryId}` |
| | | |
| | | 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 = '' |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { setting } = this.state |
| | | const { setting, primaryId } = this.state |
| | | |
| | | let param = {} |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | param[setting.primaryKey] = primaryId |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | refreshbyaction = (btn, type, primaryId) => { |
| | | if (type === 'success' && btn.afterExecSuccess === 'notclose') { |
| | | this.setState({ |
| | | primaryId: primaryId |
| | | }, () => { |
| | | if (btn.execSuccess === 'refresh') { |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | | } else if (type === 'success' && btn.afterExecSuccess === 'close') { |
| | | if (this.props.refresh) { |
| | | this.props.refresh(btn.execSuccess) |
| | | } else { |
| | | if (btn.execSuccess !== 'never') { |
| | | let PMenu = { |
| | | MenuID: this.props.param.parentId || '', |
| | | position: btn.execSuccess |
| | | } |
| | | this.props.refreshTabView(PMenu) |
| | | } |
| | | |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | } else if (type === 'error' && btn.afterExecError === 'notclose') { |
| | | if (btn.execSuccess === 'refresh') { |
| | | this.loadmaindata() |
| | | } |
| | | } else if (type === 'error' && btn.afterExecError === 'close') { |
| | | if (this.props.refresh) { |
| | | this.props.refresh(btn.execError) |
| | | } else { |
| | | if (btn.execError !== 'never') { |
| | | let PMenu = { |
| | | MenuID: this.props.param.parentId || '', |
| | | position: btn.execError |
| | | } |
| | | this.props.refreshTabView(PMenu) |
| | | } |
| | | |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getFormData = () => { |
| | | return this.formGroupRef.handleConfirm() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | |
| | | render() { |
| | | const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state |
| | | let hasform = false |
| | | |
| | | if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { |
| | | hasform = true |
| | | } |
| | | |
| | | return ( |
| | | <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {groups && (groups.length > 1 || groups[0].sublist.length > 0) ? |
| | | {hasform ? |
| | | <FormGroup |
| | | dict={this.state.dict} |
| | | data={data} |
| | |
| | | wrappedComponentRef={(inst) => this.formGroupRef = inst} |
| | | /> : null |
| | | } |
| | | {actions ? |
| | | {hasform ? |
| | | <FormAction |
| | | logcolumns={[]} |
| | | setting={setting} |
| | | actions={actions} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | MenuID={this.props.MenuID} |
| | | logcolumns={[]} |
| | | primaryId={this.state.primaryId} |
| | | getFormData={this.getFormData} |
| | | refreshdata={this.refreshbyaction} |
| | | /> : null |
| | | } |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | refreshTab: state.refreshTab, |
| | | permAction: state.permAction |
| | | } |
| | |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)) |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) |
| | | } |
| | | } |
| | | |
| | |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {}, // 页面配置信息:下拉、按钮等 |
| | | popAction: false, // 弹框页面,按钮信息 |
| | |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = (BID) => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | | |
| | | let param = { |
| | | PageIndex: pageIndex, |
| | | PageSize: pageSize, |
| | | OrderCol: orderColumn, |
| | | OrderType: orderType, |
| | | OrderCol: orderBy || setting.order, |
| | | BID: BID, |
| | | ..._search |
| | | } |
| | |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = (BID) => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | |
| | | _search = '' |
| | | } |
| | | |
| | | 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 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}` |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | |
| | | loading: true, |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderColumn: sorter.field || this.state.setting.orderColumn, |
| | | orderType: sorter.order || 'asc' |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | orderBy: '', |
| | | search: '', |
| | | configMap: {} |
| | | }, () => { |
| | |
| | | */ |
| | | handleDefaultExcelout = (btn) => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderColumn, orderType, search, setting, config } = this.state |
| | | const { arr_field, orderBy, search, setting, config } = this.state |
| | | |
| | | let _arr_labels = [] // 列名称集 |
| | | let _arr_label_field = [] // 列名称字段集 |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {} // 页面配置信息:下拉、按钮等 |
| | | } |
| | |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = () => { |
| | | const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.formatCustomMainSearch(search) |
| | | |
| | | let param = { |
| | | PageIndex: pageIndex, |
| | | PageSize: pageSize, |
| | | OrderCol: orderColumn, |
| | | OrderType: orderType, |
| | | OrderCol: orderBy || setting.order, |
| | | ..._search |
| | | } |
| | | |
| | |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = () => { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where ' + _search : '' |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | |
| | | _search = '' |
| | | } |
| | | |
| | | 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 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}` |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | |
| | | loading: true, |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderColumn: sorter.field || this.state.setting.orderColumn, |
| | | orderType: sorter.order || 'asc' |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | loading: false, |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | orderBy: '', |
| | | search: '', |
| | | configMap: {} |
| | | }, () => { |
| | |
| | | */ |
| | | handleDefaultExcelout = (btn) => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderColumn, orderType, search, setting, config } = this.state |
| | | const { arr_field, orderBy, search, setting, config } = this.state |
| | | |
| | | let _arr_labels = [] // 列名称集 |
| | | let _arr_label_field = [] // 列名称字段集 |
| | |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | let _orderBy = orderBy || setting.order |
| | | let _dataresource = setting.dataresource |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | }) |
| | | return |
| | | } |
| | | if (!btn.innerFunc) { |
| | | let param = { // 系统存储过程 |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(result.sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | let param = { |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | this.setState({loadingUuid: btn.uuid}) |
| | | param.LText = Utils.formatOptions(result.sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | this.setState({loadingUuid: btn.uuid}) |
| | | |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | |
| | | this.execError(res, btn) |
| | | } |
| | | }) |
| | | } else { |
| | | let param = { // 自定义存储过程 |
| | | func: btn.innerFunc, |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(result.sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | this.setState({loadingUuid: btn.uuid}) |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 自定义存储过程 |
| | | param.func = btn.innerFunc |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | |
| | | this.execError(res, btn) |
| | | } |
| | | }) |
| | | } else if (btn.intertype === 'outer') { // 外部接口 |
| | | let _outParam = null |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | // 存在内部函数时,数据预处理 |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | // 使用处理后的数据调用外部接口 |
| | | resolve(res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | } |
| | | |
| | | res.appkey = window.GLOB.appkey || '' // 外部请求时,统一添加appkey |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | // 回调请求 |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | |
| | | response.func = btn.callbackFunc |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | this.execSuccess(btn, response) |
| | | } else { |
| | | this.execError(response, btn) |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(btn, res) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | Object.keys(values).forEach(key => { |
| | | let _value = '' |
| | | if (this.state.datatype[key] === 'datetime') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'datemonth') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'date') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'number') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } else if (this.state.datatype[key] === 'multiselect') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] ? values[key].join(',') : '' |
| | | }) |
| | | _value = values[key] ? values[key].join(',') : '' |
| | | |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | | let vals = [] |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | _value = vals.join(',') |
| | | } else if (this.state.datatype[key] === 'text') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | }) |
| | | _value = values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | }) |
| | | |
| | | resolve(search) |
| | |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (_opentype === 'excelOut') { // 导入导出 |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (_opentype === 'excelIn') { // 导入导出 |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | |
| | | if (!initTab) { |
| | | item.initVal = '' |
| | | } |
| | | } else if (item.key === 'intertype' && _opentype === 'excelIn') { |
| | | item.initVal = 'inner' |
| | | item.readonly = true |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (value === 'excelOut') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (value === 'excelIn') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (item.hidden) return item |
| | | |
| | | if (item.key === 'intertype' && value === 'excelIn') { |
| | | _fieldval.intertype = 'inner' |
| | | item.readonly = true |
| | | } else if (item.key === 'intertype' && value !== 'excelIn') { |
| | | if (item.key === 'intertype') { |
| | | _fieldval.intertype = this.state.interType |
| | | item.readonly = false |
| | | } else if (item.key === 'Ot') { |
| | | if (value === 'innerpage' || this.state.position === 'grid') { |
| | | item.options = this.state.reqOptionSgl |
| | |
| | | let _options = null |
| | | if (openType === 'excelOut') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (openType === 'excelIn') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'excelIn') { |
| | | if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | | name: config.setting.tableName || '', |
| | | fields: '', |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, menu, config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | // resolve(true) |
| | | resolve(false) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善导入Excel验证信息!', |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | } else { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | |
| | | |
| | | if (_opentype === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (_opentype === 'excelIn' || _opentype === 'excelOut') { |
| | | } else if (_opentype === 'excelOut') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (_opentype === 'excelIn') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | |
| | | |
| | | if (value === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (value === 'excelIn' || value === 'excelOut') { |
| | | } else if (value === 'excelOut') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (value === 'excelIn') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | |
| | | if (openType === 'excelOut') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (openType === 'excelIn') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | let dataSource = JSON.parse(JSON.stringify(this.state.dataSource)) |
| | | let _width = '40%' |
| | | let fields = [] |
| | | console.log(linkSubFields) |
| | | |
| | | if (type === 'select' && linkSubFields.length > this.state.linkSubFields) { |
| | | let addcol = linkSubFields[linkSubFields.length - 1] |
| | | dataSource = dataSource.map(data => { |
| | | data[addcol.field] = data.Text |
| | | return data |
| | | }) |
| | | console.log(addcol) |
| | | } |
| | | // console.log(linkSubFields) |
| | | // console.log(type) |
| | | // console.log(dataSource) |
| | | |
| | | if (type === 'link') { |
| | | _width = '27%' |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | console.log(fields) |
| | | |
| | | let columns = [ |
| | | { |
| | |
| | | return `'${val}' as ${col.Column}` |
| | | }) |
| | | |
| | | if (!item.innerFunc) { |
| | | vals.push(`@upid+'${this.getuuid()}' as jskey`) |
| | | } |
| | | let _lineIndex = '0000' + (lindex + 1) + '0' |
| | | _lineIndex = _lineIndex.substring(_lineIndex.length - 6) |
| | | |
| | | vals.push(`@upid+'${_lineIndex}' as jskey`) |
| | | |
| | | return `Select ${vals.join(',')}` |
| | | }) |
| | |
| | | |
| | | let _sql = '' |
| | | |
| | | if (!item.innerFunc) { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | let declarefields = [] |
| | | let fields = [] |
| | | let timestamp = new Date().getTime() |
| | | |
| | | btn.columns.forEach(col => { |
| | | declarefields.push(`${col.Column} ${col.type}`) |
| | |
| | | fields = fields.join(',') |
| | | |
| | | _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50) ) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50) ,@upid nvarchar(50) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50) ,@upid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000) |
| | | |
| | | Select @ErrorCode='', @retmsg='' |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | |
| | | set @upid='${timestamp}' |
| | | set @upid='${this.getuuid()}' |
| | | |
| | | Insert into @${btn.sheet} (${fields},jskey) |
| | | ${_Ltext} |
| | |
| | | Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid,upid) |
| | | Select ${fields},@userid@,@username,@fullname,@BID@,@upid From @${btn.sheet} |
| | | |
| | | Delete @${btn.sheet}` |
| | | Delete @${btn.sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | } else { |
| | | _sql = _Ltext |
| | |
| | | |
| | | let primaryKeyName = ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKey.toLowerCase()) ? primaryKey + '@' : primaryKey |
| | | |
| | | let _actionType = null |
| | | |
| | | if (verify.default !== 'false') { // 判断是否使用默认sql |
| | | _actionType = btn.sqlType |
| | | } |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (btn.OpenType === 'pop' && btn.sqlType === 'insert' && verify.default !== 'false') { |
| | | if (_actionType === 'insert') { |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | |
| | | values = values.join(',') |
| | | _sql += _user |
| | | _sql += `insert into ${btn.sql} (${keys}) select ${values};` |
| | | } else if (btn.OpenType === 'pop' && btn.sqlType === 'update' && verify.default !== 'false') { |
| | | } else if (_actionType === 'update') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | |
| | | |
| | | _form = _form.join(',') |
| | | _sql += `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKeyName};` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'LogicDelete' && verify.default !== 'false') { // 逻辑删除 |
| | | } else if (_actionType === 'LogicDelete') { // 逻辑删除 |
| | | _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKeyName};` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete' && verify.default !== 'false') { // 物理删除 |
| | | |
| | | } else if (_actionType === 'delete') { // 物理删除 |
| | | let _msg = '' |
| | | if (data && logcolumns && logcolumns.length > 0) { |
| | | let _index = 0 |
| | |
| | | |
| | | return Ltext |
| | | } |
| | | |
| | | /** |
| | | * @description 创建导入存储过程 |
| | | * @return {String} |
| | | */ |
| | | static getexcelInfunc (param, btn, menu) { |
| | | let _verify = btn.verify |
| | | |
| | | let declarefields = [] |
| | | let fields = [] |
| | | |
| | | _verify.columns.forEach(col => { |
| | | declarefields.push(`${col.Column} ${col.type}`) |
| | | fields.push(col.Column) |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _sql = `declare @${_verify.sheet} table (${declarefields.join(',')},jskey nvarchar(50) ) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50),@upid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000) |
| | | |
| | | Select @ErrorCode='',@retmsg='' |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | |
| | | set @upid='时间戳' |
| | | |
| | | Insert into @${_verify.sheet} (${fields},jskey) |
| | | |
| | | exec s_KeyWords_Replace |
| | | @LText=@LText, @BID=@BID,@LoginUID=@LoginUID,@SessionUid=@SessionUid,@UserID=@UserID,@ID=@ID |
| | | |
| | | Insert into ${_verify.sheet} (${fields},createuserid,createuser,createstaff,bid,upid) |
| | | Select ${fields},@userid@,@username,@fullname,@BID@,@upid From @${_verify.sheet} |
| | | |
| | | Delete @${_verify.sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | let Ltext = `create proc ${param.funcName} |
| | | ( /*${menu.MenuName} ${btn.label}*/ |
| | | @ID nvarchar(50)='', |
| | | @BID nvarchar(50)='', |
| | | @Ltext nvarchar(max)='', |
| | | @sEPTMenuNo nvarchar(50)='${param.menuNo}', |
| | | @lang nvarchar(50)='', |
| | | @LoginUID nvarchar(50)='', |
| | | @SessionUid nvarchar(50)='', |
| | | @UserID nvarchar(50), |
| | | @ErrorCode nvarchar(50) out, |
| | | @retmsg nvarchar(4000) out |
| | | ) |
| | | as |
| | | begin |
| | | declare @sEPTMenuNo ,@Begindate datetime,@Enddate datetime |
| | | select @sEPTMenuNo=@retmsg,@Begindate=getdate() |
| | | set @ErrorCode='' |
| | | set @retmsg='' |
| | | BEGIN TRY |
| | | /*事务操作*/ |
| | | BEGIN TRAN |
| | | /*具体业务操作*/ |
| | | |
| | | /* |
| | | ${_sql} |
| | | */ |
| | | |
| | | COMMIT TRAN |
| | | SET NOCOUNT ON |
| | | RETURN |
| | | END TRY |
| | | BEGIN CATCH |
| | | /*错误处理*/ |
| | | ROLLBACK TRAN |
| | | DECLARE @ErrorMessage NVARCHAR(4000); |
| | | DECLARE @ErrorSeverity INT; |
| | | DECLARE @ErrorState INT; |
| | | |
| | | /*把自定义的友好的错误信息提示加上*/ |
| | | set @ErrorCode=cast(ERROR_NUMBER() as nvarchar(50)) |
| | | SET @retmsg=ERROR_MESSAGE(); |
| | | SELECT @ErrorMessage=ERROR_MESSAGE(), |
| | | @ErrorSeverity=ERROR_SEVERITY(), |
| | | @ErrorState=ERROR_STATE(); |
| | | |
| | | RAISERROR(@ErrorMessage, /*-- Message text.*/ |
| | | @ErrorSeverity, /*-- Severity.*/ |
| | | @ErrorState /*-- State.*/ |
| | | ); |
| | | END CATCH |
| | | |
| | | GOTO_RETURN: |
| | | ROLLBACK TRAN |
| | | |
| | | END` |
| | | |
| | | Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') |
| | | |
| | | return Ltext |
| | | } |
| | | } |