| | |
| | | 'header.form.refresh.view': 'Refresh the page', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | | 'header.form.refresh.maingrid': '刷新主表', |
| | | 'header.form.refresh.equaltab': '刷新同级标签', |
| | | 'header.form.refresh.subgrid': '刷新子表', |
| | | 'header.form.popClose': '标签关闭', |
| | | 'header.form.toolbar': 'The toolbar', |
| | |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.linkTab': '关联标签', |
| | | 'header.form.subTab': '下级标签', |
| | | 'header.form.supTab': '上级标签', |
| | | 'header.form.equalTab': '同级标签', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': 'Excel导入', |
| | | 'header.form.excelOut': 'Excel导出', |
| | |
| | | 'header.form.refresh.view': '刷新页面', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | | 'header.form.refresh.maingrid': '刷新主表', |
| | | 'header.form.refresh.equaltab': '刷新同级标签', |
| | | 'header.form.refresh.subgrid': '刷新子表', |
| | | 'header.form.popClose': '标签关闭', |
| | | 'header.form.toolbar': '工具栏', |
| | |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.linkTab': '关联标签', |
| | | 'header.form.subTab': '下级标签', |
| | | 'header.form.supTab': '上级标签', |
| | | 'header.form.equalTab': '同级标签', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': '导入Excel', |
| | | 'header.form.excelOut': '导出Excel', |
| | |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | tabBtn: null, // 表单标签按钮 |
| | | tabParam: null // 表单标签参数 |
| | | tabParam: null, // 表单标签参数 |
| | | refreshtabs: null // 需要刷新的标签集 |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | let _isLinkMain = false // 检查是否有与主表关联的子表 |
| | | let supmenus = {} |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group] && config[group].length > 0) { |
| | | config[group] = config[group].map(tab => { |
| | | if (tab.subtabs && tab.subtabs.length > 0) { |
| | | tab.subtabs.forEach(id => { |
| | | supmenus[id] = tab.uuid |
| | | }) |
| | | } |
| | | if (config.setting.subtabs.includes(tab.uuid)) { |
| | | tab.supMenu = 'mainTable' |
| | | _isLinkMain = true |
| | | } else if (supmenus[tab.uuid]) { |
| | | tab.supMenu = supmenus[tab.uuid] |
| | | } |
| | | config.tabgroups.forEach(groupId => { |
| | | if (!config[groupId] || config[groupId].length === 0) return |
| | | |
| | | return tab |
| | | }) |
| | | } |
| | | config[groupId].forEach(tab => { |
| | | if (tab.supMenu === 'mainTable') { |
| | | _isLinkMain = true |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | this.setState({ |
| | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = () => { |
| | | this.reloadtable() |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && tab.supMenu === 'mainTable') { |
| | | this.reloadtable() |
| | | } else if (type === 'maingrid' && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | |
| | | visible={this.state.visible} |
| | | onCancel={this.popclose} |
| | | footer={[ |
| | | <Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button> |
| | | <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | record: {} |
| | | } |
| | | |
| | | componentDidMount () { |
| | | UNSAFE_componentWillMount () { |
| | | const { data, groups } = this.props |
| | | |
| | | let datatype = {} |
| | |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | primaryId: null |
| | | primaryId: null, |
| | | refreshtabs: null |
| | | } |
| | | |
| | | /** |
| | |
| | | // if (!config[group]) return |
| | | // config[group] = config[group].filter(tab => permAction[tab.uuid]) |
| | | // }) |
| | | |
| | | let _isLinkMain = false // 检查是否有与主表关联的子表 |
| | | let supmenus = {} |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group] && config[group].length > 0) { |
| | | config[group] = config[group].map(tab => { |
| | | if (tab.subtabs && tab.subtabs.length > 0) { |
| | | tab.subtabs.forEach(id => { |
| | | supmenus[id] = tab.uuid |
| | | }) |
| | | } |
| | | if (config.setting.subtabs.includes(tab.uuid)) { |
| | | tab.supMenu = 'mainTable' |
| | | _isLinkMain = true |
| | | } else if (supmenus[tab.uuid]) { |
| | | tab.supMenu = supmenus[tab.uuid] |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | actions: config.action, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField, |
| | | primaryId: this.props.param.primaryId || '', |
| | | data: config.setting.datatype === 'query' ? null : this.props.param.data, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && tab.supMenu === 'mainTable') { |
| | | this.loadmaindata() |
| | | } else if (type === 'maingrid' && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单参数 |
| | | */ |
| | | getFormData = () => { |
| | | return this.formGroupRef.handleConfirm() |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state |
| | | const { setting, actions, loadingview, viewlost, config, groups, data } = this.state |
| | | let hasform = false |
| | | |
| | | if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | <div className="formtab" id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {hasform ? |
| | | <FormGroup |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | |
| | | } |
| | | > .ant-tabs { |
| | | padding: 0px 20px; |
| | | margin-bottom: 20px; |
| | | .ant-tabs-tab:not(.ant-tabs-tab-active) { |
| | | cursor: pointer; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | .ant-tabs + .ant-tabs { |
| | | margin-top: 20px; |
| | | } |
| | | } |
| | | .formtab.pick-control { |
| | | >.button-list { |
| | | padding-right: 140px; |
| | | } |
| | | } |
| | | |
| | | .popview-modal { |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func, // 刷新主表 |
| | | refreshtabs:PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | } else if (nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | this.reloadtable() |
| | | } |
| | | } |
| | | |
| | |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | this.reloadview() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadview() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } else if (btn.popClose === 'maingrid' && type === 'pop') { |
| | | this.props.handleMainTable() |
| | | } else if (btn.popClose === 'subgrid' && type === 'pop') { |
| | | } else if (btn.popClose === 'grid' && type === 'pop') { |
| | | this.reloadtable() |
| | | } else if (btn.popClose === 'view' && type === 'pop') { |
| | | this.reloadview() |
| | | } else if (btn.popClose === 'maingrid' && type === 'pop') { |
| | | this.props.handleMainTable('maingrid') |
| | | } else if (btn.popClose === 'equaltab' && type === 'pop') { |
| | | this.reloadtable() |
| | | this.props.handleMainTable('equaltab') |
| | | } |
| | | } |
| | | |
| | |
| | | visible={this.state.visible} |
| | | onCancel={this.popclose} |
| | | footer={[ |
| | | <Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button> |
| | | <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | triggerExcelout = (btn) => { |
| | | let viewParam = this.props.getexceloutparam() |
| | | let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` |
| | | // let pageSize = 100 |
| | | let pageSize = 100 |
| | | |
| | | this.setState({loadingUuid: btn.uuid}) |
| | | |
| | |
| | | } else { |
| | | this.execError({ErrCode: 'N', message: '导出按钮设置错误!'}, btn) |
| | | } |
| | | } else if (btn.intertype === 'outer' && btn.innerFunc) { // 分页,且两步请求 |
| | | this.getExcelOutDoubleData(btn, viewParam, 1, pageSize, [], name) |
| | | } else { // 分页,一步请求 |
| | | this.getExcelOutData(btn, viewParam, 1, pageSize, [], name) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 两步分页请求 |
| | | */ |
| | | getExcelOutDoubleData = (btn, viewParam, pageIndex, pageSize, data, name) => { |
| | | let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param.func = btn.innerFunc |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | 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 |
| | | |
| | | Api.genericInterface(res).then(result => { |
| | | if (result.status) { |
| | | if (!result.data) { |
| | | this.execError({ErrCode: 'N', message: '未获取到数据信息!'}, btn) |
| | | } else if (result.data.length >= pageSize) { |
| | | data = data.concat(result.data) |
| | | pageIndex++ |
| | | this.getExcelOutDoubleData(btn, viewParam, pageIndex, pageSize, data, name) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data, btn, name) |
| | | } |
| | | } else { |
| | | this.execError(result, btn) |
| | | } |
| | | }) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 一步分页请求 |
| | | */ |
| | | getExcelOutData = (btn, viewParam, pageIndex, pageSize, data, name) => { |
| | | let param = null |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { // 使用系统函数 |
| | | if (!viewParam.arr_field) { |
| | | this.execError({ErrCode: 'N', message: '未设置显示列!'}, btn) |
| | | return |
| | | } |
| | | |
| | | param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | |
| | | |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 使用内部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param.func = btn.innerFunc |
| | | |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | if (btn.outerFunc) { |
| | | param.func = btn.outerFunc |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (!result.data) { |
| | | this.execError({ErrCode: 'N', message: '未获取到数据信息!'}, btn) |
| | | } else if (result.data.length >= pageSize) { |
| | | data = data.concat(result.data) |
| | | pageIndex++ |
| | | this.getExcelOutData(btn, viewParam, pageIndex, pageSize, data, name) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data, btn, name) |
| | | } |
| | | } else { |
| | | this.execError(result, btn) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description Excel 生成 |
| | | */ |
| | | exportExcel = (data, btn, name) => { |
| | | const { logcolumns } = this.props |
| | | if (data && data.length > 0) { |
| | |
| | | let _header = [] |
| | | let _topRow = {} |
| | | let colwidth = [] |
| | | |
| | | let hidecolumns = [] |
| | | logcolumns.forEach(col => { |
| | | if (col.Hide === 'true') { |
| | | hidecolumns.push(col.field) |
| | | } |
| | | }) |
| | | |
| | | if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | btn.verify.columns.forEach(col => { |
| | | if (hidecolumns.includes(col.Column)) return |
| | | if (!data[0].hasOwnProperty(col.Column)) return |
| | | if (_topRow[col.Column]) return |
| | | |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | |
| | | colwidth.push({width: col.Width}) |
| | | }) |
| | | } |
| | | |
| | | logcolumns.forEach(col => { |
| | | if (col.Hide === 'true') return |
| | | |
| | | if (!data[0].hasOwnProperty(col.field)) return |
| | | if (_topRow[col.field]) return |
| | | |
| | | _header.push(col.field) |
| | | _topRow[col.field] = col.label |
| | | |
| | | let _colwidth = Math.floor(col.Width / 6) |
| | | |
| | | if (!_colwidth || _colwidth < 10) { |
| | | _colwidth = 10 |
| | | if (!_colwidth || _colwidth < 5) { |
| | | _colwidth = 5 |
| | | } |
| | | |
| | | colwidth.push({width: _colwidth}) |
| | | }) |
| | | |
| | | Object.keys(data[0]).forEach(key => { |
| | | if (hidecolumns.includes(key)) return |
| | | if (_topRow[key]) return |
| | | |
| | | _header.push(key) |
| | | _topRow[key] = key |
| | | |
| | | colwidth.push({width: 12}) |
| | | }) |
| | | |
| | | let table = [] |
| | |
| | | table.push(_row) |
| | | }) |
| | | |
| | | // const ws = XLSX.utils.aoa_to_sheet(data) |
| | | const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) |
| | | |
| | | ws['!cols'] = colwidth |
| | |
| | | ..._search |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | if (pagination) { |
| | | param.PageIndex = pageIndex |
| | | param.PageSize = pageSize |
| | |
| | | arr_field: arr_field, |
| | | appkey: window.GLOB.appkey || '' |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | let _dataresource = setting.dataresource |
| | | |
| | |
| | | componentDidMount () { |
| | | const { data, BData } = this.props |
| | | let action = JSON.parse(JSON.stringify(this.props.action)) |
| | | |
| | | |
| | | let datatype = {} |
| | | let readtype = {} |
| | | let readin = {} |
| | |
| | | import EditCard from '@/templates/tableshare/editcard' |
| | | import VerifyCard from '@/templates/tableshare/verifycard' |
| | | import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/tableshare/menuform' |
| | | import TabDragElement from '@/templates/tableshare/tabdragelement' |
| | | import SourceElement from '@/templates/tableshare/dragelement/source' |
| | |
| | | handleTab = (card) => { |
| | | const { config } = this.state |
| | | |
| | | let index = 0 // 筛选下一组 |
| | | let menus = [{value: 'mainTable', text: '主表'}] |
| | | let equalTabs = [] |
| | | let supMenu = card.supMenu || '' |
| | | let equalTab = card.equalTab || [] |
| | | let isuptab = true |
| | | let equalTabIds = [] |
| | | |
| | | config.tabgroups.forEach((groupId, i) => { |
| | | if (groupId === card.groupId) { |
| | | index = i |
| | | isuptab = false |
| | | config[card.groupId].forEach(tab => { // 可关联的同级标签 |
| | | if (tab.uuid === card.uuid) return |
| | | |
| | | equalTabIds.push(tab.uuid) |
| | | equalTabs.push(tab) |
| | | }) |
| | | } else if (isuptab) { |
| | | config[groupId].forEach(tab => { |
| | | menus.push({ |
| | | value: tab.uuid, |
| | | text: tab.label |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let menus = [] |
| | | let subtabs = card.subtabs || [] |
| | | let nextTabId = config.tabgroups[index + 1] |
| | | |
| | | if (nextTabId) { |
| | | let _tabMap = new Map() |
| | | let _usedTabMap = new Map() |
| | | |
| | | config[nextTabId].forEach(tab => { // 下级所有的标签 |
| | | menus.push(tab) |
| | | _tabMap.set(tab.uuid, true) |
| | | }) |
| | | |
| | | config[card.groupId].forEach(tab => { // 同级标签已选的下级标签 |
| | | if (tab.uuid === card.uuid) return |
| | | |
| | | tab.subtabs.forEach(subtab => { |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | | }) |
| | | |
| | | config.setting.subtabs.forEach(subtab => { // 主表已选的下级标签 |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | | |
| | | subtabs = subtabs.filter(tabId => _tabMap.has(tabId) && !_usedTabMap.has(tabId)) |
| | | menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) |
| | | } else { |
| | | subtabs = [] |
| | | if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { |
| | | supMenu = '' |
| | | } |
| | | |
| | | if (equalTab.length > 0) { |
| | | equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | modaltype: 'tabs', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'subtabs', |
| | | label: this.state.dict['header.form.subTab'], |
| | | initVal: subtabs, |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: this.state.dict['header.form.supTab'], |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | } |
| | | ] |
| | | }) |
| | |
| | | }) |
| | | resolve(false) |
| | | } |
| | | } else if (btn.OpenType === 'excelOut') { |
| | | let _param = { |
| | | innerFunc: btn.innerFunc |
| | | } |
| | | |
| | | newLText = Utils.formatOptions(Utils.getTableFunc(_param, menu, config )) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) |
| | | resolve(true) |
| | | } else { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType !== 'excelIn') { |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | if (_verify.default === 'false' && _verify.scripts.length === 0) { |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | } else if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' ? |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? |
| | | <VerifyCard |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelIn' ? |
| | | <VerifyCardExcelIn |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelOut' ? |
| | | <VerifyCardExcelOut |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | |
| | | <SettingForm |
| | | dict={this.state.dict} |
| | | menu={this.props.menu} |
| | | config={this.state.config} |
| | | data={this.state.config.setting} |
| | | columns={this.state.config.columns} |
| | | usefulFields={this.props.permFuncField} |
| | |
| | | dict: PropTypes.object, // 字典项 |
| | | menu: PropTypes.object, |
| | | data: PropTypes.object, |
| | | config: PropTypes.object, |
| | | columns: PropTypes.array, |
| | | usefulFields: PropTypes.array |
| | | } |
| | |
| | | state = { |
| | | interType: this.props.data.interType || 'inner', |
| | | columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), |
| | | currentTabs: null, |
| | | selectTabs: [], |
| | | interReadonly: false, |
| | | primaryKey: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { config, data, columns } = this.props |
| | | let _tabs = [] |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | | |
| | | config.tabgroups.forEach(groupname => { |
| | | config[groupname].forEach(tab => { |
| | | if (tab.origin) return |
| | | |
| | | _tabs.push(tab) |
| | | _tabMap.set(tab.uuid, true) |
| | | }) |
| | | }) |
| | | |
| | | data.subtabs && data.subtabs.forEach(tabId => { |
| | | if (_tabMap.has(tabId)) { |
| | | _select.push(tabId) |
| | | } |
| | | }) |
| | | const { data, columns } = this.props |
| | | |
| | | let primaryKey = data.primaryKey |
| | | if (primaryKey) { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | interReadonly: data.sysInterface === 'true', |
| | | primaryKey: primaryKey |
| | | }) |
| | |
| | | render() { |
| | | const { data, dict, menu, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, primaryKey } = this.state |
| | | const { interType, columns, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | <Select> |
| | | <Select.Option value="true">加载数据</Select.Option> |
| | | <Select.Option value="false">不加载数据</Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="主表可选取关联标签,标签关联后,主表数据切换时,下级标签会跟随主表主键值变化。"> |
| | | <Icon type="question-circle" /> |
| | | {'下级标签'} |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('subtabs', { |
| | | initialValue: selectTabs |
| | | })( |
| | | <Select |
| | | mode="multiple" |
| | | style={{ width: '100%' }} |
| | | placeholder="Please select" |
| | | > |
| | | {this.state.currentTabs.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | |
| | | handleTab = (card) => { |
| | | const { config } = this.state |
| | | |
| | | let index = 0 // 筛选下一组 |
| | | let menus = [{value: 'mainTable', text: '主数据'}] |
| | | let equalTabs = [] |
| | | let supMenu = card.supMenu || '' |
| | | let equalTab = card.equalTab || [] |
| | | let isuptab = true |
| | | let equalTabIds = [] |
| | | |
| | | config.tabgroups.forEach((groupId, i) => { |
| | | if (groupId === card.groupId) { |
| | | index = i |
| | | isuptab = false |
| | | config[card.groupId].forEach(tab => { // 可关联的同级标签 |
| | | if (tab.uuid === card.uuid) return |
| | | |
| | | equalTabIds.push(tab.uuid) |
| | | equalTabs.push(tab) |
| | | }) |
| | | } else if (isuptab) { |
| | | config[groupId].forEach(tab => { |
| | | menus.push({ |
| | | value: tab.uuid, |
| | | text: tab.label |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let menus = [] |
| | | let subtabs = card.subtabs || [] |
| | | let nextTabId = config.tabgroups[index + 1] |
| | | if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { |
| | | supMenu = '' |
| | | } |
| | | |
| | | if (nextTabId) { |
| | | let _tabMap = new Map() |
| | | let _usedTabMap = new Map() |
| | | |
| | | config[nextTabId].forEach(tab => { // 下级所有的标签 |
| | | menus.push(tab) |
| | | _tabMap.set(tab.uuid, true) |
| | | }) |
| | | |
| | | config[card.groupId].forEach(tab => { // 同级标签已选的下级标签 |
| | | if (tab.uuid === card.uuid) return |
| | | |
| | | tab.subtabs.forEach(subtab => { |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | | }) |
| | | |
| | | config.setting.subtabs.forEach(subtab => { // 主表已选的下级标签 |
| | | _usedTabMap.set(subtab, true) |
| | | }) |
| | | |
| | | subtabs = subtabs.filter(tab => _tabMap.has(tab.uuid) && !_usedTabMap.has(tab.uuid)) |
| | | menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) |
| | | } else { |
| | | subtabs = [] |
| | | if (equalTab.length > 0) { |
| | | equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'subtabs', |
| | | label: '下级标签', |
| | | initVal: subtabs, |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: this.state.dict['header.form.supTab'], |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | } |
| | | ] |
| | | }) |
| | |
| | | state = { |
| | | interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', |
| | | columns: null, |
| | | currentTabs: null, |
| | | selectTabs: [], |
| | | interReadonly: false, |
| | | primaryKey: '' |
| | | } |
| | |
| | | UNSAFE_componentWillMount() { |
| | | const { config } = this.props |
| | | |
| | | let _tabs = [] |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | | let _columns = [] |
| | | let _setting = config.setting |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | config.tabgroups.forEach(groupname => { |
| | | config[groupname].forEach(tab => { |
| | | if (tab.origin) return |
| | | |
| | | _tabs.push(tab) |
| | | _tabMap.set(tab.uuid, true) |
| | | }) |
| | | }) |
| | | |
| | | _setting.subtabs && _setting.subtabs.forEach(tabId => { |
| | | if (_tabMap.has(tabId)) { |
| | | _select.push(tabId) |
| | | } |
| | | }) |
| | | |
| | | let primaryKey = _setting.primaryKey |
| | | if (primaryKey) { |
| | | let field = _columns.filter(column => column.field === primaryKey) |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | columns: _columns, |
| | | setting: _setting, |
| | | interType: _setting.interType || 'inner', |
| | |
| | | render() { |
| | | const { dict, usefulFields, menu } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, setting, datatype, primaryKey } = this.state |
| | | const { interType, columns, setting, datatype, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="主表可选取关联标签,标签关联后,主表数据切换时,下级标签会跟随主表主键值变化。"> |
| | | <Icon type="question-circle" /> |
| | | {'下级标签'} |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('subtabs', { |
| | | initialValue: selectTabs |
| | | })( |
| | | <Select |
| | | mode="multiple" |
| | | style={{ width: '100%' }} |
| | | placeholder="Please select" |
| | | > |
| | | {this.state.currentTabs.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |
| | |
| | | }, { |
| | | value: 'delete', |
| | | text: this.props.dict['header.form.action.delete'] |
| | | }], |
| | | closeOptions: [{ |
| | | value: 'never', |
| | | text: this.props.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'grid', |
| | | text: this.props.dict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: this.props.dict['header.form.refresh.view'] |
| | | }, { |
| | | value: 'maingrid', |
| | | text: this.props.dict['header.form.refresh.maingrid'] |
| | | }, { |
| | | value: 'equaltab', |
| | | text: this.props.dict['header.form.refresh.equaltab'] |
| | | }] |
| | | } |
| | | |
| | |
| | | text: this.props.dict['header.form.popview'] |
| | | } |
| | | ] |
| | | } else if (item.key === 'execSuccess') { |
| | | item.options = this.state.closeOptions |
| | | } else if (item.key === 'execError') { |
| | | item.options = this.state.closeOptions |
| | | } else if (item.key === 'popClose') { |
| | | item.options = this.state.closeOptions |
| | | } |
| | | |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'Ot') { |
| | | item.hidden = false |
| | | } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value)) { |
| | | } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value) && this.state.interType === 'inner') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | |
| | | import EditCard from '@/templates/tableshare/editcard' |
| | | import VerifyCard from '@/templates/tableshare/verifycard' |
| | | import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/tableshare/menuform' |
| | | import SourceElement from '@/templates/tableshare/dragelement/source' |
| | | import Source from './source' |
| | |
| | | }) |
| | | resolve(false) |
| | | } |
| | | } else if (btn.OpenType === 'excelOut') { |
| | | let _param = { |
| | | innerFunc: btn.innerFunc |
| | | } |
| | | |
| | | newLText = Utils.formatOptions(Utils.getTableFunc(_param, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 创建存储过程sql |
| | | DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) |
| | | |
| | | resolve(true) |
| | | } else { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType !== 'excelIn') { |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | if (_verify.default === 'false' && _verify.scripts.length === 0) { |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | } else if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '' |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelOut' ? |
| | | <VerifyCardExcelOut |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | </Modal> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | |
| | | if (type === 'action') { |
| | | if (['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc) { |
| | | hasProfile = true |
| | | } else if (card.OpenType === 'excelIn') { |
| | | } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { |
| | | hasProfile = true |
| | | } |
| | | } |
| | |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="标签可关联下级标签,下级标签可选范围:相邻的下侧标签组中未被同级或主表关联的标签。"> |
| | | <Tooltip placement="topLeft" title="标签添加同级标签后,标签中按钮刷新主表时,添加的同级标签会刷新。"> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> |
| | |
| | | <Select |
| | | mode="multiple" |
| | | style={{ width: '100%' }} |
| | | placeholder="Please select" |
| | | placeholder="" |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Button, Input, InputNumber } from 'antd' |
| | | import './index.scss' |
| | | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | range: PropTypes.any, // 字典项 |
| | | columnChange: PropTypes.func // 修改函数 |
| | | } |
| | | |
| | | state = { |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | Column: record.Column, |
| | | Text: record.Text, |
| | | Width: record.Width, |
| | | }) |
| | | } |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | this.props.columnChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | Column: '', |
| | | Text: '', |
| | | Width: 20, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form"> |
| | | <Row gutter={24}> |
| | | <Col span={7}> |
| | | <Form.Item label={'Column'}> |
| | | {getFieldDecorator('Column', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + 'Column!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'Text'}> |
| | | {getFieldDecorator('Text', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + 'Text!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'Width'}> |
| | | {getFieldDecorator('Width', { |
| | | initialValue: 20, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + 'Width!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={5} max={200} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | | {/* <Col span={7}> |
| | | <Form.Item label={'类型'}> |
| | | {getFieldDecorator('type', { |
| | | initialValue: 'text' |
| | | })( |
| | | <Select onChange={this.typeChange}> |
| | | <Select.Option value="text"> text </Select.Option> |
| | | <Select.Option value="number"> number </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> */} |
| | | </Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(UniqueForm) |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import ColumnForm from './columnform' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | card: PropTypes.object, |
| | | } |
| | | |
| | | state = { |
| | | verify: {}, |
| | | excelColumns: [ |
| | | { |
| | | title: 'Column', |
| | | dataIndex: 'Column', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'Text', |
| | | dataIndex: 'Text', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: 'Width', |
| | | dataIndex: 'Width', |
| | | width: '25%' |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | ( |
| | | <div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | ) |
| | | } |
| | | ] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | let _verify = this.props.card.verify || {} |
| | | |
| | | this.setState({ |
| | | verify: { |
| | | ..._verify, |
| | | columns: _verify.columns || [], |
| | | } |
| | | }) |
| | | } |
| | | |
| | | columnChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | |
| | | if (values.uuid) { |
| | | verify.columns = verify.columns.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.uuid = Utils.getuuid() |
| | | verify.columns.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | handleDelete = (record, type) => { |
| | | const { verify } = this.state |
| | | |
| | | verify.columns = verify.columns.filter(item => item.uuid !== record.uuid) |
| | | |
| | | this.setState({ verify: verify }) |
| | | } |
| | | |
| | | handleEdit = (record, type) => { |
| | | this.columnForm.edit(record) |
| | | |
| | | let node = document.getElementById('verify-excelout-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | } |
| | | } |
| | | |
| | | handleUpDown = (record, type, direction) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let index = 0 |
| | | |
| | | verify.columns = verify.columns.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.columns.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.columns.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.columns.splice(index + 1, 0, record) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | showError = (errorType) => { |
| | | if (errorType === 'S') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '执行成功!', |
| | | duration: 2 |
| | | }) |
| | | } else if (errorType === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 15 |
| | | }) |
| | | } else if (errorType === 'E') { |
| | | Modal.error({ |
| | | title: '执行失败!' |
| | | }) |
| | | } else if (errorType === 'NM') { |
| | | message.error('执行失败!') |
| | | } |
| | | } |
| | | |
| | | timeChange = (val, type) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, [type]: val} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { verify, excelColumns } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div id="verify-excelout-box-tab"> |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | | <TabPane tab="Excel导出列" key="1"> |
| | | <ColumnForm |
| | | dict={this.props.dict} |
| | | range={verify.range} |
| | | columnChange={this.columnChange} |
| | | wrappedComponentRef={(inst) => this.columnForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.columns} |
| | | columns={excelColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> N </span> |
| | | <Button onClick={() => {this.showError('N')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ntime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ftime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(VerifyCard) |
New file |
| | |
| | | .verify-card-box { |
| | | .ant-tabs-nav-scroll { |
| | | text-align: center; |
| | | } |
| | | .ant-tabs-content { |
| | | min-height: 40vh; |
| | | } |
| | | table tr td { |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .verify-form { |
| | | .sql { |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | | .sqlfield { |
| | | .ant-form-item { |
| | | margin-bottom: 5px; |
| | | } |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .add { |
| | | padding-top: 4px; |
| | | } |
| | | } |
| | | .custom-table .ant-empty { |
| | | margin: 20px 8px!important; |
| | | } |
| | | .errorval { |
| | | display: inline-block; |
| | | width: 30px; |
| | | } |
| | | .operation-btn { |
| | | display: inline-block; |
| | | font-size: 16px; |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50) ) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000) |
| | | let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50)) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | |
| | | Select @ErrorCode='',@retmsg='' |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID |
| | | |
| | | Insert into @${btn.sheet} (${fields},jskey) |
| | | |
| | | exec s_KeyWords_Replace |
| | | exec s_KeyWords_Replace |
| | | @LText=@LText, @BID=@BID,@LoginUID=@LoginUID,@SessionUid=@SessionUid,@UserID=@UserID,@ID=@ID |
| | | |
| | | Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@userid@,@username,@fullname,@BID@ From @${btn.sheet} |
| | | Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet} |
| | | |
| | | Delete @${btn.sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | Delete @${btn.sheet}` |
| | | |
| | | let Ltext = `create proc ${param.funcName} |
| | | ( /*${menu.MenuName} ${btn.label}*/ |