| | |
| | | 'header.save': 'Save', |
| | | 'header.notsave': 'Do not save', |
| | | 'header.close': 'Close', |
| | | 'header.notclose': 'not close', |
| | | 'header.reset': 'Reset', |
| | | 'header.menu.basemsg': 'Please complete the basic information !', |
| | | 'header.menu.template.change': 'Switch the template', |
| | |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格或主表中的数据写入表单', |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.save': '保存', |
| | | 'header.notsave': '不保存', |
| | | 'header.close': '关闭', |
| | | 'header.notclose': '不关闭', |
| | | 'header.reset': '重置', |
| | | 'header.menu.basemsg': '请完善菜单基本信息!', |
| | | 'header.menu.template.change': '切换模板', |
| | |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格中的数据写入表单', |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = (item.decimal || item.decimal === 0) ? item.decimal : 18 |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } |
| | | |
| | | return { |
| | |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = (item.decimal || item.decimal === 0) ? item.decimal : 18 |
| | | _fieldlen = item.decimal ? item.decimal : 0 |
| | | } |
| | | |
| | | datatype[item.field] = item.type |
| | |
| | | }) |
| | | } |
| | | this.setState({ |
| | | interType: value, |
| | | // interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'interface' && value === 'true') { |
| | | item.readonly = true |
| | |
| | | * @description 显示隐藏显示列字段名 |
| | | */ |
| | | onColumnNameChange = () => { |
| | | const { showColumnName } = this.state |
| | | const { showColumnName, config } = this.state |
| | | |
| | | if (!showColumnName) { |
| | | let fields = [] |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | fields.push(col.field) |
| | | } |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let textArea = document.createElement('textarea') |
| | | textArea.value = fields |
| | | document.body.appendChild(textArea) |
| | | textArea.select() |
| | | |
| | | try { |
| | | document.execCommand('copy') |
| | | document.body.removeChild(textArea) |
| | | } catch (err) { |
| | | document.body.removeChild(textArea) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | // import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | formlist: null, // 表单信息 |
| | | openType: null, // 打开方式 |
| | | interType: null, // 接口类型:内部、外部 |
| | | position: null, // 按钮位置 |
| | | reqOptionSgl: [{ |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptions: [{ |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }], |
| | | reqOptionsMutil: [{ |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | | }, { |
| | | value: 'requiredSgl', |
| | | text: this.props.dict['header.form.requiredSgl'] |
| | | }, { |
| | | value: 'required', |
| | | text: this.props.dict['header.form.required'] |
| | | }, { |
| | | value: 'requiredOnce', |
| | | text: this.props.dict['header.form.requiredOnce'] |
| | | }], |
| | | insertUpdateOptions: [{ |
| | | value: '', |
| | | text: this.props.dict['header.form.empty'] |
| | |
| | | }) |
| | | |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | ] |
| | | if (card.btnType === 'cancel') { |
| | | item.readonly = 'true' |
| | | item.readonly = true |
| | | } |
| | | } else if (item.key === 'execSuccess' && card.btnType === 'cancel') { |
| | | item.label = '返回后' |
| | | item.label = '关闭后' |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (value === 'inner') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'interface') { |
| | | item.readonly = false |
| | | } else if (item.key === 'sysInterface') { |
| | | item.initVal = 'false' |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'sysInterface') { |
| | | if (value === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | | interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | }) |
| | | } |
| | | this.setState({ |
| | | // interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'interface' && value === 'true') { |
| | | item.readonly = true |
| | | } else if (item.key === 'interface') { |
| | | item.readonly = false |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | disabled={!!item.readonly} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | |
| | | values.id = this.props.card.id |
| | | values.uuid = this.props.card.uuid |
| | | values.verify = this.props.card.verify || null |
| | | values.btnType = this.props.card.btnType || 'tabFormBtn' |
| | | |
| | | if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') { |
| | | values.position = 'toolbar' |
| | | values.Ot = 'notRequired' |
| | | } else if (values.OpenType === 'popview' && !values.linkTab) { // 没有关联标签(新建时),创建新标签Id |
| | | values.linkTab = Utils.getuuid() |
| | | } |
| | | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | | notification.warning({ |
| | |
| | | const { menu, btnTab, config } = this.props |
| | | |
| | | let _config = '' |
| | | let columns = [] |
| | | |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | |
| | | // _config.action = Source.baseConfig.action |
| | | } |
| | | |
| | | if (menu && menu.LongParam && menu.LongParam.columns) { |
| | | columns = menu.LongParam.columns |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | columns: columns, |
| | | originMenu: JSON.parse(JSON.stringify(_config)), |
| | | selectedTables: _config.tables, |
| | | menuformlist: [ |
| | |
| | | width={700} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button>, |
| | | this.state.card && this.state.card.btnType !== 'cancel' ? |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | | <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <VerifyCard card={this.state.card} columns={this.state.config.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} dict={this.state.dict} /> |
| | | <VerifyCard |
| | | card={this.state.card} |
| | | btnTab={this.props.btnTab} |
| | | config={this.state.config} |
| | | columns={this.state.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | dict={this.state.dict} |
| | | /> |
| | | </Modal> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | |
| | | }, { |
| | | btnType: 'cancel', |
| | | uuid: Utils.getuuid(), |
| | | label: '返回', |
| | | label: '关闭', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | | const { showColumnName } = this.state |
| | | const { showColumnName, config } = this.state |
| | | |
| | | if (!showColumnName) { |
| | | let fields = [] |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | fields.push(col.field) |
| | | } |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let textArea = document.createElement('textarea') |
| | | textArea.value = fields |
| | | document.body.appendChild(textArea) |
| | | textArea.select() |
| | | |
| | | try { |
| | | document.execCommand('copy') |
| | | document.body.removeChild(textArea) |
| | | } catch (err) { |
| | | document.body.removeChild(textArea) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Button, Select, DatePicker, Input, Typography } from 'antd' |
| | | import { Icon, Button, Select, DatePicker, Input } from 'antd' |
| | | import moment from 'moment' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const { Paragraph } = Typography |
| | | // const { Paragraph } = Typography |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | </div> |
| | | {showfield ? |
| | | <div className="ant-table-column-fields"> |
| | | {/* <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> */} |
| | | <span className="ant-table-column-title"> |
| | | <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> |
| | | {/* <span className="ant-table-column-title"> |
| | | {card.type === 'colspan' ? |
| | | <Paragraph copyable>{card.subfield}</Paragraph> : |
| | | <Paragraph copyable>{card.field}</Paragraph> |
| | | } |
| | | </span> |
| | | </span> */} |
| | | </div> : null |
| | | } |
| | | </span> : null |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'afterExecSuccess', |
| | | label: Formdict['header.form.afterExecSuccess'], |
| | | initVal: card.afterExecSuccess || 'close', |
| | | required: true, |
| | | options: [{ |
| | | value: 'close', |
| | | text: Formdict['header.close'] |
| | | }, { |
| | | value: 'notclose', |
| | | text: Formdict['header.notclose'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'afterExecError', |
| | | label: Formdict['header.form.afterExecError'], |
| | | initVal: card.afterExecError || 'notclose', |
| | | required: true, |
| | | options: [{ |
| | | value: 'close', |
| | | text: Formdict['header.close'] |
| | | }, { |
| | | value: 'notclose', |
| | | text: Formdict['header.notclose'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'execSuccess', |
| | | label: Formdict['header.form.execSuccess'], |
| | | initVal: card.execSuccess || 'never', |
| | |
| | | max: 18, |
| | | decimal: 0, |
| | | label: Formdict['header.form.decimal'], |
| | | initVal: card.decimal, |
| | | required: false |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | key: 'decimal', |
| | | label: Formdict['header.form.decimal'], |
| | | initVal: card.decimal || 0, |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | | floor: PropTypes.any, // 是否为子表 |
| | | dict: PropTypes.object, // 字典项 |
| | | fields: PropTypes.array, // 表单 |
| | | billcodes: PropTypes.array, // 表单 |
| | |
| | | fieldMap.set(_field.field, true) |
| | | } |
| | | }) |
| | | |
| | | if (this.props.floor === 'subtable') { |
| | | if (!fieldMap.has('BID')) { |
| | | _billFields.unshift({ |
| | | uuid: 'BID', |
| | | field: 'BID', |
| | | label: 'BID' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let _usedfields = this.props.billcodes.map(item => item.field) |
| | | |
| | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | | floor: PropTypes.any, // 是否为子表 |
| | | btnTab: PropTypes.any, // 表单标签页(按钮)参数 |
| | | config: PropTypes.any, // 表单标签页参数 |
| | | dict: PropTypes.object, // 字典项 |
| | | card: PropTypes.object, |
| | | columns: PropTypes.array |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns } = this.props |
| | | const { columns, config } = this.props |
| | | let _verify = this.props.card.verify || {} |
| | | |
| | | this.setState({ |
| | |
| | | } |
| | | }) |
| | | |
| | | if (this.props.card.btnType) { // 按钮-表单标签页 |
| | | let _fields = [] |
| | | |
| | | config.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |
| | | |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | |
| | | if (columns && columns.length > 0 && this.props.btnTab.Ot !== 'notRequired') { |
| | | columns.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = Array.from(new Set(_usefulfields)) |
| | | _usefulfields = _usefulfields.join(', ') |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | usefulfields: _usefulfields |
| | | }) |
| | | return |
| | | } |
| | | if (this.props.card.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | let _fields = [] |
| | | if (_LongParam.groups.length > 0) { |
| | | _LongParam.groups.forEach(group => { |
| | | group.sublist.forEach(field => { |
| | | _fields.push(field) |
| | | }) |
| | | _fields.push(...group.sublist) |
| | | }) |
| | | } else { |
| | | _fields = _LongParam.fields |
| | | } |
| | | |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | let hasBid = false |
| | | |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | if (_f.field.toLowerCase() === 'bid') { |
| | | hasBid = true |
| | | } |
| | | }) |
| | | |
| | | if (this.props.floor === 'subtable' && !hasBid) { // 子表表单中增加BID |
| | | _fields.unshift({ |
| | | uuid: 'BID', |
| | | field: 'BID', |
| | | label: 'BID', |
| | | type: 'text' |
| | | }) |
| | | } |
| | | |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') { |
| | | columns.forEach(_f => { |
| | |
| | | </TabPane> |
| | | <TabPane tab="单号生成" key="4"> |
| | | <BillcodeForm |
| | | floor={this.props.floor} |
| | | fields={fields} |
| | | billcodes={verify.billcodes} |
| | | columns={this.props.columns} |
| | |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | let fields = JSON.parse(JSON.stringify(this.props.fields)) |
| | | if (fields && fields.filter(_field => _field.field === 'BID').length === 0) { |
| | | fields.unshift({ |
| | | field: 'BID', |
| | | label: 'BID', |
| | | uuid: 'BID' |
| | | }) |
| | | } |
| | | |
| | | this.setState({fields: fields}) |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | const { fields } = this.state |
| | | const { fields } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { fields } = this.state |
| | | const { fields } = this.props |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | 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 _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname'] |
| | | |
| | | // 主键字段 |
| | | let primaryKey = setting.primaryKey || 'id' |
| | |
| | | ` |
| | | |
| | | // 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 _initvars = [] // 已赋值字段集 |
| | | let _initfields = [] |
| | | let _declarefields = [] |
| | | |
| | |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | |
| | | if (form.type === 'number' && typeof(form.value) === 'number') { |
| | | _initfields.push(`@${_key}=${form.value}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | |
| | | _initvars.push(_key) |
| | | |
| | | let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' |
| | | |
| | | if (col.type === 'number' && typeof(_val) === 'number') { |
| | | _initfields.push(`@${_key}=${_val}`) |
| | | } else { |
| | | _initfields.push(`@${_key}='${_val}'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | |
| | | let _type = `nvarchar(${col.fieldlength || 50})` |
| | | |
| | | if (col.type === 'number') { |
| | | let _length = (col.decimal || col.decimal === 0) ? col.decimal : 18 |
| | | let _length = col.decimal ? col.decimal : 0 |
| | | _type = `decimal(18,${_length})` |
| | | } else if (col.type === 'picture' || col.type === 'textarea') { |
| | | _type = `nvarchar(${col.fieldlength || 512})` |
| | |
| | | |
| | | // 唯一性验证,必须存在表单(表单存在时,主键均为单值),必须填写数据源 |
| | | if (formdata && verify.uniques && verify.uniques.length > 0) { |
| | | let hasBid = false // 检验表单及列字段中是否有bid |
| | | let _keys_ = Object.keys(_formFieldValue).map(key => key.toLowerCase()) |
| | | if (_keys_.includes('bid')) { |
| | | hasBid = true |
| | | } |
| | | |
| | | verify.uniques.forEach(item => { |
| | | let _fieldValue = [] // 表单键值对field=value |
| | | let _value = [] // 表单值,用于错误提示 |
| | |
| | | |
| | | item.field.split(',').forEach((_field, index) => { |
| | | let _fval = `'${_formFieldValue[_field]}'` |
| | | if (['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(_field.toLowerCase())) { |
| | | _fval = '@' + _field + '@' |
| | | // if (['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(_field.toLowerCase())) { |
| | | // _fval = '@' + _field + '@' |
| | | // } |
| | | if (_field.toLowerCase() === 'bid' && !hasBid) { // 表单中没有bid则使用系统bid变量 |
| | | _fval = '@BID@' |
| | | } |
| | | _fieldValue.push(`${_field}=${_fval}`) |
| | | _value.push(`${_labels[index] || ''}:${_formFieldValue[_field] || ''}`) |
| | |
| | | }) |
| | | } |
| | | |
| | | let _updateconfig = '' |
| | | let hasvoucher = false |
| | | |
| | | // 凭证-显示列中选取,必须选行 |
| | | if (verify.voucher && verify.voucher.enabled && data) { |
| | | let _voucher = verify.voucher |
| | | |
| | | _updateconfig = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' |
| | | hasvoucher = true |
| | | |
| | | _sql += `exec s_BVoucher_Create |
| | | @Bill ='${data[_voucher.linkField]}', |
| | |
| | | if (btn.OpenType === 'pop' && btn.sqlType === 'insert' && verify.default !== 'false') { |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.type === 'funcvar') { |
| | | keys.push(item.key) |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('@' + item.key) |
| | | } else if (item.type === 'number') { |
| | | keys.push(item.key) |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push(item.value) |
| | | } else { |
| | | keys.push(item.key) |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('\'' + item.value + '\'') |
| | | } |
| | | }) |
| | | |
| | | if (!keys.includes('createuserid')) { |
| | | keys.push('createuserid') |
| | | values.push('@userid@') |
| | | } |
| | | if (!keys.includes('createuser')) { |
| | | keys.push('createuser') |
| | | values.push('@username') |
| | | } |
| | | if (!keys.includes('createstaff')) { |
| | | keys.push('createstaff') |
| | | values.push('@fullname') |
| | | } |
| | | if (!keys.includes('bid')) { |
| | | keys.push('bid') |
| | | values.push('@BID@') |
| | | } |
| | | |
| | | 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}) select ${values};` |
| | | } else if (btn.OpenType === 'pop' && btn.sqlType === 'update' && verify.default !== 'false') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | formdata.forEach(item => { |
| | | _arr.push(item.key.toLowerCase()) |
| | | |
| | | if (item.type === 'funcvar') { |
| | | _form.push(item.key + '=@' + item.key) |
| | | } else if (item.type === 'number') { |
| | |
| | | _form.push(item.key + '=\'' + item.value + '\'') |
| | | } |
| | | }) |
| | | |
| | | if (!_arr.includes('modifydate')) { |
| | | _form.push('modifydate=getdate()') |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | } |
| | | if (hasvoucher) { |
| | | if (!_arr.includes('bvoucher')) { |
| | | _form.push('BVoucher=@BVoucher') |
| | | } |
| | | if (!_arr.includes('fibvoucherdate')) { |
| | | _form.push('FIBVoucherDate=@FIBVoucherDate') |
| | | } |
| | | if (!_arr.includes('fiyear')) { |
| | | _form.push('FiYear=@FiYear') |
| | | } |
| | | } |
| | | |
| | | _form = _form.join(',') |
| | | _sql += `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid@${_updateconfig} where ${primaryKey}=@${primaryKeyName};` |
| | | _sql += `update ${btn.sql} set ${_form} 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}=@${primaryKeyName};` |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete' && verify.default !== 'false') { // 物理删除 |