Merge branch 'develop' of ssh://121.36.20.145:29418/~jinfei/pc-plat into develop
149个文件已修改
10个文件已添加
2个文件已删除
| | |
| | | } |
| | | }, |
| | | "@antv/x6": { |
| | | "version": "2.10.1", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6/-/x6-2.10.1.tgz", |
| | | "integrity": "sha512-38Fi9Qgnp+ylTrnRnhrGsc2cxsDosULbN6toVs9GjVpOguzq3oxRUblzO6dcnJhbzXfZxIcB/IuQt3pYpXJBKA==", |
| | | "version": "2.11.1", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6/-/x6-2.11.1.tgz", |
| | | "integrity": "sha512-DwyuT/zuTEhwsnKwCj67cadwLeEbB5jfdCxrkTnEm6pg0+vT3FinbF71IK7SHoY8d4HOHl+sJt7ikJfr61JqLw==", |
| | | "requires": { |
| | | "@antv/x6-common": "^2.0.12", |
| | | "@antv/x6-geometry": "^2.0.5", |
| | |
| | | "version": "2.0.5", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-geometry/-/x6-geometry-2.0.5.tgz", |
| | | "integrity": "sha512-MId6riEQkxphBpVeTcL4ZNXL4lScyvDEPLyIafvWMcWNTGK0jgkK7N20XSzqt8ltJb0mGUso5s56mrk8ysHu2A==" |
| | | }, |
| | | "@antv/x6-plugin-clipboard": { |
| | | "version": "2.1.6", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-clipboard/-/x6-plugin-clipboard-2.1.6.tgz", |
| | | "integrity": "sha512-roZPLnZx6PK8MBvee0QMo90fz/TXeF0WNe4EGin2NBq5M1I5XTWrYvA6N2XVIiWAAI67gjQeEE8TpkL7f8QdqA==" |
| | | }, |
| | | "@antv/x6-plugin-dnd": { |
| | | "version": "2.0.5", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-dnd/-/x6-plugin-dnd-2.0.5.tgz", |
| | | "integrity": "sha512-g8GGJS2XmM8C59juOBiFqaR/f8i8y8tqw9sJNwta7s1Phh3hwDd7o4kk36Kk5eTKkfZfnjEyWHMOqp/h+EDibQ==" |
| | | }, |
| | | "@antv/x6-plugin-history": { |
| | | "version": "2.2.3", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-history/-/x6-plugin-history-2.2.3.tgz", |
| | | "integrity": "sha512-yiv5e7CQKm1HrJe7je4iWjkzDzU+I0WsyL8En2j0UwXJrUNaKYyv4BkRg2tvyi52hydxidMgi3tNnNQHEZwoMg==" |
| | | }, |
| | | "@antv/x6-plugin-keyboard": { |
| | | "version": "2.2.1", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-keyboard/-/x6-plugin-keyboard-2.2.1.tgz", |
| | | "integrity": "sha512-sqfN0h4txVO211uIeKBd3zQ/IN2zPzDThWNTEhRx7Lecg1fO7uRXWBbOA48j3EgpRFXVexdSzIEVJEx+IWUdYw==", |
| | | "requires": { |
| | | "mousetrap": "^1.6.5" |
| | | } |
| | | }, |
| | | "@antv/x6-plugin-scroller": { |
| | | "version": "2.0.9", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-scroller/-/x6-plugin-scroller-2.0.9.tgz", |
| | | "integrity": "sha512-f3fluvSIbZBp+c5iKyidAoz19i0beWOnPA0CPfu/K4C+Jf1eWNgaFXbN3hcHPQRvFRJiPtvPApK30aCaik9Omg==" |
| | | }, |
| | | "@antv/x6-plugin-selection": { |
| | | "version": "2.1.7", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-selection/-/x6-plugin-selection-2.1.7.tgz", |
| | | "integrity": "sha512-ODfYLNwKSaLgIYMYfMW4dYQ9KKFOVBEdH0BzvyG8mfRol+JtZuyrm4BRbAvMryQKHrSxs4JCYXTFd2F7ZTuxLQ==" |
| | | }, |
| | | "@antv/x6-plugin-snapline": { |
| | | "version": "2.1.7", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-snapline/-/x6-plugin-snapline-2.1.7.tgz", |
| | | "integrity": "sha512-AsysoCb9vES0U2USNhEpYuO/W8I0aYfkhlbee5Kt4NYiMfQfZKQyqW/YjDVaS2pm38C1NKu1LdPVk/BBr4CasA==" |
| | | }, |
| | | "@antv/x6-plugin-stencil": { |
| | | "version": "2.0.3", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-stencil/-/x6-plugin-stencil-2.0.3.tgz", |
| | | "integrity": "sha512-pQkTIbMCezTqo38fofuFGnI30Rk0j5gHc/+Ndml1RHVEV0p8i1HGRAR5we7SVTcT56AHlP46H+oRFReQmVgvKA==" |
| | | }, |
| | | "@antv/x6-plugin-transform": { |
| | | "version": "2.1.7", |
| | | "resolved": "https://registry.npmjs.org/@antv/x6-plugin-transform/-/x6-plugin-transform-2.1.7.tgz", |
| | | "integrity": "sha512-idzBr8/Bcw8zHQUSNS0Y8VSNMigCWiUuiwqO572Ac/P2tMfP6Ot2SahEYHGUOD2NEMPr95q4JMZc+Evvt4JFTw==" |
| | | }, |
| | | "@antv/x6-react-components": { |
| | | "version": "1.1.15", |
| | |
| | | "insert-css": { |
| | | "version": "2.0.0", |
| | | "resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz", |
| | | "integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ=" |
| | | "integrity": "sha512-xGq5ISgcUP5cvGkS2MMFLtPDBtrtQPSFfC6gA6U8wHKqfjTIMZLZNxOItQnoSjdOzlXOLU/yD32RKC4SvjNbtA==" |
| | | }, |
| | | "internal-ip": { |
| | | "version": "4.3.0", |
| | |
| | | "@antv/g2": "^4.1.34", |
| | | "@antv/g6": "^4.6.4", |
| | | "@antv/util": "^2.0.17", |
| | | "@antv/x6": "^2.10.1", |
| | | "@antv/x6": "^2.11.1", |
| | | "@antv/x6-plugin-clipboard": "^2.1.6", |
| | | "@antv/x6-plugin-dnd": "^2.0.5", |
| | | "@antv/x6-plugin-history": "^2.2.3", |
| | | "@antv/x6-plugin-keyboard": "^2.2.1", |
| | | "@antv/x6-plugin-scroller": "^2.0.9", |
| | | "@antv/x6-plugin-selection": "^2.1.7", |
| | | "@antv/x6-plugin-snapline": "^2.1.7", |
| | | "@antv/x6-plugin-stencil": "^2.0.3", |
| | | "@antv/x6-plugin-transform": "^2.1.7", |
| | | "@antv/xflow": "^1.0.50", |
| | | "@babel/core": "7.5.5", |
| | | "@svgr/webpack": "4.3.2", |
| | |
| | | "identity-obj-proxy": "3.0.0", |
| | | "immutability-helper": "^3.0.1", |
| | | "immutable": "^4.0.0-rc.12", |
| | | "insert-css": "^2.0.0", |
| | | "is-wsl": "^1.1.0", |
| | | "jest": "24.8.0", |
| | | "jest-environment-jsdom-fourteen": "0.1.0", |
| | |
| | | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' |
| | | axios.defaults.withCredentials = false |
| | | |
| | | axios.interceptors.request.use((config) => { |
| | | if (/LoginAndRedirect|getjsonresult|wxNativePay|postek/ig.test(config.url)) { |
| | | config.data = qs.stringify(config.data) |
| | | } else if (/\/doupload|\/dopreload|\/upload/.test(config.url)) { |
| | | config.headers = { 'Content-Type': 'multipart/form-data' } |
| | | } else if (config.method === 'post' && config.data) { |
| | | config.data = JSON.stringify(config.data) |
| | | } |
| | | |
| | | return config |
| | | }, (error) => { |
| | | return Promise.reject(error) |
| | | }) |
| | | // axios.interceptors.request.use((config) => { |
| | | // return config |
| | | // }, (error) => { |
| | | // return Promise.reject(error) |
| | | // }) |
| | | |
| | | const setCurrentUrl = (res) => { |
| | | if (!!(window.history && window.history.pushState)) { |
| | |
| | | axios.interceptors.response.use((response) => { |
| | | if (response.data.ErrCode === 'LoginError') { |
| | | if (window.debugger === true) { |
| | | response.data.ErrCode = 'E' |
| | | return Promise.resolve(response.data) |
| | | } else if (window.GLOB.developing) { |
| | | sessionStorage.setItem('devError', 'true') |
| | | response.data.ErrCode = 'E' |
| | | return Promise.resolve(response.data) |
| | | } else if (!sessionStorage.getItem('loginError')) { |
| | |
| | | return axios({ |
| | | url: `/webapi/dostar${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * @description 直接请求 |
| | | * @param {Object} param 查询及提交参数 |
| | | */ |
| | | directRequest (url, method = 'post', param, cross) { |
| | | if (cross === 'true' && param) { |
| | | return axios({ |
| | | url, |
| | | method, |
| | | data: param |
| | | }) |
| | | } else if (cross === 'true') { |
| | | return axios({ |
| | | url, |
| | | method |
| | | }) |
| | | } |
| | | |
| | | let params = { method: 'post' } |
| | | let _url = url |
| | | |
| | | if (method === 'get' && param) { |
| | | let keys = Object.keys(param).map(key => `${key}=${param[key]}`) |
| | | keys = keys.join('&') |
| | | if (keys) { |
| | | _url = _url + '?' + keys |
| | | } |
| | | } else if (method === 'post' && param) { |
| | | params.data = param |
| | | } |
| | | |
| | | _url = _url.replace(/&/ig, '%26') |
| | | params.url = '/trans/redirect?rd=' + _url + '&method=' + method |
| | | |
| | | directRequest (params) { |
| | | return axios(params) |
| | | } |
| | | |
| | |
| | | param.thd_party_openid = openid |
| | | param.thd_party_appid = appid |
| | | param.id = scanId |
| | | } else if (binding_type === 'login_check') { // appid 此时为目标 |
| | | } else if (binding_type === 'login_check') { // appid 此时为目标地址 |
| | | param.v_type = 'login_check' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | url = appid.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login') |
| | |
| | | return axios({ |
| | | url: url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: `${url}/${param.func}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status && window.GLOB.IndexDB) { |
| | | let msg = { |
| | |
| | | axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status) { |
| | | window.GLOB.CacheMap.set(key, res) |
| | |
| | | axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status) { |
| | | window.GLOB.CacheMap.set(_param, res) |
| | |
| | | axios({ |
| | | url: token.interface, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }) |
| | |
| | | axios({ |
| | | url, |
| | | method: 'post', |
| | | data: _param |
| | | data: JSON.stringify(_param) |
| | | }).then(result => { |
| | | if (result.status) { |
| | | window.GLOB.OuterToken[token.interface] = { |
| | |
| | | axios({ |
| | | url: token.interface, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }) |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(result => { |
| | | resolve(result) |
| | | }) |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | } |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: '/webapi/doupload', |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: '/webapi/dopreload', |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: _url, |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: _url, |
| | | method: 'post', |
| | | data: param |
| | | data: qs.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: 'http://127.0.0.1:888/postek/print', |
| | | method: 'post', |
| | | data: data |
| | | data: qs.stringify(data) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | | |
| | | .ant-col.ant-col-0 { |
| | | display: inline-block; |
| | | } |
| | | |
| | | .ant-dropdown { |
| | | .ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover { |
| | | background-color: var(--mk-sys-color1); |
| | | } |
| | | } |
| | |
| | | const CustomPage = asyncComponent(() => import('@/tabviews/custom')) |
| | | const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) |
| | | const BaseTable = asyncComponent(() => import('@/tabviews/basetable')) |
| | | const CalendarPage = asyncComponent(() => import('@/tabviews/calendar')) |
| | | const TreePage = asyncComponent(() => import('@/tabviews/treepage')) |
| | | const Iframe = asyncComponent(() => import('@/tabviews/iframe')) |
| | | const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) |
| | |
| | | return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param} changeTemp={this.changeTemp}/>) |
| | | } else if (view.type === 'TreePage') { |
| | | return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'CalendarPage') { |
| | | return (<CalendarPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'FormTab') { |
| | | return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>) |
| | | return (<Iframe key={view.MenuID} MenuID={view.MenuID} title={view.MenuName} url={view.src}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | |
| | | } |
| | | iframe { |
| | | width: 100%; |
| | | height: calc(100vh - 115px); |
| | | height: calc(100vh - 92px); |
| | | overflow-y: scroll; |
| | | border: 0; |
| | | margin-top: 16px; |
| | | margin: 0px; |
| | | vertical-align: top; |
| | | } |
| | | .ant-back-top { |
| | | bottom: 10px; |
| | |
| | | |
| | | changeMenu (value) { |
| | | // 主菜单切换 |
| | | if (value.OpenType === 'outpage') { |
| | | window.open(value.linkUrl) |
| | | if (value.OpenType === 'newpage') { |
| | | window.open(value.src) |
| | | } else if (value.OpenType === 'newtab') { |
| | | MKEmitter.emit('modifyTabs', value) |
| | | } else if (value.OpenType === 'menu') { |
| | | this.props.modifyMainMenu(value) |
| | | } |
| | |
| | | let PageParam = JSON.parse(fst.PageParam) |
| | | |
| | | if (PageParam.OpenType === 'outpage' && PageParam.linkUrl) { |
| | | fstItem.OpenType = 'outpage' |
| | | fstItem.linkUrl = PageParam.linkUrl |
| | | fstItem.OpenType = 'newpage' |
| | | fstItem.src = PageParam.linkUrl |
| | | if (/#\/iframe\//.test(fstItem.src)) { |
| | | fstItem.src = fstItem.src.replace(/@userid@/ig, sessionStorage.getItem('UserID')).replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) |
| | | fstItem.type = 'iframe' |
| | | fstItem.OpenType = 'newtab' |
| | | } |
| | | } |
| | | } catch (e) {} |
| | | } |
| | |
| | | trdItem.hidden = PageParam.hidden || 'false' |
| | | |
| | | if (trdItem.type === 'NewPage') { |
| | | trdItem.OpenType = 'newpage' |
| | | trdItem.src = PageParam.url || '' |
| | | if (/#\/iframe\//.test(trdItem.src)) { |
| | | trdItem.src = trdItem.src.replace(/@userid@/ig, sessionStorage.getItem('UserID')).replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) |
| | | trdItem.type = 'iframe' |
| | | trdItem.OpenType = 'newtab' |
| | | } |
| | | } else { |
| | | trdItem.src = '#/tab/' + trd.MenuID |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | |
| | | if (trdItem.type !== 'NewPage') { |
| | | } else { |
| | | trdItem.src = '#/tab/' + trd.MenuID |
| | | } |
| | | |
| | | trdItem.OpenType = trdItem.OpenType.toLowerCase() // NewPage为打开外部页面地址 |
| | | |
| | | if (names.has(trdItem.menu_name)) { |
| | | doublenames.set(trdItem.menu_name, true) |
| | |
| | | |
| | | changeVerMenu(menu, type) { |
| | | if (type === 'first') { |
| | | if (menu.OpenType === 'outpage') { |
| | | window.open(menu.linkUrl) |
| | | if (menu.OpenType === 'newpage') { |
| | | window.open(menu.src) |
| | | } else if (menu.OpenType === 'newtab') { |
| | | MKEmitter.emit('modifyTabs', menu) |
| | | } |
| | | } else { |
| | | if (menu.OpenType === 'newpage') { |
| | |
| | | if (oripassword && values.password === '*********') { |
| | | values.password = oripassword |
| | | } |
| | | |
| | | values.username = values.username.replace(/\t*|\v*|\s*/g, '') |
| | | values.password = values.password.replace(/\t*|\v*|\s*/g, '') |
| | | |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | |
| | | recordChange = (values, item) => { |
| | | this.record = {...this.record, ...values} |
| | | |
| | | if (item && item.controlFields) { |
| | | if (!item) return |
| | | |
| | | if (item.controlFields) { |
| | | let map = new Map() |
| | | this.state.formlist.forEach(cell => { |
| | | if (!cell.field) return |
| | |
| | | return item || cell |
| | | }) |
| | | }) |
| | | } else if (item.reset_source) { |
| | | let map = new Map() |
| | | this.state.formlist.forEach(cell => { |
| | | if (!cell.field) return |
| | | map.set(cell.field, cell) |
| | | }) |
| | | |
| | | item.callback(map, this.record) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(cell => { |
| | | if (!cell.field) return cell |
| | | |
| | | let item = map.get(cell.field) |
| | | |
| | | return item || cell |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | MKEmitter.addListener('mkFC', this.mkFormControl) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { config } = this.state |
| | | |
| | | if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) { |
| | | this.setState({ |
| | | config: fromJS(nextProps.config).toJS(), |
| | | options: fromJS(nextProps.config.options).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Input, notification, Modal } from 'antd' |
| | | import { SnippetsOutlined } from '@ant-design/icons' |
| | | |
| | | // import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | class PaseComponent extends Component { |
| | | static propTpyes = { |
| | | inputSubmit: PropTypes.func // 回车事件 |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | value: '' |
| | | } |
| | | |
| | | trigger = () => { |
| | | // navigator.clipboard |
| | | // .readText() |
| | | // .then((val) => { |
| | | // this.evalContent(val) |
| | | // }) |
| | | // .catch((v) => { |
| | | // this.setState({visible: true, value: ''}) |
| | | // }) |
| | | |
| | | this.setState({visible: true, value: ''}) |
| | | } |
| | | |
| | | evalContent = (config) => { |
| | | let _config = config.replace(/(\n|\s)+/g, '') |
| | | |
| | | if (!_config) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到配置信息', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | try { |
| | | _config = JSON.parse(window.decodeURIComponent(window.atob(_config))) |
| | | |
| | | if (typeof(_config) === 'object' && _config.$srcId) { |
| | | let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId') |
| | | if (srcid && _config.$srcId !== srcid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '当前系统无权限使用此项配置!', |
| | | duration: 5 |
| | | }) |
| | | |
| | | _config = '' |
| | | } else { |
| | | delete _config.$srcId |
| | | } |
| | | } |
| | | } catch (e) { |
| | | // 通过sql语句添加字段集 |
| | | if (/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig.test(config)) { |
| | | _config = { |
| | | key: 'datasourcefield', |
| | | type: 'array', |
| | | data: [] |
| | | } |
| | | |
| | | let list = config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig) |
| | | |
| | | list.forEach(item => { |
| | | _config.data.unshift({ |
| | | datatype: item.split(/\s+/)[1], |
| | | field: item.split(/\s+/)[0], |
| | | label: item.split(/\s+/)[0], |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '解析错误', |
| | | duration: 5 |
| | | }) |
| | | _config = '' |
| | | } |
| | | } |
| | | |
| | | if (!_config) return |
| | | |
| | | this.props.getPasteValue(_config, () => { |
| | | this.setState({visible: false, value: ''}) |
| | | }) |
| | | } |
| | | |
| | | changeVal = (e) => { |
| | | this.setState({value: e.target.value}) |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | this.evalContent(this.state.value) |
| | | } |
| | | |
| | | enterPress = (e) => { |
| | | e.stopPropagation() |
| | | |
| | | this.evalContent(this.state.value) |
| | | } |
| | | |
| | | render() { |
| | | const { children } = this.props |
| | | const { visible, value } = this.state |
| | | |
| | | return ( |
| | | <> |
| | | {children ? <span onClick={this.trigger}>{children}</span> : <SnippetsOutlined title="粘贴" onClick={this.trigger} />} |
| | | <Modal |
| | | title="粘贴" |
| | | visible={visible} |
| | | width={600} |
| | | maskClosable={false} |
| | | onOk={this.pasteSubmit} |
| | | onCancel={() => {this.setState({visible: false})}} |
| | | destroyOnClose |
| | | > |
| | | <TextArea placeholder="请输入配置信息" autoFocus autoSize={{ minRows: 8, maxRows: 8 }} value={value} onChange={this.changeVal} onPressEnter={this.enterPress}/> |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default PaseComponent |
| | |
| | | {item.children.map(cell => { |
| | | return ( |
| | | <Menu.Item key={cell.MenuID}> |
| | | <a href={cell.src} id={cell.MenuID} onClick={(e) => this.changemenu(e, cell)}>{cell.MenuName}</a> |
| | | <a href={cell.src} onClick={(e) => this.changemenu(e, cell)}>{cell.MenuName}</a> |
| | | </Menu.Item> |
| | | ) |
| | | })} |
| | |
| | | const CustomPage = asyncComponent(() => import('@/tabviews/custom')) |
| | | const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) |
| | | const BaseTable = asyncComponent(() => import('@/tabviews/basetable')) |
| | | const CalendarPage = asyncComponent(() => import('@/tabviews/calendar')) |
| | | const TreePage = asyncComponent(() => import('@/tabviews/treepage')) |
| | | const Iframe = asyncComponent(() => import('@/tabviews/iframe')) |
| | | const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) |
| | |
| | | return (<CustomPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param} changeTemp={this.changeTemp}/>) |
| | | } else if (view.type === 'TreePage') { |
| | | return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'CalendarPage') { |
| | | return (<CalendarPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'RolePermission') { |
| | | return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) |
| | | } else if (view.type === 'FormTab') { |
| | | return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>) |
| | | return (<Iframe key={view.MenuID} MenuID={view.MenuID} title={view.MenuName} url={view.src}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | |
| | | } |
| | | iframe { |
| | | width: 100%; |
| | | height: calc(100vh - 115px); |
| | | height: calc(100vh - 92px); |
| | | overflow-y: scroll; |
| | | border: 0; |
| | | margin-top: 16px; |
| | | margin: 0px; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .ant-back-top { |
| | |
| | | MKEmitter.emit('cardAddElement', card.uuid, res) |
| | | } else { |
| | | res.eleType = 'button' |
| | | res.width = res.width || 12 |
| | | MKEmitter.emit('cardAddElement', card.uuid, res) |
| | | } |
| | | resolve({status: true}) |
| | |
| | | label: '数据源', |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces |
| | | options: interfaces, |
| | | reset_source: true, |
| | | callback: (map, record) => { |
| | | if (!record.publicId) return |
| | | |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0] |
| | | |
| | | if (!d || !d.columns) return |
| | | |
| | | let columns = JSON.parse(JSON.stringify(d.columns)) |
| | | |
| | | let _bgField = map.get('bgField') |
| | | |
| | | if (_bgField && !_bgField.forbid) { |
| | | _bgField.options = columns |
| | | _bgField.oriOptions = columns |
| | | map.set('bgField', _bgField) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | let warning = null |
| | | if (['pop', 'prompt', 'exec', 'form'].includes(card.OpenType)) { |
| | | hasProfile = true |
| | | if (card.formType === 'count_line') { |
| | | hasProfile = false |
| | | } |
| | | } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { |
| | | hasProfile = true |
| | | } else if (card.funcType === 'print') { |
| | |
| | | if (card.OpenType === 'form') { |
| | | if (card.formType === 'switch') { |
| | | btnElement = (<Switch style={_style} className={card.size === 'large' ? 'ant-switch-large' : ''} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) |
| | | } else if (card.formType === 'counter') { |
| | | } else if (card.formType === 'counter' || card.formType === 'count_line') { |
| | | btnElement = (<div style={_style} className={'mk-counter ' + card.size}><span><MinusOutlined /></span><span>1</span><span><PlusOutlined /></span></div>) |
| | | } else if (card.formType === 'radio') { |
| | | btnElement = (<Checkbox style={_style}></Checkbox>) |
| | |
| | | className += ' ' + card.checkType |
| | | } |
| | | |
| | | let updateTime = null |
| | | |
| | | if (card.updateTime && card.updateTime.indexOf(window.GLOB.curDate) > -1) { |
| | | updateTime = card.updateTime.substr(11) |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | |
| | | <CloseOutlined className="close" title="删除" onClick={() => delCard(id)} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={() => changeStyle(id)} /> |
| | | {hasProfile ? <ProfileOutlined className="profile" title="setting" onClick={() => profileCard(id)} /> : null} |
| | | {updateTime} |
| | | </div> |
| | | } trigger="hover"> |
| | | <div ref={node => drag(drop(node))} style={_style_} className={'ant-col card-button-cell ant-col-' + className} onDoubleClick={(e) => {e.stopPropagation(); doubleClickCard(id)}}> |
| | |
| | | <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> |
| | | ) |
| | | } else if (card.eleType === 'icon') { |
| | | if (card.tipType === 'text') { |
| | | return <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{card.value || card.field || ''}</div> |
| | | } |
| | | return (<MkIcon style={{height: card.innerHeight || 'auto'}} className="ant-mk-icon" type={card.icon || 'bell'}/>) |
| | | } else if (card.eleType === 'slider') { |
| | | let val = card.value ? (card.value / card.maxValue) * 100 : 30 |
| | |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | position: unset!important; |
| | | } |
| | | .sort-wrap { |
| | | position: relative; |
| | |
| | | number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle', 'alignItems'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], |
| | | video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'], |
| | | icon: ['eleType', 'datatype', 'width', 'tooltip'], |
| | | icon: ['eleType', 'datatype', 'tipType', 'width', 'tooltip'], |
| | | slider: ['eleType', 'datatype', 'width', 'color', 'maxValue', 'showInfo', 'showType', 'strokeWidth', 'strokeLinecap', 'trailColor'], |
| | | splitline: ['eleType', 'color', 'width', 'borderWidth'], |
| | | barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval', 'noValue'], |
| | |
| | | _options.push('linkurl') |
| | | } |
| | | } else if (this.record.linkType === 'other') { |
| | | _options.push('linkurl', 'joint') |
| | | _options.push('linkurl', 'joint', 'open') |
| | | } else { |
| | | _options.push('linkurl') |
| | | } |
| | |
| | | } else if (this.record.eleType === 'icon') { |
| | | if (this.record.datatype === 'dynamic') { |
| | | _options.push('field', 'noValue') |
| | | } else if (this.record.tipType === 'text') { |
| | | _options.push('value') |
| | | } else { |
| | | _options.push('icon') |
| | | } |
| | | if (this.record.tipType === 'text') { |
| | | _options.push('height') |
| | | } |
| | | } else if (this.record.eleType === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType'].includes(key)) { |
| | | } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | * @param {*} type |
| | | */ |
| | | export function getCardCellForm (card, cards, cardCell) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | let _options = [ |
| | | { value: 'text', text: '文本'}, |
| | | { value: 'number', text: '数值'}, |
| | | { value: 'picture', text: '图片'}, |
| | | { value: 'video', text: '视频'}, |
| | | { value: 'icon', text: '图标'}, |
| | | { value: 'icon', text: '提示(图标)'}, |
| | | { value: 'slider', text: '进度条'}, |
| | | { value: 'splitline', text: '分割线'}, |
| | | { value: 'barcode', text: '条形码'}, |
| | |
| | | if (card.eleType === 'icon' && card.datatype === 'dynamic' && !card.field) { // 拖拽添加类型转换 |
| | | card.datatype = 'static' |
| | | } |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | | let tooltip = '' |
| | | if (cardCell.$cardType === 'extendCard') { |
| | |
| | | options: [ |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'tipType', |
| | | label: '提示内容', |
| | | initVal: card.tipType || 'icon', |
| | | required: false, |
| | | options: [ |
| | | { value: 'icon', text: '图标' }, |
| | | { value: 'text', text: '文本' } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | tooltip: ['pc', 'mob'].includes(appType) ? '当链接类型为“其他”,且链接地址以@menuid@开头时,其后内容将被视为菜单ID。' : '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | tooltip: '菜单打开方式。', |
| | | tooltip: '菜单打开方式,链接无效。', |
| | | required: true, |
| | | forbid: !['pc', 'mob'].includes(appType), |
| | | options: [ |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Button } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { getCardCellForm } from './formconfig' |
| | |
| | | options = ['background', 'border', 'margin'] |
| | | } else if (element.eleType === 'color') { |
| | | options = ['border', 'margin', 'padding'] |
| | | } else if (element.eleType === 'number' || element.eleType === 'icon') { |
| | | options.push('display') |
| | | } else if (element.eleType === 'text') { |
| | | options[0] = 'font2' |
| | | options.push('display') |
| | |
| | | options = ['padding', 'margin'] |
| | | } else if (element.eleType === 'splitline') { |
| | | options = ['padding', 'margin'] |
| | | } |
| | | |
| | | if (element.eleType !== 'button') { |
| | | options.push('position') |
| | | } |
| | | |
| | | options.push('clear') |
| | |
| | | |
| | | getStyle = (style) => { |
| | | const { card, elements } = this.state |
| | | |
| | | // if (card.eleType === 'button') { |
| | | // if ((style.paddingLeft || style.paddingRight) && !style.width) { |
| | | // style.width = 'auto' |
| | | // } |
| | | // } |
| | | |
| | | let _card = this.resetCardStyle(card, style) |
| | | |
| | |
| | | _card.style = style |
| | | let line = _card.height || null |
| | | |
| | | if (['currentDate', 'sequence', 'icon'].includes(_card.eleType)) { |
| | | if (['currentDate', 'sequence'].includes(_card.eleType) || (_card.eleType === 'icon' && _card.tipType !== 'text')) { |
| | | line = 1 |
| | | } |
| | | |
| | |
| | | if (cell.uuid === res.uuid) { |
| | | res.style = cell.style || {} |
| | | |
| | | if (res.eleType !== 'text') { |
| | | if (!['text', 'number', 'icon'].includes(res.eleType)) { |
| | | delete res.style.display |
| | | } |
| | | |
| | |
| | | } else if (['text', 'number', 'formula', 'currentDate', 'sequence', 'icon'].includes(res.eleType)) { |
| | | let line = res.height || null |
| | | |
| | | if (['currentDate', 'sequence', 'icon'].includes(res.eleType)) { |
| | | if (['currentDate', 'sequence'].includes(res.eleType) || (res.eleType === 'icon' && res.tipType !== 'text')) { |
| | | line = 1 |
| | | } |
| | | |
| | |
| | | if (cell.uuid === res.uuid) { |
| | | res.eleType = cell.eleType || null |
| | | res.style = cell.style || null |
| | | // res.modal = cell.modal || null |
| | | // res.config = cell.config || null |
| | | res.wrapStyle = cell.wrapStyle || null |
| | | // res = {...cell, ...res} |
| | | |
| | | // if (!res.control) { |
| | | // delete res.controlField |
| | | // delete res.controlVal |
| | | // } |
| | | |
| | | // delete res.focus |
| | | |
| | | if (res.OpenType === 'form') { |
| | | if (cell.OpenType !== 'form') { |
| | |
| | | } |
| | | res.style = {...res.style, ...style} |
| | | } |
| | | |
| | | res.updateTime = moment().format('YYYY-MM-DD HH:mm') |
| | | |
| | | return res |
| | | } |
| | |
| | | let _elements = elements.map(cell => { |
| | | if (cell.uuid === card.uuid) { |
| | | cell.verify = res |
| | | cell.updateTime = moment().format('YYYY-MM-DD HH:mm') |
| | | } |
| | | |
| | | return cell |
| | |
| | | destroyOnClose |
| | | > |
| | | <ActionForm |
| | | type={cards.type === 'balcony' ? '' : 'card'} |
| | | type={cards.type === 'balcony' || cardCell.$cardType === 'extendCard' ? '' : 'card'} |
| | | card={card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleActionSubmit} |
| | |
| | | |
| | | if (element.copyType === 'action') { |
| | | element.eleType = 'button' |
| | | element.width = element.width || 12 |
| | | } |
| | | |
| | | element.uuid = _uuid |
| | |
| | | |
| | | if (element.copyType === 'action') { |
| | | element.eleType = 'button' |
| | | element.width = element.width || 12 |
| | | } |
| | | |
| | | element.uuid = _uuid |
| | |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> |
| | | <div className={'float-' + (card.wrap.cardFloat || 'left') + ' select-' + card.wrap.selStyle}> |
| | | <div className={`float-${card.wrap.cardFloat || 'left'} select-${card.wrap.selStyle || ''}`}> |
| | | {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | <div style={{clear: 'both'}}></div> |
| | |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | {field: 'goback', values: ['dynamic']}, |
| | | {field: 'goback', values: ['dynamic', 'public']}, |
| | | {field: 'empty', values: ['dynamic', 'public']}, |
| | | {field: 'jump', values: ['dynamic']}, |
| | | {field: 'autoExec', values: ['dynamic']}, |
| | | {field: 'jump', values: ['dynamic', 'public']}, |
| | | {field: 'broadcast', values: ['dynamic', 'public']}, |
| | | {field: 'autoExec', values: ['dynamic', 'public']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | ], |
| | |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces, |
| | | forbid: subtype !== 'propcard' |
| | | reset_source: true, |
| | | forbid: subtype !== 'propcard', |
| | | callback: (map, record) => { |
| | | if (!record.publicId) return |
| | | |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0] |
| | | |
| | | if (!d || !d.columns) return |
| | | let columns = JSON.parse(JSON.stringify(d.columns)) |
| | | |
| | | let _broadcast = map.get('broadcast') |
| | | |
| | | if (_broadcast && !_broadcast.forbid) { |
| | | _broadcast.options = columns |
| | | _broadcast.oriOptions = columns |
| | | map.set('broadcast', _broadcast) |
| | | } |
| | | |
| | | let _jumpField = map.get('jumpField') |
| | | |
| | | if (_jumpField && !_jumpField.forbid) { |
| | | _jumpField.options = columns |
| | | _jumpField.oriOptions = columns |
| | | map.set('jumpField', _jumpField) |
| | | } |
| | | |
| | | let _link = map.get('link') |
| | | |
| | | if (_link && !_link.forbid) { |
| | | _link.options = columns |
| | | _link.oriOptions = columns |
| | | map.set('link', _link) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | field: 'broadcast', |
| | | label: '语音播报', |
| | | initval: wrap.broadcast || '', |
| | | tooltip: '语音播报在移动端app中有效。注:使用语音播报时,数据源不要使用同步查询,添加定时器时,可循环播报', |
| | | tooltip: '语音播报在移动端有效。注:在H5中请使用音频链接,添加定时器时,可循环播报', |
| | | required: false, |
| | | options: columns, |
| | | forbid: !columns || appType !== 'mob' || subtype !== 'propcard' |
| | |
| | | field: 'display', |
| | | label: '显示控制', |
| | | initval: wrap.display || 'normal', |
| | | tooltip: '当使用属性卡进行某些业务操作,且不需要展示卡片信息时,可设置为不可见。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'normal', label: '正常显示'}, |
| | |
| | | field: 'jumpField', |
| | | label: '控制字段', |
| | | initval: wrap.jumpField || '', |
| | | tooltip: '当字段值为true时', |
| | | tooltip: '当字段值为true时触发跳转。', |
| | | required: true, |
| | | options: columns, |
| | | forbid: subtype !== 'propcard' || appType !== 'mob' |
| | |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> |
| | | <div className={'select-' + card.wrap.selStyle + extraName}> |
| | | <div className={`select-${card.wrap.selStyle || ''} ${extraName}`}> |
| | | {card.subcards.map(subcard => { |
| | | if (subcard.$cardType === 'extendCard') { |
| | | return (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>) |
| | |
| | | |
| | | mkUpdateInter = (inter, split) => { |
| | | const { card } = this.state |
| | | |
| | | |
| | | if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) { |
| | | let _card = {...card, columns: fromJS(inter.columns).toJS()} |
| | | |
| | |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <div className={(card.wrap.layout || 'grid') + '-layout float-' + (card.wrap.cardFloat || 'left') + ' select-' + card.wrap.selStyle}> |
| | | <div className={`${card.wrap.layout || 'grid'}-layout float-${card.wrap.cardFloat || 'left'} select-${card.wrap.selStyle || ''}`}> |
| | | {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} |
| | | </div> |
| | | {card.wrap.display === 'hidden' ? <HeatMapOutlined className="prop-hidden"/> : null} |
| | |
| | | label: '上级组件' |
| | | }, { |
| | | value: 'line', |
| | | label: '行' |
| | | label: '数据源' |
| | | }], |
| | | controlFields: [ |
| | | {field: 'rootLabel', values: ['fixed', 'supvalue']}, |
| | |
| | | field: 'rootValue', |
| | | label: '根节点值', |
| | | initval: card.rootValue || '', |
| | | tooltip: '根节点使用上级组件时,请填写上级组件中对应的字段。', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | field: 'rootLabel', |
| | | label: '根节点文本', |
| | | initval: card.rootLabel || '', |
| | | tooltip: '根节点使用上级组件时,请填写上级组件中对应的字段。', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | field: 'collapsed', |
| | | label: '节点合并', |
| | | initval: card.collapsed || 'false', |
| | | tooltip: '一级节点是否合并。', |
| | | tooltip: '初始化时,一级节点是否合并。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '否'}, |
| | |
| | | const { card } = this.state |
| | | |
| | | if (card.plot.subtype === 'mindmap') { |
| | | this.ponitrender() |
| | | this.mindrender() |
| | | } else if (card.plot.subtype === 'indentTree') { |
| | | this.indentrender() |
| | | } else if (card.plot.subtype === 'kapmap') { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 散点图 |
| | | * @description 思维导图 |
| | | */ |
| | | ponitrender = () => { |
| | | mindrender = () => { |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | |
| | | let _style = resetStyle(card.style) |
| | | |
| | | return ( |
| | | <div className="menu-scatter-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | | <div className="menu-g6-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <ChartCompileForm config={card} plotchange={this.updateComponent}/> |
| | |
| | | .menu-scatter-chart-edit-box { |
| | | .menu-g6-chart-edit-box { |
| | | position: relative; |
| | | box-sizing: border-box; |
| | | background: #ffffff; |
| | |
| | | color: rgba(0, 0, 0, 0.85); |
| | | background: rgba(255, 255, 255, 0.55); |
| | | } |
| | | |
| | | .model-menu-action-list { |
| | | position: absolute; |
| | | right: 0px; |
| | | top: 30px; |
| | | z-index: 4; |
| | | font-size: 16px; |
| | | |
| | | .ant-row .anticon-plus { |
| | | float: right; |
| | | } |
| | | |
| | | .page-card { |
| | | float: right; |
| | | } |
| | | } |
| | | .normal-header + .canvas + .model-menu-action-list { |
| | | top: 45px; |
| | | } |
| | | } |
| | | .menu-scatter-chart-edit-box:hover { |
| | | .menu-g6-chart-edit-box:hover { |
| | | z-index: 1; |
| | | box-shadow: 0px 0px 4px #1890ff; |
| | | } |
| | |
| | | tooltip: '点击节点时触发的事件。', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '数据切换'}, |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'menus', label: '菜单组'} |
| | | ], |
| | |
| | | type: 'select', |
| | | field: 'subtype', |
| | | label: '类型', |
| | | initval: card.subtype || 'mindmap', |
| | | initval: card.subtype || 'xflow', |
| | | required: true, |
| | | options: [{ |
| | | value: 'mindmap', |
| | | label: '思维导图' |
| | | value: 'xflow', |
| | | label: '流程图' |
| | | }, { |
| | | value: 'indentTree', |
| | | label: '缩进文件树' |
| | | label: '泳道图' |
| | | }, { |
| | | value: 'kapmap', |
| | | label: '知识图谱树' |
| | | }], |
| | | controlFields: [ |
| | | {field: 'dirField', values: ['mindmap']}, |
| | | {field: 'nodeColor', values: ['mindmap']}, |
| | | // {field: 'collapsed', values: ['indentTree', 'kapmap']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'rootType', |
| | | label: '根节点取值', |
| | | initval: card.rootType || 'fixed', |
| | | tooltip: '选择上级时,请填写根节点的文本和值的字段名', |
| | | required: true, |
| | | options: [{ |
| | | value: 'fixed', |
| | | label: '固定值' |
| | | }, { |
| | | value: 'supvalue', |
| | | label: '上级组件' |
| | | }, { |
| | | value: 'line', |
| | | label: '行' |
| | | }], |
| | | controlFields: [ |
| | | {field: 'rootLabel', values: ['fixed', 'supvalue']}, |
| | | {field: 'rootValue', values: ['fixed', 'supvalue']}, |
| | | {field: 'mark', values: ['line']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'rootValue', |
| | | label: '根节点值', |
| | | initval: card.rootValue || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'rootLabel', |
| | | label: '根节点文本', |
| | | initval: card.rootLabel || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'valueField', |
| | | label: '值字段', |
| | | initval: card.valueField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'labelField', |
| | | label: '文本字段', |
| | | initval: card.labelField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'parentField', |
| | | label: '上级字段', |
| | | initval: card.parentField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'mark', |
| | | label: '顶级标识', |
| | | initval: card.mark || '', |
| | | tooltip: '上级字段值与顶级标识相同时,视为根节点。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'dirField', |
| | | label: '方向控制', |
| | | initval: card.dirField || '', |
| | | required: false, |
| | | options: columns, |
| | | controlFields: [ |
| | | {field: 'dirSign', notNull: true}, |
| | | {field: 'leftColor', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'dirSign', |
| | | label: '左向标记', |
| | | initval: card.dirSign || '', |
| | | tooltip: '当节点值与标记相同时节点信息位于节点左侧,多个值请用逗号分隔。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'nodeColor', |
| | | label: '节点颜色', |
| | | initval: card.nodeColor || '#1890ff', |
| | | tooltip: '右侧节点的标记颜色。', |
| | | colorType: 'hex', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'leftColor', |
| | | label: '左节点颜色', |
| | | initval: card.leftColor || '#26C281', |
| | | tooltip: '左侧节点的标记颜色。', |
| | | colorType: 'hex', |
| | | required: false |
| | | label: '组织结构图' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | {value: 'show', label: '否'}, |
| | | {value: 'hidden', label: '是'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'collapsed', |
| | | label: '节点合并', |
| | | initval: card.collapsed || 'false', |
| | | tooltip: '一级节点是否合并。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '否'}, |
| | | {value: 'true', label: '是'}, |
| | | ], |
| | | }, |
| | | } |
| | | ] |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, message } from 'antd' |
| | | import { ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import G6 from '@antv/g6' |
| | | import { Popover, Tooltip, message } from 'antd' |
| | | import { ToolOutlined, DeleteOutlined, FontColorsOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, DoubleLeftOutlined } from '@ant-design/icons' |
| | | import { Graph, Shape } from '@antv/x6' |
| | | import { Stencil } from '@antv/x6-plugin-stencil' |
| | | import { Transform } from '@antv/x6-plugin-transform' |
| | | import { Selection } from '@antv/x6-plugin-selection' |
| | | import { Snapline } from '@antv/x6-plugin-snapline' |
| | | import { Keyboard } from '@antv/x6-plugin-keyboard' |
| | | import { Clipboard } from '@antv/x6-plugin-clipboard' |
| | | import { History } from '@antv/x6-plugin-history' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import { resetStyle, getTables, getHeight, checkComponent } from '@/utils/utils-custom.js' |
| | | import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js' |
| | | import './index.scss' |
| | | |
| | | const { Util } = G6 |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) |
| | | const NodeUpdate = asyncIconComponent(() => import('./nodeupdate')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | |
| | | const MindData = [ |
| | | 'Modeling Methods', |
| | | [ |
| | | 'Classification', |
| | | ['Logistic regression', 'Linear discriminant analysis', 'Rules', 'Decision trees', 'Naive Bayes', 'K nearest neighbor', 'Probabilistic neural network', 'Support vector machine'] |
| | | ], |
| | | [ |
| | | 'Consensus', |
| | | [ |
| | | 'Models diversity', |
| | | ['Different initializations', 'Different parameter choices', 'Different architectures', 'Different modeling methods', 'Different training sets', 'Different feature sets'] |
| | | ], |
| | | [ |
| | | 'Methods', |
| | | ['Classifier selection', 'Classifier fusion'] |
| | | ], |
| | | [ |
| | | 'Common', |
| | | ['Bagging', 'Boosting', 'AdaBoost'] |
| | | ] |
| | | ], |
| | | [ |
| | | 'Regression', |
| | | ['Multiple linear regression', 'Partial least squares', 'Multi-layer feedforward neural network', 'General regression neural network', 'Support vector regression'] |
| | | ] |
| | | ] |
| | | |
| | | const styles = { |
| | | blue: '#1890ff', |
| | | red: '#f5222d', |
| | | orange_red: '#fa541c', |
| | | orange: '#fa8c16', |
| | | orange_yellow: '#faad14', |
| | | yellow: '#fadb14', |
| | | yellow_green: '#a0d911', |
| | | green: '#52c41a', |
| | | cyan: '#13c2c2', |
| | | blue_purple: '#2f54eb', |
| | | purple: '#722ed1', |
| | | magenta: '#eb2f96', |
| | | grass_green: '#aeb303', |
| | | deep_red: '#c32539', |
| | | deep_blue: '#1d3661' |
| | | } |
| | | |
| | | let systemColor = '#1890ff' |
| | | if (window.GLOB.style) { |
| | | let type = window.GLOB.style.replace(/bg_black_style_|bg_white_style_/, '') |
| | | systemColor = styles[type] || '#1890ff' |
| | | } |
| | | const COLORS = ['#5B8FF9', '#F6BD16', '#5AD8A6', '#945FB9', '#E86452', '#6DC8EC', '#FF99C3', '#1E9493', '#FF9845', '#5D7092'] |
| | | |
| | | // 思维导图 |
| | | G6.registerNode( |
| | | 'dice-mind-map-root', { |
| | | jsx: (cfg) => { |
| | | const width = Util.getTextSize(cfg.label, 16)[0] + 24 |
| | | |
| | | return ` |
| | | <group> |
| | | <rect style={{width: ${width}, height: 42, stroke: ${systemColor}, radius: 4}} keyshape> |
| | | <text style={{ fontSize: 16, marginLeft: 6, marginTop: 12 }}>${cfg.label}</text> |
| | | </rect> |
| | | </group> |
| | | ` |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | | [0, 0.5], |
| | | [1, 0.5] |
| | | ] |
| | | } |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | |
| | | G6.registerNode( |
| | | 'dice-mind-map-leaf', { |
| | | jsx: (cfg) => { |
| | | const width = Util.getTextSize(cfg.label, 12)[0] + 24 |
| | | |
| | | return ` |
| | | <group> |
| | | <rect style={{width: ${width}, height: 26, fill: 'transparent', cursor: pointer }}> |
| | | <text style={{ fontSize: 12, fill: ${cfg.selected ? systemColor : '#000000'}, marginLeft: 12, marginTop: 6, cursor: pointer }}>${cfg.label}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${cfg.color}, width: ${width}, height: 2, x: 0, y: 32, cursor: pointer }} /> |
| | | </group> |
| | | ` |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | | [0, 0.965], |
| | | [1, 0.965] |
| | | ] |
| | | } |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | G6.registerBehavior('dice-mindmap', { |
| | | getEvents() { |
| | | return { |
| | | 'node:click': 'editNode', |
| | | 'canvas:click': 'onCanvasClick' |
| | | } |
| | | }, |
| | | editNode(evt) { |
| | | const item = evt.item |
| | | const model = item.get('model') |
| | | |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | } |
| | | }) |
| | | |
| | | model.selected = true |
| | | this.graph.updateItem(item, model, false) |
| | | }, |
| | | onCanvasClick(e) { |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | G6.registerBehavior('scroll-canvas', { |
| | | getEvents: function getEvents() { |
| | | return { |
| | | wheel: 'onWheel' |
| | | } |
| | | }, |
| | | onWheel: function onWheel(ev) { |
| | | const { graph } = this |
| | | if (!graph) { |
| | | return |
| | | } |
| | | if (ev.ctrlKey) { |
| | | const canvas = graph.get('canvas') |
| | | const point = canvas.getPointByClient(ev.clientX, ev.clientY) |
| | | let ratio = graph.getZoom() |
| | | if (ev.wheelDelta > 0) { |
| | | ratio += ratio * 0.05 |
| | | } else { |
| | | ratio *= ratio * 0.05 |
| | | } |
| | | graph.zoomTo(ratio, { |
| | | x: point.x, |
| | | y: point.y |
| | | }) |
| | | } else { |
| | | const x = ev.deltaX || ev.movementX |
| | | const y = ev.deltaY || ev.movementY || (-ev.wheelDelta * 125) / 3 |
| | | graph.translate(-x, -y) |
| | | } |
| | | ev.preventDefault() |
| | | } |
| | | }) |
| | | |
| | | // 缩进文件树 |
| | | G6.registerNode('indentedRoot', { |
| | | draw(model, group) { |
| | | const keyShape = group.addShape('rect', { |
| | | attrs: { |
| | | x: -46, |
| | | y: -16, |
| | | width: 92, |
| | | height: 32, |
| | | fill: systemColor, |
| | | radius: 2, |
| | | stroke: '#5B8FF9', |
| | | lineWidth: 0 |
| | | }, |
| | | name: 'key-shape' |
| | | }) |
| | | |
| | | const text = group.addShape('text', { |
| | | attrs: { |
| | | text: model.label || 'root', |
| | | fill: "#fff", |
| | | fontSize: 12, |
| | | x: 0, |
| | | y: 0, |
| | | textAlign: 'center', |
| | | textBaseline: 'middle' |
| | | }, |
| | | name: 'root-text-shape' |
| | | }) |
| | | const textBBox = text.getBBox() |
| | | const width = textBBox.width + 24 |
| | | const height = textBBox.height + 12 |
| | | keyShape.attr({ |
| | | x: -width / 2, |
| | | y: -height / 2, |
| | | width, |
| | | height |
| | | }) |
| | | |
| | | return keyShape |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | | [0.5, 1] |
| | | ] |
| | | }, |
| | | update: undefined |
| | | }) |
| | | |
| | | G6.registerNode('indentedNode', { |
| | | addChildCount(group, tag, props) { |
| | | const { collapsed, branchColor, count } = props |
| | | let clickCircleY = 10 |
| | | // 子类数量 icon,绘制圆点在节点正下方 |
| | | if (tag) { |
| | | const childCountGroup = group.addGroup({ |
| | | name: 'child-count-group' |
| | | }) |
| | | childCountGroup.setMatrix([1, 0, 0, 0, 1, 0, 0, clickCircleY, 1]) |
| | | const countBackWidth = collapsed ? 26 : 12 |
| | | childCountGroup.addShape('rect', { |
| | | attrs: { |
| | | width: countBackWidth, |
| | | height: 12, |
| | | radius: 6, |
| | | stroke: branchColor, |
| | | lineWidth: 2, |
| | | fill: collapsed ? branchColor : '#fff', |
| | | x: -countBackWidth / 2, |
| | | y: -6, |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'child-count-rect-shape' |
| | | }) |
| | | const childCountText = childCountGroup.addShape('text', { |
| | | attrs: { |
| | | text: count, |
| | | fill: '#fff', |
| | | x: 0, |
| | | y: 0, |
| | | fontSize: 10, |
| | | textAlign: 'center', |
| | | textBaseline: 'middle', |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'child-count-text-shape' |
| | | }) |
| | | const childHoverIcon = childCountGroup.addShape('path', { |
| | | attrs: { |
| | | stroke: '#fff', |
| | | lineWidth: 1, |
| | | cursor: 'pointer', |
| | | path: [['M', -3, 2], ['L', 0, -2], ['L', 3, 2]] |
| | | }, |
| | | name: 'child-count-expand-icon', |
| | | capture: false |
| | | }) |
| | | childHoverIcon.hide() |
| | | |
| | | // 连接 count 的线段 |
| | | const countLink = group.addShape('path', { |
| | | attrs: { |
| | | path: [['M', 0, 0], ['L', 0, 11]], |
| | | stroke: branchColor, |
| | | lineWidth: 2, |
| | | }, |
| | | name: 'count-link' |
| | | }) |
| | | countLink.toBack() |
| | | |
| | | if (collapsed) { |
| | | childCountGroup.show() |
| | | childCountText.show() |
| | | countLink.show() |
| | | } |
| | | else { |
| | | childCountGroup.hide() |
| | | childCountText.hide() |
| | | countLink.hide() |
| | | } |
| | | |
| | | clickCircleY += 16 |
| | | } |
| | | }, |
| | | addBottomLine(group, props) { |
| | | const { x, width, stroke, lineWidth } = props |
| | | return group.addShape('path', { |
| | | attrs: { |
| | | path: [ |
| | | ['M', x - 1, 0], |
| | | ['L', width, 0], |
| | | ], |
| | | stroke, |
| | | lineWidth, |
| | | }, |
| | | name: 'node-path-shape' |
| | | }) |
| | | }, |
| | | addName(group, props) { |
| | | const { label, x = 0, y, fill } = props |
| | | return group.addShape('text', { |
| | | attrs: { |
| | | text: label, |
| | | x, |
| | | y, |
| | | textAlign: 'start', |
| | | textBaseline: 'top', |
| | | fill, |
| | | fontSize: 14, |
| | | fontFamily: 'PingFangSC-Regular', |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'not-root-text-shape' |
| | | }) |
| | | }, |
| | | draw(model, group) { |
| | | const { collapsed, depth, label, children, selected } = model |
| | | // 是否为根节点 |
| | | const rootNode = depth === 0 |
| | | // 子节点数量 |
| | | const childCount = children ? children.length : 0 |
| | | |
| | | let width = 0 |
| | | const height = 24 |
| | | const x = 0 |
| | | const y = -height / 2 |
| | | const borderRadius = 4 |
| | | // 名称文本 |
| | | const text = this.addName(group, { label, x, y }) |
| | | |
| | | let textWidth = text.getBBox().width |
| | | width = textWidth + 20 |
| | | |
| | | const keyShapeAttrs = { |
| | | x, |
| | | y, |
| | | width, |
| | | height, |
| | | radius: borderRadius, |
| | | fill: undefined, |
| | | stroke: undefined, |
| | | } |
| | | |
| | | const keyShape = group.addShape('rect', { |
| | | attrs: keyShapeAttrs, |
| | | name: 'root-key-shape-rect-shape' |
| | | }) |
| | | |
| | | // 底部横线 |
| | | const bottomLine = this.addBottomLine(group, { |
| | | stroke: model.branchColor || '#AAB7C4', |
| | | lineWidth: 3, |
| | | x, |
| | | width |
| | | }) |
| | | |
| | | let nameColor = 'rgba(0, 0, 0, 0.85)' |
| | | |
| | | if (selected) { |
| | | nameColor = systemColor |
| | | } |
| | | |
| | | // 名称 |
| | | text.attr({ |
| | | y: y - 12, |
| | | fill: nameColor |
| | | }) |
| | | text.toFront() |
| | | textWidth = text.getBBox().width |
| | | |
| | | if (bottomLine) bottomLine.toFront() |
| | | |
| | | this.addChildCount(group, childCount && !rootNode, { |
| | | collapsed, |
| | | branchColor: model.branchColor, |
| | | count: childCount ? `${childCount}` : undefined |
| | | }) |
| | | |
| | | const bbox = group.getBBox() |
| | | const backContainer = group.addShape('path', { |
| | | attrs: { |
| | | path: childCount ? [ |
| | | ['M', bbox.minX, bbox.minY], |
| | | ['L', bbox.maxX, bbox.minY], |
| | | ['L', bbox.maxX, bbox.maxY], |
| | | ['L', bbox.minX + 20, bbox.maxY], |
| | | ['L', bbox.minX + 20, bbox.maxY + 20], |
| | | ['L', bbox.minX, bbox.maxY + 20], |
| | | ['Z'] |
| | | ] : [ |
| | | ['M', bbox.minX, bbox.minY], |
| | | ['L', bbox.maxX, bbox.minY], |
| | | ['L', bbox.maxX, bbox.maxY], |
| | | ['L', bbox.minX, bbox.maxY], |
| | | ['Z'] |
| | | ], |
| | | // #region 初始化图形 |
| | | const groups = { |
| | | top: { |
| | | position: 'top', |
| | | attrs: { |
| | | circle: { |
| | | r: 4, |
| | | magnet: true, |
| | | stroke: 'var(--mk-sys-color)', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | opacity: 0 |
| | | } |
| | | }) |
| | | backContainer.toBack() |
| | | return keyShape |
| | | } |
| | | }) |
| | | |
| | | G6.registerEdge('indentedEdge', { |
| | | afterDraw: (cfg, group) => { |
| | | const sourceNode = cfg.sourceNode && cfg.sourceNode.getModel() |
| | | const targetNode = cfg.targetNode && cfg.targetNode.getModel() |
| | | const color = sourceNode.branchColor || targetNode.branchColor || cfg.color || '#000' |
| | | |
| | | const keyShape = group.get('children')[0] |
| | | keyShape.attr({ |
| | | stroke: color, |
| | | lineWidth: 3 // branchThick |
| | | }) |
| | | group.toBack() |
| | | }, |
| | | getControlPoints: (cfg) => { |
| | | const startPoint = cfg.startPoint |
| | | const endPoint = cfg.endPoint |
| | | return [ |
| | | startPoint, |
| | | { |
| | | x: startPoint.x, |
| | | y: endPoint.y, |
| | | }, |
| | | endPoint |
| | | ] |
| | | }, |
| | | update: undefined |
| | | }, 'polyline') |
| | | |
| | | G6.registerBehavior('wheel-scroll', { |
| | | getDefaultCfg() { |
| | | return { |
| | | direction: 'y', |
| | | zoomKey: 'ctrl', |
| | | sensitivity: 3, |
| | | scalableRange: -64 |
| | | } |
| | | }, |
| | | getEvents() { |
| | | return { |
| | | wheel: 'onWheel' |
| | | } |
| | | }, |
| | | onWheel(ev) { |
| | | const graph = this.graph |
| | | let keyDown = ev[`${this.zoomKey}Key`] |
| | | if (this.zoomKey === 'control') keyDown = ev.ctrlKey |
| | | if (keyDown) { |
| | | const sensitivity = this.get('sensitivity') |
| | | const canvas = graph.get('canvas') |
| | | const point = canvas.getPointByClient(ev.clientX, ev.clientY) |
| | | let ratio = graph.getZoom() |
| | | if (ev.wheelDelta > 0) { |
| | | ratio *= (1 + 0.01 * sensitivity) |
| | | } else { |
| | | ratio *= (1 - 0.01 * sensitivity) |
| | | } |
| | | graph.zoomTo(ratio, { |
| | | x: point.x, |
| | | y: point.y |
| | | }) |
| | | graph.emit('wheelzoom', ev) |
| | | } else { |
| | | let dx = ev.deltaX || ev.movementX |
| | | let dy = ev.deltaY || ev.movementY |
| | | if (!dy && navigator.userAgent.indexOf('Firefox') > -1) dy = (-ev.wheelDelta * 125) / 3 |
| | | |
| | | const width = this.graph.get('width') |
| | | const height = this.graph.get('height') |
| | | const graphCanvasBBox = this.graph.get('group').getCanvasBBox() |
| | | |
| | | let expandWidth = this.scalableRange |
| | | let expandHeight = this.scalableRange |
| | | // 若 scalableRange 是 0~1 的小数,则作为比例考虑 |
| | | if (expandWidth < 1 && expandWidth > -1) { |
| | | expandWidth = width * expandWidth |
| | | expandHeight = height * expandHeight |
| | | } |
| | | |
| | | const { minX, maxX, minY, maxY } = graphCanvasBBox |
| | | |
| | | if (dx > 0) { |
| | | if (maxX < -expandWidth) { |
| | | dx = 0 |
| | | } else if (maxX - dx < -expandWidth) { |
| | | dx = maxX + expandWidth |
| | | } |
| | | } else if (dx < 0) { |
| | | if (minX > width + expandWidth) { |
| | | dx = 0 |
| | | } else if (minX - dx > width + expandWidth) { |
| | | dx = minX - (width + expandWidth) |
| | | } |
| | | } |
| | | |
| | | if (dy > 0) { |
| | | if (maxY < -expandHeight) { |
| | | dy = 0 |
| | | } else if (maxY - dy < -expandHeight) { |
| | | dy = maxY + expandHeight |
| | | } |
| | | } else if (dy < 0) { |
| | | if (minY > height + expandHeight) { |
| | | dy = 0 |
| | | } else if (minY - dy > height + expandHeight) { |
| | | dy = minY - (height + expandHeight) |
| | | } |
| | | } |
| | | |
| | | if (this.get('direction') === 'x') { |
| | | dy = 0 |
| | | } else if (this.get('direction') === 'y') { |
| | | dx = 0 |
| | | } |
| | | |
| | | graph.translate(-dx, -dy) |
| | | } |
| | | ev.preventDefault() |
| | | } |
| | | }) |
| | | G6.registerBehavior('hover-node', { |
| | | getEvents() { |
| | | return { |
| | | 'node:mouseover': 'onNodeMouseOver', |
| | | 'node:mouseleave': 'onNodeMouseLeave', |
| | | 'node:mouseenter': 'onNodeMouseEnter' |
| | | } |
| | | }, |
| | | onNodeMouseEnter(ev) { |
| | | const { item } = ev |
| | | if (!item || item.get('destroyed')) return |
| | | item.toFront() |
| | | const model = item.getModel() |
| | | const { collapsed, depth } = model |
| | | const rootNode = depth === 0 || model.isRoot |
| | | const group = item.getContainer() |
| | | |
| | | if (rootNode) return |
| | | |
| | | // 控制子节点个数标记 |
| | | if (!collapsed) { |
| | | const childCountGroup = group.find(e => e.get('name') === 'child-count-group') |
| | | if (childCountGroup) { |
| | | childCountGroup.show() |
| | | } |
| | | } |
| | | }, |
| | | onNodeMouseOver(ev) { |
| | | const shape = ev.target |
| | | |
| | | // tooltip显示、隐藏 |
| | | this.graph.emit('tooltip: show', ev) |
| | | |
| | | // expand 状态下,若 hover 到子节点个数标记,填充背景+显示收起 icon |
| | | const { item } = ev |
| | | const group = item.getContainer() |
| | | const model = item.getModel() |
| | | if (!model.collapsed) { |
| | | const childCountGroup = group.find(e => e.get('name') === 'child-count-group') |
| | | if (childCountGroup) { |
| | | childCountGroup.show() |
| | | const back = childCountGroup.find(e => e.get('name') === 'child-count-rect-shape') |
| | | const expandIcon = childCountGroup.find(e => e.get('name') === 'child-count-expand-icon') |
| | | const rootNode = model.depth === 0 || model.isRoot |
| | | const branchColor = rootNode ? '#576286' : model.branchColor |
| | | if (shape.get('parent').get('name') === 'child-count-group') { |
| | | if (back) { |
| | | back.attr('fill', branchColor || '#fff') |
| | | } |
| | | if (expandIcon) { |
| | | expandIcon.show() |
| | | } |
| | | } else { |
| | | if (back) { |
| | | back.attr('fill', '#fff') |
| | | } |
| | | if (expandIcon) { |
| | | expandIcon.hide() |
| | | } |
| | | style: { |
| | | visibility: 'hidden' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | onNodeMouseLeave(ev) { |
| | | const { item } = ev |
| | | const model = item.getModel() |
| | | const group = item.getContainer() |
| | | const { collapsed } = model |
| | | |
| | | if (!collapsed) { |
| | | const childCountGroup = group.find(e => e.get('name') === 'child-count-group') |
| | | if (childCountGroup) { |
| | | childCountGroup.hide() |
| | | right: { |
| | | position: 'right', |
| | | attrs: { |
| | | circle: { |
| | | r: 4, |
| | | magnet: true, |
| | | stroke: 'var(--mk-sys-color)', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden' |
| | | } |
| | | } |
| | | |
| | | const iconsLinkPath = group.find(e => e.get('name') === 'icons-link-path') |
| | | if (iconsLinkPath) { |
| | | iconsLinkPath.hide() |
| | | } |
| | | } |
| | | |
| | | this.graph.emit('tooltip: hide', ev) |
| | | } |
| | | }) |
| | | G6.registerBehavior('click-node', { |
| | | getEvents() { |
| | | return { |
| | | 'node:click': 'onNodeClick', |
| | | 'canvas:click': 'onCanvasClick' |
| | | } |
| | | }, |
| | | onNodeClick(e) { |
| | | const { item, target } = e |
| | | const shape = target |
| | | const shapeName = shape.cfg.name |
| | | let model = item.getModel() |
| | | |
| | | // 点击收起/展开 icon |
| | | if (shapeName === 'child-count-rect-shape' || shapeName === 'child-count-text-shape') { |
| | | const updatedCollapsed = !model.collapsed |
| | | this.graph.updateItem(item, { collapsed: updatedCollapsed }) |
| | | this.graph.layout() |
| | | return |
| | | } |
| | | |
| | | // 选中节点 |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | bottom: { |
| | | position: 'bottom', |
| | | attrs: { |
| | | circle: { |
| | | r: 4, |
| | | magnet: true, |
| | | stroke: 'var(--mk-sys-color)', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden' |
| | | } |
| | | } |
| | | }) |
| | | |
| | | model.selected = true |
| | | this.graph.updateItem(item, model, false) |
| | | |
| | | return |
| | | } |
| | | }, |
| | | onCanvasClick(e) { |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | left: { |
| | | position: 'left', |
| | | attrs: { |
| | | circle: { |
| | | r: 4, |
| | | magnet: true, |
| | | stroke: 'var(--mk-sys-color)', |
| | | strokeWidth: 1, |
| | | fill: '#fff', |
| | | style: { |
| | | visibility: 'hidden' |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | const dataIndTransform = (data) => { |
| | | const changeData = (d) => { |
| | | let data = { ...d } |
| | | |
| | | data.type = data.isRoot ? 'indentedRoot' : 'indentedNode' |
| | | |
| | | if (d.children) { |
| | | data.children = d.children.map((child) => changeData(child)) |
| | | } |
| | | // 给定 branchColor 和 0-2 层节点 depth |
| | | if (data.children && data.children.length) { |
| | | data.depth = 0 |
| | | data.children.forEach((subtree, i) => { |
| | | subtree.branchColor = COLORS[i % COLORS.length] |
| | | // dfs |
| | | let currentDepth = 1 |
| | | subtree.depth = currentDepth |
| | | Util.traverseTree(subtree, child => { |
| | | child.branchColor = COLORS[i % COLORS.length] |
| | | |
| | | if (!child.depth) { |
| | | child.depth = currentDepth + 1 |
| | | } |
| | | else currentDepth = subtree.depth |
| | | if (child.children) { |
| | | child.children.forEach(subChild => { |
| | | subChild.depth = child.depth + 1 |
| | | }) |
| | | } |
| | | |
| | | if (!data.isRoot) { |
| | | child.collapsed = data.collapsed || false |
| | | } |
| | | return true |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | return data |
| | | } |
| | | return changeData(data) |
| | | } |
| | | |
| | | // 知识图谱树 |
| | | G6.registerNode('treeNode', { |
| | | draw: (cfg, group) => { |
| | | const { label, selected, children, isRoot } = cfg |
| | | const rootNode = !!isRoot |
| | | const hasChildren = children && children.length !== 0 |
| | | |
| | | let width = 0 |
| | | const height = 28 |
| | | const x = 0 |
| | | const y = -height / 2 |
| | | |
| | | // 名称文本 |
| | | const text = group.addShape('text', { |
| | | attrs: { |
| | | text: label, |
| | | x: x * 2, |
| | | y, |
| | | textAlign: 'left', |
| | | textBaseline: 'top', |
| | | fontFamily: 'PingFangSC-Regular', |
| | | Graph.registerNode( |
| | | 'mk-rect', |
| | | { |
| | | inherit: 'rect', |
| | | width: 66, |
| | | height: 36, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | | stroke: '#5F95FF', |
| | | fill: '#EFF4FF' |
| | | }, |
| | | cursor: 'pointer', |
| | | name: 'name-text-shape', |
| | | }) |
| | | const textWidth = text.getBBox().width |
| | | width = textWidth + 20 |
| | | |
| | | width = width < 60 ? 60 : width |
| | | |
| | | if (!rootNode && hasChildren) { |
| | | width += 22 |
| | | text: { |
| | | fontSize: 12, |
| | | fill: '#262626' |
| | | } |
| | | }, |
| | | ports: { |
| | | groups, |
| | | items: [ |
| | | { group: 'top' }, |
| | | { group: 'right' }, |
| | | { group: 'bottom' }, |
| | | { group: 'left' } |
| | | ] |
| | | } |
| | | }, |
| | | true |
| | | ) |
| | | |
| | | const keyShapeAttrs = { |
| | | x, |
| | | y, |
| | | width, |
| | | height, |
| | | radius: 4 |
| | | } |
| | | |
| | | const keyShape = group.addShape('rect', { |
| | | attrs: keyShapeAttrs, |
| | | name: 'root-key-shape-rect-shape' |
| | | }) |
| | | |
| | | if (!rootNode) { |
| | | // 底部横线 |
| | | group.addShape('path', { |
| | | attrs: { |
| | | path: [ |
| | | ['M', x - 1, 0], |
| | | ['L', width, 0], |
| | | ], |
| | | stroke: '#AAB7C4', |
| | | lineWidth: 1, |
| | | }, |
| | | name: 'node-path-shape' |
| | | }) |
| | | } |
| | | |
| | | const mainX = x - 10 |
| | | const mainY = -height + 15 |
| | | |
| | | if (rootNode) { |
| | | group.addShape('rect', { |
| | | attrs: { |
| | | x: mainX, |
| | | y: mainY, |
| | | width: width + 12, |
| | | height, |
| | | radius: 14, |
| | | fill: systemColor, |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'main-shape' |
| | | }) |
| | | } |
| | | |
| | | let nameColor = 'rgba(0, 0, 0, 0.85)' |
| | | if (selected) { |
| | | nameColor = systemColor |
| | | } |
| | | |
| | | // 名称 |
| | | if (rootNode) { |
| | | group.addShape('text', { |
| | | attrs: { |
| | | text: label, |
| | | x: mainX + 18, |
| | | y: 1, |
| | | textAlign: 'left', |
| | | textBaseline: 'middle', |
| | | fill: '#ffffff', |
| | | fontSize: 12, |
| | | fontFamily: 'PingFangSC-Regular', |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'root-text-shape' |
| | | }) |
| | | } else { |
| | | group.addShape('text', { |
| | | attrs: { |
| | | text: label, |
| | | x: mainX + 6, |
| | | y: y - 5, |
| | | textAlign: 'start', |
| | | textBaseline: 'top', |
| | | fill: nameColor, |
| | | fontSize: 12, |
| | | fontFamily: 'PingFangSC-Regular', |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'not-root-text-shape' |
| | | }) |
| | | } |
| | | |
| | | // 子类数量 |
| | | if (hasChildren && !rootNode) { |
| | | const childCountHeight = 12 |
| | | const childCountX = width - 22 |
| | | const childCountY = -childCountHeight / 2 |
| | | |
| | | group.addShape('rect', { |
| | | attrs: { |
| | | width: 22, |
| | | height: 12, |
| | | stroke: systemColor, |
| | | fill: '#fff', |
| | | x: childCountX, |
| | | y: childCountY, |
| | | radius: 6, |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'child-count-rect-shape', |
| | | }) |
| | | group.addShape('text', { |
| | | attrs: { |
| | | text: `${children.length}`, |
| | | fill: 'rgba(0, 0, 0, .65)', |
| | | x: childCountX + 11, |
| | | y: childCountY + 12, |
| | | fontSize: 10, |
| | | width: 22, |
| | | textAlign: 'center', |
| | | cursor: 'pointer', |
| | | }, |
| | | name: 'child-count-text-shape' |
| | | }) |
| | | } |
| | | |
| | | return keyShape |
| | | } |
| | | }) |
| | | |
| | | G6.registerEdge('smooth', { |
| | | draw(cfg, group) { |
| | | const { startPoint, endPoint } = cfg |
| | | const hgap = Math.abs(endPoint.x - startPoint.x) |
| | | |
| | | const path = [ |
| | | ['M', startPoint.x, startPoint.y], |
| | | [ |
| | | 'C', |
| | | startPoint.x + hgap / 4, |
| | | startPoint.y, |
| | | endPoint.x - hgap / 2, |
| | | endPoint.y, |
| | | endPoint.x, |
| | | endPoint.y, |
| | | ], |
| | | ] |
| | | |
| | | const shape = group.addShape('path', { |
| | | attrs: { |
| | | stroke: '#AAB7C4', |
| | | path, |
| | | Graph.registerNode( |
| | | 'mk-polygon', |
| | | { |
| | | inherit: 'polygon', |
| | | width: 66, |
| | | height: 36, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | | stroke: '#5F95FF', |
| | | fill: '#EFF4FF' |
| | | }, |
| | | name: 'smooth-path-shape', |
| | | }) |
| | | return shape |
| | | }, |
| | | }) |
| | | |
| | | G6.registerBehavior('click-item', { |
| | | getEvents() { |
| | | return { |
| | | 'node:click': 'onNodeClick', |
| | | 'canvas:click': 'onCanvasClick' |
| | | text: { |
| | | fontSize: 12, |
| | | fill: '#262626' |
| | | } |
| | | }, |
| | | ports: { |
| | | groups, |
| | | items: [ |
| | | { group: 'top' }, |
| | | { group: 'right' }, |
| | | { group: 'bottom' }, |
| | | { group: 'left' } |
| | | ] |
| | | } |
| | | }, |
| | | onNodeClick(e) { |
| | | const { item } = e |
| | | let model = item.getModel() |
| | | true |
| | | ) |
| | | |
| | | if (model.children) return |
| | | // 选中节点 |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | Graph.registerNode( |
| | | 'mk-circle', |
| | | { |
| | | inherit: 'circle', |
| | | width: 36, |
| | | height: 36, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | | stroke: '#5F95FF', |
| | | fill: '#EFF4FF' |
| | | }, |
| | | text: { |
| | | fontSize: 12, |
| | | fill: '#262626' |
| | | } |
| | | }) |
| | | |
| | | model.selected = true |
| | | this.graph.updateItem(item, model, false) |
| | | |
| | | return |
| | | }, |
| | | ports: { |
| | | groups, |
| | | items: [ |
| | | { group: 'top' }, |
| | | { group: 'right' }, |
| | | { group: 'bottom' }, |
| | | { group: 'left' } |
| | | ] |
| | | } |
| | | }, |
| | | onCanvasClick(e) { |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.selected) { |
| | | _model.selected = false |
| | | this.graph.updateItem(node, _model, false) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | true |
| | | ) |
| | | |
| | | class antvG6Chart extends Component { |
| | | Graph.registerNode( |
| | | 'mk-ellipse', |
| | | { |
| | | inherit: 'ellipse', |
| | | width: 66, |
| | | height: 36, |
| | | attrs: { |
| | | body: { |
| | | strokeWidth: 1, |
| | | stroke: '#5F95FF', |
| | | fill: '#EFF4FF' |
| | | }, |
| | | text: { |
| | | fontSize: 12, |
| | | fill: '#262626' |
| | | } |
| | | }, |
| | | ports: { |
| | | groups, |
| | | items: [ |
| | | { group: 'top' }, |
| | | { group: 'right' }, |
| | | { group: 'bottom' }, |
| | | { group: 'left' } |
| | | ] |
| | | } |
| | | }, |
| | | true |
| | | ) |
| | | |
| | | Graph.registerNode( |
| | | 'mk-star', |
| | | { |
| | | inherit: 'polygon', |
| | | width: 36, |
| | | height: 36, |
| | | points: '100,10 40,198 190,78 10,78 160,198', |
| | | attrs: { |
| | | body: { |
| | | fill: '#EFF4FF', |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | fillRule: 'nonzero' |
| | | }, |
| | | text: { |
| | | fontSize: 12, |
| | | fill: '#262626' |
| | | } |
| | | }, |
| | | ports: { |
| | | groups, |
| | | items: [ |
| | | { group: 'top' }, |
| | | { group: 'right' }, |
| | | { group: 'bottom' }, |
| | | { group: 'left' } |
| | | ] |
| | | } |
| | | }, |
| | | true |
| | | ) |
| | | |
| | | class antvX6Chart extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object, |
| | | updateConfig: PropTypes.func, |
| | |
| | | |
| | | state = { |
| | | card: null, |
| | | eventListener: null |
| | | eventListener: null, |
| | | toolunfold: true, |
| | | nodeunfold: true, |
| | | node: null |
| | | } |
| | | |
| | | selectNode = null |
| | | mkGraph = null |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card } = this.props |
| | |
| | | plot: _plot, |
| | | } |
| | | |
| | | if (card.config) { |
| | | let config = fromJS(card.config).toJS() |
| | | |
| | | _card.plot = config.plot |
| | | _card.plot.name = card.name |
| | | _card.style = config.style |
| | | _card.headerStyle = config.headerStyle |
| | | |
| | | _card.setting = config.setting |
| | | _card.columns = config.columns |
| | | _card.scripts = config.scripts |
| | | } |
| | | |
| | | this.updateComponent(_card) |
| | | } else { |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 1000) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('tabsChange', this.handleTabsChange) |
| | | } |
| | | |
| | | handleTabsChange = (parentId) => { |
| | | const { card } = this.state |
| | | |
| | | if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { |
| | | let _element = document.getElementById(card.uuid + 'canvas') |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | |
| | | this.$timer && clearTimeout(this.$timer) |
| | | this.$timer = setTimeout(this.viewrender, 100) |
| | | } |
| | | } |
| | | |
| | | getdata = () => { |
| | | const { card } = this.state |
| | | |
| | | const setData = (list) => { |
| | | let item = { |
| | | label: list[0], |
| | | id: list[0], |
| | | children: [] |
| | | } |
| | | if (!list[1]) { |
| | | delete item.children |
| | | |
| | | return item |
| | | } else if (!Array.isArray(list[1])) { |
| | | return list.map(m => ({label: m, id: m})) |
| | | } |
| | | |
| | | for (let i = 1; i < list.length; i++) { |
| | | let cell = setData(list[i]) |
| | | |
| | | if (Array.isArray(cell)) { |
| | | item.children.push(...cell) |
| | | } else { |
| | | item.children.push(cell) |
| | | } |
| | | } |
| | | |
| | | return item |
| | | } |
| | | |
| | | let data = setData(MindData) |
| | | |
| | | if (card.plot.subtype === 'mindmap') { |
| | | if (card.plot.dirField) { |
| | | data.children[0].direction = 'left' |
| | | data.children[2].direction = 'left' |
| | | } |
| | | |
| | | data.children.forEach(item => { |
| | | if (item.direction === 'left') { |
| | | item.color = card.plot.leftColor || '#26C281' |
| | | } else { |
| | | item.direction = 'right' |
| | | item.color = card.plot.nodeColor || '#1890ff' |
| | | } |
| | | }) |
| | | |
| | | data.collapsed = false |
| | | data.type = 'dice-mind-map-root' |
| | | |
| | | const collapse = (item) => { |
| | | if (!item.children) return |
| | | |
| | | item.children.forEach(cell => { |
| | | cell.collapsed = card.plot.collapsed === 'true' |
| | | cell.direction = cell.direction || 'right' |
| | | cell.type = 'dice-mind-map-leaf' |
| | | cell.color = cell.color || item.color |
| | | collapse(cell) |
| | | }) |
| | | } |
| | | |
| | | collapse(data) |
| | | } else if (card.plot.subtype === 'indentTree') { |
| | | data.isRoot = true |
| | | data.collapsed = false |
| | | |
| | | data.children.forEach(item => { |
| | | item.collapsed = card.plot.collapsed === 'true' |
| | | }) |
| | | } else if (card.plot.subtype === 'kapmap') { |
| | | data.isRoot = true |
| | | data.collapsed = false |
| | | |
| | | if (card.plot.collapsed === 'true') { |
| | | const collapse = (item) => { |
| | | if (!item.children) return |
| | | |
| | | item.children.forEach(cell => { |
| | | cell.collapsed = true |
| | | collapse(cell) |
| | | }) |
| | | } |
| | | |
| | | collapse(data) |
| | | } |
| | | } |
| | | |
| | | return data |
| | | componentDidMount () { |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 1000) |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { card } = this.state |
| | | // const { card } = this.state |
| | | |
| | | if (card.plot.subtype === 'mindmap') { |
| | | this.ponitrender() |
| | | } else if (card.plot.subtype === 'indentTree') { |
| | | this.indentrender() |
| | | } else if (card.plot.subtype === 'kapmap') { |
| | | // if (card.plot.subtype === 'mindmap') { |
| | | // this.ponitrender() |
| | | // } else if (card.plot.subtype === 'indentTree') { |
| | | // this.indentrender() |
| | | // } else if (card.plot.subtype === 'kapmap') { |
| | | this.kapmaprender() |
| | | } |
| | | // } |
| | | } |
| | | |
| | | kapmaprender = () => { |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | | const height = getHeight(plot.height) |
| | | |
| | | const graph = new G6.TreeGraph({ |
| | | container: card.uuid + 'canvas', |
| | | width: this.wrap.scrollWidth - 30, |
| | | height: height, |
| | | modes: { |
| | | default: [ |
| | | { |
| | | type: 'collapse-expand', |
| | | }, |
| | | 'drag-canvas', |
| | | 'zoom-canvas', |
| | | 'click-item' |
| | | ], |
| | | // #region 初始化画布 |
| | | const graph = new Graph({ |
| | | container: document.getElementById(card.uuid + 'container'), |
| | | // grid: { |
| | | // visible: true, |
| | | // type: 'doubleMesh', |
| | | // args: [ |
| | | // { |
| | | // color: '#eee', // 主网格线颜色 |
| | | // thickness: 1 // 主网格线宽度 |
| | | // }, |
| | | // { |
| | | // color: '#ddd', // 次网格线颜色 |
| | | // thickness: 1, // 次网格线宽度 |
| | | // factor: 4 // 主次网格线间隔 |
| | | // } |
| | | // ] |
| | | // }, |
| | | scaling: { |
| | | min: 0.5, |
| | | max: 2 |
| | | }, |
| | | defaultNode: { |
| | | type: 'treeNode', |
| | | anchorPoints: [ |
| | | [0, 0.5], |
| | | [1, 0.5], |
| | | ], |
| | | autoResize: true, |
| | | panning: true, |
| | | background: { |
| | | color: '#ffffff' |
| | | }, |
| | | defaultEdge: { |
| | | type: 'smooth', |
| | | mousewheel: { |
| | | enabled: true, |
| | | zoomAtMousePosition: true, |
| | | modifiers: 'ctrl' |
| | | }, |
| | | layout: { |
| | | type: 'compactBox', |
| | | direction: 'LR', |
| | | getId: function getId(d) { |
| | | return d.id |
| | | connecting: { |
| | | router: 'manhattan', |
| | | connector: { |
| | | name: 'rounded', |
| | | args: { |
| | | radius: 8 |
| | | } |
| | | }, |
| | | getHeight: function getHeight() { |
| | | return 16 |
| | | anchor: 'center', |
| | | connectionPoint: 'anchor', |
| | | allowBlank: false, |
| | | snap: { |
| | | radius: 20 |
| | | }, |
| | | getWidth: function getWidth(d) { |
| | | const labelWidth = G6.Util.getTextSize(d.label, 12)[0] |
| | | const width = 60 + labelWidth |
| | | return width |
| | | createEdge() { |
| | | return new Shape.Edge({ |
| | | attrs: { |
| | | line: { |
| | | stroke: '#A2B1C3', |
| | | strokeWidth: 2, |
| | | targetMarker: { |
| | | name: 'block', |
| | | width: 12, |
| | | height: 8 |
| | | } |
| | | } |
| | | }, |
| | | zIndex: 0 |
| | | }) |
| | | }, |
| | | getVGap: function getVGap() { |
| | | return 15 |
| | | }, |
| | | getHGap: function getHGap() { |
| | | return 30 |
| | | validateConnection({ targetMagnet }) { |
| | | return !!targetMagnet |
| | | } |
| | | }, |
| | | highlighting: { |
| | | magnetAdsorbed: { |
| | | name: 'stroke', |
| | | args: { |
| | | attrs: { |
| | | fill: '#5F95FF', |
| | | stroke: '#5F95FF' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | |
| | | graph.data(data) |
| | | graph.render() |
| | | graph.fitView() |
| | | // #region 使用插件 |
| | | graph |
| | | .use(new Transform({ |
| | | resizing: true, |
| | | rotating: true |
| | | })) |
| | | .use(new Selection()) |
| | | .use(new Snapline()) |
| | | .use(new Keyboard()) |
| | | .use(new Clipboard()) |
| | | .use(new History()) |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | graph.zoomTo(1, { x: 0, y: height / 2 }) |
| | | // #region 初始化 stencil |
| | | const stencil = new Stencil({ |
| | | title: '流程图', |
| | | target: graph, |
| | | stencilGraphWidth: 180, |
| | | stencilGraphHeight: 180, |
| | | groups: [ |
| | | { |
| | | title: '通用节点', |
| | | name: 'group1' |
| | | }, |
| | | { |
| | | title: '自定义', |
| | | name: 'group2', |
| | | graphHeight: 120, |
| | | layoutOptions: { |
| | | rowHeight: 70 |
| | | } |
| | | } |
| | | ], |
| | | layoutOptions: { |
| | | columns: 2, |
| | | columnWidth: 80, |
| | | rowHeight: 55 |
| | | } |
| | | }) |
| | | |
| | | document.getElementById(card.uuid + 'stencil').appendChild(stencil.container) |
| | | |
| | | // #region 快捷键与事件 |
| | | graph.bindKey(['meta+c', 'ctrl+c'], () => { |
| | | const cells = graph.getSelectedCells() |
| | | if (cells.length) { |
| | | graph.copy(cells) |
| | | } |
| | | return false |
| | | }) |
| | | graph.bindKey(['meta+x', 'ctrl+x'], () => { |
| | | const cells = graph.getSelectedCells() |
| | | if (cells.length) { |
| | | graph.cut(cells) |
| | | } |
| | | return false |
| | | }) |
| | | graph.bindKey(['meta+v', 'ctrl+v'], () => { |
| | | if (!graph.isClipboardEmpty()) { |
| | | graph.paste({ offset: 32 }) |
| | | } |
| | | return false |
| | | }) |
| | | |
| | | // undo redo |
| | | graph.bindKey(['meta+z', 'ctrl+z'], () => { |
| | | if (graph.canUndo()) { |
| | | graph.undo() |
| | | } |
| | | return false |
| | | }) |
| | | graph.bindKey(['meta+shift+z', 'ctrl+shift+z'], () => { |
| | | if (graph.canRedo()) { |
| | | graph.redo() |
| | | } |
| | | return false |
| | | }) |
| | | |
| | | // 删除元素 |
| | | graph.bindKey(['backspace', 'delete'], () => { |
| | | const cells = graph.getSelectedCells() |
| | | if (cells.length) { |
| | | graph.removeCells(cells) |
| | | this.selectNode = null |
| | | this.setState({node: null}) |
| | | } |
| | | }) |
| | | |
| | | // 控制连接桩显示/隐藏 |
| | | const showPorts = (ports, show) => { |
| | | for (let i = 0, len = ports.length; i < len; i += 1) { |
| | | ports[i].style.visibility = show ? 'visible' : 'hidden' |
| | | } |
| | | } |
| | | graph.on('node:mouseenter', () => { |
| | | const container = document.getElementById(card.uuid + 'container') |
| | | const ports = container.querySelectorAll('.x6-port-body') |
| | | showPorts(ports, true) |
| | | }) |
| | | graph.on('node:mouseleave', () => { |
| | | const container = document.getElementById(card.uuid + 'container') |
| | | const ports = container.querySelectorAll('.x6-port-body') |
| | | showPorts(ports, false) |
| | | }) |
| | | |
| | | graph.on('node:click', ({ e, x, y, node, view }) => { |
| | | this.selectNode = node |
| | | |
| | | this.setState({node: node.store.data}) |
| | | }) |
| | | graph.on('edge:click', ({ e, x, y, edge, view }) => { |
| | | this.selectNode = edge |
| | | |
| | | this.setState({node: edge.store.data}) |
| | | |
| | | graph.clearTransformWidgets() |
| | | }) |
| | | graph.on('blank:click', ({ e, x, y }) => { |
| | | this.selectNode = null |
| | | |
| | | this.setState({node: null}) |
| | | }) |
| | | |
| | | const r1 = graph.createNode({ |
| | | shape: 'mk-rect', |
| | | label: '开始', |
| | | attrs: { |
| | | body: { |
| | | rx: 20, |
| | | ry: 26 |
| | | } |
| | | } |
| | | }) |
| | | const r2 = graph.createNode({ |
| | | shape: 'mk-rect', |
| | | label: '过程' |
| | | }) |
| | | const r3 = graph.createNode({ |
| | | shape: 'mk-rect', |
| | | attrs: { |
| | | body: { |
| | | rx: 6, |
| | | ry: 6 |
| | | } |
| | | }, |
| | | label: '可选过程' |
| | | }) |
| | | const r4 = graph.createNode({ |
| | | shape: 'mk-polygon', |
| | | attrs: { |
| | | body: { |
| | | refPoints: '0,10 10,0 20,10 10,20' |
| | | } |
| | | }, |
| | | label: '决策' |
| | | }) |
| | | const r5 = graph.createNode({ |
| | | shape: 'mk-polygon', |
| | | attrs: { |
| | | body: { |
| | | refPoints: '10,0 40,0 30,20 0,20' |
| | | } |
| | | }, |
| | | label: '数据' |
| | | }) |
| | | const r6 = graph.createNode({ |
| | | shape: 'mk-circle', |
| | | label: '连接' |
| | | }) |
| | | |
| | | stencil.load([r1, r2, r3, r4, r5, r6], 'group1') |
| | | |
| | | const p1 = graph.createNode({ |
| | | shape: 'mk-ellipse', |
| | | label: 'ellipse' |
| | | }) |
| | | const p2 = graph.createNode({ |
| | | shape: 'mk-star', |
| | | label: '' |
| | | }) |
| | | |
| | | stencil.load([p1, p2], 'group2') |
| | | |
| | | this.mkGraph = graph |
| | | } |
| | | |
| | | setTop = () => { |
| | | if (!this.selectNode) { |
| | | message.warning('请选择节点!') |
| | | return |
| | | } |
| | | this.selectNode.toFront() |
| | | } |
| | | |
| | | indentrender = () => { |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | | |
| | | const tree = new G6.TreeGraph({ |
| | | container: card.uuid + 'canvas', |
| | | width: this.wrap.scrollWidth - 30, |
| | | height: getHeight(plot.height), |
| | | layout: { |
| | | type: 'indented', |
| | | direction: 'LR', |
| | | isHorizontal: true, |
| | | indent: 40, |
| | | getHeight: (d) => { |
| | | if (d.isRoot) { |
| | | return 30 |
| | | } |
| | | if (d.collapsed && d.children && d.children.length) { |
| | | return 36 |
| | | } |
| | | return 22 |
| | | }, |
| | | getVGap: () => { |
| | | return 10 |
| | | }, |
| | | }, |
| | | defaultEdge: { |
| | | type: 'indentedEdge', |
| | | style: { |
| | | lineWidth: 2, |
| | | radius: 16 |
| | | } |
| | | }, |
| | | minZoom: 0.5, |
| | | modes: { |
| | | default: [ |
| | | 'drag-canvas', |
| | | 'wheel-scroll', |
| | | 'hover-node', |
| | | 'click-node' |
| | | ] |
| | | } |
| | | }) |
| | | |
| | | tree.on('afterrender', e => { |
| | | tree.getEdges().forEach(edge => { |
| | | const targetNode = edge.getTarget().getModel() |
| | | const color = targetNode.branchColor |
| | | tree.updateItem(edge, { color }) |
| | | }) |
| | | setTimeout(() => { |
| | | tree.moveTo(32, 32) |
| | | tree.zoomTo(0.7) |
| | | }, 16) |
| | | }) |
| | | |
| | | tree.data(dataIndTransform(data)) |
| | | |
| | | tree.render() |
| | | setBottom = () => { |
| | | if (!this.selectNode) { |
| | | message.warning('请选择节点!') |
| | | return |
| | | } |
| | | // let cells = this.mkGraph.getCells() |
| | | this.selectNode.toBack() |
| | | } |
| | | |
| | | /** |
| | | * @description 散点图 |
| | | */ |
| | | ponitrender = () => { |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | | const width = this.wrap.scrollWidth - 30 |
| | | const height = getHeight(plot.height) |
| | | let modes = ['drag-canvas', 'zoom-canvas', 'dice-mindmap'] |
| | | // zoom() 可获取或者设置缩放比例 |
| | | setZoomIn = () => { |
| | | this.mkGraph.zoom(0.1) |
| | | } |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | modes = [{ type: 'collapse-expand' },'drag-canvas', 'zoom-canvas', 'dice-mindmap'] |
| | | } |
| | | setZoomOut = () => { |
| | | this.mkGraph.zoom(-0.1) |
| | | } |
| | | |
| | | const tree = new G6.TreeGraph({ |
| | | container: card.uuid + 'canvas', |
| | | width: width, |
| | | height: height, |
| | | fitView: true, |
| | | layout: { |
| | | type: 'mindmap', |
| | | direction: 'H', |
| | | getHeight: () => { |
| | | return 16 |
| | | }, |
| | | getWidth: (node) => { |
| | | return node.level === 0 ? |
| | | Util.getTextSize(node.label, 16)[0] + 12 : |
| | | Util.getTextSize(node.label, 12)[0] |
| | | }, |
| | | getVGap: () => { |
| | | return 10 |
| | | }, |
| | | getHGap: () => { |
| | | return 60 |
| | | }, |
| | | getSide: (node) => { |
| | | return node.data.direction |
| | | setZoomInt = () => { |
| | | this.mkGraph.zoomTo(1) |
| | | } |
| | | |
| | | save = () => { |
| | | // let nodes = this.mkGraph.toJSON() |
| | | } |
| | | |
| | | changeProps = (value, key) => { |
| | | const { node } = this.state |
| | | |
| | | if (node.shape === 'edge') { |
| | | if (key === 'title') { |
| | | this.selectNode.setLabels(value) |
| | | } else if (key === 'stroke') { |
| | | this.selectNode.attr('line/stroke', value) |
| | | } else if (key === 'strokeWidth') { |
| | | this.selectNode.attr('line/strokeWidth', value) |
| | | } else if (key === 'lineType') { |
| | | if (value === 'dash') { |
| | | this.selectNode.attr('line/strokeDasharray', 5) |
| | | } else { |
| | | this.selectNode.attr('line/strokeDasharray', 0) |
| | | } |
| | | }, |
| | | defaultEdge: { |
| | | type: 'cubic-horizontal', |
| | | style: { |
| | | lineWidth: 2 |
| | | } |
| | | }, |
| | | minZoom: 0.5, |
| | | modes: { |
| | | default: modes |
| | | } else if (key === 'fontSize') { |
| | | this.selectNode.attr('text/fontSize', value) |
| | | } else if (key === 'fontFill') { |
| | | this.selectNode.attr('text/fill', value) |
| | | } |
| | | }) |
| | | |
| | | tree.data(data) |
| | | |
| | | tree.render() |
| | | |
| | | if (plot.collapsed === 'true' && plot.dirField) { |
| | | tree.zoomTo(1, { x: width / 2, y: height / 2 }) |
| | | } else if (plot.collapsed === 'true') { |
| | | tree.zoomTo(1, { x: 0, y: height / 2 }) |
| | | } else { |
| | | if (key === 'title') { |
| | | this.selectNode.attr('text/text', value) |
| | | } else if (key === 'fill') { |
| | | this.selectNode.attr('body/fill', value) |
| | | } else if (key === 'stroke') { |
| | | this.selectNode.attr('body/stroke', value) |
| | | } else if (key === 'fontSize') { |
| | | this.selectNode.attr('text/fontSize', value) |
| | | } else if (key === 'fontFill') { |
| | | this.selectNode.attr('text/fill', value) |
| | | } |
| | | } |
| | | } |
| | | |
| | | updateComponent = (card) => { |
| | | if (this.state.card && (!is(fromJS(card.plot), fromJS(this.state.card.plot)) || !is(fromJS(card.style), fromJS(this.state.card.style)))) { |
| | | let _element = document.getElementById(card.uuid + 'canvas') |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.$timer && clearTimeout(this.$timer) |
| | | this.$timer = setTimeout(() => { |
| | | this.viewrender() |
| | | }, 150) |
| | | } |
| | | |
| | | card.width = card.plot.width |
| | | card.name = card.plot.name |
| | | card.subtype = card.plot.subtype |
| | |
| | | |
| | | if (card.errors.length === 0) { |
| | | card.$tables = getTables(card) |
| | | } |
| | | |
| | | if (!card.plot.valueField) { |
| | | card.errors.push({ level: 0, detail: '图表信息尚未设置!'}) |
| | | } else { |
| | | let columns = card.columns.map(c => c.field) |
| | | if (!columns.includes(card.plot.valueField)) { |
| | | card.errors.push({ level: 0, detail: '值字段在字段集中不存在'}) |
| | | } else if (!columns.includes(card.plot.labelField)) { |
| | | card.errors.push({ level: 0, detail: '文本字段在字段集中不存在'}) |
| | | } else if (!columns.includes(card.plot.parentField)) { |
| | | card.errors.push({ level: 0, detail: '上级字段在字段集中不存在'}) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.state |
| | | const { card, toolunfold, nodeunfold, node } = this.state |
| | | let _style = resetStyle(card.style) |
| | | |
| | | return ( |
| | | <div className="menu-scatter-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | | <div className="menu-x6-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <ChartCompileForm config={card} plotchange={this.updateComponent}/> |
| | | <CopyComponent type="antvG6" card={card}/> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> |
| | | <SettingComponent config={card} updateConfig={this.updateComponent}/> |
| | | </div> |
| | |
| | | <ToolOutlined/> |
| | | </Popover> |
| | | <NormalHeader config={card} updateComponent={this.updateComponent}/> |
| | | <div className="canvas" style={{minHeight: card.plot.height}} id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> |
| | | <div className="mk-toolbar"> |
| | | <div className="left-tool"> |
| | | <Tooltip title="置前"> |
| | | <VerticalAlignTopOutlined onClick={this.setTop}/> |
| | | </Tooltip> |
| | | <Tooltip title="置后"> |
| | | <VerticalAlignBottomOutlined onClick={this.setBottom}/> |
| | | </Tooltip> |
| | | <Tooltip title="保存"> |
| | | <SaveOutlined onClick={this.save}/> |
| | | </Tooltip> |
| | | </div> |
| | | <div className="right-tool"> |
| | | <Tooltip title="放大"> |
| | | <ZoomInOutlined onClick={this.setZoomIn}/> |
| | | </Tooltip> |
| | | <Tooltip title="缩小"> |
| | | <ZoomOutOutlined onClick={this.setZoomOut}/> |
| | | </Tooltip> |
| | | <Tooltip title="1:1"> |
| | | <OneToOneOutlined onClick={this.setZoomInt}/> |
| | | </Tooltip> |
| | | </div> |
| | | </div> |
| | | <div className="canvas" style={{width: '100%', minHeight: card.plot.height, height: card.plot.height}} id={card.uuid + 'canvas'}> |
| | | <div id={card.uuid + 'stencil'} className={'mk-stencil ' + (toolunfold ? '' : 'merge')}> |
| | | <div className="tool-control" onClick={() => this.setState({toolunfold: !toolunfold})}> |
| | | <DoubleLeftOutlined /> |
| | | </div> |
| | | </div> |
| | | <div id={card.uuid + 'container'} className="mk-container"></div> |
| | | <div className={'mk-node-edit ' + (nodeunfold ? '' : 'merge')}> |
| | | <div className="tool-control" onClick={() => this.setState({nodeunfold: !nodeunfold})}> |
| | | <DoubleLeftOutlined /> |
| | | </div> |
| | | <div className="header">设置</div> |
| | | {!node ? <div className="empty">未选中</div> : <NodeUpdate node={node} onChange={this.changeProps}/>} |
| | | </div> |
| | | </div> |
| | | <div className="component-name"> |
| | | <div className="center"> |
| | | <div className="title" onDoubleClick={() => { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = 'anchor' + card.uuid |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | message.success('复制成功。') |
| | | }}>{card.name}</div> |
| | | <div className="title">{card.name}</div> |
| | | <div className="content"> |
| | | {card.errors && card.errors.map((err, index) => { |
| | | if (err.level === 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | export default antvG6Chart |
| | | export default antvX6Chart |
| | |
| | | .menu-scatter-chart-edit-box { |
| | | .menu-x6-chart-edit-box { |
| | | position: relative; |
| | | box-sizing: border-box; |
| | | background: #ffffff; |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | |
| | | .mk-toolbar { |
| | | width: 100%; |
| | | height: 40px; |
| | | border: 1px solid #1890ff; |
| | | |
| | | .left-tool { |
| | | float: left; |
| | | line-height: 40px; |
| | | .anticon { |
| | | margin: 0 10px; |
| | | font-size: 16px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .right-tool { |
| | | float: right; |
| | | line-height: 40px; |
| | | .anticon { |
| | | margin: 0 10px; |
| | | font-size: 16px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | .x6-graph-scroller::-webkit-scrollbar { |
| | | display: none; |
| | | } |
| | | .x6-cell.x6-edge.x6-edge-selected path:nth-child(2) { |
| | | stroke: #1890ff; |
| | | } |
| | | |
| | | .canvas { |
| | | margin: 0px; |
| | | padding: 15px; |
| | | letter-spacing: 0px; |
| | | display: flex; |
| | | |
| | | .mk-stencil { |
| | | width: 180px; |
| | | min-width: 180px; |
| | | height: 100%; |
| | | position: relative; |
| | | z-index: 2; |
| | | border-right: 1px solid #dfe3e8; |
| | | transition: all 0.2s; |
| | | |
| | | .x6-widget-stencil-title { |
| | | display: none; |
| | | } |
| | | .x6-widget-stencil-content { |
| | | overflow-y: auto; |
| | | } |
| | | .x6-widget-stencil-content::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .x6-widget-stencil-content::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .x6-widget-stencil-content::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | .tool-control { |
| | | position: absolute; |
| | | right: -13px; |
| | | top: 5px; |
| | | z-index: 3; |
| | | background: #ffffff; |
| | | width: 25px; |
| | | height: 25px; |
| | | border: 1px solid #d8d8d8; |
| | | border-radius: 30px; |
| | | text-align: center; |
| | | line-height: 25px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .mk-stencil.merge { |
| | | width: 0px; |
| | | min-width: 0px; |
| | | |
| | | .tool-control { |
| | | right: -25px; |
| | | border-top-left-radius: 0px; |
| | | border-bottom-left-radius: 0px; |
| | | .anticon-double-left { |
| | | transform: rotate(180deg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mk-node-edit { |
| | | width: 180px; |
| | | min-width: 180px; |
| | | height: 100%; |
| | | position: relative; |
| | | z-index: 2; |
| | | border-left: 1px solid #dfe3e8; |
| | | transition: all 0.2s; |
| | | |
| | | .header { |
| | | width: 100%; |
| | | height: 32px; |
| | | text-align: center; |
| | | line-height: 32px; |
| | | background-color: #f5f5f5!important; |
| | | overflow-x: hidden; |
| | | white-space: nowrap; |
| | | } |
| | | .empty { |
| | | width: 100%; |
| | | text-align: center; |
| | | padding-top: 20px; |
| | | overflow-x: hidden; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .tool-control { |
| | | position: absolute; |
| | | left: -13px; |
| | | top: 5px; |
| | | z-index: 3; |
| | | background: #ffffff; |
| | | width: 25px; |
| | | height: 25px; |
| | | border: 1px solid #d8d8d8; |
| | | border-radius: 30px; |
| | | text-align: center; |
| | | line-height: 25px; |
| | | cursor: pointer; |
| | | .anticon-double-left { |
| | | transform: rotate(180deg); |
| | | } |
| | | } |
| | | } |
| | | .mk-node-edit.merge { |
| | | width: 0px; |
| | | min-width: 0px; |
| | | |
| | | .tool-control { |
| | | left: -25px; |
| | | border-top-right-radius: 0px; |
| | | border-bottom-right-radius: 0px; |
| | | .anticon-double-left { |
| | | transform: rotate(0deg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mk-container { |
| | | width: calc(100% - 180px); |
| | | height: 100%; |
| | | } |
| | | .x6-widget-stencil { |
| | | background-color: #fff; |
| | | } |
| | | .x6-widget-stencil-title { |
| | | background-color: #fff; |
| | | } |
| | | .x6-widget-stencil-group-title { |
| | | background-color: #f5f5f5!important; |
| | | } |
| | | .x6-widget-transform { |
| | | margin: -1px 0 0 -1px; |
| | | padding: 0px; |
| | | border: 1px solid #239edd; |
| | | } |
| | | .x6-widget-transform > div { |
| | | border: 1px solid #239edd; |
| | | } |
| | | .x6-widget-transform > div:hover { |
| | | background-color: #3dafe4; |
| | | } |
| | | .x6-widget-transform-active-handle { |
| | | background-color: #3dafe4; |
| | | } |
| | | .x6-widget-transform-resize { |
| | | border-radius: 0; |
| | | } |
| | | .x6-widget-selection-inner { |
| | | border: 1px solid #239edd; |
| | | } |
| | | .x6-widget-selection-box { |
| | | opacity: 0; |
| | | } |
| | | } |
| | | |
| | | .chart-header { |
| | |
| | | color: rgba(0, 0, 0, 0.85); |
| | | background: rgba(255, 255, 255, 0.55); |
| | | } |
| | | |
| | | .model-menu-action-list { |
| | | position: absolute; |
| | | right: 0px; |
| | | top: 30px; |
| | | z-index: 4; |
| | | font-size: 16px; |
| | | |
| | | .ant-row .anticon-plus { |
| | | float: right; |
| | | } |
| | | |
| | | .page-card { |
| | | float: right; |
| | | } |
| | | } |
| | | .normal-header + .canvas + .model-menu-action-list { |
| | | top: 45px; |
| | | } |
| | | } |
| | | .menu-scatter-chart-edit-box:hover { |
| | | .menu-x6-chart-edit-box:hover { |
| | | z-index: 1; |
| | | box-shadow: 0px 0px 4px #1890ff; |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, InputNumber } from 'antd' |
| | | |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | |
| | | import './index.scss' |
| | | |
| | | class NodeUpdate extends Component { |
| | | static propTpyes = { |
| | | node: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | | formlist: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.setState({ |
| | | formlist: this.getFormList(this.props.node) |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.node), fromJS(nextProps.node))) { |
| | | this.setState({ |
| | | formlist: null |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.getFormList(nextProps.node) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | getFormList = (node) => { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let title = '' |
| | | if (node.attrs && node.attrs.text) { |
| | | title = node.attrs.text.text || '' |
| | | } |
| | | |
| | | if (node.shape === 'edge') { |
| | | // let fontSize = 14 |
| | | // if (node.attrs && node.attrs.text) { |
| | | // fontSize = node.attrs.text.fontSize || 14 |
| | | // } |
| | | let stroke = '' |
| | | |
| | | if (node.attrs && node.attrs.line) { |
| | | stroke = node.attrs.line.stroke || '#A2B1C3' |
| | | } |
| | | |
| | | let strokeWidth = '' |
| | | |
| | | if (node.attrs && node.attrs.line) { |
| | | strokeWidth = node.attrs.line.strokeWidth || 2 |
| | | } |
| | | |
| | | let lineType = 'solid' |
| | | |
| | | if (node.attrs && node.attrs.line && node.attrs.line.strokeDasharray) { |
| | | lineType = 'dash' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'title', |
| | | label: '内容' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'title', |
| | | label: '标签', |
| | | initval: title |
| | | }, |
| | | { |
| | | type: 'title', |
| | | label: '样式' |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'stroke', |
| | | label: '颜色', |
| | | initval: stroke |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'strokeWidth', |
| | | label: '线宽', |
| | | initval: strokeWidth |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'lineType', |
| | | label: '线型', |
| | | initval: lineType, |
| | | options: [ |
| | | {value: 'solid', text: '实线'}, |
| | | {value: 'dash', text: '虚线'} |
| | | ] |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'fontSize', |
| | | // label: '字号', |
| | | // initval: fontSize |
| | | // }, |
| | | // { |
| | | // type: 'color', |
| | | // field: 'fontFill', |
| | | // label: '颜色', |
| | | // initval: fontFill |
| | | // } |
| | | ] |
| | | } else { |
| | | let fontFill = '#262626' |
| | | if (node.attrs && node.attrs.text) { |
| | | fontFill = node.attrs.text.fill || '#262626' |
| | | } |
| | | |
| | | let fill = '' |
| | | |
| | | if (node.attrs && node.attrs.body) { |
| | | fill = node.attrs.body.fill || '' |
| | | } |
| | | let fontSize = 12 |
| | | if (node.attrs && node.attrs.text) { |
| | | fontSize = node.attrs.text.fontSize || 12 |
| | | } |
| | | let stroke = '' |
| | | |
| | | if (node.attrs && node.attrs.body) { |
| | | stroke = node.attrs.body.stroke || '' |
| | | } |
| | | return [ |
| | | { |
| | | type: 'title', |
| | | label: '内容' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'title', |
| | | label: '标签', |
| | | initval: title |
| | | }, |
| | | { |
| | | type: 'title', |
| | | label: '样式' |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'fill', |
| | | label: '背景', |
| | | initval: fill |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'stroke', |
| | | label: '边框', |
| | | initval: stroke |
| | | }, |
| | | { |
| | | type: 'title', |
| | | label: '标签样式' |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'fontSize', |
| | | label: '字号', |
| | | initval: fontSize |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'fontFill', |
| | | label: '颜色', |
| | | initval: fontFill |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | |
| | | change = (value, key) => { |
| | | if (key === 'fontSize') { |
| | | if (typeof(value) !== 'number' || value < 0) { |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.props.onChange(value, key) |
| | | } |
| | | |
| | | getFields() { |
| | | const { formlist } = this.state |
| | | const fields = [] |
| | | |
| | | if (!formlist) return |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if (item.type === 'title') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <span className="split-line">{item.label}</span> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'text') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Input defaultValue={item.initval} placeholder="" autoComplete="off" onChange={(e) => this.change(e.target.value, item.field)} /> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'number') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <InputNumber defaultValue={item.initval} precision={0} min={0} onChange={(value) => this.change(value, item.field)} /> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Select |
| | | showSearch |
| | | defaultValue={item.initval} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.change(value, item.field)}} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option key={option.value} value={option.value}> |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Radio.Group defaultValue={item.initval} style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.change(e.target.value, item.field)}}> |
| | | {item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | })} |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'color') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <ColorSketch defaultValue={item.initval} onChange={(value) => this.change(value, item.field)}/> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | render() { |
| | | return ( |
| | | <Form className="node-edit-form"> |
| | | <Row>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default NodeUpdate |
New file |
| | |
| | | .node-edit-form { |
| | | padding-top: 10px; |
| | | .split-line { |
| | | display: block; |
| | | border-bottom: 1px solid #d9d9d9; |
| | | margin: 5px 12px 10px; |
| | | padding-bottom: 2px; |
| | | font-size: 13px; |
| | | } |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | |
| | | .ant-form-item-label { |
| | | width: 40px; |
| | | line-height: 24px; |
| | | label { |
| | | color: rgba(0,0,0,0.45); |
| | | font-size: 13px; |
| | | } |
| | | label::after { |
| | | display: none; |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | padding: 0 8px; |
| | | flex: 1; |
| | | .ant-form-item-control { |
| | | line-height: 24px; |
| | | } |
| | | .ant-input { |
| | | height: 24px; |
| | | padding: 0px 4px; |
| | | font-size: 13px; |
| | | line-height: 24px; |
| | | border-radius: 0px; |
| | | } |
| | | .ant-input-number { |
| | | height: 24px; |
| | | border-radius: 0px; |
| | | .ant-input-number-input { |
| | | height: 22px; |
| | | padding: 2px 4px; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | .ant-radio-wrapper { |
| | | margin-right: 0px; |
| | | } |
| | | |
| | | .color-sketch-block { |
| | | height: 22px; |
| | | margin-top: 2px; |
| | | .color-sketch-block-box { |
| | | width: 22px; |
| | | height: 22px; |
| | | } |
| | | .color-sketch-value { |
| | | display: none; |
| | | } |
| | | .color-sketch-block-inner { |
| | | border-radius: 0px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | label: '数据源', |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces |
| | | options: interfaces, |
| | | reset_source: true, |
| | | callback: (map, record) => { |
| | | if (!record.publicId) return |
| | | |
| | | let interfaces = window.GLOB.customMenu.interfaces || [] |
| | | |
| | | let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0] |
| | | |
| | | if (!d || !d.columns) return |
| | | |
| | | let columns = JSON.parse(JSON.stringify(d.columns)) |
| | | |
| | | let _field = map.get('field') |
| | | |
| | | if (_field) { |
| | | _field.options = columns |
| | | _field.oriOptions = columns |
| | | map.set('field', _field) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'field', |
| | | label: '文本字段', |
| | | initval: wrap.field || '', |
| | | tooltip: '选择动态值时,需设置文本字段才可生效,使用公共数据源时,需先保存数据源后再选取文本字段。', |
| | | required: false, |
| | | options: columns |
| | | }, |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | } |
| | | |
| | | state = { |
| | | formlist: null, // 表单信息 |
| | | interType: null, // 接口类型:内部、外部 |
| | | procMode: null, // 参数方式 |
| | | linkmenu: null, |
| | | callbackType: null |
| | | formlist: null |
| | | } |
| | | |
| | | record = {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card } = this.props |
| | | this.props.formlist.forEach(item => { |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _intertype = card.intertype || 'system' // 接口类型 |
| | | let _procMode = card.procMode || 'system' // 参数请求方式 |
| | | let _callbackType = card.callbackType || 'script' |
| | | |
| | | let _options = this.getOptions(_intertype, _procMode, card.linkmenu, _callbackType) |
| | | let { shows, reRequired, reReadonly } = this.getMutilOptions() |
| | | |
| | | this.setState({ |
| | | interType: _intertype, |
| | | procMode: _procMode, |
| | | callbackType: _callbackType, |
| | | linkmenu: card.linkmenu, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'innerFunc' && _procMode === 'inner') { |
| | | item.required = true |
| | | item.hidden = !shows.includes(item.key) |
| | | item.initVal = this.record[item.key] |
| | | |
| | | if (reRequired[item.key] !== undefined) { |
| | | item.required = reRequired[item.key] |
| | | } |
| | | if (reReadonly[item.key] !== undefined) { |
| | | item.readonly = reReadonly[item.key] |
| | | } |
| | | |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getOptions = (_intertype, _procMode, linkmenu, _callbackType) => { |
| | | const { card } = this.props |
| | | getMutilOptions = () => { |
| | | let shows = [] |
| | | let reRequired = {} |
| | | let reReadonly = {} |
| | | |
| | | if (card.type === 'prev') { |
| | | return ['type', 'label', 'enable', 'actionType'] |
| | | } else if (card.type === 'next') { |
| | | return ['type', 'label', 'enable', 'actionType'] |
| | | } else if (card.type === 'close') { |
| | | return ['type', 'label', 'enable'] |
| | | } |
| | | |
| | | let _options = ['type', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'enable', 'output', 'reload'] // 选项列表 |
| | | |
| | | if (_intertype === 'custom') { |
| | | _options.pop() |
| | | _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') |
| | | if (_procMode === 'system') { |
| | | _options.push('sql', 'sqlType') |
| | | } else { |
| | | _options.push('innerFunc') |
| | | } |
| | | if (_callbackType === 'func') { |
| | | _options.push('callbackFunc') |
| | | } else if (_callbackType !== 'none') { |
| | | _options.push('cbTable') |
| | | } |
| | | } else if (_intertype === 'outer') { |
| | | _options.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType') |
| | | if (_procMode === 'system') { |
| | | _options.push('sql', 'sqlType') |
| | | } else if (_procMode === 'inner') { |
| | | _options.push('innerFunc') |
| | | } |
| | | if (_callbackType === 'func') { |
| | | _options.push('callbackFunc') |
| | | } else if (_callbackType !== 'none') { |
| | | _options.push('cbTable') |
| | | } |
| | | |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('innerFunc') |
| | | if (this.record.type === 'prev') { |
| | | shows = ['type', 'label', 'enable', 'actionType'] |
| | | } else if (this.record.type === 'next') { |
| | | shows = ['type', 'label', 'enable', 'actionType'] |
| | | } else if (this.record.type === 'close') { |
| | | shows = ['type', 'label', 'enable'] |
| | | } else { |
| | | _options.push('sql', 'sqlType') |
| | | } |
| | | |
| | | if (linkmenu && linkmenu !== 'goback') { |
| | | _options.push('open') |
| | | shows = ['type', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'enable', 'output', 'reload'] // 选项列表 |
| | | |
| | | if (this.record.intertype === 'custom') { |
| | | shows.pop() |
| | | shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') |
| | | if (this.record.procMode === 'system') { |
| | | shows.push('sql', 'sqlType') |
| | | } else if (this.record.procMode === 'inner') { |
| | | shows.push('innerFunc') |
| | | } |
| | | if (this.record.callbackType === 'func') { |
| | | shows.push('callbackFunc') |
| | | } else if (this.record.callbackType !== 'none') { |
| | | shows.push('cbTable') |
| | | } |
| | | } else if (this.record.intertype === 'outer') { |
| | | shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType') |
| | | if (this.record.procMode === 'system') { |
| | | shows.push('sql', 'sqlType') |
| | | } else if (this.record.procMode === 'inner') { |
| | | shows.push('innerFunc') |
| | | } |
| | | if (this.record.callbackType === 'func') { |
| | | shows.push('callbackFunc') |
| | | } else if (this.record.callbackType !== 'none') { |
| | | shows.push('cbTable') |
| | | } |
| | | |
| | | reRequired.outerFunc = false |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | | reRequired.interface = true |
| | | |
| | | shows.push('proInterface') |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | } |
| | | } else if (this.record.intertype === 'inner') { |
| | | shows.push('innerFunc') |
| | | } else { |
| | | shows.push('sql', 'sqlType') |
| | | } |
| | | |
| | | if (this.record.linkmenu && this.record.linkmenu !== 'goback') { |
| | | shows.push('open') |
| | | } |
| | | } |
| | | |
| | | return _options |
| | | return { |
| | | shows, |
| | | reRequired, |
| | | reReadonly |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * 3、切换标签类型,重置可选标签 |
| | | */ |
| | | optionChange = (key, value) => { |
| | | const { procMode, linkmenu, callbackType } = this.state |
| | | this.record[key] = value |
| | | let _fieldval = {} |
| | | |
| | | if (key === 'intertype') { |
| | | let _options = this.getOptions(value, procMode, linkmenu, callbackType) |
| | | |
| | | 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 === 'procMode') { |
| | | let _options = this.getOptions(this.state.interType, value, linkmenu, callbackType) |
| | | |
| | | this.setState({ |
| | | procMode: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'procMode') { |
| | | item.initVal = value |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'linkmenu') { |
| | | let _options = this.getOptions(this.state.interType, procMode, value, callbackType) |
| | | |
| | | this.setState({ |
| | | linkmenu: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'callbackType') { |
| | | let _options = this.getOptions(this.state.interType, procMode, linkmenu, value) |
| | | |
| | | this.setState({ |
| | | callbackType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'callbackType') { |
| | | item.initVal = value |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'sysInterface') { |
| | | if (key === 'sysInterface') { |
| | | if (value === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | | interface: window.GLOB.mainSystemApi || '' |
| | | }) |
| | | _fieldval.interface = window.GLOB.mainSystemApi || '' |
| | | this.record.interface = window.GLOB.mainSystemApi || '' |
| | | } |
| | | this.setState({ |
| | | 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 |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | let { shows, reRequired, reReadonly } = this.getMutilOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !shows.includes(item.key) |
| | | item.initVal = this.record[item.key] |
| | | |
| | | if (reRequired[item.key] !== undefined) { |
| | | item.required = reRequired[item.key] |
| | | } |
| | | if (reReadonly[item.key] !== undefined) { |
| | | item.readonly = reReadonly[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.props.form.setFieldsValue(_fieldval) |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = (e) => { |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/> |
| | | <Cascader onChange={(value) => {this.optionChange(item.key, value)}} options={item.options || []} expandTrigger="hover" placeholder=""/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | label: '系统类型', |
| | | initVal: card.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | tooltip: '业务系统指同一sso下的其他业务系统', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | text: '单点' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | text: '业务' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | initVal: card.proInterface || '', |
| | | tooltip: '正式系统所使用的接口地址。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Ot', |
| | | label: '行设置', |
| | | initVal: card.Ot, |
| | |
| | | field: 'height', |
| | | label: '高度', |
| | | initval: wrap.height || '', |
| | | tooltip: 'ifram高度。', |
| | | tooltip: 'ifram高度。注:高度100vh时会根据标签页窗口进行调整', |
| | | required: true, |
| | | options: ['px', 'vh', 'vw'] |
| | | }, |
| | |
| | | field: 'linkUrl', |
| | | label: '地址链接', |
| | | initval: wrap.linkUrl || '', |
| | | tooltip: '地址中的@userid@与@loginuid@会自动替换为当前系统的登录信息。', |
| | | required: true, |
| | | span: 24 |
| | | }, |
| | |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .check-card-edit-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .ant-form-item::after { |
| | |
| | | const { TextArea } = Input |
| | | const { Paragraph } = Typography |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) |
| | | const acTyOptions = { |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], |
| | |
| | | |
| | | let hasclass = true |
| | | this.props.formlist.forEach(item => { |
| | | if (!item.key) return |
| | | |
| | | this.record[item.key] = item.initVal |
| | | |
| | | if (item.key === 'class') { |
| | |
| | | reOptions.intertype = this.state.interTypeOptions |
| | | |
| | | if (intertype === 'custom') { |
| | | shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') |
| | | shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') |
| | | if (this.record.procMode === 'system') { |
| | | shows.push('sql', 'sqlType') |
| | | } else if (this.record.procMode === 'inner') { |
| | |
| | | shows.push('cbTable') |
| | | } |
| | | |
| | | reRequired.outerFunc = false |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | | reRequired.interface = true |
| | |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | |
| | | shows.push('interface') |
| | | } else if (this.record.sysInterface === 'external') { |
| | |
| | | |
| | | if (this.record.formType === 'switch') { |
| | | shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else if (this.record.formType === 'counter') { |
| | | } else if (this.record.formType === 'counter' || this.record.formType === 'count_line') { |
| | | shows.push('field', 'size', 'min', 'max', 'decimal') |
| | | } else if (this.record.formType === 'radio') { |
| | | shows.push('field', 'checkType', 'openVal', 'closeVal') |
| | |
| | | shows.push('cbTable') |
| | | } |
| | | |
| | | reRequired.outerFunc = false |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | | reRequired.interface = true |
| | |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | |
| | | shows.push('interface') |
| | | } else if (this.record.sysInterface === 'external') { |
| | |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | |
| | | if (this.record.formType === 'count_line') { |
| | | reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) |
| | | shows = shows.filter(op => ['label', 'OpenType', 'formType', 'Ot', 'width', 'title', 'hidden', 'field', 'size', 'min', 'max', 'decimal'].includes(op)) |
| | | } |
| | | } else if (openType === 'excelIn') { |
| | | reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) |
| | |
| | | shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc') |
| | | reRequired.innerFunc = false |
| | | reRequired.callbackFunc = false |
| | | reRequired.outerFunc = false |
| | | |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | |
| | | shows.push('interface') |
| | | } else if (this.record.sysInterface === 'external') { |
| | |
| | | if (this.record.intertype === 'outer') { |
| | | shows.push('innerFunc', 'sysInterface', 'outerFunc') |
| | | reRequired.innerFunc = false |
| | | reRequired.outerFunc = false |
| | | |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | |
| | | shows.push('interface') |
| | | } else if (this.record.sysInterface === 'external') { |
| | |
| | | shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc') |
| | | reRequired.innerFunc = false |
| | | reRequired.callbackFunc = false |
| | | reRequired.outerFunc = false |
| | | |
| | | if (this.record.sysInterface === 'false') { |
| | | reReadonly.interface = false |
| | |
| | | } else if (this.record.sysInterface === 'true') { |
| | | reReadonly.interface = true |
| | | reRequired.interface = false |
| | | reRequired.outerFunc = true |
| | | |
| | | shows.push('interface') |
| | | } else if (this.record.sysInterface === 'external') { |
| | |
| | | } |
| | | } |
| | | |
| | | if (shows.includes('syncComponent') && this.record.syncComponent[0] === 'multiComponent') { |
| | | shows.push('syncComponents') |
| | | } |
| | | |
| | | if (this.record.show === 'icon') { |
| | | reRequired.icon = true |
| | | } else { |
| | |
| | | } |
| | | |
| | | this.props.updRecord && this.props.updRecord(this.record) |
| | | } else if (key === 'formType') { |
| | | if (value === 'count_line') { |
| | | _fieldval.Ot = 'requiredSgl' |
| | | this.record.Ot = 'requiredSgl' |
| | | } |
| | | } else if (key === 'funcType') { |
| | | if (value === 'print') { |
| | | _fieldval.label = '打印' |
| | |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/> |
| | | content = <Cascader onChange={(value) => {this.optionChange(item.key, value)}} options={item.options || []} expandTrigger="hover" placeholder=""/> |
| | | } else if (item.type === 'table') { |
| | | span = 24 |
| | | className = 'textarea' |
| | | rules = [ |
| | | { required: item.required, message: '请添加' + item.label + '!' } |
| | | ] |
| | | content = (<MKTable tip={''} columns={item.columns || []} actions={[]}/>) |
| | | } else if (item.type === 'icon') { |
| | | rules = [ |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | |
| | | ) |
| | | } |
| | | |
| | | let updateTime = null |
| | | if (card.updateTime && card.updateTime.indexOf(window.GLOB.curDate) > -1) { |
| | | updateTime = card.updateTime.substr(11) |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | |
| | | <CloseOutlined className="close" onClick={() => delCard(id)} /> |
| | | {type !== 'datacard' && type !== 'basetable' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => changeStyle(id)}/> : ''} |
| | | {hasProfile ? <ProfileOutlined className="profile" title="验证" onClick={() => profileCard(id)} /> : null} |
| | | {updateTime} |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: formTypes.length ? 'select' : 'radio', |
| | | key: 'formType', |
| | | label: '表单类型', |
| | | initVal: card.formType || 'switch', |
| | |
| | | }, { |
| | | value: 'counter', |
| | | text: '计数器' |
| | | }, { |
| | | value: 'count_line', |
| | | text: '计数器(本地)' |
| | | }, |
| | | ...formTypes] |
| | | }, |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | label: '回调函数', |
| | | initVal: card.callbackFunc || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | initVal: card.syncComponent || [], |
| | | tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。', |
| | | required: false, |
| | | options: modules |
| | | options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'syncComponents', |
| | | label: '组件列表', |
| | | initVal: card.syncComponents || [], |
| | | required: true, |
| | | actions: [], |
| | | columns: [ |
| | | { |
| | | title: '组件', |
| | | dataIndex: 'syncComId', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | required: true, |
| | | extends: [{key: 'label', value: 'label'}], |
| | | width: '70%', |
| | | render: (text, record) => record.label, |
| | | options: modules |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | label: '回调函数', |
| | | initVal: card.callbackFunc || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | initVal: card.syncComponent || [], |
| | | tooltip: '执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“刷新上级组件 - 行”。', |
| | | required: false, |
| | | options: modules |
| | | options: modules.length ? [...modules, {value: 'multiComponent', label: '多组件'}] : [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'syncComponents', |
| | | label: '组件列表', |
| | | initVal: card.syncComponents || [], |
| | | required: true, |
| | | actions: [], |
| | | columns: [ |
| | | { |
| | | title: '组件', |
| | | dataIndex: 'syncComId', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | required: true, |
| | | extends: [{key: 'label', value: 'label'}], |
| | | width: '70%', |
| | | render: (text, record) => record.label, |
| | | options: modules |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification, Button } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Utils, { FuncUtils } from '@/utils/utils.js' |
| | | import { getActionForm, getBaseTableActionForm } from './formconfig' |
| | |
| | | btn.style = {} |
| | | } |
| | | } |
| | | |
| | | btn.updateTime = moment().format('YYYY-MM-DD HH:mm') |
| | | return btn |
| | | } else { |
| | | return item |
| | |
| | | _actionlist = _actionlist.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | item.updateTime = moment().format('YYYY-MM-DD HH:mm') |
| | | } |
| | | |
| | | return item |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, moveCol, addElement, dropCol, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | const { connectDragSource, connectDropTarget, moveCol, componentId, addElement, dropCol, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | |
| | | if (index !== undefined && column) { |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | if (!column) return ( |
| | | <th {...restProps}>{children}</th> |
| | | ) |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } else if (column) { |
| | | let style = {textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th> |
| | | ) |
| | | } else { |
| | | return (<th {...restProps}>{children}</th>) |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } |
| | | } |
| | | |
| | |
| | | const ColTarget = { |
| | | drop(props, monitor) { |
| | | const item = monitor.getItem() |
| | | const dragIndex = item.index |
| | | const hoverIndex = props.index |
| | | let dragIndex = item.index |
| | | let hoverIndex = props.index |
| | | |
| | | if (item.$init) { |
| | | props.dropCol(item, hoverIndex) |
| | | if (/sub_/.test(hoverIndex)) { |
| | | message.warning('合并列子元素暂不支持拖拽添加。') |
| | | } else { |
| | | props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) |
| | | } |
| | | return |
| | | } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { |
| | | return |
| | | } else { |
| | | let reg = new RegExp(props.componentId + '@', 'ig') |
| | | if (reg.test(dragIndex)) { |
| | | props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) |
| | | } else { |
| | | message.warning('拖动元素不在当前组件中。') |
| | | return |
| | | } |
| | | } |
| | | |
| | | props.moveCol(dragIndex, hoverIndex) |
| | | monitor.getItem().index = hoverIndex |
| | | }, |
| | | } |
| | |
| | | moveCol = (dragIndex, hoverIndex) => { |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { |
| | | let sign1 = dragIndex.split('_') |
| | | let sign2 = hoverIndex.split('_') |
| | | if (sign1[1] !== sign2[1]) { |
| | | message.warning('拖动元素不在同一个合并列中。') |
| | | return |
| | | } |
| | | this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) |
| | | } else { |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }, () => { |
| | | this.props.updatecolumn({...this.props.config, cols: _columns}) |
| | | }) |
| | | } |
| | | |
| | | loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { |
| | | columns.forEach(column => { |
| | | if (column.type === 'colspan' && column.uuid === colId) { |
| | | column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) |
| | | } else if (column.type === 'colspan') { |
| | | this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | document.body.removeChild(oInput) |
| | | } |
| | | |
| | | handlecolumns = (columns, fields, config, isSub) => { |
| | | handlecolumns = (columns, fields, config, pId) => { |
| | | return columns.map((col, index) => { |
| | | return { |
| | | title: col.label, |
| | |
| | | upComponent: this.updateCol |
| | | }), |
| | | onHeaderCell: () => ({ |
| | | index: isSub ? undefined : index, |
| | | index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, |
| | | column: col, |
| | | componentId: config.uuid, |
| | | fields: fields, |
| | | align: col.Align, |
| | | moveCol: this.moveCol, |
| | |
| | | changeStyle: this.changeStyle, |
| | | deleteCol: this.deleteCol, |
| | | }), |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, |
| | | } |
| | | }) |
| | | } |
| | |
| | | let n = [] |
| | | |
| | | config.columns.forEach(col => { |
| | | m.push(`${col.field}(${col.label})`) |
| | | m.push(`${col.field} ${col.datatype}`) |
| | | n.push(col.field) |
| | | }) |
| | | |
| | |
| | | label: '无动作' |
| | | } |
| | | ] |
| | | columns.forEach(col => { |
| | | if (col.editable === 'true' && col.uuid !== card.uuid) { |
| | | editCols.push({ |
| | | field: col.uuid, |
| | | label: col.label |
| | | }) |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols.forEach(subcol => { |
| | | if (subcol.editable === 'true' && subcol.uuid !== card.uuid) { |
| | | editCols.push({ |
| | | field: subcol.uuid, |
| | | label: col.label + '-' + subcol.label |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let cols = [] |
| | | let getcols = (columns, suplabel = '') => { |
| | | columns.forEach(col => { |
| | | if (col.editable === 'true' && col.uuid !== card.uuid) { |
| | | cols.push({ |
| | | field: col.uuid, |
| | | label: suplabel + col.label |
| | | }) |
| | | } else if (col.type === 'colspan') { |
| | | getcols(col.subcols, col.label + '-') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getcols(columns) |
| | | |
| | | editCols.push(...cols) |
| | | |
| | | cols.forEach(col => { |
| | | editCols.push({ |
| | | field: '$next_' + col.field, |
| | | label: col.label + '(下一行)' |
| | | }) |
| | | }) |
| | | |
| | | return [ |
| | |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。', |
| | | required: true, |
| | | }, |
| | | { |
| | |
| | | className = 'text-area' |
| | | |
| | | extra = <span className="add-resource-empty" onClick={this.handleEmpty}>空</span> |
| | | if (item.placeholder) { |
| | | extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> |
| | | } |
| | | |
| | | content = <CodeMirror /> |
| | | } else if (item.type === 'options') { |
| | |
| | | cursor: pointer; |
| | | font-size: 14px; |
| | | } |
| | | .resource-public-var { |
| | | position: absolute; |
| | | left: 0px; |
| | | top: -25px; |
| | | font-size: 14px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | const { connectDragSource, connectDropTarget, moveCol, componentId, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | |
| | | if (!column) return ( |
| | | <th {...restProps} index={index}> |
| | | {children} |
| | | </th> |
| | | <th {...restProps}>{children}</th> |
| | | ) |
| | | |
| | | if (index !== undefined) { |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } else if (column) { |
| | | let style = {textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th> |
| | | ) |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } |
| | | } |
| | | |
| | |
| | | const ColTarget = { |
| | | drop(props, monitor) { |
| | | const item = monitor.getItem() |
| | | const dragIndex = item.index |
| | | const hoverIndex = props.index |
| | | let dragIndex = item.index |
| | | let hoverIndex = props.index |
| | | |
| | | if (item.$init) { |
| | | props.dropCol(item, hoverIndex) |
| | | if (/sub_/.test(hoverIndex)) { |
| | | message.warning('合并列子元素暂不支持拖拽添加。') |
| | | } else { |
| | | props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) |
| | | } |
| | | return |
| | | } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { |
| | | return |
| | | } else { |
| | | let reg = new RegExp(props.componentId + '@', 'ig') |
| | | if (reg.test(dragIndex)) { |
| | | props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) |
| | | } else { |
| | | message.warning('拖动元素不在当前组件中。') |
| | | return |
| | | } |
| | | } |
| | | |
| | | props.moveCol(dragIndex, hoverIndex) |
| | | |
| | | monitor.getItem().index = hoverIndex |
| | | }, |
| | | } |
| | |
| | | moveCol = (dragIndex, hoverIndex) => { |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { |
| | | let sign1 = dragIndex.split('_') |
| | | let sign2 = hoverIndex.split('_') |
| | | if (sign1[1] !== sign2[1]) { |
| | | message.warning('拖动元素不在同一个合并列中。') |
| | | return |
| | | } |
| | | this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) |
| | | } else { |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }, () => { |
| | | this.props.updatecolumn({...this.props.config, cols: _columns}) |
| | | }) |
| | | } |
| | | |
| | | loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { |
| | | columns.forEach(column => { |
| | | if (column.type === 'colspan' && column.uuid === colId) { |
| | | column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) |
| | | } else if (column.type === 'colspan') { |
| | | this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | handlecolumns = (columns, fields, config, isSub) => { |
| | | handlecolumns = (columns, fields, config, pId) => { |
| | | return columns.map((col, index) => { |
| | | let title = col.label |
| | | if (col.editable === 'true') { |
| | |
| | | upComponent: this.updateCol |
| | | }), |
| | | onHeaderCell: () => ({ |
| | | index: isSub ? undefined : index, |
| | | index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, |
| | | column: col, |
| | | componentId: config.uuid, |
| | | fields: fields, |
| | | align: col.Align, |
| | | moveCol: this.moveCol, |
| | |
| | | changeStyle: this.changeStyle, |
| | | deleteCol: this.deleteCol, |
| | | }), |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, |
| | | } |
| | | }) |
| | | } |
| | |
| | | destroyOnClose |
| | | > |
| | | <TableVerify |
| | | card={config.submit} |
| | | setting={config.setting} |
| | | cols={config.cols} |
| | | columns={config.columns} |
| | | config={config} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' |
| | | import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' |
| | | import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import UniqueForm from './uniqueform' |
| | | import CustomScript from './customscript' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | state = { |
| | | verify: {}, |
| | | fields: [], |
| | | modules: [], |
| | | fieldLabel: {}, |
| | | systemScripts: [], |
| | | activeKey: 'basemsg', |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns, card, setting } = this.props |
| | | let _verify = fromJS(card).toJS() |
| | | const { columns, submit, setting, uuid } = this.props.config |
| | | let _verify = fromJS(submit).toJS() |
| | | _verify.sheet = _verify.sheet || setting.tableName |
| | | |
| | | let fieldLabel = {} |
| | | // let _columns = [] |
| | | // let _fields = {} |
| | | |
| | | columns.forEach(col => { |
| | | fieldLabel[col.field] = col.label |
| | | // _fields[col.field] = col |
| | | }) |
| | | // cols.forEach(col => { |
| | | // if (!col.field || col.type === 'index' || !_fields[col.field]) return |
| | | |
| | | // _columns.push(_fields[col.field]) |
| | | // }) |
| | | |
| | | let supId = '' |
| | | if (setting && setting.supModule) { |
| | | let pid = setting.supModule[setting.supModule.length - 1] |
| | | if (pid && pid !== 'empty') { |
| | | supId = pid |
| | | } else { |
| | | supId = '' |
| | | } |
| | | } |
| | | |
| | | let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, uuid, supId) |
| | | |
| | | this.setState({ |
| | | fields: fromJS(columns).toJS().filter(item => item.field !== setting.primaryKey), |
| | | fieldLabel, |
| | | modules: modules, |
| | | verify: _verify |
| | | }, () => { |
| | | this.resetUniqueColumns() |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { verify, scriptsColumns, uniqueColumns, activeKey, fields } = this.state |
| | | const { verify, scriptsColumns, uniqueColumns, activeKey, fields, modules } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="执行成功后(或弹窗标签关闭时),需要同步刷新的组件。注:选择当前组件的上级组件无效,刷新上级组件请选择成功后“上级(行)”。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 刷新组件 |
| | | </Tooltip> |
| | | }> |
| | | <Cascader options={modules} value={verify.syncComponent || []} expandTrigger="hover" allowClear placeholder="" onChange={(val) => this.onOptionChange(val, 'syncComponent')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | const { connectDragSource, connectDropTarget, moveCol, componentId, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | |
| | | if (index !== undefined && column) { |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | if (!column) return ( |
| | | <th {...restProps}>{children}</th> |
| | | ) |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } else if (column) { |
| | | let style = {textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th> |
| | | ) |
| | | } else { |
| | | return (<th {...restProps}>{children}</th>) |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | | </Popover> |
| | | </th>), |
| | | ) |
| | | } |
| | | } |
| | | |
| | |
| | | const ColTarget = { |
| | | drop(props, monitor) { |
| | | const item = monitor.getItem() |
| | | const dragIndex = item.index |
| | | const hoverIndex = props.index |
| | | let dragIndex = item.index |
| | | let hoverIndex = props.index |
| | | |
| | | if (item.$init) { |
| | | props.dropCol(item, hoverIndex) |
| | | if (/sub_/.test(hoverIndex)) { |
| | | message.warning('合并列子元素暂不支持拖拽添加。') |
| | | } else { |
| | | props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) |
| | | } |
| | | return |
| | | } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { |
| | | return |
| | | } else { |
| | | let reg = new RegExp(props.componentId + '@', 'ig') |
| | | if (reg.test(dragIndex)) { |
| | | props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) |
| | | } else { |
| | | message.warning('拖动元素不在当前组件中。') |
| | | return |
| | | } |
| | | } |
| | | |
| | | props.moveCol(dragIndex, hoverIndex) |
| | | monitor.getItem().index = hoverIndex |
| | | }, |
| | | } |
| | |
| | | moveCol = (dragIndex, hoverIndex) => { |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { |
| | | let sign1 = dragIndex.split('_') |
| | | let sign2 = hoverIndex.split('_') |
| | | if (sign1[1] !== sign2[1]) { |
| | | message.warning('拖动元素不在同一个合并列中。') |
| | | return |
| | | } |
| | | this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) |
| | | } else { |
| | | _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }, () => { |
| | | this.props.updatecolumn({...this.props.config, cols: _columns}) |
| | | }) |
| | | } |
| | | |
| | | loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { |
| | | columns.forEach(column => { |
| | | if (column.type === 'colspan' && column.uuid === colId) { |
| | | column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) |
| | | } else if (column.type === 'colspan') { |
| | | this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | document.body.removeChild(oInput) |
| | | } |
| | | |
| | | handlecolumns = (columns, fields, config, isSub) => { |
| | | handlecolumns = (columns, fields, config, pId) => { |
| | | return columns.map((col, index) => { |
| | | return { |
| | | title: col.label, |
| | |
| | | upComponent: this.updateCol |
| | | }), |
| | | onHeaderCell: () => ({ |
| | | index: isSub ? undefined : index, |
| | | index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, |
| | | column: col, |
| | | componentId: config.uuid, |
| | | fields: fields, |
| | | align: col.Align, |
| | | moveCol: this.moveCol, |
| | |
| | | changeStyle: this.changeStyle, |
| | | deleteCol: this.deleteCol, |
| | | }), |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, |
| | | children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, |
| | | } |
| | | }) |
| | | } |
| | |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | strict: true, |
| | | copy: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | |
| | | let n = [] |
| | | |
| | | columns.forEach(col => { |
| | | m.push(`${col.field}(${col.label})`) |
| | | m.push(`${col.field} ${col.datatype}`) |
| | | n.push(col.field) |
| | | }) |
| | | |
| | |
| | | let n = [] |
| | | |
| | | subColumns.forEach(col => { |
| | | m.push(`${col.field}(${col.label})`) |
| | | m.push(`${col.field} ${col.datatype}`) |
| | | n.push(col.field) |
| | | }) |
| | | |
| | |
| | | const Account = asyncComponent(() => import('@/menu/components/module/account')) |
| | | const Iframe = asyncComponent(() => import('@/menu/components/iframe')) |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | const AntvX6 = asyncComponent(() => import('@/menu/components/chart/antv-X6')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | return (<Iframe card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'antvG6') { |
| | | return (<AntvG6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'antvX6') { |
| | | return (<AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'module' && card.subtype === 'voucher') { |
| | | return (<Voucher card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'module' && card.subtype === 'account') { |
| | | return (<Account card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } |
| | | } |
| | | |
| | | // if (card.type === 'antvX6') { // 测试 |
| | | // return ( |
| | | // <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} style={style}> |
| | | // <AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/> |
| | | // </div> |
| | | // ) |
| | | // } |
| | | |
| | | return ( |
| | | <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drag(drop(node))} style={style}> |
| | | {getCardComponent()} |
| | |
| | | balcony: '浮动卡', |
| | | timeline: '时间轴', |
| | | antvG6: '树图', |
| | | antvX6: '流程图', |
| | | iframe: 'iframe', |
| | | module: '模块', |
| | | card: '卡片' |
| | |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const TableComponent = asyncComponent(() => import('./tablecomponent')) |
| | | const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) |
| | | const PasteForms = asyncComponent(() => import('@/menu/components/share/pasteforms')) |
| | | const DragElement = asyncComponent(() => import('@/templates/modalconfig/dragelement')) |
| | |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="1" bordered={false}> |
| | | <Panel header="基本信息" key="0"> |
| | | <TableComponent /> |
| | | </Panel> |
| | | <Panel header="表单" key="1"> |
| | | <div className="search-element"> |
| | | {SearchItems.map((item, index) => { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import { Tooltip, Select, List, notification } from 'antd' |
| | | import { QuestionCircleOutlined, CloseOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import './index.scss' |
| | | |
| | | const { Option } = Select |
| | | |
| | | class TablesComponent extends Component { |
| | | state = { |
| | | tables: [], // 系统表 |
| | | selectedTables: [], // 已选表 |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件初始化 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | this.setState({ |
| | | selectedTables: window.GLOB.publicTables ? fromJS(window.GLOB.publicTables).toJS() : [] |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | this.gettables() |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统表 |
| | | */ |
| | | gettables = () => { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证 |
| | | |
| | | if (options.cloudServiceApi) { // 且存在云端地址 |
| | | param.rduri = options.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | tables: res.data |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 添加表名 |
| | | */ |
| | | onTableChange = (value) => { |
| | | const { tables, selectedTables } = this.state |
| | | |
| | | let _table = tables.filter(item => item.TbName === value)[0] |
| | | let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] |
| | | if (!isSelected) { |
| | | let _tables = [...selectedTables, _table] |
| | | |
| | | MKEmitter.emit('publicTableChange', value, 'plus') |
| | | |
| | | this.setState({ |
| | | selectedTables: _tables |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 删除表名 |
| | | */ |
| | | deleteTable = (table) => { |
| | | const { selectedTables } = this.state |
| | | |
| | | let _tables = selectedTables.filter(item => item.TbName !== table.TbName) |
| | | |
| | | MKEmitter.emit('publicTableChange', table, 'del') |
| | | |
| | | this.setState({ |
| | | selectedTables: _tables |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { tables, selectedTables } = this.state |
| | | |
| | | return ( |
| | | <div className="model-tablename-manage-view"> |
| | | {/* 表名添加 */} |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label> |
| | | <Tooltip placement="topLeft" title="此处可以添加页面配置相关的常用表。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 表名 |
| | | </Tooltip> |
| | | </label> |
| | | </div> |
| | | <Select |
| | | showSearch |
| | | className="tables" |
| | | style={{ width: '100%' }} |
| | | optionFilterProp="children" |
| | | value="请选择表名" |
| | | onSelect={this.onTableChange} |
| | | dropdownClassName="mk-tables" |
| | | dropdownMatchSelectWidth={false} |
| | | showArrow={false} |
| | | filterOption={(input, option) => { |
| | | return option.props.children[0].toLowerCase().indexOf(input.toLowerCase()) >= 0 || |
| | | option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | | }} |
| | | > |
| | | {tables.map((table, index) => ( |
| | | <Option key={index} title={table.TbName} value={table.TbName}>{table.Remark}<br/>{table.TbName}</Option> |
| | | ))} |
| | | </Select> |
| | | {selectedTables.length > 0 && <List |
| | | size="small" |
| | | bordered |
| | | dataSource={selectedTables} |
| | | renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> |
| | | {item.Remark + ' (' + item.TbName + ')'} |
| | | <CloseOutlined onClick={() => this.deleteTable(item)}/> |
| | | </List.Item>} |
| | | />} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default TablesComponent |
New file |
| | |
| | | .model-tablename-manage-view { |
| | | >.ant-list { |
| | | margin-top: 20px; |
| | | .ant-list-item { |
| | | display: -webkit-box; |
| | | padding-right: 20px; |
| | | position: relative; |
| | | padding-left: 5px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | -webkit-line-clamp: 2; |
| | | -webkit-box-orient: vertical; |
| | | min-height: 55px; |
| | | width: 100%; |
| | | .anticon { |
| | | position: absolute; |
| | | top: 0px; |
| | | right: 0px; |
| | | padding: 3px 3px 10px 10px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | .tables { |
| | | width: 66.66666667%!important; |
| | | .ant-select-selection-selected-value { |
| | | opacity: 0.4!important; |
| | | } |
| | | } |
| | | >.ant-form-item-label { |
| | | width: 33.33333333%; |
| | | } |
| | | } |
| | | .mk-tables { |
| | | max-width: 300px; |
| | | } |
| | |
| | | import bar from '@/assets/mobimg/bar.png' |
| | | import bar1 from '@/assets/mobimg/bar1.png' |
| | | import line from '@/assets/mobimg/line.png' |
| | | // import line1 from '@/assets/mobimg/line1.png' |
| | | import tabs from '@/assets/mobimg/tabs.png' |
| | | import group from '@/assets/mobimg/group.png' |
| | | import card1 from '@/assets/mobimg/card1.png' |
| | |
| | | { type: 'menu', url: timeline, component: 'timeline', subtype: 'timeline', title: '时间轴', width: 12 }, |
| | | { type: 'menu', url: tree, component: 'tree', subtype: 'normaltree', title: '树形列表', width: 12, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: line, component: 'line', subtype: 'line', title: '折线图', width: 24 }, |
| | | // { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '阶梯折线图', width: 24 }, |
| | | { type: 'menu', url: bar, component: 'bar', subtype: 'bar', title: '柱状图', width: 24 }, |
| | | { type: 'menu', url: bar1, component: 'bar', subtype: 'bar1', title: '条形图', width: 24 }, |
| | | { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '饼图', width: 12 }, |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Collapse, Form, Col, InputNumber, Input, Select, Radio, Drawer, Button } from 'antd' |
| | | import { Collapse, Form, Col, InputNumber, Input, Select, Radio, Drawer, Button, message } from 'antd' |
| | | import { |
| | | ColumnHeightOutlined, |
| | | FontSizeOutlined, |
| | |
| | | ArrowLeftOutlined, |
| | | ArrowRightOutlined, |
| | | SwapOutlined, |
| | | EnterOutlined, |
| | | EnterOutlined |
| | | } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | const { Panel } = Collapse |
| | | const { Option } = Select |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const PasteBoard = asyncComponent(() => import('@/components/pasteboard')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | |
| | | class MobController extends Component { |
| | | static propTpyes = { |
| | | editElem: PropTypes.any, |
| | | updateStyle: PropTypes.func, |
| | | } |
| | | |
| | | state = { |
| | | card: null, |
| | | fonts: null, |
| | |
| | | this.callback = null |
| | | } |
| | | |
| | | updateStyle = (style, prop) => { |
| | | updateStyle = (style) => { |
| | | const { card } = this.state |
| | | |
| | | let _style = { |
| | |
| | | ...style |
| | | } |
| | | |
| | | if (prop && !_style[prop]) { |
| | | delete _style[prop] |
| | | Object.keys(style).forEach(key => { |
| | | if (!_style[key] && _style[key] !== 0) { |
| | | delete _style[key] |
| | | } |
| | | }) |
| | | |
| | | if (_style.position === 'relative' || _style.position === 'absolute') { |
| | | _style.zIndex = 1 |
| | | } else { |
| | | delete _style.zIndex |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | * @description 修改背景颜色 ,颜色控件 |
| | | */ |
| | | changeBackgroundColor = (val) => { |
| | | this.updateStyle({backgroundColor: val}, 'backgroundColor') |
| | | this.updateStyle({backgroundColor: val}) |
| | | } |
| | | |
| | | changeBackground = (val) => { |
| | |
| | | } |
| | | |
| | | changeWidth = (val) => { |
| | | this.updateStyle({width: val === '0px' ? '' : val}, 'width') |
| | | this.updateStyle({width: val}) |
| | | } |
| | | |
| | | changeHeight = (val) => { |
| | | this.updateStyle({height: val === '0px' ? '' : val}, 'height') |
| | | this.updateStyle({height: val}) |
| | | } |
| | | |
| | | changeNormalStyle = (val, type) => { |
| | | this.updateStyle({[type]: val}) |
| | | } |
| | | |
| | | copy = () => { |
| | | const { card, options } = this.state |
| | | |
| | | let msg = { copyType: 'style' } |
| | | |
| | | msg.data = card |
| | | msg.options = options |
| | | |
| | | try { |
| | | msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | msg = '' |
| | | } |
| | | |
| | | if (msg) { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = msg |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | message.success('复制成功。') |
| | | } |
| | | } |
| | | |
| | | paste = (res, callback) => { |
| | | const { options } = this.state |
| | | |
| | | if (res.copyType !== 'style') { |
| | | message.warning('配置信息格式错误!', 5) |
| | | return |
| | | } else if (JSON.stringify(res.options) !== JSON.stringify(options)) { |
| | | message.warning('样式选项不一致,不可粘贴!', 5) |
| | | return |
| | | } |
| | | |
| | | let style = res.data || {} |
| | | |
| | | let backgroundImage = '' |
| | | if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) { |
| | | backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '') |
| | | } |
| | | |
| | | let borposition = 'outer' |
| | | |
| | | if (!style.borderWidth) { |
| | | if (style.borderLeftWidth) { |
| | | borposition = 'left' |
| | | } else if (style.borderRightWidth) { |
| | | borposition = 'right' |
| | | } else if (style.borderTopWidth) { |
| | | borposition = 'top' |
| | | } else if (style.borderBottomWidth) { |
| | | borposition = 'bottom' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | card: style, |
| | | borposition, |
| | | backgroundImage |
| | | }) |
| | | |
| | | this.callback && this.callback(style) |
| | | |
| | | callback() |
| | | |
| | | message.success('粘贴成功。') |
| | | } |
| | | |
| | | render () { |
| | |
| | | label={<ColumnWidthOutlined title="宽度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.width || ''} options={['px', 'vh', 'vw', '%', 'auto']} onChange={this.changeWidth}/> |
| | | <StyleInput clear={true} defaultValue={card.width || ''} options={['px', 'vh', 'vw', '%', 'auto']} onChange={this.changeWidth}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<ColumnHeightOutlined title="高度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.height || ''} options={['px', 'vh', 'vw']} onChange={this.changeHeight}/> |
| | | <StyleInput clear={true} defaultValue={card.height || ''} options={['px', 'vh', 'vw']} onChange={this.changeHeight}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<FontColorsOutlined title="字体颜色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={card.color || 'rgba(0, 0, 0, 0.85)'} onChange={this.changeFontColor} /> |
| | | <ColorSketch value={card.color || ''} onChange={this.changeFontColor} /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | |
| | | label={<BgColorsOutlined title="边框颜色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | {borposition === 'outer' ? <ColorSketch value={card.borderColor || 'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'left' ? <ColorSketch value={card.borderLeftColor || 'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'right' ? <ColorSketch value={card.borderRightColor || 'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'top' ? <ColorSketch value={card.borderTopColor || 'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'bottom' ? <ColorSketch value={card.borderBottomColor || 'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'outer' ? <ColorSketch value={card.borderColor || ''} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'left' ? <ColorSketch value={card.borderLeftColor || ''} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'right' ? <ColorSketch value={card.borderRightColor || ''} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'top' ? <ColorSketch value={card.borderTopColor || ''} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'bottom' ? <ColorSketch value={card.borderBottomColor || ''} onChange={this.changeBorderColor} /> : null} |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | |
| | | label={<RadiusSettingOutlined title="圆角"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.borderRadius || '0px'} options={['px', '%']} onChange={(val) => this.changeNormalStyle(val, 'borderRadius')}/> |
| | | <StyleInput clear={true} defaultValue={card.borderRadius || ''} options={['px', '%']} onChange={(val) => this.changeNormalStyle(val, 'borderRadius')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<BgColorsOutlined title="阴影颜色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={card.shadowColor || 'transparent'} onChange={this.changeShadowColor} /> |
| | | <ColorSketch value={card.shadowColor || ''} onChange={this.changeShadowColor} /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | |
| | | label={<ArrowUpOutlined title="上边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.marginTop || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginTop')}/> |
| | | <StyleInput clear={true} defaultValue={card.marginTop || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginTop')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowDownOutlined title="下边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.marginBottom || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginBottom')}/> |
| | | <StyleInput clear={true} defaultValue={card.marginBottom || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginBottom')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowLeftOutlined title="左边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.marginLeft || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginLeft')}/> |
| | | <StyleInput clear={true} defaultValue={card.marginLeft || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginLeft')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowRightOutlined title="右边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.marginRight || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginRight')}/> |
| | | <StyleInput clear={true} defaultValue={card.marginRight || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginRight')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<ArrowUpOutlined title="上边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.paddingTop || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingTop')}/> |
| | | <StyleInput clear={true} defaultValue={card.paddingTop || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingTop')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowDownOutlined title="下边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.paddingBottom || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingBottom')}/> |
| | | <StyleInput clear={true} defaultValue={card.paddingBottom || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingBottom')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowLeftOutlined title="左边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.paddingLeft || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingLeft')}/> |
| | | <StyleInput clear={true} defaultValue={card.paddingLeft || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingLeft')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<ArrowRightOutlined title="右边距"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.paddingRight || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingRight')}/> |
| | | <StyleInput clear={true} defaultValue={card.paddingRight || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingRight')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<ColumnHeightOutlined title="最小高度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput defaultValue={card.minHeight || ''} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'minHeight')}/> |
| | | <StyleInput clear={true} defaultValue={card.minHeight || ''} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'minHeight')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | {options.includes('position') ? <Panel header="定位" key="position"> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<SwapOutlined title="定位"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} defaultValue={card.position || 'unset'} onChange={(e) => this.changeNormalStyle(e.target.value, 'position')}> |
| | | <Radio value="unset">无</Radio> |
| | | <Radio value="relative">相对定位</Radio> |
| | | <Radio value="absolute">绝对定位</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowUpOutlined title="上"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.top || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'top')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowDownOutlined title="下"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.bottom || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'bottom')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowLeftOutlined title="左"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.left || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'left')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowRightOutlined title="右"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.right || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'right')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | </Collapse> : null} |
| | | </Form> |
| | | <div style={{textAlign: 'right'}}> |
| | | <Button style={{margin: '30px 10px 30px 0px'}} onClick={this.onCloseDrawer}>关闭</Button> |
| | | <div style={{textAlign: 'right', lineHeight: '60px', marginBottom: '30px'}}> |
| | | <div style={{float: 'left'}}> |
| | | <Button onClick={() => this.copy()} className="mk-border-green" style={{marginRight: '10px'}}>复制</Button> |
| | | <PasteBoard getPasteValue={this.paste}><Button style={{borderColor: 'rgb(64, 169, 255)', color: 'rgb(64, 169, 255)'}}>粘贴</Button></PasteBoard> |
| | | </div> |
| | | <Button style={{marginRight: '10px'}} onClick={this.onCloseDrawer}>关闭</Button> |
| | | </div> |
| | | </div> |
| | | </Drawer> |
| | |
| | | } |
| | | |
| | | changeValue = (e) => { |
| | | const { clear } = this.props |
| | | const { unit } = this.state |
| | | let val = e.target.value |
| | | |
| | |
| | | |
| | | if (this.props.onChange) { |
| | | if (!_val) { |
| | | this.props.onChange('0px') |
| | | this.props.onChange(clear ? '' : '0px') |
| | | } else { |
| | | this.props.onChange(`${_val}${unit}`) |
| | | } |
| | |
| | | this.setState({ interfaces }) |
| | | this.props.updateConfig({...config, interfaces}) |
| | | |
| | | MKEmitter.emit('editLineId', record.uuid) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkUpdateInter', record, {delay: 0}) |
| | | }, 10) |
| | |
| | | <div className="color-sketch-block-inner" style={ {background: color} }></div> |
| | | </div> |
| | | </Popover> |
| | | <div className="color-sketch-value">{color}{allowClear && color ? <CloseCircleFilled onClick={this.clear}/> : null}</div> |
| | | <div className="color-sketch-value">{color || <span style={{color: '#ff4d4f'}}>无</span>}{allowClear && color ? <CloseCircleFilled onClick={this.clear}/> : null}</div> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const TableComponent = asyncComponent(() => import('@/menu/modalconfig/tablecomponent')) |
| | | const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) |
| | | const PasteForms = asyncComponent(() => import('@/menu/components/share/pasteforms')) |
| | | const DragElement = asyncComponent(() => import('@/mob/components/formdragelement')) |
| | |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="1" bordered={false}> |
| | | <Panel header="基本信息" key="0"> |
| | | <TableComponent /> |
| | | </Panel> |
| | | <Panel header="表单" key="1"> |
| | | <div className="search-element"> |
| | | {SearchItems.map((item, index) => { |
| | |
| | | tr:not(.classify) + .ant-table-expanded-row { |
| | | display: none; |
| | | } |
| | | td[colspan="6"] { |
| | | padding: 5px 0px 5px 5px!important; |
| | | td[colspan="5"] { |
| | | padding: 5px 0px 5px 0px!important; |
| | | } |
| | | .ant-table-body { |
| | | margin: 0!important; |
| | |
| | | const RoleManage = asyncLoadComponent(() => import('@/views/rolemanage')) |
| | | const SystemFunc = asyncLoadComponent(() => import('@/views/systemfunc')) |
| | | const SystemProc = asyncLoadComponent(() => import('@/views/systemproc')) |
| | | const MkIframe = asyncLoadComponent(() => import('@/views/mkiframe')) |
| | | |
| | | const routers = [ |
| | | {path: '/login', name: 'login', component: Login}, |
| | |
| | | {path: '/role/:param', name: 'role', component: RoleManage}, |
| | | {path: '/hs', name: 'hs', component: SystemFunc}, |
| | | {path: '/proc', name: 'proc', component: SystemProc}, |
| | | {path: '/iframe/:menuId/:userId/:loginUid', name: 'iframe', component: MkIframe}, |
| | | {path: '/iframe/:menuId/:userId/:loginUid/:bid', name: 'iframe', component: MkIframe}, |
| | | {path: '/interface', name: 'interface', component: Interface} |
| | | ] |
| | | |
| | |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | cell.$view = 'popview' |
| | | cell.$toolbtn = true |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | userConfig: null, // 用户自定义设置 |
| | | searchlist: null, // 搜索条件 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | |
| | | config.setting.customScript = _customScript |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | hasReqFields, |
| | | BID: param && param.$BID ? param.$BID : '', |
| | |
| | | config: config, |
| | | userConfig: userConfig, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | arr_field: config.columns.map(item => item.field).join(','), |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, setting, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state |
| | | const { BID, loadingview, viewlost, config, loading, data, triggerTime } = this.state |
| | | |
| | | return ( |
| | | <div className="calendar-page"> |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null |
| | | {config.search && config.search.length > 0 ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateCommonTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | shortcuts: null, // 快捷键 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false, |
| | | autoMatic: null, |
| | | visible: false |
| | |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | config.setting.dataresource = config.setting.dataresource || '' |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | statFields, |
| | | shortcuts: shortcuts.length > 0 ? shortcuts : null, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | |
| | | loadData = (id) => { |
| | | const { MenuID } = this.props |
| | | const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state |
| | | const { setting, search, hasReqFields, ContainerId } = this.state |
| | | |
| | | this.setState({ |
| | | selectedData: [] |
| | |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource() |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = () => { |
| | | const { setting, search, BID } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, search, BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke // 是否继续执行 |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key // 当前请求的key值,用于回调 |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting, BID } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) |
| | | } else { |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.state.config.MenuID, |
| | | MenuName: this.state.config.MenuName, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | item.$Index = start + index + '' |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | getStatFieldsValue = () => { |
| | | const { setting, search, BID, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) |
| | |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, |
| | | data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false, searchlist: null |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | |
| | | render() { |
| | | const { MenuID } = this.props |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state |
| | | const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state |
| | | |
| | | return ( |
| | | <div className="commontable" id={this.state.ContainerId}> |
| | | {loadingview ? <Spin size="large" /> : null} |
| | | {searchlist && searchlist.length ? |
| | | <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null |
| | | {config && config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {setting && config.charts ? <Row className="chart-view" gutter={16}> |
| | | {/* 视图组 */} |
| | |
| | | MKEmitter.addListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | MKEmitter.removeListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS() |
| | | _data[btn.field] = count |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | syncBalconyData = (menuId, data, checked) => { |
| | | const { syncConfig } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | openView = () => { |
| | | openView = (e) => { |
| | | const { card, data, cards, onClick } = this.props |
| | | |
| | | onClick && onClick() |
| | | |
| | | if (!card.setting.click || data.$disabled) return |
| | | |
| | | if (card.setting.click === 'menus' && cards.subtype === 'datacard' && card.$cardType !== 'extendCard') { |
| | | e.stopPropagation() |
| | | |
| | | if (card.setting.click === 'menus') { |
| | | let menu = null |
| | | |
| | | if (card.menus && card.menus.length > 0) { |
| | |
| | | menu = m |
| | | }) |
| | | } |
| | | if (!menu || !menu.MenuID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未查询到菜单信息!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | if (!menu) return |
| | | |
| | | let newtab = { |
| | | MenuID: menu.MenuID, |
| | |
| | | |
| | | Object.keys(data).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (key === 'children') return |
| | | newtab.param[key] = data[key] |
| | | }) |
| | | } |
| | | |
| | | MKEmitter.emit('modifyTabs', newtab, true) |
| | | } else if (card.setting.click === 'menu' && card.setting.menu) { |
| | | } else if (card.setting.click === 'menu') { |
| | | let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] |
| | | let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] |
| | | |
| | |
| | | |
| | | Object.keys(data).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (key === 'children') return |
| | | newtab.param[key] = data[key] |
| | | }) |
| | | } |
| | |
| | | node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) |
| | | } |
| | | |
| | | if (!card.link) return |
| | | if (!card.link || (card.linkType === 'qywx' || card.linkType === 'linkmenu')) return |
| | | e.stopPropagation() |
| | | |
| | | let url = '' |
| | |
| | | } |
| | | window.open(_url) |
| | | return |
| | | } else if (card.linkType === 'qywx' || card.linkType === 'linkmenu') { |
| | | } else if (card.linkType === 'other' && /^@menuid@/ig.test(url)) { |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | if (card.datatype === 'dynamic') { |
| | | icon = data[card.field] || '' |
| | | } else if (card.tipType === 'text') { |
| | | icon = card.value |
| | | } else { |
| | | icon = card.icon |
| | | } |
| | |
| | | } else { |
| | | val = card.tooltip |
| | | } |
| | | |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>} |
| | | |
| | | if (card.tipType === 'text') { |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight}}>{icon}</div> |
| | | </Tooltip> : <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight}}>{icon}</div>} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | ) |
| | | ) |
| | | } else { |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } else if (card.eleType === 'slider') { |
| | | let val = 0 |
| | | let color = card.color |
| | |
| | | } |
| | | |
| | | _config.$extend = false |
| | | _config.$empty = true |
| | | |
| | | _config.subcards.forEach(item => { |
| | | if (item.setting.click === 'button' && !item.setting.linkbtn) { |
| | |
| | | _card = item |
| | | } else if (!_card) { |
| | | _config.$extend = true |
| | | if (item.setting.width !== 24) { |
| | | _config.$empty = false |
| | | } |
| | | precards.push(item) |
| | | } else { |
| | | _config.$extend = true |
| | | _config.$empty = false |
| | | nextcards.push(item) |
| | | } |
| | | }) |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (_config.wrap.controlField) { |
| | | if (_config.wrap.controlVal.includes(item[_config.wrap.controlField])) { |
| | | if (_config.wrap.controlVal.includes(item[_config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | MKEmitter.addListener('mkCheckAll', this.mkCheckAll) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | MKEmitter.removeListener('mkCheckAll', this.mkCheckAll) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | if (position === 'popclose') { // 执行启动弹窗的按钮所选择的刷新项 |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | item.$Index = index + start + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | ))} |
| | | </Row> |
| | | {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} |
| | | {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | |
| | | } |
| | | |
| | | .ant-empty { |
| | | width: 100%; |
| | | min-height: 100px; |
| | | padding-top: 15px; |
| | | |
| | |
| | | } |
| | | |
| | | _config.$extend = false |
| | | _config.$empty = true |
| | | |
| | | _config.subcards.forEach(item => { |
| | | if (item.setting.click === 'button' && !item.setting.linkbtn) { |
| | |
| | | _card = item |
| | | } else if (!_card) { |
| | | _config.$extend = true |
| | | if (item.setting.width !== 24) { |
| | | _config.$empty = false |
| | | } |
| | | precards.push(item) |
| | | } else { |
| | | _config.$extend = true |
| | | _config.$empty = false |
| | | nextcards.push(item) |
| | | } |
| | | }) |
| | |
| | | subcard.setting = subcard.backSetting |
| | | |
| | | if (_card.setting.position === 'inner') { |
| | | wrapStyle = {} |
| | | wrapStyle = {backgroundColor: '#ffffff'} |
| | | Object.keys(_card.style).forEach(key => { |
| | | if (!/^(margin|border|box)/.test(key)) return |
| | | if (!/^(margin|border|box|backgroundColor)/.test(key)) return |
| | | wrapStyle[key] = _card.style[key] |
| | | delete _card.style[key] |
| | | }) |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | if (position === 'popclose') { // 执行启动弹窗的按钮所选择的刷新项 |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | item.children.forEach(cell => { |
| | | if (cell.$$uuid === uuid) { |
| | | cell[btn.field] = count |
| | | } |
| | | }) |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | item.$Index = index + start + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | changeSubCard = (item) => { |
| | | const { subcard, card } = this.state |
| | | |
| | | if (subcard.setting.click || card.setting.position !== 'inner' || card.setting.click !== 'menu') return |
| | | |
| | | let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] |
| | | let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] |
| | | |
| | | if (!menu && card.setting.MenuName && card.setting.tabType) { |
| | | menu = { |
| | | MenuID: menuId, |
| | | MenuName: card.setting.MenuName, |
| | | MenuNo: card.setting.MenuNo || '', |
| | | type: card.setting.tabType |
| | | } |
| | | } |
| | | |
| | | if (!menu) return |
| | | |
| | | let newtab = { |
| | | ...menu, |
| | | param: {} |
| | | } |
| | | |
| | | if (card.setting.joint === 'true') { |
| | | newtab.param.$BID = item.$$uuid || '' |
| | | |
| | | Object.keys(item).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (key === 'children') return |
| | | newtab.param[key] = item[key] |
| | | }) |
| | | } |
| | | |
| | | MKEmitter.emit('modifyTabs', newtab, true) |
| | | } |
| | | |
| | | onDoubleClick = (i, subClass) => { |
| | | const { opens, card } = this.state |
| | | |
| | |
| | | let unfold = true |
| | | |
| | | if (item.$disabled) { |
| | | className = 'mk-disabled ' + mainBox |
| | | className = 'card-item-wrap mk-disabled ' + mainBox |
| | | } else if (activeKey === index) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | |
| | | {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/>) : null} |
| | | {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : null} |
| | | </CardItem> |
| | | <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')}> |
| | | <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')} onClick={() => this.changeSubCard(item)}> |
| | | {item.children.map((cell, index) => <Col key={'sub' + index} span={subcard.setting.width || 24}> |
| | | <CardItem card={subcard} cards={subconfig} data={cell} /> |
| | | </Col>)} |
| | |
| | | </Col> |
| | | ))} |
| | | </Row> |
| | | {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | |
| | | } |
| | | |
| | | .ant-empty { |
| | | width: 100%; |
| | | min-height: 100px; |
| | | padding-top: 15px; |
| | | |
| | |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic' && this.loaded) { |
| | | this.autoExec() |
| | | if (_config.wrap.goback === 'true' && _data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', _config.$pageId) |
| | | } else { |
| | | this.autoExec() |
| | | } |
| | | } |
| | | if (!_config.wrap.cardType && _data.$$uuid) { |
| | | if (_data.$$uuid) { |
| | | setTimeout(() => { |
| | | this.transferLine() |
| | | }, 200) |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | MKEmitter.removeListener('mkPublicData', this.mkPublicData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else if (!config.wrap.cardType && _data.$$uuid) { |
| | | this.transferLine() |
| | | if (config.wrap.goback === 'true' && _data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else if (_data.$$uuid) { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | this.autoExec() |
| | | }) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | |
| | | this.loaded = true |
| | | |
| | | this.setState({data: _data}, () => { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | if (config.wrap.goback === 'true' && _data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | this.transferLine() |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS() |
| | | _data[btn.field] = count |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | cursor: not-allowed; |
| | | color: #bcbcbc; |
| | | } |
| | | .ant-empty { |
| | | min-height: 100px; |
| | | padding-top: 15px; |
| | | .ant-empty-image { |
| | | height: 60px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .custom-card-box::after { |
| | |
| | | } |
| | | |
| | | data = [] |
| | | mkgraph = null |
| | | selectedId = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | |
| | | |
| | | _options.push(_item) |
| | | }) |
| | | |
| | | root = this.getTree(root, _options) |
| | | |
| | | root.nodeNumber = 0 |
| | | root = this.getTree(root, _options, root) |
| | | root.children = root.children || [] |
| | | |
| | | if (root.selectedItem) { |
| | | let option = {...root.selectedItem} |
| | | setTimeout(() => { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, option.id, option) |
| | | }, 20) |
| | | delete root.selectedItem |
| | | } else { |
| | | this.selectedId = '' |
| | | } |
| | | |
| | | if (plot.subtype === 'mindmap') { |
| | | root.type = 'dice-mind-map-root' |
| | |
| | | return root |
| | | } |
| | | |
| | | getTree = (parent, options) => { |
| | | getTree = (parent, options, root) => { |
| | | parent.children = [] |
| | | // 添加菜单的子元素 |
| | | options = options.filter(option => { |
| | | if (option.$parentId === parent.id) { |
| | | delete option.$parentId |
| | | |
| | | if (this.selectedId && option.id === this.selectedId) { |
| | | root.selectedItem = {...option} |
| | | option.selected = true |
| | | } |
| | | |
| | | parent.children.push(option) |
| | | |
| | | root.nodeNumber++ |
| | | |
| | | return false |
| | | } |
| | | return true |
| | |
| | | parent.children = null |
| | | } else { |
| | | parent.children = parent.children.map(item => { |
| | | item = this.getTree(item, options) |
| | | item = this.getTree(item, options, root) |
| | | |
| | | return item |
| | | }) |
| | |
| | | } |
| | | |
| | | handleData = () => { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | const { config } = this.state |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | |
| | | if (this.mkgraph) { |
| | | this.mkgraph.clear() |
| | | this.resetrender() |
| | | } else { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { plot } = this.state |
| | | |
| | | this.selectedId = '' |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | } else { |
| | | this.setState({empty: false}) |
| | | |
| | | if (plot.subtype === 'mindmap') { |
| | | this.ponitrender() |
| | | this.mindrender() |
| | | } else if (plot.subtype === 'indentTree') { |
| | | this.indentrender() |
| | | } else if (plot.subtype === 'kapmap') { |
| | | this.kapmaprender() |
| | | } |
| | | } |
| | | } |
| | | |
| | | resetrender = () => { |
| | | const { plot } = this.state |
| | | |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | this.selectedId = '' |
| | | } else { |
| | | this.setState({empty: false}) |
| | | |
| | | const data = this.getdata() |
| | | if (plot.subtype === 'mindmap') { |
| | | this.mkgraph.data(data) |
| | | |
| | | this.mkgraph.render() |
| | | |
| | | const width = this.wrap.scrollWidth - 30 |
| | | |
| | | if (plot.collapsed === 'true' && plot.dirField) { |
| | | this.mkgraph.zoomTo(1, { x: width / 2, y: plot.height / 2 }) |
| | | } else if (plot.collapsed === 'true' || data.nodeNumber < 5) { |
| | | this.mkgraph.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | } else if (plot.subtype === 'indentTree') { |
| | | this.mkgraph.data(dataIndTransform(data)) |
| | | |
| | | this.mkgraph.render() |
| | | } else if (plot.subtype === 'kapmap') { |
| | | this.mkgraph.data(data) |
| | | this.mkgraph.render() |
| | | this.mkgraph.fitView() |
| | | |
| | | if (plot.collapsed === 'true' || data.nodeNumber < 5) { |
| | | this.mkgraph.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | graph.render() |
| | | graph.fitView() |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | if (plot.collapsed === 'true' || data.nodeNumber < 5) { |
| | | graph.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | |
| | | this.mkgraph = graph |
| | | } |
| | | |
| | | indentrender = () => { |
| | |
| | | tree.data(dataIndTransform(data)) |
| | | |
| | | tree.render() |
| | | |
| | | this.mkgraph = tree |
| | | } |
| | | |
| | | /** |
| | | * @description 散点图 |
| | | * @description 思维导图 |
| | | */ |
| | | ponitrender = () => { |
| | | mindrender = () => { |
| | | const { config, plot, chartId } = this.state |
| | | const data = this.getdata() |
| | | const width = this.wrap.scrollWidth - 30 |
| | |
| | | |
| | | if (plot.collapsed === 'true' && plot.dirField) { |
| | | tree.zoomTo(1, { x: width / 2, y: plot.height / 2 }) |
| | | } else if (plot.collapsed === 'true') { |
| | | } else if (plot.collapsed === 'true' || data.nodeNumber < 5) { |
| | | tree.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | |
| | | this.mkgraph = tree |
| | | } |
| | | |
| | | handleClick = (data = null) => { |
| | |
| | | |
| | | MKEmitter.emit('modifyTabs', newtab, true) |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) |
| | | if (data) { |
| | | this.selectedId = data.$$uuid || '' |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data.$$uuid || '', data) |
| | | } else { |
| | | this.selectedId = '' |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | sync: false, // 是否统一请求数据 |
| | | data: [], // 数据 |
| | | html: '', |
| | | result: {} |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | }, 10) |
| | | } |
| | | |
| | | let _result = {...result} |
| | | delete _result.data |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | result: _result, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | renderView = () => { |
| | | const { data } = this.state |
| | | const { data, result } = this.state |
| | | const { html, js, wrap, columns } = this.state.config |
| | | |
| | | let _html = html |
| | |
| | | if (js) { |
| | | try { |
| | | // eslint-disable-next-line |
| | | let evalfunc = eval('(true && function (data) {' + js + '})') |
| | | evalfunc(data) |
| | | // if (wrap.compileMode !== 'custom') { |
| | | // // eslint-disable-next-line no-eval |
| | | // eval(js) |
| | | // } else { |
| | | // // eslint-disable-next-line |
| | | // let evalfunc = eval('(true && function (data) {' + js + '})') |
| | | // evalfunc(data) |
| | | // } |
| | | let evalfunc = eval('(true && function (data, result) {' + js + '})') |
| | | evalfunc(data, result) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (_config.wrap.height === '100vh') { |
| | | _config.wrap.height = 'calc(100vh - 92px)' |
| | | } |
| | | |
| | | this.setState({ |
| | | linkUrl: linkUrl, |
| | | sync: _sync, |
| | |
| | | </div> : null} |
| | | <div className="iframe-wrap" style={{height: config.wrap.height}}> |
| | | {loading ? <div className="mask"><Spin size="large" /></div> : null} |
| | | {linkUrl ? <iframe title="mk" className="iframe" src={linkUrl} frameBorder="0"></iframe> : <Empty description={false}/>} |
| | | {linkUrl ? <iframe title="mk" className="iframe" src={linkUrl.replace(/@userid@/ig, sessionStorage.getItem('UserID')).replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))} frameBorder="0"></iframe> : <Empty description={false}/>} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { getMark } from '@/utils/utils.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Encrypts from '@/components/encrypts' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | | const Video = asyncComponent(() => import('@/components/video')) |
| | | const MkIcon = asyncComponent(() => import('@/components/mk-icon')) |
| | | const MkPicture = asyncComponent(() => import('@/components/mkPicture')) |
| | | const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) |
| | | const PicRadio = { |
| | |
| | | }) |
| | | } |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | const { setting } = this.state |
| | | |
| | | if (setting.onload === 'false') { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches, |
| | | setting: {...setting, onload: 'true'} |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | search: '' // 搜索条件数组,使用时需分场景处理 |
| | | } |
| | | |
| | | /** |
| | |
| | | let _columns = [] |
| | | setting.initId = '' |
| | | let triMap = new Map() |
| | | setting.hasSubmit = false |
| | | |
| | | let getColumns = (cols) => { |
| | | return cols.filter(item => { |
| | |
| | | } |
| | | |
| | | if (item.editable === 'true') { |
| | | setting.hasSubmit = true |
| | | if (!setting.initId) { |
| | | setting.initId = item.uuid |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | } |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | MKEmitter.emit('transferData', config.uuid, _data, 'line') |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) |
| | |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | const { setting } = this.state |
| | | |
| | | if (setting.onload === 'false') { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches, |
| | | setting: {...setting, onload: 'true'} |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | }) |
| | | } |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(this.state.data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | let _selectedData = fromJS(this.state.selectedData).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | selectedData: _selectedData |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { config } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className="custom-edit-table" id={'anchor' + config.uuid} style={style}> |
| | | <div className={'custom-edit-table' + (setting.hasSubmit ? '' : ' withnot-submit')} id={'anchor' + config.uuid} style={style}> |
| | | <NormalHeader config={config}/> |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | |
| | | right: 0px; |
| | | margin-top: 15px; |
| | | } |
| | | } |
| | | .custom-edit-table.withnot-submit { |
| | | .button-list.toolbar-button { |
| | | margin-right: 0px; |
| | | } |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd' |
| | | import { EditOutlined } from '@ant-design/icons' |
| | | import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Utils, { getEditTableSql, getMark } from '@/utils/utils.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import CusSwitch from './cusSwitch' |
| | | import Encrypts from '@/components/encrypts' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | | const MkIcon = asyncComponent(() => import('@/components/mk-icon')) |
| | | const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) |
| | | |
| | | class BodyRow extends React.Component { |
| | |
| | | |
| | | this.setState({editing: false}) |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | this.setState({editing: false}) |
| | | |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | this.setState({editing: false}) |
| | | |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | this.onBlur() |
| | | |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | const { col, record } = this.props |
| | | |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | if (col.enter === '$next') { |
| | | if (/\$next/.test(col.enter)) { |
| | | MKEmitter.emit('nextLine', col, record.$$uuid) |
| | | } else if (col.enter === '$sub') { |
| | | MKEmitter.emit('subLine', col, record) |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | edData: [], |
| | | selectedRowKeys: [], // 表格中选中行 |
| | | tableId: '', // 表格ID |
| | |
| | | orderfields: {}, // 排序id与field转换 |
| | | loading: false, |
| | | pageOptions: [], |
| | | deForms: null |
| | | deForms: null, |
| | | visible: false, |
| | | midData: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | } |
| | | |
| | | transferData = (menuid, data, type) => { |
| | | const { MenuID, setting } = this.props |
| | | const { MenuID } = this.props |
| | | const { edData } = this.state |
| | | |
| | | if (menuid !== MenuID) return |
| | | |
| | | if (type !== 'line') { |
| | | if (setting.editType === 'multi' && data.length > 0) { |
| | | this.setState({edData: []}, () => { |
| | | this.setState({edData: data}) |
| | | }) |
| | | } else { |
| | | this.setState({edData: data}) |
| | | } |
| | | let index = edData.findIndex(item => !item.$origin && !item.$forbid) |
| | | |
| | | if (setting.addable && data.length === 0) { |
| | | setTimeout(() => { |
| | | this.plusLine(true) |
| | | }, 10) |
| | | if (index > -1) { |
| | | this.setState({visible: true, midData: data}) |
| | | } else { |
| | | this.updateMutil(data) |
| | | } |
| | | } else if (type === 'line') { |
| | | let _edData = this.state.edData.map(item => { |
| | |
| | | }) |
| | | |
| | | this.setState({edData: _edData}) |
| | | } |
| | | } |
| | | |
| | | updateMutil = (data) => { |
| | | const { setting } = this.props |
| | | |
| | | if (setting.editType === 'multi' && data.length > 0) { |
| | | this.setState({edData: []}, () => { |
| | | this.setState({edData: data, visible: false, midData: null}) |
| | | }) |
| | | } else { |
| | | this.setState({edData: data, visible: false, midData: null}) |
| | | } |
| | | |
| | | if (setting.addable && data.length === 0) { |
| | | setTimeout(() => { |
| | | this.plusLine(true) |
| | | }, 10) |
| | | } |
| | | } |
| | | |
| | |
| | | let next = edData[index + 1] || null |
| | | |
| | | if (next) { |
| | | let node = document.getElementById(setting.initId + next.$$uuid) |
| | | let nextId = setting.initId + next.$$uuid |
| | | if (/^\$next_/.test(col.enter)) { |
| | | nextId = col.enter.split('_')[1] + next.$$uuid |
| | | } |
| | | |
| | | let node = document.getElementById(nextId) |
| | | if (node) { |
| | | if (setting.editType === 'multi') { |
| | | if (setting.triType === 'click') { |
| | |
| | | const { submit, BID, setting } = this.props |
| | | const { forms } = this.state |
| | | |
| | | this.setState({visible: false, midData: null}) |
| | | |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | } |
| | | |
| | | updataLine = (item) => { |
| | | if (item.$type === 'del') { |
| | | let _data = this.state.edData.filter(m => m.$$uuid !== item.$$uuid) |
| | | |
| | | this.setState({edData: _data}) |
| | | } else { |
| | | let _data = this.state.edData.map(m => { |
| | | if (m.$$uuid === item.$$uuid) { |
| | | item.$origin = true |
| | | return item |
| | | } |
| | | return m |
| | | }) |
| | | |
| | | this.setState({edData: _data}) |
| | | } |
| | | MKEmitter.emit('reloadData', this.props.MenuID, item.$$uuid, item) |
| | | } |
| | | |
| | | execSuccess = (res) => { |
| | | const { submit } = this.props |
| | | const { edData } = this.state |
| | | |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.state.dict['main.action.confirm.success'], |
| | | message: res.ErrMesg || '执行成功', |
| | | duration: submit.stime ? submit.stime : 2 |
| | | }) |
| | | } else if (res && res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.ErrMesg || this.state.dict['main.action.confirm.success'] |
| | | title: res.ErrMesg || '执行成功' |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | let _edData = fromJS(edData).toJS() |
| | | |
| | | _edData = _edData.map(item => { |
| | | if (!item.$forbid) { |
| | | item.$origin = true |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | loading: false |
| | | loading: false, |
| | | edData: _edData |
| | | }) |
| | | |
| | | if (submit.closetab === 'true') { |
| | |
| | | if (submit.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) |
| | | } |
| | | |
| | | submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId) |
| | | } |
| | | |
| | | execError = (res) => { |
| | |
| | | |
| | | render() { |
| | | const { setting, lineMarks, submit } = this.props |
| | | const { tableId, edData, columns, loading, pageOptions, selectedRowKeys } = this.state |
| | | const { tableId, edData, columns, loading, pageOptions, selectedRowKeys, visible, midData } = this.state |
| | | |
| | | const components = { |
| | | body: { |
| | |
| | | } |
| | | } |
| | | |
| | | // 数据收起时,过滤已选数据 |
| | | let _data = edData.filter(item => !item.$deleted) |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | |
| | | } |
| | | } |
| | | |
| | | let _footer = '' |
| | | |
| | | let height = setting.height || false |
| | | if (height && height <= 100) { |
| | | height = height + 'vh' |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> |
| | | {setting.hasSubmit ? <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> |
| | | <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-table" type="link">提交</Button> |
| | | </div> |
| | | </div> : null} |
| | | <div className={`edit-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''} mk-edit-${setting.editType || 'simple'}`} id={tableId}> |
| | | <Table |
| | | rowKey="$$uuid" |
| | |
| | | onChange={this.changeTable} |
| | | pagination={_pagination} |
| | | /> |
| | | {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null} |
| | | {_data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">提交</Button> : null} |
| | | {setting.hasSubmit && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">提交</Button> : null} |
| | | </div> |
| | | <Modal |
| | | className="mk-user-confirm" |
| | | visible={visible} |
| | | width={450} |
| | | maskClosable={false} |
| | | closable={false} |
| | | footer={[ |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false, midData: null }) }}>取消</Button>, |
| | | <Button key="refresh" className="table-refresh" onClick={() => { midData && this.updateMutil(midData) }}>刷新表格</Button>, |
| | | <Button key="confirm" type="primary" onClick={() => setTimeout(() => {this.submit()}, 10)}>提交数据</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <div><QuestionCircleOutlined />表格中有数据尚未提交</div> |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | |
| | | --mk-table-font-size: 14px; |
| | | --mk-table-font-weight: normal; |
| | | |
| | | .normal-table-footer { |
| | | padding: 10px 0px; |
| | | color: rgba(0, 0, 0, 0.65); |
| | | } |
| | | .normal-table-footer.pagination { |
| | | position: absolute; |
| | | bottom: 10px; |
| | | } |
| | | >.ant-table-wrapper { |
| | | position: relative; |
| | | z-index: 1; |
| | |
| | | table tbody tr { |
| | | color: var(--mk-table-color); |
| | | } |
| | | .ant-table-bordered { |
| | | table { |
| | | tbody { |
| | | tr:last-child { |
| | | td { |
| | | border-bottom: none; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // .ant-table-bordered { |
| | | // table { |
| | | // tbody { |
| | | // tr:last-child { |
| | | // td { |
| | | // border-bottom: none; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | .edit-custom-table.mk-edit-simple { |
| | | table tbody tr td { |
| | |
| | | margin-bottom: 10px!important; |
| | | } |
| | | } |
| | | .mk-user-confirm { |
| | | top: 30vh; |
| | | |
| | | .ant-modal-body { |
| | | font-size: 16px; |
| | | } |
| | | .anticon-question-circle { |
| | | color: orange; |
| | | font-size: 16px; |
| | | margin-right: 5px; |
| | | } |
| | | .ant-modal-footer { |
| | | border-top: 0px; |
| | | padding: 10px 20px 25px 0px; |
| | | .table-refresh, .table-refresh:hover, .table-refresh:active, .table-refresh:focus { |
| | | color: #fff!important; |
| | | background-color: #ff4d4f!important; |
| | | border-color: #ff4d4f!important; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | const { setting } = this.state |
| | | |
| | | if (setting.onload === 'false') { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches, |
| | | setting: {...setting, onload: 'true'} |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(this.state.data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | let _selectedData = fromJS(this.state.selectedData).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | selectedData: _selectedData |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { sync, config, setting, BID, BData } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | let val = '' |
| | | Object.keys(data).forEach(key => { |
| | | if (key.toLowerCase() === _tabs.setting.controlField) { |
| | | val = data[key] |
| | | val = data[key] + '' |
| | | } |
| | | }) |
| | | _tabs.subtabs = config.subtabs.filter(tab => { |
| | |
| | | let val = '' |
| | | Object.keys(data).forEach(key => { |
| | | if (key.toLowerCase() === tabs.setting.controlField) { |
| | | val = data[key] |
| | | val = data[key] + '' |
| | | } |
| | | }) |
| | | this.setState({ |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().map(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | if (pval === config.wrap.mark) { |
| | | parentNodes.push({ |
| | | ...item, |
| | | mk_floor: 1, |
| | | $$uuid: uuid, |
| | | $title: item[config.wrap.labelField] || '', |
| | | $key: val, |
| | |
| | | } |
| | | }) |
| | | let _treedata = this.getTree(parentNodes, _options) |
| | | |
| | | |
| | | let _treeNodes = [] |
| | | |
| | | if (!searchkey) { |
| | |
| | | // 添加菜单的子元素 |
| | | options = options.filter(option => { |
| | | if (option.$parentId === parent.$key) { |
| | | option.mk_floor = parent.mk_floor + 1 |
| | | parent.children.push(option) |
| | | return false |
| | | } |
| | |
| | | |
| | | // 数据缓存设置 |
| | | if (config.cacheUseful === 'true') { |
| | | if (!['day', 'hour'].includes(config.timeUnit)) { |
| | | if (!['day', 'hour', 'minute'].includes(config.timeUnit)) { |
| | | config.timeUnit = 'day' |
| | | } |
| | | config.cacheTime = config.cacheTime || 1 |
| | |
| | | item.search = Utils.initSearchVal(item.search) |
| | | } |
| | | |
| | | let mutil = false |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | mutil = true |
| | | item.setting.supModule = item.supNodes[0].componentId |
| | | } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { |
| | | let pid = item.setting.supModule.pop() |
| | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | cell.$toolbtn = true |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : '' |
| | | |
| | | if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) { |
| | | item.submit.syncComponentId = '' |
| | | if (item.submit.execSuccess === 'grid') { |
| | | item.submit.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | |
| | | if (card.setting.click === 'menus') { |
| | | if (card.menus) { |
| | | card.menus = card.menus.filter(m => !!m.MenuID) |
| | | if (card.menus.length === 0) { |
| | | card.menus = null |
| | | } |
| | | } |
| | | if (!card.menus || item.subtype !== 'datacard' || card.$cardType === 'extendCard') { |
| | | card.setting.click = '' |
| | | } |
| | | } else if (card.setting.click === 'menu') { |
| | | if (!Array.isArray(card.setting.menu)) { |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | |
| | | if (item.subtype === 'dualdatacard' && card.$cardType !== 'extendCard') { |
| | | if (card.backSetting && card.backSetting.click === 'menu') { |
| | | if (!Array.isArray(card.backSetting.menu)) { |
| | | card.backSetting.click = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!card.backElements || card.backElements.length === 0) return |
| | | |
| | | card.backElements = card.backElements.filter(cell => { |
| | |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | | } |
| | | |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : '' |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' |
| | | |
| | | if (group.subButton.syncComponentId === item.setting.supModule) { |
| | | if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { |
| | | group.subButton.syncComponentId = '' |
| | | if (group.subButton.execSuccess === 'grid') { |
| | | group.subButton.execSuccess = 'mainline' |
| | |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | |
| | | |
| | | // 数据缓存设置 |
| | | if (config.cacheUseful === 'true') { |
| | | if (!['day', 'hour'].includes(config.timeUnit)) { |
| | | if (!['day', 'hour', 'minute'].includes(config.timeUnit)) { |
| | | config.timeUnit = 'day' |
| | | } |
| | | config.cacheTime = config.cacheTime || 1 |
| | |
| | | item.search = Utils.initSearchVal(item.search) |
| | | } |
| | | |
| | | let mutil = false |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | mutil = true |
| | | item.setting.supModule = item.supNodes[0].componentId |
| | | } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { |
| | | let pid = item.setting.supModule.pop() |
| | |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | cell.$toolbtn = true |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | return true |
| | | }) |
| | |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : '' |
| | | |
| | | if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) { |
| | | item.submit.syncComponentId = '' |
| | | if (item.submit.execSuccess === 'grid') { |
| | | item.submit.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | if (card.setting.click === 'menus') { |
| | | if (card.menus) { |
| | | card.menus = card.menus.filter(m => !!m.MenuID) |
| | | if (card.menus.length === 0) { |
| | | card.menus = null |
| | | } |
| | | } |
| | | if (!card.menus || item.subtype !== 'datacard' || card.$cardType === 'extendCard') { |
| | | card.setting.click = '' |
| | | } |
| | | } else if (card.setting.click === 'menu') { |
| | | if (!Array.isArray(card.setting.menu)) { |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | |
| | | if (item.subtype === 'dualdatacard' && card.$cardType !== 'extendCard') { |
| | | if (card.backSetting && card.backSetting.click === 'menu') { |
| | | if (!Array.isArray(card.backSetting.menu)) { |
| | | card.backSetting.click = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!card.backElements || card.backElements.length === 0) return |
| | | |
| | |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | | } |
| | | |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : '' |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' |
| | | |
| | | if (group.subButton.syncComponentId === item.setting.supModule) { |
| | | if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { |
| | | group.subButton.syncComponentId = '' |
| | | if (group.subButton.execSuccess === 'grid') { |
| | | group.subButton.execSuccess = 'mainline' |
| | |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | |
| | | static propTypes = { |
| | | title: PropTypes.string, |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | url: PropTypes.string |
| | | } |
| | | |
| | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateSubTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false, |
| | | BID: '', |
| | | BData: '' |
| | |
| | | config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | BID: this.props.BID || '', |
| | |
| | | absFields, |
| | | statFields, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | |
| | | loadData = (id) => { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, search, loadCustomApi, hasReqFields } = this.state |
| | | const { setting, BID, search, hasReqFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | } |
| | | } |
| | | |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (this.props.Tab.supMenu && !BID) { // 主表ID不存在时,不查询子表 |
| | | this.setState({ |
| | | data: [], |
| | |
| | | }) |
| | | MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') |
| | | return |
| | | } else if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource(searches) |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = (searches) => { |
| | | const { setting, BID } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, searches, BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting, BID } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) |
| | | } else { |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.props.MenuID, |
| | | MenuName: this.props.Tab.label, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | item.$Index = start + index + '' |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | getStatFieldsValue = (searches) => { |
| | | const { setting, BID, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, BID, BData, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state |
| | | const { config, BID, BData, setting, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | {loadingview && <Spin />} |
| | | {searchlist && searchlist.length ? |
| | | <SubSearch BID={BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null |
| | | {config && config.search && config.search.length ? |
| | | <SubSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config && config.charts ? <Row className="chart-view" gutter={16}> |
| | | {/* 视图组 */} |
| | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateSubTabTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false |
| | | } |
| | | |
| | |
| | | config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | absFields, |
| | | statFields, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | } |
| | | |
| | | loadData = (id) => { |
| | | const { setting, search, hasReqFields, loadCustomApi } = this.state |
| | | const { setting, search, hasReqFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | |
| | | selectedData: [] |
| | | }) |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource(searches) |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = (searches) => { |
| | | const { setting } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, searches, this.props.BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.props.BID) |
| | | } else { |
| | | let name = this.props.Tab ? (this.props.Tab.label || '') : '' |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.props.MenuID, |
| | | MenuName: name, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | item.$Index = start + index + '' |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | |
| | | const { BID } = this.props |
| | | const { setting, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state |
| | | const { config, setting, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> |
| | | {loadingview && <Spin />} |
| | | {searchlist && searchlist.length ? |
| | | <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null |
| | | {config && config.search && config.search.length ? |
| | | <SubSearch BID={this.props.BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config ? <div style={{minHeight: '25px'}}> |
| | | <SubAction |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', this.state.selines) |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | |
| | | if (btn.syncComponentId) { |
| | | if (btn.syncComponentId === 'multiComponent') { |
| | | btn.syncComponentIds.forEach((id, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('reloadData', id) |
| | | }, 20 * i) |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | } |
| | | } |
| | | |
| | | if (btn.switchTab && btn.switchTab.length > 0) { |
| | | let id = btn.switchTab[btn.switchTab.length - 1] |
| | | let node = document.getElementById('tab' + id) |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', []) |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | if (btn.syncComponentId) { |
| | | if (btn.syncComponentId === 'multiComponent') { |
| | | btn.syncComponentIds.forEach((id, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('reloadData', id) |
| | | }, 20 * i) |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | } |
| | | } |
| | | |
| | | if (btn.switchTab && btn.switchTab.length > 0) { |
| | | let id = btn.switchTab[btn.switchTab.length - 1] |
| | |
| | | }) |
| | | window.open(url) |
| | | } else if (btn.pageTemplate === 'custom') { |
| | | if (/#\/iframe\//.test(btn.url)) { |
| | | let menu = { |
| | | MenuID: btn.uuid, |
| | | MenuName: btn.label, |
| | | type: 'iframe', |
| | | OpenType: 'newtab', |
| | | src: btn.url.replace(/@userid@/ig, sessionStorage.getItem('UserID')).replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) |
| | | } |
| | | MKEmitter.emit('modifyTabs', menu) |
| | | |
| | | return |
| | | } |
| | | |
| | | let url = btn.url |
| | | let con = '?' |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import qs from 'qs' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd' |
| | | |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = selectedData && selectedData[0] ? selectedData[0] : null |
| | | if (btn.formType === 'counter') { |
| | | if (btn.formType === 'counter' || btn.formType === 'count_line') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null |
| | | if (btn.formType === 'counter') { |
| | | if (btn.formType === 'counter' || btn.formType === 'count_line') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | |
| | | return |
| | | } |
| | | } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { |
| | | if (btn.OpenType === 'form' && btn.formType === 'count_line') { |
| | | return |
| | | } |
| | | // 接口类型错误 |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | let _params = [] |
| | | |
| | | if ( btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce' ) { |
| | | let param = { |
| | | func: btn.innerFunc || '' |
| | | let param = {} |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | let ids = data.map(d => { return d[setting.primaryKey] || ''}) |
| | | ids = ids.filter(Boolean) |
| | | primaryId = ids.join(',') |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId // 设置主键参数 |
| | | } |
| | | |
| | |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, btn.method, param, btn.cross).then(res => { |
| | | let _params = { |
| | | url: url, |
| | | method: btn.method || 'post' |
| | | } |
| | | |
| | | if (btn.cross === 'true') { |
| | | if (JSON.stringify(param) !== '{}') { |
| | | if (btn.stringify === 'qs') { |
| | | _params.data = qs.stringify(param) |
| | | } else if (btn.stringify === 'JSON') { |
| | | _params.data = param |
| | | } else { |
| | | _params.data = JSON.stringify(param) |
| | | } |
| | | } |
| | | } else { |
| | | let _url = url |
| | | if (JSON.stringify(param) !== '{}') { |
| | | if (_params.method === 'get') { |
| | | let keys = Object.keys(param).map(key => `${key}=${param[key]}`) |
| | | _url = _url + '?' + keys.join('&') |
| | | } else if (_params.method === 'post') { |
| | | if (btn.stringify === 'qs') { |
| | | _params.data = qs.stringify(param) |
| | | } else if (btn.stringify === 'JSON') { |
| | | _params.data = param |
| | | } else { |
| | | _params.data = JSON.stringify(param) |
| | | } |
| | | } |
| | | } |
| | | |
| | | _url = _url.replace(/&/ig, '%26') |
| | | |
| | | _params.url = '/trans/redirect?rd=' + _url + '&method=' + _params.method |
| | | |
| | | _params.method = 'post' |
| | | } |
| | | |
| | | Api.directRequest(_params).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | |
| | | MKEmitter.emit('refreshDebugTable') |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | if (btn.syncComponentId) { |
| | | if (btn.syncComponentId === 'multiComponent') { |
| | | btn.syncComponentIds.forEach((id, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('reloadData', id) |
| | | }, 20 * i) |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | } |
| | | } |
| | | |
| | | if (tabId) { |
| | | MKEmitter.emit('reloadMenuView', tabId, 'table') |
| | |
| | | if (!res.oa_access_token) return |
| | | |
| | | params.forEach(n => { |
| | | Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { |
| | | Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { |
| | | if (verify.wxNoteCallback === 'true') { |
| | | let msg = re.errmsg || '' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | changeLineCount = (count) => { |
| | | const { btn, selectedData } = this.props |
| | | const { disabled } = this.state |
| | | |
| | | if (disabled) return |
| | | |
| | | let data = selectedData || [] |
| | | |
| | | if (data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectline'], |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({count}, () => { |
| | | MKEmitter.emit('refreshLineData', btn.$menuId, btn, data[0].$$uuid, count) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loadingNumber, loadingTotal, loading, disabled, hidden, check, count } = this.state |
| | |
| | | return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> |
| | | } else if (btn.formType === 'counter') { |
| | | return <MkCounter count={count} disabled={disabled} btn={btn} onChange={this.changeCount}/> |
| | | } else if (btn.formType === 'count_line') { |
| | | return <MkCounter count={count} disabled={disabled} btn={btn} onChange={this.changeLineCount}/> |
| | | } else if (btn.formType === 'radio') { |
| | | return <Checkbox className={btn.checkType || ''} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> |
| | | } else { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | plus = () => { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | submit = () => { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(count) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | render() { |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | if (btn.syncComponentId) { |
| | | if (btn.syncComponentId === 'multiComponent') { |
| | | btn.syncComponentIds.forEach((id, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('reloadData', id) |
| | | }, 20 * i) |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getPop = () => { |
| | |
| | | if (unload) return |
| | | |
| | | if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', fieldMap.get(action.setting.focus).uuid) |
| | | }, 500) |
| | | let focusItem = fieldMap.get(action.setting.focus) |
| | | |
| | | if (focusItem.type === 'text' || focusItem.type === 'number') { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | | }, 50) |
| | | } else { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | | }, 500) |
| | | } |
| | | } |
| | | |
| | | if (deForms.length > 0) { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Col, Row } from 'antd' |
| | | import { Col, Row, Switch } from 'antd' |
| | | import { CheckOutlined } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | } |
| | | } |
| | | |
| | | onChange = (val) => { |
| | | if (val) { |
| | | let keys = [] |
| | | this.state.options.forEach(item => { |
| | | if (item.$disabled) return |
| | | |
| | | keys.push(item.$value) |
| | | }) |
| | | |
| | | this.setState({ |
| | | selectKeys: keys |
| | | }, () => { |
| | | this.props.onChange(keys.join(',')) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | selectKeys: [] |
| | | }, () => { |
| | | this.props.onChange('') |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { config, options } = this.state |
| | | |
| | |
| | | if (options.length * config.width > 24) { |
| | | extend += ' mutile-line' |
| | | } |
| | | if (config.border === 'hide') { |
| | | extend += ' border-hide' |
| | | } |
| | | |
| | | return ( |
| | | <div className={'check-card-form-box ' + extend}> |
| | | {config.checkAll === 'show' && options.length > 3 ? <Switch size="small" onChange={this.onChange}/> : null} |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |
| | |
| | | .check-card-form-box { |
| | | margin-top: 5px; |
| | | position: relative; |
| | | .card-cell { |
| | | position: relative; |
| | | border: 1px solid #bcbcbc; |
| | | background: #ffffff; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | line-height: 1.5; |
| | | transition: all 0.3s; |
| | |
| | | position: relative; |
| | | border: 1px solid transparent; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | min-height: 35px; |
| | | min-height: 32px; |
| | | cursor: pointer; |
| | | |
| | | .anticon-check { |
| | |
| | | .anticon-check { |
| | | display: inline-block; |
| | | } |
| | | } |
| | | |
| | | .ant-switch { |
| | | position: absolute; |
| | | top: -22px; |
| | | right: 0px; |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | .card-cell.disabled { |
| | |
| | | .card-cell, .card-pic-cell { |
| | | cursor: not-allowed; |
| | | } |
| | | } |
| | | .check-card-form-box.border-hide { |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .check-card-form-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | .advance-button { |
| | | position: absolute; |
| | | left: 0; |
| | |
| | | import './index.scss' |
| | | |
| | | const MutilForm = asyncSpinComponent(() => import('./advanceform')) |
| | | const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheckCard')) |
| | | const MKCheckCard = asyncComponent(() => import('./mkCheckCard')) |
| | | const MKCheck = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheck')) |
| | | const MKSwitch = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkSwitch')) |
| | | const MKSelect = asyncComponent(() => import('./mkSelect')) |
| | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id,用于查询下拉选择项 |
| | | searchlist: PropTypes.array, // 搜索条件列表 |
| | | config: PropTypes.object, // 组件配置信息(自定义页面) |
| | | setting: PropTypes.object, // 组件配置信息(自定义页面) |
| | | refreshdata: PropTypes.func // 刷新数据 |
| | | } |
| | | |
| | |
| | | sign = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, searchlist, setting } = this.props |
| | | const { config } = this.props |
| | | |
| | | let _searchlist = [] |
| | | let fieldMap = new Map() |
| | |
| | | let hasReqFields = false |
| | | |
| | | let forbid = false // header中不设置高级搜索 |
| | | let _setting = {showAdv: false, show: false} |
| | | let _setting = {showAdv: false, show: false, style: null} |
| | | |
| | | if (setting) { |
| | | _setting.show = setting.show !== 'false' |
| | | _setting.float = setting.float || 'left' |
| | | _setting.advanceType = setting.advanceType || 'modal' |
| | | _setting.advWidth = setting.advanceWidth || 1000 |
| | | _setting.placement = setting.drawerPlacement || 'right' |
| | | _setting.ratio = setting.searchRatio || 6 |
| | | _setting.labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3 |
| | | if (config.wrap) { |
| | | _setting.show = config.wrap.show !== 'false' |
| | | _setting.advanceType = config.wrap.advanceType || 'modal' |
| | | _setting.advWidth = config.wrap.advanceWidth || 1000 |
| | | _setting.placement = config.wrap.drawerPlacement || 'right' |
| | | _setting.ratio = config.wrap.searchRatio || 6 |
| | | _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 |
| | | _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} |
| | | _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} |
| | | _setting.style = null |
| | | } else if (config) { |
| | | if (config.wrap) { |
| | | _setting.show = config.wrap.show !== 'false' |
| | | _setting.advanceType = config.wrap.advanceType || 'modal' |
| | | _setting.advWidth = config.wrap.advanceWidth || 1000 |
| | | _setting.placement = config.wrap.drawerPlacement || 'right' |
| | | _setting.ratio = config.wrap.searchRatio || 6 |
| | | _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 |
| | | _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} |
| | | _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} |
| | | _setting.borderRadius = config.wrap.borderRadius |
| | | } |
| | | _setting.style = null |
| | | |
| | | if (config.type === 'search') { |
| | | _setting.float = config.wrap.float || 'left' |
| | | _setting.style = config.style |
| | | } else if (config.type === 'table') { |
| | | _setting.float = 'left' |
| | | } else { |
| | | _setting.float = 'right' |
| | | _setting.show = false |
| | | forbid = true |
| | | } |
| | | _setting.borderRadius = config.wrap.borderRadius |
| | | } |
| | | |
| | | if (config.type === 'search') { |
| | | _setting.float = config.wrap.float || 'left' |
| | | _setting.style = config.style |
| | | } else if (config.type === 'table') { |
| | | _setting.float = 'left' |
| | | } else { |
| | | _setting.float = 'right' |
| | | _setting.show = false |
| | | forbid = true |
| | | } |
| | | |
| | | if (_setting.advanceType === 'drawer' && _setting.advWidth) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (searchlist) { |
| | | _searchlist = fromJS(searchlist).toJS() |
| | | } else if (config) { |
| | | _searchlist = fromJS(config.search).toJS() |
| | | } |
| | | _searchlist = fromJS(config.search).toJS() |
| | | |
| | | _searchlist.forEach(item => { |
| | | if (item.linkField) { |
| | |
| | | |
| | | // 数据源查询语句 |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | if (item.multiple === 'dropdown') { |
| | | item.parentField = 'pid' |
| | | } |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | |
| | | } |
| | | } |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | |
| | | if (item.type === 'checkcard' && item.multiple === 'dropdown' && item.resourceType === '0') { |
| | | this.resetCheckcard(item) |
| | | } |
| | | } |
| | | |
| | | fieldMap.set(item.field, item) |
| | |
| | | this.improveSearch(mainItems, localItems) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | resetCheckcard = (item) => { |
| | | let _options = [] |
| | | let _others = [] |
| | | item.oriOptions.forEach(op => { |
| | | if (op.pid === item.mark) { |
| | | _options.push(op) |
| | | } else { |
| | | _others.push(op) |
| | | } |
| | | }) |
| | | |
| | | _options = _options.map(op => { |
| | | op.children = [] |
| | | |
| | | _others = _others.filter(cell => { |
| | | if (cell.pid === op.$value) { |
| | | op.children.push(cell) |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | op.subIds = op.children.map(cell => cell.$value) |
| | | |
| | | return op |
| | | }) |
| | | |
| | | item.oriOptions = _options |
| | | item.options = _options |
| | | } |
| | | |
| | | // 查询下拉菜单 |
| | |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | |
| | | if (item.type === 'checkcard' && item.multiple === 'dropdown') { |
| | | this.resetCheckcard(item) |
| | | } |
| | | } |
| | | |
| | | if (item.linkField) { |
| | |
| | | content: '*'; |
| | | } |
| | | } |
| | | .check-card-form-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | .search-button { |
| | | min-height: 55px; |
| | | .ant-btn-link, .ant-btn-link:hover, .ant-btn-link:active{ |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Col, Row, Dropdown, Menu } from 'antd' |
| | | import { CheckOutlined } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | class MKCheckCard extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | selectKeys: null, |
| | | config: null, |
| | | options: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | let selectKeys = config.initval |
| | | let initlength = 0 |
| | | if (config.multiple === 'true') { |
| | | selectKeys = config.initval ? config.initval.split(',') : [] |
| | | initlength = selectKeys.length |
| | | selectKeys = this.filterVals(config.options, selectKeys) |
| | | } |
| | | |
| | | if (!config.selectStyle && config.backgroundColor) { |
| | | config.selectStyle = 'custom' |
| | | } else if (!config.selectStyle) { |
| | | config.selectStyle = 'background' |
| | | } |
| | | |
| | | if (config.display === 'picture' && !config.picratio) { // 兼容旧数据 |
| | | config.picratio = config.ratio || '1:1' |
| | | } |
| | | |
| | | config.selectClass = ` mk-${config.selectStyle} ` |
| | | config.fields = config.fields || [] |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | options: fromJS(config.options).toJS(), |
| | | selectKeys: selectKeys |
| | | }, () => { |
| | | if (config.multiple === 'true' && selectKeys.length < initlength) { |
| | | this.props.onChange(selectKeys.join(',')) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | |
| | | if (config.linkField) { |
| | | MKEmitter.addListener('mkFP', this.mkFormHandle) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { config, selectKeys } = this.state |
| | | |
| | | if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) { |
| | | if (config.multiple === 'true') { |
| | | let keys = this.filterVals(nextProps.config.options, fromJS(selectKeys).toJS()) |
| | | if (keys.length < selectKeys.length) { |
| | | this.setState({ |
| | | selectKeys: keys |
| | | }, () => { |
| | | this.props.onChange(keys.join(',')) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, oriOptions: nextProps.config.oriOptions}, |
| | | options: fromJS(nextProps.config.options).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('mkFP', this.mkFormHandle) |
| | | } |
| | | |
| | | filterVals = (options, vals) => { |
| | | if (options.length === 0 || vals.length === 0) return vals |
| | | |
| | | let ops = options.map(item => item.$value) |
| | | |
| | | vals = vals.filter(val => ops.includes(val)) |
| | | |
| | | return vals |
| | | } |
| | | |
| | | mkFormHandle = (uuid, parentId, level) => { |
| | | if (uuid !== this.state.config.uuid) return |
| | | |
| | | const { config } = this.state |
| | | |
| | | let options = config.oriOptions.filter(option => option.ParentID === parentId) |
| | | |
| | | if (config.multiple === 'true') { |
| | | this.setState({ |
| | | options, |
| | | selectKeys: [] |
| | | }) |
| | | this.props.onChange('') |
| | | } else { |
| | | let _option = options[0] ? options[0] : null |
| | | let val = _option ? _option.$value : '' |
| | | |
| | | this.setState({ |
| | | options, |
| | | selectKeys: val |
| | | }) |
| | | |
| | | let other = {} |
| | | |
| | | if (config.subFields && _option) { |
| | | config.subFields.forEach((n, i) => { |
| | | other[n.field] = _option[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, _option[n.field]) |
| | | }, i * 5) |
| | | }) |
| | | } |
| | | |
| | | this.props.onChange(val, other) |
| | | |
| | | if (level < 7 && config.linkFields) { |
| | | config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, val, level + 1) |
| | | }, (i + 1) * 70) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | changeCard = (item) => { |
| | | const { selectKeys, config } = this.state |
| | | |
| | | if (config.multiple === 'true') { |
| | | let keys = [] |
| | | if (selectKeys.includes(item.$value)) { |
| | | keys = selectKeys.filter(key => key !== item.$value) |
| | | } else { |
| | | keys = [...selectKeys, item.$value] |
| | | } |
| | | |
| | | this.setState({ |
| | | selectKeys: keys |
| | | }, () => { |
| | | this.props.onChange(keys.join(',')) |
| | | }) |
| | | } else if (selectKeys !== item.$value) { |
| | | let other = {} |
| | | config.subFields && config.subFields.forEach((n, i) => { |
| | | other[n.field] = item[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, item[n.field]) |
| | | }, i * 5) |
| | | }) |
| | | config.linkFields && config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, item.$value, 0) |
| | | }, (i + 1) * 100) |
| | | }) |
| | | |
| | | this.setState({ |
| | | selectKeys: item.$value |
| | | }, () => { |
| | | this.props.onChange(item.$value, other) |
| | | }) |
| | | } else { |
| | | let other = {} |
| | | config.linkFields && config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, '', 0) |
| | | }, (i + 1) * 100) |
| | | }) |
| | | |
| | | this.setState({ |
| | | selectKeys: '' |
| | | }, () => { |
| | | this.props.onChange('', other) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | getCards = () => { |
| | | const { selectKeys, options, config } = this.state |
| | | const { display, width, fields, picratio, multiple, backgroundColor, selectStyle, selectClass } = config |
| | | |
| | | if (options.length === 0) { |
| | | return null |
| | | } else if (display === 'color') { |
| | | return options.map(item => { |
| | | let _active = false |
| | | if (multiple === 'true') { |
| | | _active = selectKeys.includes(item.$value) |
| | | } else { |
| | | _active = selectKeys === item.$value |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-color-cell' + (_active ? ' active' : '')} style={{background: item.$color}} onClick={() => this.changeCard(item)}> |
| | | {fields.map(col => { |
| | | return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | <CheckOutlined /> |
| | | </div> |
| | | </Col> |
| | | }) |
| | | } else if (display === 'picture') { |
| | | let paddingTop = '100%' |
| | | if (picratio === '4:3') { |
| | | paddingTop = '75%' |
| | | } else if (picratio === '3:2') { |
| | | paddingTop = '66.7%' |
| | | } else if (picratio === '16:9') { |
| | | paddingTop = '56.25%' |
| | | } |
| | | |
| | | return options.map(item => { |
| | | let _active = false |
| | | if (multiple === 'true') { |
| | | _active = selectKeys.includes(item.$value) |
| | | } else { |
| | | _active = selectKeys === item.$value |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-pic-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)} style={{paddingTop, backgroundImage: `url(${item.$url})`}}> |
| | | <div className="content-wrap"> |
| | | <div className="content-center"> |
| | | {fields.map(col => { |
| | | return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | </div> |
| | | <CheckOutlined /> |
| | | </div> |
| | | </div> |
| | | </Col> |
| | | }) |
| | | } else { |
| | | let _style = selectStyle === 'custom' ? {backgroundColor} : null |
| | | |
| | | if (multiple === 'dropdown') { |
| | | return options.map(item => { |
| | | if (item.children.length) { |
| | | return <Col span={width} key={item.key}> |
| | | <Dropdown |
| | | overlayClassName="mk-search-card" |
| | | overlay={ |
| | | <Menu> |
| | | {item.children.map((cell, index) => (<Menu.Item className={selectKeys === cell.$value ? ' active' : ''} key={index} onClick={() => this.changeCard(cell)}>{cell[fields[0].field]}</Menu.Item>))} |
| | | </Menu>} |
| | | placement="bottomCenter" |
| | | > |
| | | <div className={'card-cell' + (selectKeys && (selectKeys === item.$value || item.subIds.includes(selectKeys)) ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}> |
| | | <div className="bg-mask" style={_style}></div> |
| | | {fields.map(col => { |
| | | return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | </div> |
| | | </Dropdown> |
| | | </Col> |
| | | |
| | | } else { |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-cell' + (selectKeys === item.$value ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}> |
| | | <div className="bg-mask" style={_style}></div> |
| | | {fields.map(col => { |
| | | return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | </div> |
| | | </Col> |
| | | } |
| | | }) |
| | | } else { |
| | | return options.map(item => { |
| | | let _active = false |
| | | if (multiple === 'true') { |
| | | _active = selectKeys.includes(item.$value) |
| | | } else { |
| | | _active = selectKeys === item.$value |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-cell' + (_active ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}> |
| | | <div className="bg-mask" style={_style}></div> |
| | | {fields.map(col => { |
| | | return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | | </div> |
| | | </Col> |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { config, options } = this.state |
| | | |
| | | let extend = '' |
| | | |
| | | if (options.length * config.width > 24) { |
| | | extend += ' mutile-line' |
| | | } |
| | | if (config.border === 'hide') { |
| | | extend += ' border-hide' |
| | | } |
| | | |
| | | return ( |
| | | <div className={'check-card-form-wrap ' + extend}> |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MKCheckCard |
New file |
| | |
| | | .check-card-form-wrap { |
| | | margin-top: 5px; |
| | | .card-cell { |
| | | position: relative; |
| | | border: 1px solid #bcbcbc; |
| | | background: #ffffff; |
| | | border-radius: 4px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | line-height: 1.5; |
| | | transition: all 0.3s; |
| | | cursor: pointer; |
| | | |
| | | .bg-mask { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | opacity: 0.6; |
| | | border-radius: 4px; |
| | | background-color: transparent; |
| | | transition: opacity 0.3s; |
| | | } |
| | | } |
| | | |
| | | .content-line { |
| | | display: block; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | position: relative; |
| | | z-index: 1; |
| | | line-height: 1.5; |
| | | } |
| | | .card-cell.mk-background.active { |
| | | border-color: var(--mk-sys-color); |
| | | background: var(--mk-sys-color); |
| | | span { |
| | | color: #ffffff!important; |
| | | } |
| | | } |
| | | .card-cell.mk-background.active::after { |
| | | content: ' '; |
| | | position: absolute; |
| | | display: table; |
| | | border: 2px solid #ffffff; |
| | | border-top: 0; |
| | | border-left: 0; |
| | | bottom: 0; |
| | | right: 10px; |
| | | width: 6px; |
| | | height: 12px; |
| | | transform: rotate(45deg) scale(1) translate(-50%, -50%); |
| | | } |
| | | .card-cell.mk-font.active { |
| | | border-color: var(--mk-sys-color); |
| | | span { |
| | | color: var(--mk-sys-color)!important; |
| | | } |
| | | } |
| | | .card-cell.mk-custom { |
| | | border-color: transparent; |
| | | } |
| | | .card-cell.mk-custom.active { |
| | | .bg-mask { |
| | | opacity: 1; |
| | | } |
| | | } |
| | | .card-pic-cell { |
| | | position: relative; |
| | | border: 1px solid #e8e8e8; |
| | | border-radius: 4px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | margin-bottom: 2px; |
| | | line-height: 1.5; |
| | | cursor: pointer; |
| | | transition: all 0.3s; |
| | | |
| | | .content-wrap { |
| | | position: absolute; |
| | | top: 6px; |
| | | left: 6px; |
| | | right: 6px; |
| | | bottom: 6px; |
| | | .content-center { |
| | | position: relative; |
| | | top: 50%; |
| | | transform: translate(0px, -50%); |
| | | } |
| | | } |
| | | .anticon-check { |
| | | display: none; |
| | | position: absolute; |
| | | color: #ffffff; |
| | | border-radius: 20px; |
| | | padding: 3px; |
| | | width: 18px; |
| | | height: 18px; |
| | | font-size: 12px; |
| | | right: -2px; |
| | | bottom: -2px; |
| | | background: var(--mk-sys-color); |
| | | } |
| | | } |
| | | |
| | | .card-color-cell { |
| | | position: relative; |
| | | border: 1px solid transparent; |
| | | border-radius: 4px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | min-height: 32px; |
| | | cursor: pointer; |
| | | |
| | | .anticon-check { |
| | | display: none; |
| | | position: absolute; |
| | | color: #ffffff; |
| | | border-radius: 20px; |
| | | padding: 3px; |
| | | width: 18px; |
| | | height: 18px; |
| | | font-size: 12px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | background: var(--mk-sys-color); |
| | | } |
| | | } |
| | | |
| | | .card-pic-cell.active, .card-color-cell.active { |
| | | .anticon-check { |
| | | display: inline-block; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .check-card-form-wrap.mutile-line { |
| | | .card-cell { |
| | | margin-bottom: 12px; |
| | | } |
| | | .card-pic-cell { |
| | | margin-bottom: 12px; |
| | | } |
| | | .card-color-cell { |
| | | margin-bottom: 12px; |
| | | } |
| | | } |
| | | |
| | | .check-card-form-wrap { |
| | | .card-cell.mk-background:hover { |
| | | border-color: var(--mk-sys-color); |
| | | background: var(--mk-sys-color); |
| | | span { |
| | | color: #ffffff!important; |
| | | } |
| | | } |
| | | .card-cell.mk-font:hover { |
| | | border-color: var(--mk-sys-color); |
| | | span { |
| | | color: var(--mk-sys-color)!important; |
| | | } |
| | | } |
| | | |
| | | .card-cell.mk-custom:not(.active):hover { |
| | | .bg-mask { |
| | | opacity: 0.8; |
| | | } |
| | | } |
| | | .card-pic-cell:hover { |
| | | border-color: var(--mk-sys-color); |
| | | box-shadow: 0px 0px 4px var(--mk-sys-color); |
| | | } |
| | | } |
| | | .check-card-form-wrap.border-hide { |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | | .mk-search-card { |
| | | .ant-dropdown-menu-item { |
| | | min-width: 80px; |
| | | } |
| | | .ant-dropdown-menu-item.active { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | |
| | | } |
| | | }) |
| | | |
| | | if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置前置脚本,不可启用!' |
| | |
| | | }) |
| | | } |
| | | |
| | | checkBtns = (card) => { |
| | | card.action.forEach(cell => { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | |
| | | card.cols.forEach(col => { |
| | | if (col.type !== 'custom') return |
| | | |
| | | col.elements.forEach(cell => { |
| | | if (cell.hidden === 'true' || cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | submitConfig = (_resolve, config) => { |
| | | let tbs = [] |
| | | config.components.forEach(item => { |
| | |
| | | if (tab.components[0].$tables) { |
| | | tbs.push(...tab.components[0].$tables) |
| | | } |
| | | |
| | | this.checkBtns(tab.components[0]) |
| | | }) |
| | | } else { |
| | | if (item.$tables) { |
| | | tbs.push(...item.$tables) |
| | | } |
| | | this.checkBtns(item) |
| | | } |
| | | }) |
| | | |
| | |
| | | popActions.push({origin: btn.uuid, linkTab: btn.linkTab || '', uuid: _btn.uuid, name: newCon.name, label: btn.label}) |
| | | } else if (_btn.OpenType === 'tab') { |
| | | if (btn.tabTemplate === 'FormTab') { |
| | | if (newCon.isMain !== true) { |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | return |
| | | } |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | return |
| | | // if (newCon.isMain !== true) { |
| | | // errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | // return |
| | | // } |
| | | |
| | | delete _btn.tabTemplate |
| | | // delete _btn.tabTemplate |
| | | |
| | | _btn.MenuID = 'tab' + md5(btn.uuid).substr(3) |
| | | _btn.MenuName = this.baseMsg.MenuName + '-' + btn.label |
| | | _btn.MenuNo = this.baseMsg.MenuNo + '_' + _btn.MenuID.substr(-4).toUpperCase() |
| | | _btn.hidden = _btn.hidden || 'false' |
| | | _btn.tabType = 'CustomPage' |
| | | _btn.linkmenu = [this.baseMsg.fstMenuId, this.baseMsg.parentId, _btn.MenuID] |
| | | // _btn.MenuID = 'tab' + md5(btn.uuid).substr(3) |
| | | // _btn.MenuName = this.baseMsg.MenuName + '-' + btn.label |
| | | // _btn.MenuNo = this.baseMsg.MenuNo + '_' + _btn.MenuID.substr(-4).toUpperCase() |
| | | // _btn.hidden = _btn.hidden || 'false' |
| | | // _btn.tabType = 'CustomPage' |
| | | // _btn.linkmenu = [this.baseMsg.fstMenuId, this.baseMsg.parentId, _btn.MenuID] |
| | | |
| | | let _tab = {...btn} |
| | | // let _tab = {...btn} |
| | | |
| | | _tab.MenuID = _btn.MenuID |
| | | _tab.MenuNo = _btn.MenuNo |
| | | _tab.MenuName = _btn.MenuName |
| | | // _tab.MenuID = _btn.MenuID |
| | | // _tab.MenuNo = _btn.MenuNo |
| | | // _tab.MenuName = _btn.MenuName |
| | | |
| | | formTabs.push(_tab) |
| | | // formTabs.push(_tab) |
| | | } else if (!btn.linkmenu || btn.linkmenu.length !== 3) { |
| | | |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | |
| | | } else if (!_card.setting.supModule) { |
| | | _card.errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | |
| | | _card.action.forEach(cell => { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | |
| | | _card.cols.forEach(col => { |
| | | if (col.type !== 'custom') return |
| | | |
| | | col.elements.forEach(cell => { |
| | | if (cell.hidden === 'true' || cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | return _card |
| | | } |
| | |
| | | } |
| | | |
| | | let cls = '' |
| | | if (_options.length * width <= 24 && this.state.appType !== 'mob') { |
| | | if (_options.length * width <= 24) { |
| | | cls = 'no-margin-bottom' |
| | | } |
| | | if (display === 'picture') { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | |
| | | return ( |
| | | <div className="check-card-edit-box" style={{marginTop: '5px'}}> |
| | | <div className={'check-card-edit-box border-' + (config.border || 'show')} style={{marginTop: '5px'}}> |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |
| | |
| | | position: relative; |
| | | border: 1px solid #bcbcbc; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 12px; |
| | | |
| | | .bg-mask { |
| | |
| | | .card-color-cell { |
| | | border: 1px solid transparent; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | margin-bottom: 12px; |
| | | min-height: 35px; |
| | | min-height: 32px; |
| | | } |
| | | |
| | | .content-line { |
| | |
| | | .no-margin-bottom { |
| | | margin-bottom: 2px; |
| | | } |
| | | } |
| | | .check-card-edit-box.border-hide { |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | |
| | | reOptions.intertype = this.state.interTypeOptions |
| | | |
| | | if (intertype === 'custom') { |
| | | shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') |
| | | shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') |
| | | if (this.record.procMode === 'system') { |
| | | shows.push('sql', 'sqlType') |
| | | } else if (this.record.procMode === 'inner') { |
| | |
| | | } |
| | | |
| | | values.uuid = editItem ? editItem.uuid : '' |
| | | values.position = values.position || (editItem ? editItem.position : 'front') |
| | | |
| | | if (type === 'fullscreen' && editItem) { |
| | | values.status = editItem.status || 'true' |
| | |
| | | }) |
| | | |
| | | if (reset) { |
| | | message.warn('数值类型均为必填。') |
| | | message.warning('数值类型均为必填。') |
| | | } |
| | | |
| | | this.setState({verify: {...verify, columns}}, () => { |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | }) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql, |
| | | // position: record.position || 'back' |
| | | sql: record.sql |
| | | }) |
| | | } |
| | | |
| | |
| | | <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Form.Item label={'表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | <Form.Item label="表名" style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {sheet} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={10}> |
| | | <Form.Item label={'报错字段'} style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | <Form.Item label="报错字段" style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | ErrorCode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT), retmsg |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | <Form.Item label="可用字段"> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'系统变量,系统会定义变量并赋值。'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip> |
| | | {usefulfields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'搜索条件,请按照@xxx@格式使用。'}>, {usefulfields}</Tooltip> : null} |
| | | {linefields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'表单及行变量,系统会定义变量并赋值。'}>, {linefields}</Tooltip> : null} |
| | | </Form.Item> |
| | | </Col> |
| | | {/* <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | <Form.Item style={{marginBottom: 0}} label={ |
| | | <Tooltip placement="bottomLeft" title={'自定义脚本与默认sql位置关系。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 执行位置 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('position', { |
| | | initialValue: 'front' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="init">初始化</Radio> |
| | | <Radio value="front">sql前</Radio> |
| | | <Radio value="back">sql后</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> */} |
| | | <Col span={8}> |
| | | <Form.Item style={{marginBottom: 0}} label={'快捷添加'}> |
| | | <Form.Item style={{marginBottom: 0}} label="快捷添加"> |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | |
| | | </Button> |
| | | </Col> |
| | | <Col span={24} className="sql"> |
| | | <Form.Item label={'sql'}> |
| | | <Form.Item label="sql"> |
| | | {getFieldDecorator('sql', { |
| | | initialValue: '', |
| | | rules: [ |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || 10} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .check-card-edit-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | } |
| | | .ant-form-explain { |
| | | display: none; |
| | |
| | | } |
| | | |
| | | state = { |
| | | openType: null, // 搜索条件显示类型 |
| | | resourceType: null, // 下拉搜索时,选项来源类型 |
| | | formlist: null, // 表单 |
| | | cFields: [], |
| | | textTooltip: '字段名可以使用逗号分隔,进行综合搜索', |
| | | formlist: null |
| | | } |
| | | |
| | | record = {} |
| | |
| | | } else { |
| | | reRequired.fields = true |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options', 'fields', 'selectStyle') |
| | | shows.push('options', 'fields', 'selectStyle', 'border') |
| | | } else if (this.record.resourceType === '1') { // 数据源 |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle') |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle', 'border') |
| | | } |
| | | if (this.record.selectStyle === 'custom') { |
| | | shows.push('backgroundColor') |
| | | } |
| | | if (this.record.multiple === 'dropdown') { |
| | | shows.push('mark') |
| | | } |
| | | } |
| | | shows.push('linkField') |
| | |
| | | <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | </AutoComplete> |
| | | } else { |
| | | content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} onChange={(e) => {this.optionChange(item.key, e.target.value)}}/> |
| | | } |
| | | } else if (item.type === 'number') { |
| | | rules = [ |
| | |
| | | if (this.record.linkField) { |
| | | type = 'link' |
| | | } |
| | | content = <DataTable type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> |
| | | content = <DataTable type={type} multiple={this.record.multiple} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> |
| | | } |
| | | } else if (item.type === 'fields') { |
| | | span = 24 |
| | |
| | | values.options = [] |
| | | } |
| | | } else if (values.type === 'checkcard') { |
| | | if (values.multiple === 'dropdown' && values.display !== 'text') { |
| | | values.multiple = 'false' |
| | | } |
| | | |
| | | if (values.resourceType === '0') { |
| | | values.options = values.options || [] |
| | | values.options = values.options.map(m => { |
| | | m.ParentID = m.ParentID || '' |
| | | m.pid = m.pid || '' |
| | | return m |
| | | }) |
| | | |
| | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import './index.scss' |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | let tables = config.tables ? fromJS(config.tables).toJS() : [] |
| | | |
| | | window.GLOB.publicTables = tables |
| | | |
| | | this.setState({ |
| | | selectedTables: config.tables ? fromJS(config.tables).toJS() : [] |
| | | selectedTables: tables |
| | | }, () => { |
| | | this.gettableFields() |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('publicTableChange', this.publicTableChange) |
| | | this.gettables() |
| | | } |
| | | |
| | | publicTableChange = (table, type) => { |
| | | if (type === 'plus') { |
| | | this.onTableChange(table) |
| | | } else if (type === 'del') { |
| | | this.deleteTable(table) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | let _table = tables.filter(item => item.TbName === value)[0] |
| | | let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] |
| | | if (!isSelected) { |
| | | let _tables = [...selectedTables, _table] |
| | | |
| | | window.GLOB.publicTables = _tables |
| | | |
| | | this.setState({ |
| | | selectedTables: [...selectedTables, _table] |
| | | selectedTables: _tables |
| | | }) |
| | | |
| | | let _config = {...config, tables: [...selectedTables, _table]} |
| | | let _config = {...config, tables: _tables} |
| | | |
| | | Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { |
| | | if (res.status) { |
| | |
| | | let _tables = selectedTables.filter(item => item.TbName !== table.TbName) |
| | | let _fields = tableFields.filter(item => item.tableName !== table.TbName) |
| | | |
| | | window.GLOB.publicTables = _tables |
| | | |
| | | this.setState({ |
| | | selectedTables: _tables, |
| | | tableFields: _fields |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('publicTableChange', this.publicTableChange) |
| | | } |
| | | |
| | | render() { |
| | |
| | | {/* 表名添加 */} |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label> |
| | | <Tooltip placement="topLeft" title="此处可以添加页面配置相关的常用表,可通过工具栏中的添加按钮,可批量添加表格相关字段。"> |
| | | <Tooltip placement="topLeft" title="此处可以添加页面配置相关的常用表。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 表名 |
| | | </Tooltip> |
| | |
| | | } |
| | | }) |
| | | |
| | | if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置前置脚本,不可启用!' |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd' |
| | | import { CopyOutlined, EditOutlined, DeleteOutlined, SnippetsOutlined, SwapOutlined } from '@ant-design/icons' |
| | | import { CopyOutlined, EditOutlined, DeleteOutlined, SwapOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | import PasteForm from '@/templates/zshare/pasteform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import CusSwitch from './cusSwitch' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const PasteBoard = asyncComponent(() => import('@/components/pasteboard')) |
| | | const EditableContext = React.createContext() |
| | | const { confirm } = Modal |
| | | let dragingIndex = -1 |
| | |
| | | state = { |
| | | data: [], |
| | | editingKey: '', |
| | | visible: false, |
| | | editLineId: '', |
| | | columns: [] |
| | | } |
| | |
| | | 操作 |
| | | <span className="copy-control"> |
| | | {actions.includes('copy') ? <CopyOutlined title="复制" onClick={() => this.copy()} /> : null} |
| | | {actions.includes('copy') ? <SnippetsOutlined title="粘贴" onClick={this.paste} /> : null} |
| | | {actions.includes('copy') ? <PasteBoard getPasteValue={this.pasteSubmit}/> : null} |
| | | {actions.includes('clear') ? <DeleteOutlined title="清空" onClick={this.clear} /> : null} |
| | | </span> |
| | | </div>), |
| | |
| | | } |
| | | } |
| | | |
| | | paste = () => { |
| | | this.setState({visible: true}) |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | pasteSubmit = (res, callback) => { |
| | | const { type } = this.props |
| | | const { columns } = this.state |
| | | let data = fromJS(this.state.data).toJS() |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (res.copyType === 'columns' && type === 'datasourcefield') { |
| | | res.type = 'array' |
| | | res.data = [] |
| | | res.columns.forEach(col => { |
| | | if (!col.field) return |
| | | if (col.type === 'number') { |
| | | let datatype = 'Int' |
| | | if (col.decimal) { |
| | | datatype = `Decimal(18,${col.decimal})` |
| | | } |
| | | |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | decimal: col.decimal, |
| | | label: col.label, |
| | | type: 'number', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } else { |
| | | let datatype = 'Nvarchar(50)' |
| | | let fieldlength = 50 |
| | | if (col.fieldlength && [10, 20, 50, 100, 256, 512, 1024, 2048].includes(col.fieldlength)) { |
| | | fieldlength = col.fieldlength |
| | | datatype = `Nvarchar(${fieldlength})` |
| | | } |
| | | |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | fieldlength: fieldlength, |
| | | label: col.label, |
| | | type: 'text', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | if (res.copyType === 'columns' && type === 'datasourcefield') { |
| | | res.type = 'array' |
| | | res.data = [] |
| | | res.columns.forEach(col => { |
| | | if (!col.field) return |
| | | if (col.type === 'number') { |
| | | let datatype = 'Int' |
| | | if (col.decimal) { |
| | | datatype = `Decimal(18,${col.decimal})` |
| | | } |
| | | }) |
| | | } else if (res.key !== type) { |
| | | message.warning('配置信息格式错误!') |
| | | return |
| | | } |
| | | |
| | | if (res.type === 'line') { |
| | | let unique = true |
| | | res.data.uuid = Utils.getuuid() |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | decimal: col.decimal, |
| | | label: col.label, |
| | | type: 'number', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } else { |
| | | let datatype = 'Nvarchar(50)' |
| | | let fieldlength = 50 |
| | | if (col.fieldlength && [10, 20, 50, 100, 256, 512, 1024, 2048].includes(col.fieldlength)) { |
| | | fieldlength = col.fieldlength |
| | | datatype = `Nvarchar(${fieldlength})` |
| | | } |
| | | |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | fieldlength: fieldlength, |
| | | label: col.label, |
| | | type: 'text', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } |
| | | }) |
| | | } else if (res.key !== type) { |
| | | message.warning('配置信息格式错误!') |
| | | return |
| | | } |
| | | |
| | | if (res.type === 'line') { |
| | | let unique = true |
| | | res.data.uuid = Utils.getuuid() |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | |
| | | if (col.strict) { |
| | | let key = res.data[col.dataIndex].toLowerCase() |
| | | let _index = data.findIndex(item => key === item[col.dataIndex].toLowerCase()) |
| | | |
| | | if (_index > -1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: col.title + '不可重复!', |
| | | duration: 5 |
| | | }) |
| | | unique = false |
| | | } |
| | | } else { |
| | | let _index = data.findIndex(item => res.data[col.dataIndex] === item[col.dataIndex]) |
| | | |
| | | if (_index > -1) { |
| | |
| | | }) |
| | | unique = false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (!unique) return |
| | | if (!unique) return |
| | | |
| | | data.unshift(res.data) |
| | | this.setState({ data, editingKey: '', visible: false }, () => { |
| | | this.props.onChange(data) |
| | | }) |
| | | } else if (res.type === 'array') { |
| | | res.data.forEach(cell => { |
| | | let unique = true |
| | | cell.uuid = Utils.getuuid() |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | data.unshift(res.data) |
| | | this.setState({ data, editingKey: '', editLineId: res.data.uuid || '' }, () => { |
| | | this.props.onChange(data) |
| | | }) |
| | | } else if (res.type === 'array') { |
| | | res.data.forEach(cell => { |
| | | let unique = true |
| | | cell.uuid = Utils.getuuid() |
| | | columns.forEach(col => { |
| | | if (col.unique !== true || !unique) return |
| | | |
| | | if (col.strict) { |
| | | let _index = data.findIndex(item => cell[col.dataIndex].toLowerCase() === item[col.dataIndex].toLowerCase()) |
| | | |
| | | if (_index > -1) { |
| | | unique = false |
| | | } |
| | | } else { |
| | | let _index = data.findIndex(item => cell[col.dataIndex] === item[col.dataIndex]) |
| | | |
| | | if (_index > -1) { |
| | | unique = false |
| | | } |
| | | }) |
| | | |
| | | if (!unique) return |
| | | |
| | | data.push(cell) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ data, editingKey: '', visible: false }, () => { |
| | | this.props.onChange(data) |
| | | }) |
| | | } |
| | | message.success('粘贴成功。') |
| | | }) |
| | | if (!unique) return |
| | | |
| | | data.push(cell) |
| | | }) |
| | | |
| | | this.setState({ data, editingKey: '' }, () => { |
| | | this.props.onChange(data) |
| | | }) |
| | | } |
| | | |
| | | callback() |
| | | message.success('粘贴成功。') |
| | | } |
| | | |
| | | handleStatus = (record) => { |
| | |
| | | })} |
| | | /> |
| | | </DndProvider> |
| | | {/* 信息粘贴 */} |
| | | <Modal |
| | | title="粘贴" |
| | | visible={this.state.visible} |
| | | width={600} |
| | | maskClosable={false} |
| | | onOk={this.pasteSubmit} |
| | | onCancel={() => {this.setState({visible: false})}} |
| | | destroyOnClose |
| | | > |
| | | <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> |
| | | </Modal> |
| | | </div> |
| | | </EditableContext.Provider> |
| | | ) |
| | |
| | | }) |
| | | } |
| | | |
| | | let muloptions = [{ |
| | | value: 'false', |
| | | text: '单选' |
| | | }, { |
| | | value: 'true', |
| | | text: '多选' |
| | | }, { |
| | | value: 'dropdown', |
| | | text: '下拉菜单' |
| | | }] |
| | | |
| | | if (appType !== '') { |
| | | muloptions = [{ |
| | | value: 'false', |
| | | text: '单选' |
| | | }, { |
| | | value: 'true', |
| | | text: '多选' |
| | | }] |
| | | if (card.multiple === 'dropdown') { |
| | | card.multiple = 'false' |
| | | } |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | min: 0, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width === 0 ? 0 : (card.width || 4), |
| | | tooltip: '栅格布局,每行等分为24列。注:当宽度为0时,元素根据内容自适应', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | key: 'multiple', |
| | | label: '选择形式', |
| | | initVal: card.multiple || 'false', |
| | | tooltip: appType === '' ? '使用下拉菜单时,选项会依据 pid 组织数据的上下级关系,二级选项会下拉展示。注:1、显示为文本时有效;2、使用数据源请返回 pid 字段。' : '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '单选' |
| | | }, { |
| | | value: 'true', |
| | | text: '多选' |
| | | }] |
| | | options: muloptions |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hide', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'selectStyle', |
| | | label: '选中效果', |
| | | tooltip: '背景及文字变化时会使用系统色。', |
| | |
| | | initVal: card.backgroundColor || '', |
| | | tooltip: '设置背景色后,选中效果由背景颜色控制。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'mark', |
| | | label: '顶级标识', |
| | | initVal: card.mark || '', |
| | | tooltip: 'pid与顶级标识相同时,视为顶级节点。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | initVal: card.callbackFunc || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | min: 0, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width === 0 ? 0 : (card.width || 4), |
| | | tooltip: '栅格布局,每行等分为24列。注:当宽度为0时,元素根据内容自适应', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | key: 'dataSource', |
| | | label: '数据源', |
| | | initVal: card.dataSource || '', |
| | | placeholder: '系统变量:mk_departmentcode、mk_organization、mk_user_type。', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | }, { |
| | | value: 'adaptive', |
| | | text: '自适应' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hide', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'checkAll', |
| | | label: '全选', |
| | | initVal: card.checkAll || 'hide', |
| | | tooltip: '可多选的选项卡是否显示全选开关,注:当选项大于3个时有效。', |
| | | required: false, |
| | | forbid: appType !== '', |
| | | options: [{ |
| | | value: 'hide', |
| | | text: '隐藏' |
| | | }, { |
| | | value: 'show', |
| | | text: '显示' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon || '', |
| | | required: false, |
| | | forbid: type === 'CalendarPage' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: '上级标签', |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus, |
| | | forbid: type === 'CalendarPage' |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs, |
| | | forbid: type === 'CalendarPage' |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false, |
| | | forbid: type === 'CalendarPage' |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | forbid: type !== 'CommonTable' && type !== 'CalendarPage', |
| | | forbid: type !== 'CommonTable', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | !is(fromJS(this.props.fields), fromJS(nextProps.fields)) || |
| | | !is(fromJS(this.props.linkSubFields), fromJS(nextProps.linkSubFields)) || |
| | | this.props.display !== nextProps.display || |
| | | (nextProps.multiple && this.props.multiple !== nextProps.multiple) || |
| | | this.props.type !== nextProps.type |
| | | ) { |
| | | this.setState({editingKey: ''}, () => { |
| | |
| | | } |
| | | |
| | | getCloumns = () => { |
| | | const { display, fields, linkSubFields, transfield, type } = this.props |
| | | const { display, fields, linkSubFields, transfield, type, multiple } = this.props |
| | | let columns = [] |
| | | let keys = ['ParentID'] |
| | | let keys = ['ParentID', 'pid'] |
| | | |
| | | if (display === 'picture') { |
| | | columns.push({ |
| | |
| | | editable: true, |
| | | }) |
| | | |
| | | if (multiple === 'dropdown' && display === 'text') { |
| | | columns.unshift({ |
| | | title: 'pid', |
| | | dataIndex: 'pid', |
| | | editable: true, |
| | | }) |
| | | } |
| | | |
| | | if (type === 'link') { |
| | | columns.unshift({ |
| | | title: 'ParentID', |
| | |
| | | this.setState({loading: false}) |
| | | }) |
| | | return |
| | | } else if (fields.filter(f => f.toLowerCase() === 'parentid').length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段名不可使用parentid!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({loading: true}, () => { |
| | | this.setState({loading: false}) |
| | | }) |
| | | return |
| | | } else if (fields.filter(f => f.toLowerCase() === 'pid').length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段名不可使用pid!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({loading: true}, () => { |
| | | this.setState({loading: false}) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ data }, () => { |
| | |
| | | } else { |
| | | reRequired.fields = true |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options', 'fields', 'selectStyle') |
| | | shows.push('options', 'fields', 'selectStyle', 'border') |
| | | } else if (this.record.resourceType === '1') { // 数据源 |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle') |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle', 'border') |
| | | } |
| | | if (this.record.selectStyle === 'custom') { |
| | | shows.push('backgroundColor') |
| | |
| | | shows.push('decimal') |
| | | } |
| | | } else { |
| | | shows.push('fieldlength') |
| | | shows.push('fieldlength', 'checkAll') |
| | | reTooltip.initval = '添加多个初始值请使用逗号分隔。' |
| | | } |
| | | |
| | |
| | | if (this.record.type === 'select' || this.record.type === 'link') { |
| | | extra = <span className="add-resource-empty" onClick={this.handleEmpty}>空</span> |
| | | } |
| | | if (item.placeholder) { |
| | | extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> |
| | | } |
| | | |
| | | content = <CodeMirror /> |
| | | } else if (item.type === 'textarea') { |
| | |
| | | cursor: pointer; |
| | | font-size: 14px; |
| | | } |
| | | .resource-public-var { |
| | | position: absolute; |
| | | left: 0px; |
| | | top: -25px; |
| | | font-size: 14px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <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"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ntime || (appType === 'mob' ? 3 : 10)} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <Form.Item label="停留时间"> |
| | | <InputNumber defaultValue={verify.ftime || (appType === 'mob' ? 3 : 10)} 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={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | <Form.Item label="提示编码"> |
| | | <span className="errorval"> -2 </span> |
| | | 执行失败无提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | import nortable from '@/assets/img/normaltable.jpg' |
| | | // import mainsubtable from '@/assets/img/mainsubtable.jpg' |
| | | import treepage from '@/assets/img/treepage.jpg' |
| | | import calendar from '@/assets/img/calendar.jpg' |
| | | import customImg from '@/assets/img/custom.jpg' |
| | | import newpage from '@/assets/img/newpage.jpg' |
| | | import rolemanage from '@/assets/img/rolemanage.jpg' |
| | |
| | | title: '树形页面', |
| | | type: 'TreePage', |
| | | url: treepage, |
| | | baseconfig: '', |
| | | isSystem: true |
| | | }, |
| | | { |
| | | title: '日历', |
| | | type: 'CalendarPage', |
| | | url: calendar, |
| | | baseconfig: '', |
| | | isSystem: true |
| | | }, |
| | |
| | | } else if (item.type === 'tabs') { |
| | | if (item.subtype === 'tabletabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.components[0].uuid === selfId) return |
| | | |
| | | modules.push({ |
| | | value: tab.components[0].uuid, |
| | | label: tab.label, |
| | |
| | | |
| | | return cell |
| | | }) |
| | | } else if (col.editable === 'true' && col.enter) { |
| | | col.enter = md5(commonId + col.enter) |
| | | } else if (col.editable === 'true' && col.enter && col.enter !== '$next' && col.enter !== '$sub') { |
| | | if (/\$next_/.test(col.enter)) { |
| | | col.enter = '$next_' + md5(commonId + col.enter.split('_')[1]) |
| | | } else { |
| | | col.enter = md5(commonId + col.enter) |
| | | } |
| | | } |
| | | |
| | | return col |
| | |
| | | if (btn.anchors && btn.anchors.length > 0) { |
| | | btn.anchors = btn.anchors.map(m => md5(commonId + m)) |
| | | } |
| | | if (btn.syncComponent && btn.syncComponent.length > 0) { |
| | | if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) { |
| | | btn.syncComponents = btn.syncComponents.map(m => { |
| | | m.syncComId = m.syncComId.map(n => md5(commonId + n)) |
| | | return m |
| | | }) |
| | | } else if (btn.syncComponent && btn.syncComponent.length > 0) { |
| | | btn.syncComponent = btn.syncComponent.map(m => md5(commonId + m)) |
| | | } |
| | | } |
| | |
| | | } |
| | | return cell |
| | | }) |
| | | } else if (col.editable === 'true' && col.enter) { // 可编辑表 |
| | | col.enter = md5(commonId + col.enter) |
| | | } else if (col.editable === 'true' && col.enter && col.enter !== '$next' && col.enter !== '$sub') { // 可编辑表 |
| | | if (/\$next_/.test(col.enter)) { |
| | | col.enter = '$next_' + md5(commonId + col.enter.split('_')[1]) |
| | | } else { |
| | | col.enter = md5(commonId + col.enter) |
| | | } |
| | | } |
| | | |
| | | return col |
| | |
| | | static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id) { |
| | | let param = null |
| | | |
| | | if (setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) { |
| | | if (setting.interType === 'system') { |
| | | param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, id, BID) |
| | | } else { |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id) |
| | |
| | | param.PageSize = pageSize |
| | | } |
| | | |
| | | if (setting.interType === 'inner' || (setting.interType === 'custom' && setting.requestMode === 'inner')) { |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (window.GLOB.mkHS) { |
| | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.DateCount = Utils.formatOptions(DateCount) |
| | | |
| | | // 多层结构数据 |
| | | // LText = `SELECT a.id as bid,a.ID,a.workerCode,a.workerName,a.jobName,a.Initials,case when isnull(m.friend_id ,'') ='' then '' |
| | | // when isnull(m.status,0)=10 then '已添加' else '待通过' end as friend_text |
| | | // ,case when images='' then 'http://epc.mk9h.cn/Content/images/upload/img/kane.jpg' else images end as icon FROM |
| | | // (select friend_id,status from oa_mail_list where userid='sso202004100959326131C0805998B6745F886F9' and Initials=case when right('0',1)='0' then Initials else '0' end |
| | | // and status=10 and deleted=0) m |
| | | // inner join (select * from BD_workers where |
| | | // Initials=case when right('0',1)='0' then Initials else '0' end and deleted=0 ) a |
| | | // on a.id=m.friend_id ` |
| | | // param.custom_script = '' |
| | | // param.LText = Utils.formatOptions(LText) |
| | | // param.DateCount = '' |
| | | // param.prm_field = 'workerCode' |
| | | // param.arr_field = 'workerName,jobName' |
| | | // param.tabid = 'ID' |
| | | // param.parid = 'BID' |
| | | // param.sub_name = 'sub_data' |
| | | // param.sub_field = 'BID,friend_text,icon,Initials' |
| | | |
| | | if (setting.sub_field) { |
| | | param.sub_name = setting.subdata |
| | | param.tabid = setting.primaryKey || '' |
| | |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 数据源名称,用于统一查询 |
| | | * @param {Object} setting 数据源设置 |
| | | * @param {String} arrFields 查询字段 |
| | | * @param {Array} search 搜索条件 |
| | | * @param {String} orderBy 排序方式 |
| | | * @param {Number} pageIndex 页码 |
| | | * @param {Number} pageSize 每页数量 |
| | | * @param {String} BID 上级ID |
| | | * @return {Object} param |
| | | */ |
| | | static getPrevQueryParams (setting, search = [], BID) { |
| | | let param = null |
| | | if (setting.procMode !== 'inner') { |
| | | param = this.getDefaultPrevQueryParam(setting, search, BID) |
| | | } else { |
| | | param = Utils.formatCustomMainSearch(search) |
| | | param.func = setting.prevFunc || '' |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统前置脚本 |
| | | */ |
| | | static getDefaultPrevQueryParam (setting, search, BID) { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | exec_type: 'y', |
| | | script_type: 'Y' |
| | | } |
| | | |
| | | let sql = '' |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | setting.preScripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | sql += `${item.sql} |
| | | ` |
| | | }) |
| | | |
| | | if (sql) { |
| | | sql = `/*前置脚本*/ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' |
| | | ${sql} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | allSearch.forEach(item => { |
| | | sql = sql.replace(new RegExp('@' + item.key + '@', 'ig'), `'${item.value}'`) |
| | | }) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | sql = sql.replace(/\$@/ig, '/*') |
| | | sql = sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | sql = sql.replace(/@userName@/ig, `'${userName}'`) |
| | | sql = sql.replace(/@fullName@/ig, `'${fullName}'`) |
| | | |
| | | sql = sql.replace(/@ID@/ig, `''`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | console.info(sql.replace(/\n\s{8}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (window.GLOB.mkHS) { // 函数 sPC_TableData_InUpDe 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (setting.$name) { |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统回调脚本 |
| | | */ |
| | | static getCallBackQueryParams (setting, sql, errSql, BID) { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | exec_type: 'y', |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | let _prevCustomScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) |
| | | Select @ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' |
| | | ${errSql} |
| | | ` |
| | | let _backCustomScript = ` |
| | | ` |
| | | |
| | | setting.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (script.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | sql = _prevCustomScript + sql |
| | | sql = sql + _backCustomScript |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | sql = sql.replace(/\$@/ig, '/*') |
| | | sql = sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | sql = sql.replace(/@ID@/ig, `''`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | console.info(sql.replace(/\n\s{8}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = sql |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | | if (setting.$name) { |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (window.GLOB.mkHS) { // 系统函数云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取回调sql |
| | | */ |
| | | static getCallBackSql (setting, result) { |
| | | let lines = [] |
| | | let pre = setting.callbackType === 'script' ? '@' : '' |
| | | |
| | | let getDefaultSql = (obj, tb, bid, level) => { |
| | | let keys = [] |
| | | let vals = [] |
| | | let subObjs = [] |
| | | let id = Utils.getuuid() |
| | | |
| | | delete obj.$$key |
| | | |
| | | Object.keys(obj).forEach(key => { |
| | | let val = obj[key] |
| | | if (val === null || val === undefined) return |
| | | if (typeof(val) === 'object') { |
| | | if (Array.isArray(val)) { |
| | | val.forEach(item => { |
| | | if (typeof(item) !== 'object' || Array.isArray(item)) return |
| | | if (Object.keys(item).length > 0) { |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | } |
| | | }) |
| | | } else if (Object.keys(val).length > 0) { |
| | | val.$$key = tb + '_' + key |
| | | subObjs.push(val) |
| | | } |
| | | } else { |
| | | if (typeof(val) === 'string') { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | keys.push(key) |
| | | vals.push(`'${val}'`) |
| | | } |
| | | }) |
| | | |
| | | lines.push({ |
| | | table: tb, |
| | | insert: `Insert into ${pre}${tb} (${keys.join(',')},mk_level,mk_id,mk_bid)`, |
| | | select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` |
| | | }) |
| | | |
| | | subObjs.forEach(item => { |
| | | getDefaultSql(item, item.$$key, id, level + 1) |
| | | }) |
| | | } |
| | | |
| | | getDefaultSql(result, setting.cbTable, '', 1) |
| | | |
| | | let lineMap = new Map() |
| | | lines.forEach(line => { |
| | | if (lineMap.has(line.table)) { |
| | | let _line = lineMap.get(line.table) |
| | | _line.selects.push(line.select) |
| | | lineMap.set(line.table, _line) |
| | | } else { |
| | | lineMap.set(line.table, { |
| | | table: line.table, |
| | | insert: line.insert, |
| | | selects: [line.select] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return [...lineMap.values()] |
| | | } |
| | | } |
| | | |
| | |
| | | arrfield.push(item.urlField) |
| | | } else if (item.colorField) { |
| | | arrfield.push(item.colorField) |
| | | } else if (item.parentField) { |
| | | arrfield.push(item.parentField) |
| | | } |
| | | } |
| | | |
| | |
| | | const Header = asyncComponent(() => import('@/menu/header')) |
| | | const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig')) |
| | | const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig')) |
| | | const CalendarPageConfig = asyncLoadComponent(() => import('@/templates/calendarconfig')) |
| | | const FormTabConfig = asyncLoadComponent(() => import('@/templates/formtabconfig')) |
| | | const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) |
| | | const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig')) |
| | |
| | | <Header/> |
| | | {this.state.tabview === 'TreePage' ? |
| | | <TreePageConfig |
| | | menu={this.state.editMenu} |
| | | reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} |
| | | handleView={this.handleView} |
| | | /> : null |
| | | } |
| | | {this.state.tabview === 'CalendarPage' ? |
| | | <CalendarPageConfig |
| | | menu={this.state.editMenu} |
| | | reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} |
| | | handleView={this.handleView} |
| | |
| | | handleMVisible: true, |
| | | sysMenu: _menu |
| | | }) |
| | | } else if (['CommonTable', 'TreePage', 'CalendarPage'].includes(_menu.PageParam.Template)) { |
| | | } else if (['CommonTable', 'TreePage'].includes(_menu.PageParam.Template)) { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) |
| | | |
| | |
| | | } |
| | | _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | window.open(`#/menudesign/${_param}`) |
| | | } else if (['CommonTable', 'TreePage', 'CalendarPage'].includes(cell.type)) { |
| | | } else if (['CommonTable', 'TreePage'].includes(cell.type)) { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Tooltip } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | // import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | <Form {...formItemLayout} style={{paddingRight: '20px'}}> |
| | | <Row gutter={24}> |
| | | <Col span={22}> |
| | | <Form.Item label={'一级菜单'}> |
| | | <Form.Item label="一级菜单"> |
| | | {getFieldDecorator('fstMenuId', { |
| | | initialValue: menu.fstMenuId, |
| | | rules: [ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={22}> |
| | | <Form.Item label={'二级菜单'}> |
| | | <Form.Item label="二级菜单"> |
| | | {getFieldDecorator('ParentID', { |
| | | initialValue: menu.ParentId, |
| | | rules: [ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={22}> |
| | | <Form.Item label={'菜单名称'}> |
| | | <Form.Item label="菜单名称"> |
| | | {getFieldDecorator('MenuName', { |
| | | initialValue: menu.MenuName || '', |
| | | rules: [ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={22}> |
| | | <Form.Item label={'菜单参数'}> |
| | | <Form.Item label="菜单参数"> |
| | | {getFieldDecorator('MenuNo', { |
| | | initialValue: menu.MenuNo || '', |
| | | rules: [ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {menu.Template === 'NewPage' ? <Col span={22}> |
| | | <Form.Item label={'链接地址'}> |
| | | <Form.Item label={ |
| | | <Tooltip overlayStyle={{minWidth: 500}} placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>使用同一单点系统下的其他业务系统,链接格式为:http://<span style={{color: 'orange'}}>******</span>/admin/index.html#/iframe/<span style={{color: 'orange'}}>menuId</span>/<span style={{color: 'orange'}}>userid</span>/<span style={{color: 'orange'}}>loginuid</span>/<span style={{color: 'orange'}}>BID</span>。注:******为域名+虚拟目录;menuId为菜单ID;userid为用户ID(使用@userid@时自动替换为当前系统的userid);loginuid为登录信息(使用@loginuid@时自动替换为当前系统的loginuid);BID是向菜单中的传参,可为空。</div>}><QuestionCircleOutlined className="mk-form-tip" />链接地址</Tooltip> |
| | | }> |
| | | {getFieldDecorator('url', { |
| | | initialValue: menu.url || '', |
| | | rules: [ |
| | |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") |
| | | |
| | | // 获取ip及城市信息 |
| | | // let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, '')) |
| | | // Api.directRequest(ipurl, 'get', null, 'true').then(res => { |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | |
| | | setTimeout(() => { |
| | | Api.delCacheConfig() |
| | | }, 50) |
| | | |
| | | if (window.GLOB.filter) { |
| | | let view = document.getElementById('mk-login-view') |
| | | |
| | |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => { |
| | | Api.directRequest({ |
| | | url: _rduri + '/' + _func, |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |
| | | let box = [] |
| | |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.cloudusername = values.cloudusername.replace(/\t*|\v*|\s*/g, '') |
| | | values.cloudpassword = values.cloudpassword.replace(/\t*|\v*|\s*/g, '') |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | if (activeKey === 'uname_pwd') { |
| | | values.username = values.username.replace(/\t*|\v*|\s*/g, '') |
| | | values.password = values.password.replace(/\t*|\v*|\s*/g, '') |
| | | } else if (activeKey === 'sms_vcode') { |
| | | values.phone = values.phone.replace(/\t*|\v*|\s*/g, '') |
| | | values.vercode = values.vercode.replace(/\t*|\v*|\s*/g, '') |
| | | } |
| | | resolve({type: activeKey, ...values}) |
| | | } else { |
| | | reject(err) |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | sessionStorage.removeItem('appType') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型 |
| | | |
| | | window.GLOB.curDate = moment().format('YYYY-MM-DD') |
| | | window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件 |
| | | window.GLOB.TabsMap = new Map() // 缓存用户操作的标签页 |
| | | window.GLOB.urlFields = [] // url变量 |
| | | window.GLOB.customMenu = null // 保存菜单信息 |
| | | window.GLOB.developing = true |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | if (!sessionStorage.getItem('UserID')) return |
| | | |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | |
| | | if (!error) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import { Spin } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class MkIframe extends Component { |
| | | state = { |
| | | loading: true |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | // const { menuId, userId, loginUid, bid } = this.props.match.params |
| | | |
| | | // sessionStorage.setItem('LoginUID', loginUid) |
| | | } |
| | | |
| | | componentDidMount() { |
| | | // sessionStorage.setItem('ThirdMenu', this.props.match.params.menuId) |
| | | |
| | | // if (sessionStorage.getItem('UserID')) { |
| | | // this.props.history.replace('/main') |
| | | // } else { |
| | | // localStorage.setItem('getSessionStorage', window.GLOB.appkey) |
| | | |
| | | // window.addEventListener('storage', function(event) { |
| | | // if (event.key === 'sessionStorage' && event.newValue && !sessionStorage.getItem('UserID')) { |
| | | // let values = event.newValue |
| | | // values = JSON.parse(values) |
| | | |
| | | // Object.keys(values).forEach(key => { |
| | | // sessionStorage.setItem(key, values[key]) |
| | | // }) |
| | | // } |
| | | // }) |
| | | |
| | | // setTimeout(() => { |
| | | // localStorage.removeItem('getSessionStorage') |
| | | // localStorage.removeItem('sessionStorage') |
| | | |
| | | // if (sessionStorage.getItem('UserID')) { |
| | | // this.props.history.replace('/main') |
| | | // } else { |
| | | // this.props.history.replace('/login') |
| | | // } |
| | | // }, 20) |
| | | // } |
| | | } |
| | | |
| | | render () { |
| | | return ( |
| | | <div className="main-iframe"> |
| | | <Spin size="large" /> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MkIframe |
New file |
| | |
| | | .main-iframe { |
| | | .ant-spin { |
| | | position: absolute; |
| | | left: calc(50vw - 22px); |
| | | top: 45vh; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | sessionStorage.removeItem('editMenuType') |
| | | sessionStorage.removeItem('appType') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | if (memberLevel < 30) return |
| | | |
| | | window.GLOB.developing = true |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | |
| | | window.GLOB.winHeight = 738 |
| | | window.GLOB.shellWidth = 376 |
| | | window.GLOB.shellHeight = 680 |
| | | window.GLOB.curDate = moment().format('YYYY-MM-DD') |
| | | |
| | | let adapters = sessionStorage.getItem('adapter') |
| | | if (adapters) { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | if (!sessionStorage.getItem('UserID')) return |
| | | if (memberLevel < 30) { |
| | | document.getElementById('mk-mob-design-view').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh; height: 100vh; background: #fff;">本应用没有PC端页面的编辑权限,请联系管理员!</div>' |
| | | return |
| | |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | |
| | | if (!error) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | sessionStorage.removeItem('appType') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | if (memberLevel < 30) return |
| | | |
| | | sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型 |
| | | |
| | | window.GLOB.curDate = moment().format('YYYY-MM-DD') |
| | | window.GLOB.TabsMap = new Map() // 缓存用户操作的标签页 |
| | | window.GLOB.CacheIndependent = new Map() |
| | | window.GLOB.urlFields = [] // url变量 |
| | | window.GLOB.customMenu = null // 保存菜单信息 |
| | | window.GLOB.developing = true |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | if (!sessionStorage.getItem('UserID')) return |
| | | if (memberLevel < 30) { |
| | | document.getElementById('mk-pc-design-view').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh; height: 100vh; background: #fff;">本应用没有PC端页面的编辑权限,请联系管理员!</div>' |
| | | return |
| | |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | |
| | | if (!error) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | {getFieldDecorator('timeUnit', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | <Radio value="minute">分钟</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('devError') === 'true') { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | if (!sessionStorage.getItem('UserID')) { |
| | | sessionStorage.removeItem('isEditState') |
| | | sessionStorage.removeItem('appType') |
| | | this.props.history.replace('/login') |
| | | return |
| | | } |
| | | |
| | | sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型 |
| | | |
| | | window.GLOB.curDate = moment().format('YYYY-MM-DD') |
| | | window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件 |
| | | window.GLOB.TabsMap = new Map() // 缓存用户操作的标签页 |
| | | window.GLOB.urlFields = [] // url变量 |
| | | window.GLOB.customMenu = null // 保存菜单信息 |
| | | window.GLOB.developing = true |
| | | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | if (!sessionStorage.getItem('UserID')) return |
| | | |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | setTimeout(() => { |
| | |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | |
| | | if (!error) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | } else if (key === 'parentId') { |
| | | this.props.updateConfig({...config, parentId: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } else if (key === 'OpenType') { |
| | | this.props.updateConfig({...config, OpenType: value}) |
| | | } else if (key === 'hidden') { |