| | |
| | | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", |
| | | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" |
| | | }, |
| | | "sheetjs-style": { |
| | | "version": "0.15.8", |
| | | "resolved": "https://registry.npmjs.org/sheetjs-style/-/sheetjs-style-0.15.8.tgz", |
| | | "integrity": "sha512-/wRiwnq5ck7aO+zLBs+u5JqQK4agUTIGCS0nxgaMjFl6XdlVaaB/RNJcP6S6Efj3+RYbSZuAoyqmSnbzxfT7Kg==", |
| | | "requires": { |
| | | "adler-32": "~1.2.0", |
| | | "cfb": "^1.1.4", |
| | | "codepage": "~1.14.0", |
| | | "commander": "~2.17.1", |
| | | "crc-32": "~1.2.0", |
| | | "exit-on-epipe": "~1.0.1", |
| | | "ssf": "~0.10.3", |
| | | "wmf": "~1.0.1" |
| | | }, |
| | | "dependencies": { |
| | | "cfb": { |
| | | "version": "1.2.2", |
| | | "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", |
| | | "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==", |
| | | "requires": { |
| | | "adler-32": "~1.3.0", |
| | | "crc-32": "~1.2.0" |
| | | }, |
| | | "dependencies": { |
| | | "adler-32": { |
| | | "version": "1.3.1", |
| | | "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz", |
| | | "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==" |
| | | } |
| | | } |
| | | }, |
| | | "commander": { |
| | | "version": "2.17.1", |
| | | "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", |
| | | "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==" |
| | | }, |
| | | "ssf": { |
| | | "version": "0.10.3", |
| | | "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.3.tgz", |
| | | "integrity": "sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w==", |
| | | "requires": { |
| | | "frac": "~1.1.2" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "shell-quote": { |
| | | "version": "1.6.1", |
| | | "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", |
| | |
| | | "string-width": "^1.0.2 || 2 || 3 || 4" |
| | | } |
| | | }, |
| | | "wmf": { |
| | | "version": "1.0.2", |
| | | "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz", |
| | | "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==" |
| | | }, |
| | | "wolfy87-eventemitter": { |
| | | "version": "5.2.9", |
| | | "resolved": "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz", |
| | |
| | | "resolve-url-loader": "3.1.0", |
| | | "sass-loader": "7.2.0", |
| | | "semver": "6.3.0", |
| | | "sheetjs-style": "^0.15.8", |
| | | "spark-md5": "^3.0.1", |
| | | "sql-formatter": "^11.0.2", |
| | | "style-loader": "1.0.0", |
| | |
| | | { |
| | | "appId": "201912040924165801464FF1788654BC5AC73", |
| | | "appkey": "20191106103859640976D6E924E464D029CF0", |
| | | "appId": "202108312122504607B107A83F55B40C98CCF", |
| | | "appkey": "20210831212235413F287EC3BF489424496C8", |
| | | "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", |
| | | "systemType": "", |
| | | "externalDatabase": "", |
| | | "lineColor": "", |
| | | "filter": "false", |
| | | "defaultApp": "mk", |
| | | "defaultApp": "mkindustry", |
| | | "defaultLang": "zh-CN", |
| | | "WXAppID": "", |
| | | "WXminiAppID": "", |
| | |
| | | "transfer": "false", |
| | | "keepPassword": "true", |
| | | "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "MKWMS/" |
| | | "host": "http://demo.mk9h.cn", |
| | | "service": "erp_new/" |
| | | } |
| | |
| | | throw 'CREATE TABLE ERROR' |
| | | }) |
| | | |
| | | tx.executeSql('CREATE TABLE IF NOT EXISTS CACHES (menuid varchar(50), CreateDate varchar(50), LongParam text, CDefine1 varchar(50), CDefine2 varchar(50))', [], () => { |
| | | |
| | | }, () => { |
| | | // eslint-disable-next-line |
| | | throw 'CREATE TABLE ERROR' |
| | | }) |
| | | |
| | | if (window.GLOB.systemType === '') { |
| | | tx.executeSql('CREATE TABLE IF NOT EXISTS FUNCS (func_code varchar(50), key_sql text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 将缓存数据写入websql |
| | | */ |
| | | static writeCacheInWebSql (data) { |
| | | if (!window.GLOB.WebSql) return |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | tx.executeSql(`DELETE FROM CACHES where menuid='${data[0]}'`) |
| | | if (data[2]) { |
| | | tx.executeSql('INSERT INTO CACHES (menuid, CreateDate, LongParam) VALUES (?, ?, ?)', data) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取websql中的配置信息 |
| | | */ |
| | | static getWebSqlCacheConfig (MenuID) { |
| | | if (!window.GLOB.WebSql) return Promise.resolve() |
| | | return new Promise((resolve, reject) => { |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | tx.executeSql(`SELECT * FROM CACHES WHERE menuid='${MenuID}'`, [], (tx, results) => { |
| | | resolve(results.rows[0]) |
| | | }, (tx, results) => { |
| | | console.warn(results) |
| | | resolve() |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 删除websql中超过7天的缓存信息 |
| | | */ |
| | | static delWebSqlCacheConfig (date, type) { |
| | | if (!window.GLOB.WebSql) return |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | if (type === 'all') { |
| | | tx.executeSql('DELETE FROM CACHES') |
| | | } else { |
| | | tx.executeSql(`DELETE FROM CACHES where CreateDate<'${date}'`) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 打开IndexedDB |
| | | */ |
| | | static openIndexDB (db) { |
| | | try { |
| | | let request = window.indexedDB.open(db, 1) |
| | | let request = window.indexedDB.open(db, 2) |
| | | request.onerror = () => { |
| | | console.warn('IndexedDB 初始化失败!') |
| | | } |
| | |
| | | let objectStore = window.GLOB.IndexDB.createObjectStore('configs', { keyPath: 'id' }) |
| | | objectStore.createIndex('menuid', 'menuid', { unique: false }) |
| | | objectStore.createIndex('userid', 'userid', { unique: false }) |
| | | } |
| | | if (!window.GLOB.IndexDB.objectStoreNames.contains('caches')) { |
| | | window.GLOB.IndexDB.createObjectStore('caches', { keyPath: 'menuid' }) |
| | | } |
| | | if (window.GLOB.systemType === '' && !window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | |
| | | static writeInIndexDB (data) { |
| | | if (!window.GLOB.IndexDB || !data) return |
| | | |
| | | let request = window.GLOB.IndexDB.transaction(['configs'], 'readwrite') |
| | | .objectStore('configs') |
| | | .add(data) |
| | | window.GLOB.IndexDB.transaction(['configs'], 'readwrite').objectStore('configs').add(data) |
| | | } |
| | | |
| | | request.onerror = () => { |
| | | window.GLOB.IndexDB = null |
| | | /** |
| | | * @description 将数据写入IndexedDB |
| | | */ |
| | | static writeCacheInIndexDB (data) { |
| | | if (!window.GLOB.IndexDB) return |
| | | |
| | | let objectStore = window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches') |
| | | objectStore.delete(data.menuid) |
| | | |
| | | if (data.LongParam) { |
| | | objectStore.add(data) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取IndexedDB中的配置信息 |
| | | */ |
| | | static getIndexDBCacheConfig (MenuID) { |
| | | if (!window.GLOB.IndexDB) return Promise.resolve() |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | let request = window.GLOB.IndexDB.transaction(['caches']).objectStore('caches').get(MenuID) |
| | | |
| | | request.onerror = () => { |
| | | resolve() |
| | | } |
| | | |
| | | request.onsuccess = () => { |
| | | resolve(request.result) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 删除IndexedDB中超过7天的缓存信息 |
| | | */ |
| | | static delIndexDBCacheConfig (date, type) { |
| | | if (!window.GLOB.IndexDB) return |
| | | |
| | | if (type === 'all') { |
| | | window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches').clear() |
| | | } else { |
| | | let request = window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches').openCursor() |
| | | |
| | | request.onsuccess = (e) => { |
| | | let cursor = e.target.result |
| | | if (cursor) { |
| | | if (cursor.value.CreateDate < date) { |
| | | cursor.delete() |
| | | } |
| | | cursor.continue() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * @description 手机号验证码登录 |
| | | */ |
| | | getphoneusermsg (phoneNo, checkcode, isCloud = false, ipAddress, city) { |
| | | getphoneusermsg (phoneNo, checkcode, isCloud = false) { |
| | | let param = { |
| | | // func: 'webapi_login', |
| | | mob: phoneNo, |
| | |
| | | check_code: checkcode, |
| | | way_no: 'sms_vcode', |
| | | systemType: options.sysType, |
| | | login_city: city, |
| | | login_id_address: ipAddress, |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | device_id: localStorage.getItem('SessionUid'), |
| | | appkey: window.GLOB.appkey || '' |
| | |
| | | /** |
| | | * @description 登录系统, 获取用户信息 |
| | | */ |
| | | getusermsg (username, password, isCloud = false, ipAddress, city) { |
| | | getusermsg (username, password, isCloud = false) { |
| | | let param = { |
| | | // func: 'webapi_login', |
| | | UserName: username, |
| | | systemType: options.sysType, |
| | | Type: 'S', |
| | | login_city: city, |
| | | login_id_address: ipAddress, |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | device_id: localStorage.getItem('SessionUid'), |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | |
| | | }) |
| | | } |
| | | |
| | | delCacheConfig (type = '') { |
| | | let date = moment().subtract(7, 'days').format('YYYY-MM-DD') |
| | | CacheUtils.delWebSqlCacheConfig(date, type) |
| | | CacheUtils.delIndexDBCacheConfig(date, type) |
| | | } |
| | | |
| | | writeCacheConfig (menuid, data) { |
| | | if (!menuid) return |
| | | let date = moment().format('YYYY-MM-DD') |
| | | let _data = data ? JSON.stringify(data) : '' |
| | | |
| | | CacheUtils.writeCacheInWebSql([menuid, date, _data]) |
| | | CacheUtils.writeCacheInIndexDB({menuid, CreateDate: date, LongParam: _data}) |
| | | } |
| | | |
| | | getLCacheConfig (menuid) { |
| | | return new Promise((resolve, reject) => { |
| | | if (window.GLOB.WebSql) { |
| | | CacheUtils.getWebSqlCacheConfig(menuid).then(res => { |
| | | if (res && res.LongParam) { |
| | | let _data = JSON.parse(res.LongParam) |
| | | if (_data.length === 0) { |
| | | resolve() |
| | | } else { |
| | | resolve(_data) |
| | | } |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } else if (window.GLOB.IndexDB) { |
| | | CacheUtils.getIndexDBCacheConfig(menuid).then(res => { |
| | | if (res && res.LongParam) { |
| | | let _data = JSON.parse(res.LongParam) |
| | | if (_data.length === 0) { |
| | | resolve() |
| | | } else { |
| | | resolve(_data) |
| | | } |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统版本信息,启用或更新websql |
| | | */ |
| | |
| | | resolve() |
| | | } else { |
| | | Api.updateAppVersion() |
| | | Api.delCacheConfig('all') |
| | | setTimeout(() => { |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | let _style = {...card.style} |
| | | |
| | | if (cards.type === 'carousel') { |
| | | _style.height = cards.style.height |
| | | _style.height = cards.wrap.height |
| | | } |
| | | |
| | | let control = true |
| | |
| | | _style = resetStyle(_style) |
| | | |
| | | return ( |
| | | <div className="ant-col ant-col-24"> |
| | | <div className="card-item" style={_style}> |
| | | <CardCellComponent cards={cards} cardCell={card} elements={card.elements} updateElement={this.updateCard}/> |
| | | <div className="card-control"> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <PlusOutlined className="plus" title="添加元素" onClick={this.addElement}/> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton}/> |
| | | {cards.type !== 'timeline' ? <NormalForm title="卡片设置" width={800} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> : <NodesWrap card={card} updateMenus={this.updateNodes}/>} |
| | | {cards.type !== 'timeline' ? <CopyComponent type="cardcell" card={card}/> : null} |
| | | <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {control ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <ArrowLeftOutlined className="plus" title="前移" onClick={() => this.props.move(card, 'left')} /> |
| | | <ArrowRightOutlined className="close" title="后移" onClick={() => this.props.move(card, 'right')} /> |
| | | </div> |
| | | } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> |
| | | <SwapOutlined id={card.uuid + 'swap'}/> |
| | | </Popover> : null} |
| | | {control ? <DeleteOutlined className="close" title="删除卡片" onClick={() => this.props.deleteElement(card)} /> : null} |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined/> |
| | | </Popover> |
| | | </div> |
| | | <div className="card-item" style={_style}> |
| | | <CardCellComponent cards={cards} cardCell={card} elements={card.elements} updateElement={this.updateCard}/> |
| | | <div className="card-control"> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <PlusOutlined className="plus" title="添加元素" onClick={this.addElement}/> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton}/> |
| | | {cards.type !== 'timeline' ? <NormalForm title="卡片设置" width={800} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> : <NodesWrap card={card} updateMenus={this.updateNodes}/>} |
| | | {cards.type !== 'timeline' ? <CopyComponent type="cardcell" card={card}/> : null} |
| | | <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {control ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <ArrowLeftOutlined className="plus" title="前移" onClick={() => this.props.move(card, 'left')} /> |
| | | <ArrowRightOutlined className="close" title="后移" onClick={() => this.props.move(card, 'right')} /> |
| | | </div> |
| | | } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> |
| | | <SwapOutlined id={card.uuid + 'swap'}/> |
| | | </Popover> : null} |
| | | {control ? <DeleteOutlined className="close" title="删除卡片" onClick={() => this.props.deleteElement(card)} /> : null} |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined/> |
| | | </Popover> |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | |
| | | pasteSubmit = () => { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox'] |
| | | let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox'] |
| | | let types = { |
| | | login: '登录', |
| | | navbar: '导航栏', |
| | |
| | | } |
| | | |
| | | if (appType !== 'mob') { |
| | | options.push('editable', 'antvG6') |
| | | options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') |
| | | } |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | |
| | | |
| | | let resource = this.props.form.getFieldValue('dataSource') || '' |
| | | |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | if (field === text) { |
| | | resource = `select '' as ${field} union all \n${resource}` |
| | | } else { |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | } |
| | | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | |
| | | pasteSubmit = () => { |
| | | const { Tab } = this.props |
| | | let appType = sessionStorage.getItem('appType') |
| | | let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox'] |
| | | let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox'] |
| | | let types = { |
| | | login: '登录', |
| | | navbar: '导航栏', |
| | |
| | | if (appType === 'mob') { |
| | | options.push('menubar') |
| | | } else { |
| | | options.push('editable', 'antvG6') |
| | | options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') |
| | | } |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | |
| | | <NormalForm title="基本设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="normaltable" card={card}/> |
| | | <CopyComponent type="tree" card={card}/> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { config } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.sync = values.sync || 'false' |
| | | |
| | | if (['navbar', 'balcony', 'menubar', 'interface'].includes(config.type)) { |
| | | values.onload = 'true' |
| | | } |
| | | |
| | | // 数据源前端验证 |
| | | if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { |
| | | let _quot = values.dataresource.match(/'{1}/g) |
| | |
| | | |
| | | pasteSubmit = () => { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'iframe', 'sandbox'] |
| | | let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'iframe', 'sandbox'] |
| | | |
| | | if (appType === 'mob') { |
| | | if (sessionStorage.getItem('editMenuType') !== 'popview') { |
| | |
| | | options.push('menubar') |
| | | } |
| | | } else { |
| | | options.push('editable', 'antvG6') |
| | | options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') |
| | | } |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | |
| | | } |
| | | |
| | | this.callback = callback |
| | | let card = fromJS(style).toJS() |
| | | let borposition = 'outer' |
| | | |
| | | if (!card.borderWidth) { |
| | | if (card.borderLeftWidth) { |
| | | borposition = 'left' |
| | | } else if (card.borderRightWidth) { |
| | | borposition = 'right' |
| | | } else if (card.borderTopWidth) { |
| | | borposition = 'top' |
| | | } else if (card.borderBottomWidth) { |
| | | borposition = 'bottom' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | fonts: fonts, |
| | | card: fromJS(style).toJS(), |
| | | card: card, |
| | | options: options, |
| | | borposition: 'outer', |
| | | borposition: borposition, |
| | | backgroundImage |
| | | }) |
| | | window.GLOB.styling = true |
| | |
| | | label={<BorderOutlined title="边框位置"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Radio.Group className="border-position" defaultValue={'outer'} onChange={(e) => this.setState({borposition: e.target.value})}> |
| | | <Radio.Group className="border-position" defaultValue={borposition} onChange={(e) => this.setState({borposition: e.target.value})}> |
| | | <Radio value="outer"><BorderOuterOutlined title="外边框"/></Radio> |
| | | <Radio value="left"><BorderLeftOutlined title="左边框"/></Radio> |
| | | <Radio value="right"><BorderRightOutlined title="右边框"/></Radio> |
| | |
| | | }) |
| | | |
| | | return true |
| | | } else { |
| | | item.name = (this.props.MenuName || '') |
| | | } |
| | | |
| | | // 搜索条件初始化 |
| | |
| | | checked: false |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } else if (_sync && initdata) { |
| | | _data = initdata |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | this.loaded = true |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } |
| | | |
| | | _data.$$BID = BID || '' |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } |
| | | } |
| | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({data: _data}) |
| | | } |
| | |
| | | this.setState({ |
| | | data: {$$BID: BID || '', $$BData: BData, $$empty: true}, |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | supComs: null |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && data) { |
| | | if (_sync && data) { |
| | | _data = data[_config.dataName] || [] |
| | | _sync = false |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | this.setState({ |
| | | supComs, |
| | | selected, |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | const { config, arr_field, pageIndex, search, BID, BData, selected } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | |
| | | selected: 'false', |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } else if (_sync && initdata) { |
| | | _data = initdata |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | this.loaded = true |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } |
| | | |
| | | _data.$$BID = BID || '' |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({data: _data}, () => { |
| | | if (selected !== 'false') { |
| | |
| | | this.setState({ |
| | | data: {$$BID: BID || '', $$BData: BData, $$empty: true}, |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | BData: '' |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | /** |
| | | * @description 初始化处理 |
| | | * 1、 initdata 为打印时使用的数据集 |
| | |
| | | |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | this.setState({ |
| | | sync: _sync, |
| | | BID: BID || '', |
| | |
| | | }, () => { |
| | | this.loadData('timer') |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | data: [], |
| | | total: 0 |
| | | }) |
| | | |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = [] |
| | | |
| | | if (type === 'plus') { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | visible: false |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | } |
| | | |
| | | if (_data) { |
| | | this.loaded = true |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | item.$Index = index + 1 |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.openModal() |
| | |
| | | data: [], |
| | | loading: false |
| | | }) |
| | | |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | |
| | | visible: false |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting && _config.wrap.datatype === 'dynamic') { |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } else if (_sync && initdata) { |
| | | _data = initdata |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } |
| | | |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (config.wrap.display === 'modal') { |
| | |
| | | this.setState({ |
| | | data: {$$BID: BID || '', $$BData: BData, $$empty: true} |
| | | }) |
| | | |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | |
| | | state = { |
| | | config: null, |
| | | data: null, |
| | | BID: '', |
| | | BData: '', |
| | | plot: null, |
| | |
| | | empty: true |
| | | } |
| | | |
| | | data = [] |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | } |
| | | |
| | | if (_sync && data) { |
| | | _data = data[config.dataName] || [] |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | | }) |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | |
| | | |
| | | let that = this |
| | | |
| | | if (config.plot.subtype === 'mindmap') { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | } |
| | | |
| | | this.setState({sync: false}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config, sync } = this.state |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.data.length > 0) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {} |
| | | }, () => { |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | | this.data = [] |
| | | this.handleData() |
| | | }) |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = result.data || [] |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | loading: false |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS(result.data || []))) { |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | } |
| | | |
| | | getdata = () => { |
| | | const { plot, data, config, BData } = this.state |
| | | const { plot, config, BData } = this.state |
| | | |
| | | let root = { |
| | | label: 'Root', |
| | |
| | | let _options = [] |
| | | let logMap = new Map() |
| | | |
| | | data.forEach(item => { |
| | | this.data.forEach(item => { |
| | | let pval = item[plot.parentField] |
| | | let val = item[plot.valueField] |
| | | let label = item[plot.labelField] || '' |
| | |
| | | } |
| | | |
| | | handleData = () => { |
| | | const { plot, data } = this.state |
| | | |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | |
| | | if (!data || data.length === 0) { |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { plot } = this.state |
| | | |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | } else { |
| | | this.setState({empty: false}) |
| | |
| | | transfield: {}, // 字段名称翻译 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | search: null, // 搜索条件 |
| | | vFields: [], // 数值字段 |
| | | vstFields: null, // 统计数据值字段信息 |
| | | chart: null |
| | | } |
| | | |
| | | data = [] |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | let _data = null |
| | | let _sync = config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | _data = data[config.dataName] || [] |
| | | if (_sync && data) { |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | } else if (_sync && initdata) { |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | vFields: vFields, |
| | | vstFields: vstFields, |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | this.setState({sync: false}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.data.length > 0) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [] |
| | | }, () => { |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | | this.data = [] |
| | | this.handleData() |
| | | }) |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS(result.data || []))) { |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | * 3、柱状图数据补齐 |
| | | */ |
| | | getdata = () => { |
| | | const { data, plot, vFields, config } = this.state |
| | | const { plot, vFields, config } = this.state |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | | |
| | | let _data = [] |
| | | let _cdata = fromJS(data).toJS() |
| | | let _cdata = fromJS(this.data).toJS() |
| | | |
| | | if (plot.repeat === 'average') { |
| | | let _mdata = new Map() |
| | |
| | | * @description 统计数据预处理 |
| | | */ |
| | | getStaticMsg = () => { |
| | | const { plot, vstFields, data } = this.state |
| | | const { plot, vstFields } = this.state |
| | | |
| | | let percent = false |
| | | let decimal = vstFields ? vstFields.decimal : 0 |
| | |
| | | percent = true |
| | | } |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | | |
| | | let _data = [] |
| | | let _cdata = fromJS(data).toJS() |
| | | let _cdata = fromJS(this.data).toJS() |
| | | |
| | | if (plot.repeat === 'average') { |
| | | let _mdata = new Map() |
| | |
| | | chartId: Utils.getuuid(), // 图表Id |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: {}, // 数据 |
| | | chart: null |
| | | } |
| | | |
| | | data = {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | } |
| | | |
| | | if (_sync && data) { |
| | | _data = data[config.dataName] || [] |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_config.subtype === 'ratioboard') { |
| | | _data = _data || [] |
| | | } else { |
| | | if (_data && Array.isArray(_data)) { |
| | | _data = _data[0] || {} |
| | | } else { |
| | | _data = {} |
| | | if (_config.subtype !== 'ratioboard') { |
| | | if (Array.isArray(this.data)) { |
| | | this.data = this.data[0] || {} |
| | | } |
| | | this.data.value = this.data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | _config.plot.height = Utils.getHeight(_config.plot.height) |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true') { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.sync === 'true' && !_sync) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = null |
| | | |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = [] |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | } else { |
| | | _data = {} |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] || {} |
| | | } |
| | | if (_data.hasOwnProperty(config.plot.valueField)) { |
| | | _data.value = _data[config.plot.valueField] |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | if (config.subtype !== 'ratioboard') { |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {} |
| | | } |
| | | _data.value = _data[config.plot.valueField] || 0 |
| | | } |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (_data && !is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | this.setState({sync: false}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | let _data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = res |
| | | } else { |
| | | _data = res[0] |
| | | _data.value = _data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {} |
| | | }, () => { |
| | | let _data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = [] |
| | | } else { |
| | | _data = {value: 0} |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | data = result.data || [] |
| | | } else { |
| | | data = {} |
| | | if (result.data && result.data[0] && result.data[0].hasOwnProperty(config.plot.valueField)) { |
| | | data.value = result.data[0][config.plot.valueField] |
| | | } |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(data), fromJS(this.state.data))) { |
| | | reset = false |
| | | let _data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = result.data || [] |
| | | } else { |
| | | _data = result.data && result.data[0] ? result.data && result.data[0] : {} |
| | | _data.value = _data.value[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | getratiodata = () => { |
| | | const { data, plot } = this.state |
| | | const { plot } = this.state |
| | | |
| | | let colors = {} |
| | | if (plot.colors && plot.colors.length > 0) { |
| | |
| | | }) |
| | | } |
| | | |
| | | return data.map(item => { |
| | | return this.data.map(item => { |
| | | let val = +item[plot.valueField] |
| | | let type = item[plot.labelField] || '' |
| | | if (isNaN(val)) { |
| | |
| | | * @description 仪表盘渲染 |
| | | */ |
| | | dashboardrender = () => { |
| | | const { plot, chartId, data } = this.state |
| | | const { plot, chartId } = this.state |
| | | |
| | | let _data = fromJS(data).toJS() |
| | | let _data = fromJS(this.data).toJS() |
| | | _data.value = +_data.value |
| | | |
| | | if (_data.hasOwnProperty('value')) { |
| | | if (_data.value === '' || _data.value === null) { |
| | | delete _data.value |
| | | } else { |
| | | _data.value = +_data.value |
| | | |
| | | if (isNaN(_data.value)) { |
| | | delete _data.value |
| | | } else if (_data.value > plot.maxValue) { |
| | | _data.value = plot.maxValue |
| | | } |
| | | } |
| | | if (isNaN(_data.value)) { |
| | | _data.value = 0 |
| | | } else if (_data.value > plot.maxValue) { |
| | | _data.value = plot.maxValue |
| | | } |
| | | |
| | | const chart = new Chart({ |
| | |
| | | }) |
| | | } |
| | | |
| | | if (data.hasOwnProperty('value')) { |
| | | let val = data.value |
| | | let val = +this.data.value |
| | | |
| | | if (!isNaN(val)) { |
| | | if (plot.percent !== 'false' && plot.maxValue) { |
| | | val = +(val / plot.maxValue * 100).toFixed(2) + ' %' |
| | | } |
| | |
| | | title: '', // 组件标题 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | search: null, // 搜索条件 |
| | | chart: null |
| | | } |
| | | |
| | | data = [] |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | let _data = null |
| | | let _sync = config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | _data = data[config.dataName] || [] |
| | | if (_sync && data) { |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | } else if (_sync && initdata) { |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | this.setState({sync: false}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.data.length > 0) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | handleData = () => { |
| | | const { plot, chartId } = this.state |
| | | |
| | | let _element = document.getElementById(chartId) |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { plot } = this.state |
| | | |
| | | if (plot.shape === 'nest') { |
| | | this.nestrender() |
| | |
| | | const { config, arr_field, search, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [] |
| | | }, () => { |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | | this.data = [] |
| | | this.handleData() |
| | | }) |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS(result.data || []))) { |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | * 3、柱状图数据补齐 |
| | | */ |
| | | getdata = () => { |
| | | const { data, plot } = this.state |
| | | const { plot } = this.state |
| | | |
| | | if (!data) { |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | | |
| | | let _data = [] |
| | | let _cdata = fromJS(data).toJS() |
| | | let _cdata = fromJS(this.data).toJS() |
| | | |
| | | if (plot.repeat === 'average') { |
| | | let _mdata = new Map() |
| | |
| | | } |
| | | |
| | | getnestdata = () => { |
| | | const { data, plot } = this.state |
| | | const { plot } = this.state |
| | | |
| | | if (!data) { |
| | | if (this.data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | | |
| | | let _data = [] |
| | | let _cdata = fromJS(data).toJS() |
| | | let _cdata = fromJS(this.data).toJS() |
| | | |
| | | if (plot.repeat === 'average') { |
| | | let _mdata = new Map() |
| | |
| | | chartId: Utils.getuuid(), // 图表Id |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | search: null, // 搜索条件 |
| | | chart: null |
| | | } |
| | | |
| | | data = [] |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | let _data = null |
| | | let _sync = config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | _data = data[config.dataName] || [] |
| | | if (_sync && data) { |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | } else if (_sync && initdata) { |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | empty: !_data, |
| | | empty: this.data.length === 0, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | sync: _sync, |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data, empty: !_data,}, () => { |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | this.setState({sync: false, empty: _data.length === 0}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.data.length > 0) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | |
| | | this.setState({empty: false}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [], |
| | | empty: false, |
| | | }, () => { |
| | | this.setState({ empty: true }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | | this.data = [] |
| | | this.handleData() |
| | | }) |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | empty: false, |
| | | empty: !result.data || result.data.length === 0, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS(result.data || []))) { |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.scatterrender() |
| | | |
| | | setTimeout(() => { |
| | | this.scatterrender() |
| | | }, 100) |
| | | } |
| | | |
| | | /** |
| | | * @description 散点图渲染 |
| | | */ |
| | | scatterrender = () => { |
| | | const { plot, data, chartId } = this.state |
| | | const { plot, chartId } = this.state |
| | | const chart = new Chart({ |
| | | container: chartId, |
| | | autoFit: true, |
| | | height: plot.height |
| | | }) |
| | | |
| | | chart.data(data); |
| | | chart.data(this.data); |
| | | chart.scale({ |
| | | [plot.Xaxis]: { nice: true }, |
| | | [plot.Yaxis]: { nice: true }, |
| | |
| | | loading: false, // 数据加载状态 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | search: null, // 搜索条件 |
| | | } |
| | | |
| | | data = [] |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | let _data = null |
| | | let _sync = config.setting.sync === 'true' |
| | | |
| | | let BID = '' |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | _data = data[config.dataName] || [] |
| | | if (_sync && data) { |
| | | this.data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | } else if (_sync && initdata) { |
| | | this.data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | empty: !_data || _data.length === 0, |
| | | empty: this.data.length === 0, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data, empty: _data.length === 0}, () => { |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | this.setState({sync: false, empty: _data.length === 0}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.data.length > 0) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | this.setState({empty: false}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [] |
| | | }, () => { |
| | | this.handleData() |
| | | empty: true |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS([]))) { |
| | | this.data = [] |
| | | this.handleData() |
| | | } |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false, |
| | | empty: result.data.length === 0 |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | empty: !result.data || result.data.length === 0 |
| | | }) |
| | | |
| | | if (!is(fromJS(this.data), fromJS(result.data || []))) { |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 150) |
| | | }, 100) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表渲染分组 |
| | | */ |
| | | viewrender = () => { |
| | | const { config, data } = this.state |
| | | const { config } = this.state |
| | | |
| | | if (!config.plot.script) return |
| | | |
| | |
| | | try { |
| | | // eslint-disable-next-line |
| | | let func = new Function('Chart', 'DataSet', 'wrap', 'data', 'config', config.plot.script) |
| | | func(Chart, DataSet, this.wrap, data, config) |
| | | func(Chart, DataSet, this.wrap, this.data, config) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | |
| | |
| | | try { |
| | | // eslint-disable-next-line |
| | | let func = new Function('echarts', 'DataSet', 'wrap', 'data', 'config', config.plot.script) |
| | | func(echarts, DataSet, this.wrap, data, config) |
| | | func(echarts, DataSet, this.wrap, this.data, config) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | |
| | |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} /> |
| | | <NormalHeader config={config} BID={BID} refresh={this.refreshSearch}/> |
| | | <div className="canvas-wrap" style={{height: (config.plot.height + 30) + 'px'}}> |
| | | <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 'px'}} ref={ref => this.wrap = ref}></div> |
| | | </div> |
| | |
| | | html: '', |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | if (_sync && data) { |
| | | _data = data[_config.dataName] || {} |
| | | _sync = false |
| | | this.loaded = true |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || {} |
| | | _sync = false |
| | | this.loaded = true |
| | | } |
| | | } else { |
| | | _data = {} |
| | | this.loaded = true |
| | | } |
| | | |
| | | if (_config.css) { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res[0]}, () => { |
| | | this.renderView() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.renderView() |
| | | }) |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | setTimeout(() => { |
| | | this.renderView() |
| | | }, 10) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | data: {}, |
| | | loading: false |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = result.data || {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | loading: false |
| | | }, () => { |
| | | this.renderView() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | setTimeout(() => { |
| | | this.renderView() |
| | | }, 10) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(this.props.config.$pageId) |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result |
| | | }) |
| | |
| | | BID: '', |
| | | config: null, |
| | | loading: false, |
| | | data: null, |
| | | data: [], |
| | | disableAdd: false, |
| | | disableSave: false, |
| | | typeOptions: [], |
| | | subjects: [], |
| | | charType: '', |
| | | charInt: '', |
| | | vouDate: null, |
| | |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.supBook === MenuID) { |
| | | this.setState({ book: data }, () => { |
| | | let month = data.months |
| | | let vouDate = moment() |
| | | |
| | | if (month && month < moment().format('YYYY-MM')) { |
| | | vouDate = moment(month, 'YYYY-MM').endOf('month') |
| | | } |
| | | |
| | | this.setState({ book: data, vouDate }, () => { |
| | | this.loadData() |
| | | }) |
| | | return |
| | |
| | | typeOptions: typeOptions, |
| | | charType: typeOptions[0] ? typeOptions[0].voucher_class : '', |
| | | charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '', |
| | | subjects: res.subjects || [], |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | this.getVoucher() |
| | | }, 200) |
| | | }) |
| | | } |
| | | |
| | | |
| | | getVoucher = () => { |
| | | let data = [ |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 124, creditor: ''}, |
| | | {remark: '购入固定资产', subjectscode: '1001', subjectsname: '库存现金', debtor: '', creditor: 124}, |
| | | {remark: '转结销售成本', subjectscode: '1001', subjectsname: '库存现金', debtor: -524, creditor: ''}, |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 34, creditor: ''}, |
| | | ] |
| | | |
| | | this.setState({ |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | changeVoucherDate = () => { |
| | | |
| | | } |
| | | |
| | | render() { |
| | | const { config, disableSave, disableAdd, typeOptions, charType, charInt, data } = this.state |
| | | const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, subjects } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-voucher-wrap" style={config.style}> |
| | |
| | | {config.wrap.type === 'edit' ? <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charInt})}> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charint})}> |
| | | {typeOptions.map(option => |
| | | <Select.Option value={option.voucher_class} charInt={option.voucher_char_int}>{option.voucher_char}</Select.Option> |
| | | <Select.Option key={option.voucher_char_int} value={option.voucher_class} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option> |
| | | )} |
| | | </Select> |
| | | <Input value={charInt} autoComplete="off" onChange={(e) => this.setState({charInt: e.target.value})}/> 号 |
| | | </div> |
| | | <div className="voucher-date"> |
| | | 日期:<DatePicker onChange={this.changeVoucherDate}/> |
| | | 日期:<DatePicker value={vouDate} onChange={(val) => this.setState({vouDate: val})}/> |
| | | </div> |
| | | <div className="voucher-affix"> |
| | | 附单据 <Input autoComplete="off" /> 张 |
| | |
| | | <Button type="link" className="" onClick={this.triggerprint}>备注</Button> |
| | | </div> |
| | | </div> |
| | | <VoucherTable config={config} data={data}/> |
| | | <VoucherTable config={config} subjects={subjects} data={data}/> |
| | | </div> : null} |
| | | {config.wrap.type === 'check' ? <div className="voucher-body"> |
| | | <div className="pre-wrap"> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Modal, Input, InputNumber, notification, message, AutoComplete } from 'antd' |
| | | import { Table, Modal, Input, InputNumber, notification, message, AutoComplete, Select } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | if (col.field === 'creditor') { |
| | | MKEmitter.emit('nextLine', col, record) |
| | | } else { |
| | | let cl = {remark: 'subject', subject: 'debtor', debtor: 'creditor'} |
| | | let cl = {remark: 'subjectscode', subjectscode: 'debtor', debtor: 'creditor'} |
| | | MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid) |
| | | } |
| | | }, 50) |
| | |
| | | |
| | | if (record.type === 'total') return |
| | | |
| | | this.setState({editing: true, value: record[col.field]}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid) |
| | | node && node.select() |
| | | }) |
| | | if (col.field === 'subjectscode') { |
| | | this.setState({editing: true}, () => { |
| | | try { |
| | | let node = document.getElementById(col.uuid + record.uuid) |
| | | node.click() |
| | | } catch(e) {} |
| | | }) |
| | | } else { |
| | | this.setState({editing: true, value: record[col.field]}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid) |
| | | node && node.select() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onBlur = () => { |
| | |
| | | const { value } = this.state |
| | | |
| | | this.setState({editing: false}) |
| | | |
| | | if (col.field === 'subjectscode') return |
| | | |
| | | if (value !== record[col.field]) { |
| | | let line = {...record, [col.field]: value} |
| | |
| | | this.setState({value: val}) |
| | | } |
| | | |
| | | complete = (key, option) => { |
| | | this.setState({value: option.props.value}) |
| | | complete = (val) => { |
| | | this.setState({value: val}, () => { |
| | | this.onBlur() |
| | | }) |
| | | } |
| | | |
| | | onSelectChange = (val, option) => { |
| | | const { col, record } = this.props |
| | | |
| | | this.setState({editing: false}) |
| | | |
| | | let line = {...record, ...option.props.extra} |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + record.uuid) |
| | | }, 50) |
| | | } |
| | | |
| | | render() { |
| | | let { col, record, className } = this.props |
| | | let { col, record, subjects, className } = this.props |
| | | const { editing } = this.state |
| | | |
| | | let children = null |
| | |
| | | children = <div className="content-wrap" onClick={this.focus}>{val}</div> |
| | | } |
| | | } |
| | | } else if (col.field === 'subject') { |
| | | } else if (col.field === 'subjectscode') { |
| | | if (record.type === 'total') { |
| | | colSpan = 0 |
| | | } else { |
| | | let val = record.subject || '' |
| | | |
| | | if (editing) { |
| | | children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | children = <Select |
| | | showSearch |
| | | defaultValue={record.subjectscode || ''} |
| | | dropdownClassName="edit-table-dropdown" |
| | | id={col.uuid + record.uuid} |
| | | onBlur={this.onBlur} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.onSelectChange} |
| | | > |
| | | {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subjectscode}>{item.subjectscode + ' ' + item.subjectsname}</Select.Option>))} |
| | | </Select> |
| | | } else { |
| | | let val = '' |
| | | if (record.subjectscode) { |
| | | val = (record.subjectscode || '') + ' ' + (record.subjectsname || '') |
| | | } |
| | | children = <div className="content-wrap" onClick={this.focus}>{val}</div> |
| | | } |
| | | } |
| | |
| | | class VoucherTable extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 菜单Id |
| | | subjects: PropTypes.array, // 会计科目 |
| | | BID: PropTypes.any, // 主表ID |
| | | data: PropTypes.any, // 表格数据 |
| | | total: PropTypes.any, // 总数 |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | let data = [ |
| | | {remark: '提现', subject: '1001 库存现金', debtor: 124, creditor: ''}, |
| | | {remark: '购入固定资产', subject: '1001 库存现金', debtor: '', creditor: 124}, |
| | | {remark: '转结销售成本', subject: '1001 库存现金', debtor: -524, creditor: ''}, |
| | | {remark: '提现', subject: '1001 库存现金', debtor: 34, creditor: ''}, |
| | | ] |
| | | |
| | | data = this.initData(data) |
| | | data.push(this.getTotalLine(data)) |
| | | const { config, subjects, data } = this.props |
| | | |
| | | let columns = [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | title: '会计科目', |
| | | dataIndex: 'subject', |
| | | key: 'subject', |
| | | dataIndex: 'subjectscode', |
| | | key: 'subjectscode', |
| | | width: '34%', |
| | | onCell: record => ({ |
| | | record, |
| | | col: {uuid: 'subject', field: 'subject', tableId: config.uuid}, |
| | | subjects, |
| | | col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, |
| | | }) |
| | | }, |
| | | { |
| | |
| | | ] |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | edData: fromJS(data).toJS(), |
| | | edData: this.resetData(fromJS(data).toJS()), |
| | | columns, |
| | | tableId: config.uuid |
| | | }) |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | this.setState({data: nextProps.data || []}) |
| | | this.resetData(fromJS(nextProps.data).toJS()) |
| | | } else if (!is(fromJS(this.props.subjects), fromJS(nextProps.subjects))) { |
| | | this.resetSubjects(nextProps.subjects) |
| | | } |
| | | } |
| | | |
| | | resetSubjects = (subjects) => { |
| | | const { config } = this.props |
| | | let columns = fromJS(this.state.columns).toJS() |
| | | |
| | | this.setState({ |
| | | columns: columns.map(col => { |
| | | if (col.key === 'subjectscode') { |
| | | return { |
| | | title: '会计科目', |
| | | dataIndex: 'subjectscode', |
| | | key: 'subjectscode', |
| | | width: '34%', |
| | | onCell: record => ({ |
| | | record, |
| | | subjects, |
| | | col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, |
| | | }) |
| | | } |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetData = (data) => { |
| | | data = this.initData(data) |
| | | data.push(this.getTotalLine(data)) |
| | | |
| | | this.setState({ |
| | | edData: data |
| | | }) |
| | | } |
| | | |
| | | initData = (data) => { |
| | |
| | | |
| | | if (_data.length < 4) { |
| | | for (let i = _data.length - 1; i < 4; i++) { |
| | | _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | } |
| | | } |
| | | return _data |
| | |
| | | MKEmitter.emit('tdFocus', 'remark' + edData[record.index + 1].uuid) |
| | | } else { |
| | | let _data = fromJS(edData).toJS() |
| | | let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subject: '', debtor: '', creditor: ''} |
| | | let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''} |
| | | |
| | | _data.splice(_data.length - 1, 0, line) |
| | | |
| | |
| | | |
| | | if (_data.length < 4) { |
| | | for (let i = _data.length - 1; i < 4; i++) { |
| | | _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | } |
| | | } |
| | | |
| | |
| | | _data.pop() |
| | | |
| | | if (record.index === _data.length - 1) { |
| | | _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subject: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | } |
| | | |
| | | _data.push(this.getTotalLine(_data)) |
| | |
| | | height: 60px; |
| | | } |
| | | } |
| | | .ant-select { |
| | | padding: 0px; |
| | | position: absolute; |
| | | top: 0px; |
| | | left: 0px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | .ant-select-selection { |
| | | height: 100%; |
| | | border-radius: 0; |
| | | |
| | | .ant-select-arrow { |
| | | display: none; |
| | | } |
| | | } |
| | | } |
| | | .editing_table_cell { |
| | | .ant-input { |
| | | padding: 0px; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .edit-table-dropdown { |
| | | .ant-select-dropdown-menu-item { |
| | | white-space: unset; |
| | | text-overflow: unset; |
| | | } |
| | | } |
| | |
| | | MKEmitter.emit('resetSelectLine', MenuID, _id, _data) |
| | | } |
| | | |
| | | resetTable = (id, repage) => { |
| | | resetTable = (id, repage, pageIndex) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (id !== MenuID) return |
| | |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else if (repage === 'repage') { |
| | | this.setState({ |
| | | pageIndex: pageIndex, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(this.props.config.$pageId) |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result |
| | | }) |
| | |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 列表重置 |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { |
| | | let _pageIndex = Math.ceil(result.total / pageSize) |
| | | |
| | | if (_pageIndex < pageIndex) { |
| | | MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) |
| | | this.setState({ |
| | | pageIndex: _pageIndex, |
| | | data: [], |
| | | selectedData: [], |
| | | total: result.total |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | |
| | | selectedData: [], |
| | | total: 0 |
| | | }) |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 列表重置 |
| | | return |
| | | } |
| | | |
| | |
| | | if (item.resourceType === '1' && result[item.uuid] && result[item.uuid].length > 0) { |
| | | let options = [] |
| | | let _map = new Map() |
| | | let all = false |
| | | result[item.uuid].forEach(cell => { |
| | | let _cell = {key: Utils.getuuid()} |
| | | |
| | | _cell.value = cell[item.valueField] |
| | | _cell.label = cell[item.valueText] |
| | | |
| | | if (!_cell.label && _cell.label !== 0) return |
| | | if (!_cell.label && _cell.label !== 0) { |
| | | if (!all) { |
| | | _cell.label = '全部' |
| | | all = true |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (_map.has(_cell.value)) return |
| | | _map.set(_cell.value, 0) |
| | |
| | | statFValue: [] // 合计值 |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | /** |
| | | * @description 初始化处理 |
| | | * 1、 initdata 为打印时使用的数据集 |
| | |
| | | setting.orisel = true |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && data) { |
| | | if (_sync && data) { |
| | | _data = data[_config.dataName] || [] |
| | | _sync = false |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_data) { |
| | | this.loaded = true |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 列表重置 |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [], false) |
| | | } |
| | | |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { |
| | | let _pageIndex = Math.ceil(result.total / pageSize) |
| | | |
| | | if (_pageIndex < pageIndex) { |
| | | MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) |
| | | this.setState({ |
| | | pageIndex: _pageIndex, |
| | | data: [], |
| | | selectedData: [], |
| | | total: result.total |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | |
| | | } |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({pageIndex: 1}, () => { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, setting } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | description: false |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | /** |
| | | * @description 初始化处理 |
| | | * 1、 initdata 为打印时使用的数据集 |
| | |
| | | } |
| | | |
| | | if (_data) { |
| | | this.loaded = true |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | this.setState({ |
| | | data: [], |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | selected: false // 选中首行 |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | if (_sync && data) { |
| | | _data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%' |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | this.setState({ |
| | | selected: _config.wrap.selected === 'true', |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false |
| | |
| | | popview = 'popview' |
| | | } |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview) |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | |
| | | } |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) => { |
| | | return components.filter(item => { |
| | | item.$pageId = pageId |
| | | item.$cache = cache |
| | | |
| | | if (item.style && item.style.boxShadow) { |
| | | delete item.style.hShadow |
| | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = pageId |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | let param = getStructuredParams(params, this.state.config, this.state.BID || '') |
| | | const { config } = this.state |
| | | let param = getStructuredParams(params, config, this.state.BID || '') |
| | | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | |
| | | delete result.message |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result, |
| | |
| | | |
| | | return ( |
| | | <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} |
| | | {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | |
| | | }) |
| | | } |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab) |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, config.$cache) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab) => { |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab, cache) => { |
| | | return components.filter(item => { |
| | | item.$pageId = Tab.uuid |
| | | item.$cache = cache |
| | | |
| | | if (item.style && item.style.boxShadow) { |
| | | delete item.style.hShadow |
| | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = Tab.uuid |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab) |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, cache) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab) |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, cache) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | let param = getStructuredParams(params, this.state.config, this.state.BID || '') |
| | | const { config } = this.state |
| | | let param = getStructuredParams(params, config, this.state.BID || '') |
| | | |
| | | this.setState({loading: true}) |
| | | |
| | |
| | | delete result.message |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result, |
| | |
| | | |
| | | return ( |
| | | <div className={'pop-page-wrap ' + (loading ? 'loading' : '')} style={config ? config.style : null}> |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | | {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | |
| | | let _this = this |
| | | |
| | | let param = { |
| | | func: 'webapi_ChangeUser' |
| | | func: 'webapi_ChangeUser', |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | domain_name: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | import React, { Component } from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { notification } from 'antd' |
| | | import * as XLSX from 'xlsx' |
| | | import * as XLSX from 'sheetjs-style' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || '')) |
| | | let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || ''), this.state.primaryId) |
| | | |
| | | if (result.errors) { |
| | | notification.warning({ |
| | |
| | | import moment from 'moment' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import * as XLSX from 'xlsx' |
| | | import * as XLSX from 'sheetjs-style' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | |
| | | let _header = [] |
| | | let _topRow = {} |
| | | let colwidth = [] |
| | | |
| | | columns.forEach(col => { |
| | | let requires = [] |
| | | |
| | | columns.forEach((col, i) => { |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | colwidth.push({width: col.Width || 20}) |
| | | if (col.required === 'true') { |
| | | requires.push(i) |
| | | } |
| | | }) |
| | | |
| | | let table = [] |
| | |
| | | }) |
| | | |
| | | const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) |
| | | |
| | | |
| | | ws['!cols'] = colwidth |
| | | |
| | | if (requires.length) { |
| | | let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| | | requires.forEach(col => { |
| | | if (cols[col]) { |
| | | ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }} |
| | | } |
| | | }) |
| | | } |
| | | // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} |
| | | |
| | | const wb = XLSX.utils.book_new() |
| | | XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') |
| | |
| | | if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = [] |
| | | let map = new Map() |
| | | let all = false |
| | | result[item.field].forEach(cell => { |
| | | let _cell = { key: Utils.getuuid() , ParentID: ''} |
| | | |
| | |
| | | if (item.type !== 'checkcard') { |
| | | _cell.value = cell[item.valueField] |
| | | _cell.label = cell[item.valueText] + '' |
| | | if (!_cell.label || map.has(_cell.ParentID + _cell.value)) return |
| | | if (map.has(_cell.ParentID + _cell.value)) return |
| | | if (!_cell.label) { |
| | | if (!all) { |
| | | _cell.label = '全部' |
| | | all = true |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | map.set(_cell.ParentID + _cell.value, 0) |
| | | } else { |
| | |
| | | if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = [] |
| | | let map = new Map() |
| | | let all = false |
| | | result[item.field].forEach(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | |
| | | _item.Value = cell[item.valueField] |
| | | _item.Text = cell[item.valueText] + '' |
| | | |
| | | if (!_item.Text || map.has(_item.ParentID + _item.Value)) return |
| | | if (map.has(_item.ParentID + _item.Value)) return |
| | | if (!_item.Text) { |
| | | if (!all) { |
| | | _item.Text = '全部' |
| | | all = true |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | map.set(_item.ParentID + _item.Value, 0) |
| | | } else { |
| | |
| | | _dec += ',' |
| | | } |
| | | |
| | | let _sql = `Declare @${btn.sheet} table (${_dec}jskey nvarchar(50) ) |
| | | let _sql = `Declare @${btn.sheet.replace(/@db@/ig, '')} table (${_dec}jskey nvarchar(50) ) |
| | | Declare @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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) |
| | | Select @ErrorCode='', @retmsg='' |
| | | ` |
| | |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | // 外联数据库替换 |
| | |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | | <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</span></Tooltip>, |
| | | <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} |
| | | </Form.Item> |
| | |
| | | col.type = col.type || 'Nvarchar(50)' |
| | | col.import = col.import || 'true' |
| | | col.required = col.required || 'true' |
| | | |
| | | if (col.type === 'text' || col.type === 'image') { |
| | | col.type = 'Nvarchar(50)' |
| | | } else if (col.type === 'number') { |
| | | col.type = 'Decimal(18,2)' |
| | | } |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/)[0] |
| | |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | width: '17%' |
| | | width: '16%' |
| | | }, |
| | | { |
| | | title: '名称', |
| | |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | width: '17%' |
| | | width: '16%' |
| | | }, |
| | | { |
| | | title: '列宽', |
| | |
| | | min: 5, |
| | | max: 200, |
| | | editable: true, |
| | | width: '12%', |
| | | width: '10%', |
| | | render: (text) => text || 20 |
| | | }, |
| | | { |
| | |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '14%', |
| | | width: '12%', |
| | | render: (text) => { |
| | | if (text === 'image') { |
| | | return '图片' |
| | |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | width: '14%', |
| | | width: '12%', |
| | | render: (text) => { |
| | | if (text === 'true') { |
| | | return '是' |
| | |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | width: '14%', |
| | | width: '12%', |
| | | render: (text) => { |
| | | if (text !== 'false') { |
| | | return '是' |
| | |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | title: '红色标题', |
| | | dataIndex: 'required', |
| | | width: '10%', |
| | | editable: true, |
| | | inputType: 'radio', |
| | | render: (text, record) => record.required === 'true' ? '是' : '否', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | ], |
| | | scriptsColumns: [ |
| | | { |
| | |
| | | if (card.intertype !== 'system') { |
| | | _verify.enable = 'false' |
| | | } |
| | | if (_verify.columns[0] && (!_verify.columns[0].type || !_verify.columns[0].output)) { |
| | | _verify.columns = _verify.columns.map(col => { |
| | | col.type = col.type || 'text' |
| | | col.output = col.output || 'true' |
| | | return col |
| | | }) |
| | | } |
| | | _verify.columns = _verify.columns.map(col => { |
| | | col.type = col.type || 'text' |
| | | col.output = col.output || 'true' |
| | | col.required = col.required || 'false' |
| | | |
| | | if (!['text', 'image', 'number'].includes(col.type)) { |
| | | if (/^Decimal/ig.test(col.type)) { |
| | | col.type = 'number' |
| | | } else { |
| | | col.type = 'text' |
| | | } |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | |
| | | let defaultscript = '' |
| | | if (!_verify.script && card.intertype === 'system') { |
| | |
| | | values.uuid = Utils.getuuid() |
| | | values.abs = 'false' |
| | | values.output = 'true' |
| | | values.required = 'false' |
| | | verify.columns.push(values) |
| | | |
| | | this.setState({ |
| | |
| | | Width: 20, |
| | | abs: 'false', |
| | | output: 'true', |
| | | required: 'false', |
| | | type: 'text', |
| | | uuid: Utils.getuuid() |
| | | } |
| | |
| | | Width: 20, |
| | | abs: 'false', |
| | | output: col.output || 'true', |
| | | required: col.required || 'false', |
| | | type: 'text', |
| | | } |
| | | |
| | |
| | | <Button className="excel-col-add mk-red" title="清空Excel列" onClick={this.clearField}> |
| | | 清空Excel列 |
| | | </Button> |
| | | <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;数值类型导出时可进行数据处理(取绝对值、保留小数位)。</div> |
| | | <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;数值类型导出时可进行数据处理(取绝对值、保留小数位);红色标题导出时列头文字为红色。</div> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> |
| | | </TabPane> |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | |
| | | |
| | | let resource = this.props.form.getFieldValue('dataSource') || '' |
| | | |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | if (field === text) { |
| | | resource = `select '' as ${field} union all \n${resource}` |
| | | } else { |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | } |
| | | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | |
| | | .ant-select { |
| | | width: 100%; |
| | | } |
| | | span.ant-radio + * { |
| | | padding-left: 2px; |
| | | } |
| | | > td { |
| | | padding: 14px 10px; |
| | | } |
| | |
| | | |
| | | let resource = this.props.form.getFieldValue('dataSource') || '' |
| | | |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | if (field === text) { |
| | | resource = `select '' as ${field} union all \n${resource}` |
| | | } else { |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | } |
| | | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | |
| | | * @description 生成单个组件sPC_Get_structured_data请求参数 |
| | | */ |
| | | export function getStructDefaultParam (component, searchlist, first) { |
| | | const { columns, setting, dataName, format } = component |
| | | const { columns, setting, dataName, format, uuid } = component |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | let _dataresource = setting.dataresource |
| | |
| | | } |
| | | |
| | | return { |
| | | uuid: uuid, |
| | | name: dataName, |
| | | $name: setting.$name, |
| | | columns: columns, |
| | |
| | | * @return {Object} dict 字典项 |
| | | * @return {String} BID 上级Id |
| | | */ |
| | | export function getExcelInSql (item, data, dict, BID) { |
| | | export function getExcelInSql (item, data, dict, BID, primaryId) { |
| | | let btn = item.verify |
| | | let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | |
| | | btn.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | let _sql = script.sql |
| | | |
| | | _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) |
| | | _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 (script.position === 'init') { |
| | | _initCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ${_sql} |
| | | ` |
| | | } else if (script.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ${_sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ${_sql} |
| | | ` |
| | | } |
| | | }) |
| | |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在使用明科云APP时,状态栏的字体颜色。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 状态栏 |
| | | 状态栏文字 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('statusBarColor', { |
| | |
| | | * @param {Object} param 用户名密码等信息 |
| | | */ |
| | | async loginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getusermsg(param.username, param.password, false, ipAddress, city) |
| | | let res = await Api.getusermsg(param.username, param.password, false) |
| | | if (res.status) { |
| | | if (res.check_mob) { |
| | | let loginWays = this.state.loginWays.filter(item => item.type === 'sms_vcode') |
| | |
| | | } |
| | | |
| | | async phoneloginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false, ipAddress, city) |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false) |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | |
| | | // 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') |
| | | |