| | |
| | | import { Popover, Modal, Button, Switch, notification, message } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import { getModalForm } from '@/templates/zshare/formconfig' |
| | |
| | | * 3、通过loading刷新 |
| | | */ |
| | | handleSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = fromJS(this.state.group).toJS() |
| | | let fieldrepet = false // 字段重复 |
| | | |
| | | this.formRef.handleConfirm(_config.fields).then(res => { |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid !== res.uuid && res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { |
| | | fieldrepet = true |
| | | } |
| | | |
| | | delete item.focus |
| | | |
| | | if (item.uuid === res.uuid) { |
| | | if (item.style) { |
| | | res.style = item.style |
| | | } |
| | | return res |
| | | if (item.uuid === res.values.uuid) { |
| | | return res.values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (fieldrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | window.GLOB.formId = res.uuid |
| | | |
| | | if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | if (res.loading) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.sDebug(sql, rduri).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | res.promise().then(() => { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | editform: null, |
| | | visible: false |
| | | }) |
| | | this.updateGroup(_config) |
| | | } else { |
| | | }, () => { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |