| | |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('isEditState', state) |
| | | let _userName = sessionStorage.getItem('User_Name') |
| | | let _avatar = this.state.avatar |
| | | |
| | | if (!state && sessionStorage.getItem('avatar')) { |
| | | _avatar = Utils.getrealurl(sessionStorage.getItem('avatar')) // 头像 |
| | | } else if (state && sessionStorage.getItem('CloudAvatar')) { |
| | | _avatar = Utils.getrealurl(sessionStorage.getItem('CloudAvatar')) // 头像 |
| | | } |
| | | |
| | | if (state) { |
| | | _userName = sessionStorage.getItem('CloudUserName') |
| | | } |
| | | |
| | | this.setState({ |
| | | menulist: null |
| | | menulist: null, |
| | | userName: _userName, |
| | | avatar: _avatar |
| | | }) |
| | | this.loadmenu() |
| | | this.props.modifyMainMenu('') |
| | |
| | | sessionStorage.setItem('CloudUserID', res.UserID) |
| | | sessionStorage.setItem('CloudSessionUid', Utils.getuuid()) |
| | | sessionStorage.setItem('CloudLoginUID', res.LoginUID) |
| | | sessionStorage.setItem('CloudUserName', res.UserName) |
| | | sessionStorage.setItem('CloudAvatar', res.icon) |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | |
| | | let _avatar = this.state.avatar |
| | | if (res.icon) { |
| | | _avatar = Utils.getrealurl(res.icon) // 头像 |
| | | } |
| | | |
| | | this.setState({ |
| | | menulist: null, |
| | | loginVisible: false, |
| | | loginLoading: false |
| | | loginLoading: false, |
| | | userName: res.UserName, |
| | | avatar: _avatar |
| | | }) |
| | | this.loadmenu() |
| | | this.props.modifyMainMenu('') |
| | |
| | | } |
| | | |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加 |
| | | // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除) |
| | | if ( |
| | | btn.Ot === 'notRequired' || |
| | | btn.Ot === 'requiredSgl' || |
| | | (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') || |
| | | (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert') |
| | | (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') |
| | | // (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert') |
| | | ) { |
| | | |
| | | // 创建凭证时,需要选择行时 |
| | |
| | | } |
| | | } else if (btn.intertype === 'outer') { |
| | | /** *********************调用外部接口************************* */ |
| | | |
| | | if (2 > 1) return |
| | | if (!btn.interface) { // 接口地址不存在时报错 |
| | | this.actionSettingError() |
| | | _resolve() |
| | |
| | | let _data = option.props.data |
| | | _field.linkSubField.forEach(subfield => { |
| | | if (this.props.form.getFieldValue(subfield) !== undefined) { |
| | | fieldsvalue[subfield] = _data[subfield] |
| | | fieldsvalue[subfield] = _data[subfield] || '' |
| | | } else { |
| | | _record[subfield] = _data[subfield] |
| | | _record[subfield] = _data[subfield] || '' |
| | | } |
| | | }) |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Input, Button, Popconfirm, Form, Icon } from 'antd' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | class EditTable extends Component { |
| | | constructor(props) { |
| | | super(props) |
| | | |
| | | let _width = '40%' |
| | | let fields = [] |
| | | |
| | | if (props.type === 'link') { |
| | | _width = '27%' |
| | | } else { |
| | | _width = Math.floor(80 / (props.linkSubFields.length + 2)) + '%' |
| | | fields = props.linkSubFields.map(field => { |
| | | return { |
| | | title: field.label, |
| | | dataIndex: field.field, |
| | | width: _width, |
| | | editable: true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let columns = [ |
| | | { |
| | | title: 'Value', |
| | | dataIndex: 'Value', |
| | | width: props.type === 'link' ? '27%' : '40%', |
| | | width: _width, |
| | | editable: true |
| | | }, |
| | | { |
| | | title: 'Text', |
| | | dataIndex: 'Text', |
| | | width: props.type === 'link' ? '27%' : '40%', |
| | | width: _width, |
| | | editable: true |
| | | }, |
| | | ...fields, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | |
| | | this.setState({ dataSource: newData }) |
| | | } |
| | | |
| | | resetColumn = (type) => { |
| | | resetColumn = (type, linkSubFields) => { |
| | | let _width = '40%' |
| | | let fields = [] |
| | | |
| | | if (type === 'link') { |
| | | _width = '27%' |
| | | } else { |
| | | _width = Math.floor(80 / (linkSubFields.length + 2)) + '%' |
| | | fields = linkSubFields.map(field => { |
| | | return { |
| | | title: field.label, |
| | | dataIndex: field.field, |
| | | width: _width, |
| | | editable: true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let columns = [ |
| | | { |
| | | title: 'Value', |
| | | dataIndex: 'Value', |
| | | width: type === 'link' ? '27%' : '40%', |
| | | width: _width, |
| | | editable: true |
| | | }, |
| | | { |
| | | title: 'Text', |
| | | dataIndex: 'Text', |
| | | width: type === 'link' ? '27%' : '40%', |
| | | width: _width, |
| | | editable: true |
| | | }, |
| | | ...fields, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (this.props.type !== nextProps.type) { |
| | | this.resetColumn(nextProps.type) |
| | | } else if (!is(fromJS(this.props.linkSubFields), fromJS(nextProps.linkSubFields))) { |
| | | this.resetColumn(this.props.type, nextProps.linkSubFields) |
| | | } |
| | | } |
| | | |
| | |
| | | state = { |
| | | openType: null, |
| | | resourceType: null, |
| | | formlist: null |
| | | formlist: null, |
| | | linkSubFields: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let formlist = JSON.parse(JSON.stringify(this.props.formlist)) |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let type = '' |
| | | let resourceType = '' |
| | | let linkSubFields = [] |
| | | |
| | | formlist.forEach(cell => { |
| | | if (cell.key === 'type') { |
| | | type = cell.initVal |
| | | } else if (cell.key === 'resourceType') { |
| | | resourceType = cell.initVal |
| | | } else if (cell.key === 'linkSubField') { |
| | | let arr = [] |
| | | linkSubFields = cell.options.filter(option => { |
| | | if (!['Value', 'Text'].includes(option.field) && cell.initVal.includes(option.field) && !arr.includes(option.field)) { |
| | | arr.push(option.field) |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | |
| | | } else if (type === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | linkSubFields: linkSubFields, |
| | | formlist: formlist.map(form => { |
| | | if (dateOptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = dateOptions[type] |
| | |
| | | form.show = false |
| | | } else if (form.key === 'resourceType') { |
| | | form.initVal = this.state.resourceType |
| | | } else if (form.key === 'linkSubField') { |
| | | form.initVal = this.state.linkSubFields.map(_field => _field.field) |
| | | } |
| | | return form |
| | | }) |
| | |
| | | |
| | | multiselectChange = (key, value, options) => { |
| | | if (key === 'linkSubField') { |
| | | let arr = [] |
| | | let linkSubFields = options.filter(option => { |
| | | if (!['Value', 'Text'].includes(option.field) && value.includes(option.field) && !arr.includes(option.field)) { |
| | | arr.push(option.field) |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | |
| | | this.setState({linkSubFields: linkSubFields}) |
| | | } |
| | | console.log(key) |
| | | console.log(value) |
| | | console.log(options) |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | |
| | | } else if (item.type === 'options') { |
| | | fields.push( |
| | | <Col span={20} offset={4} key={index}> |
| | | <EditTable data={item.initVal} type={this.state.openType} ref="editTable"/> |
| | | <EditTable data={item.initVal} type={this.state.openType} linkSubFields={this.state.linkSubFields} ref="editTable"/> |
| | | </Col> |
| | | ) |
| | | } |
| | |
| | | let verify = btn.verify || {} |
| | | let _formFieldValue = {} |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | // let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'] |
| | | |
| | | // 主键字段 |
| | | let primaryKey = setting.primaryKey || 'id' |
| | |
| | | let _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50) |
| | | ` |
| | | |
| | | let _initvars = ['ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] // 已赋值字段集 |
| | | // let _initvars = ['ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] // 已赋值字段集 |
| | | let _initvars = ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'] // 已赋值字段集 |
| | | let _initfields = [] |
| | | let _declarefields = [] |
| | | |
| | |
| | | if (formdata) { |
| | | formdata.forEach(form => { |
| | | _formFieldValue[form.key] = form.value |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (!_initvars.includes(form.key)) { |
| | | _initvars.push(form.key) |
| | | _initfields.push(`@${form.key}='${form.value}'`) |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | _initfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(form.key)) { |
| | | _vars.push(form.key) |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } |
| | | |
| | | _declarefields.push(`@${form.key} ${_type}`) |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | if (logcolumns && logcolumns.length > 0) { |
| | | logcolumns.forEach(col => { |
| | | if (!_initvars.includes(col.field)) { |
| | | _initvars.push(col.field) |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | |
| | | let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' |
| | | _initfields.push(`@${col.field}='${_val}'`) |
| | | _initfields.push(`@${_key}='${_val}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(col.field)) { |
| | | _vars.push(col.field) |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | let _type = `nvarchar(${col.fieldlength || 50})` |
| | | |
| | |
| | | _type = `nvarchar(${col.fieldlength || 512})` |
| | | } |
| | | |
| | | _declarefields.push(`@${col.field} ${_type}`) |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | let _declare = '' |
| | | if (!_vars.includes(item.field)) { |
| | | _declare = `Declare @${item.field} nvarchar(50)` |
| | | let _key = item.field.toLowerCase() |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | | _vars.push(_key) |
| | | } |
| | | _vars.push(item.field) |
| | | |
| | | _sql += `${_declare} |
| | | select @BillCode='', @${item.field}='' |
| | | select @BillCode='', @${_key}='' |
| | | exec s_get_BillCode |
| | | @ModularDetailCode='${_ModularDetailCode}', |
| | | @Type=${item.Type}, |
| | |
| | | @retmsg=@retmsg output |
| | | if @ErrorCode!='' |
| | | goto aaa |
| | | set @${item.field}=@BillCode |
| | | set @${_key}=@BillCode |
| | | ` |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | // 用于取用户信息 |
| | | let _user = `select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID |
| | | let _user = `select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ |
| | | ` |
| | | |
| | | let primaryKeyName = ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKey.toLowerCase()) ? primaryKey + '@' : primaryKey |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (btn.OpenType === 'pop' && btn.sqlType === 'insert' && verify.default !== 'false') { |
| | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | _sql += _user |
| | | _sql += `insert into ${btn.sql} (${keys},createuserid,CreateUser,CreateStaff,BID) select ${values},@userid,@username,@fullname,@BID;` |
| | | _sql += `insert into ${btn.sql} (${keys},createuserid,CreateUser,CreateStaff,BID) select ${values},@userid@,@username,@fullname,@BID@;` |
| | | } else if (btn.OpenType === 'pop' && btn.sqlType === 'update' && verify.default !== 'false') { |
| | | let _form = [] |
| | | formdata.forEach(item => { |
| | |
| | | } |
| | | }) |
| | | _form = _form.join(',') |
| | | _sql += `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid${_updateconfig} where ${primaryKey}=@${primaryKey};` |
| | | _sql += `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid@${_updateconfig} where ${primaryKey}=@${primaryKeyName};` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'LogicDelete' && verify.default !== 'false') { // 逻辑删除 |
| | | _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${primaryKey}=@${primaryKey};` |
| | | _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') { // 物理删除 |
| | | let _msg = '' |
| | | if (data && logcolumns && logcolumns.length > 0) { |
| | |
| | | }) |
| | | } |
| | | _sql += _user |
| | | _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKey},@userid,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKey};` |
| | | _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKeyName},@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKeyName};` |
| | | } |
| | | |
| | | // 拼接自定义脚本 |