From cb4c8706eb48183ac8875d92d4a950ad6b6675a2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 18 三月 2020 11:01:11 +0800 Subject: [PATCH] 2020-03-18 --- src/components/tabview/index.jsx | 69 src/tabviews/tableshare/verifycard/index.jsx | 13 src/components/tabview/index.scss | 2 src/tabviews/tableshare/normalTable/index.jsx | 18 src/tabviews/verup/config.js | 157 +++ src/tabviews/verup/index.jsx | 519 ++++++++++ src/templates/formtabconfig/index.jsx | 4 src/tabviews/tableshare/verifycard/index.scss | 2 src/templates/comtableconfig/index.jsx | 8 src/tabviews/tableshare/actionList/index.jsx | 32 src/tabviews/tableshare/normalTable/index.scss | 13 src/tabviews/verup/topSearch/index.jsx | 120 ++ src/tabviews/subtable/index.jsx | 11 src/tabviews/subtabtable/index.jsx | 13 src/tabviews/verup/actionList/index.scss | 44 src/tabviews/commontable/index.jsx | 5 src/templates/tableshare/verifycard/index.jsx | 11 src/utils/utils.js | 2 src/templates/subtableconfig/actionform/index.jsx | 8 src/tabviews/tableshare/mutilform/index.jsx | 1 src/tabviews/verup/topSearch/index.scss | 26 src/templates/comtableconfig/actionform/index.jsx | 8 src/tabviews/subtable/index.scss | 12 src/tabviews/verup/actionList/index.jsx | 763 +++++++++++++++ src/tabviews/verup/subtabtable/index.jsx | 490 +++++++++ src/templates/tableshare/verifycardexcelout/index.jsx | 11 src/templates/tableshare/verifycardprint/index.jsx | 37 src/tabviews/managetable/index.jsx | 50 src/templates/subtableconfig/index.jsx | 4 /dev/null | 127 -- src/templates/tableshare/verifycardprint/index.scss | 39 src/components/sidemenu/index.jsx | 84 - src/components/sidemenu/config.js | 78 + src/tabviews/verup/index.scss | 115 ++ src/templates/tableshare/verifycardexcelin/index.jsx | 11 src/tabviews/verup/subtabtable/index.scss | 52 + 36 files changed, 2,571 insertions(+), 388 deletions(-) diff --git a/src/components/sidemenu/config.js b/src/components/sidemenu/config.js new file mode 100644 index 0000000..81313ef --- /dev/null +++ b/src/components/sidemenu/config.js @@ -0,0 +1,78 @@ +// 绯荤粺鑿滃崟 +export const SySMenuList = { + systemManageView: [{ + MenuID: 'systemManageViewConfig', + text: '閰嶇疆', + PageParam: {Icon: 'folder'}, + children: [{ + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1581067625930haged11ieaivpavv77k', + MenuNo: 'sDatasM', + MenuName: '鏁版嵁瀛楀吀', + text: '鏁版嵁瀛楀吀' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1581734956310scks442ul2d955g9tu5', + MenuNo: 'sVersionM', + MenuName: '浼犺緭鍙风鐞�', + text: '浼犺緭鍙风鐞�' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1583991994144ndddg0bhh0is6shi0v1', + MenuNo: 'sVersionQueryM', + MenuName: '浼犺緭鍙锋煡璇�', + text: '浼犺緭鍙锋煡璇�' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'VerupTable'}, + type: 'VerupTable', + MenuID: '1583979633842550imkchl4qt4qppsiv', + MenuNo: 'sVersionMUpgrade', + MenuName: '鐗堟湰鍗囩骇', + text: '鐗堟湰鍗囩骇' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1578900109100np8aqd0a77q3na46oas', + MenuNo: 'sPrintTemplateM', + MenuName: '鎵撳嵃妯℃澘', + text: '鎵撳嵃妯℃澘' + }] + }, { + MenuID: 'systemManageViewInterface', + text: '鎺ュ彛', + PageParam: {Icon: 'folder'}, + children: [{ + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1582771068837vsv54a089lgp45migbg', + MenuNo: 'KUNTitleM', + MenuName: '鎺ュ彛涓绘暟鎹�', + text: '鎺ュ彛涓绘暟鎹�' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1582777675954ifu05upurs465omoth7', + MenuNo: 'KUNMainM', + MenuName: '鏌ヨ鎺ュ彛', + text: '鏌ヨ鎺ュ彛' + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '158294809668898cklbv6c5bou8e1fpu', + MenuNo: 'KUNMainMOut_advanced', + MenuName: '楂橀樁鏌ヨ', + text: '楂橀樁鏌ヨ' + }] + }] +} diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 6328403..f232ff2 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -4,11 +4,12 @@ import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Menu, Icon, notification } from 'antd' + import asyncComponent from '@/utils/asyncComponent' import {modifyTabview, resetEditLevel} from '@/store/action' +import { SySMenuList } from './config.js' import zhCN from '@/locales/zh-CN/header.js' import enUS from '@/locales/en-US/header.js' -import Utils from '@/utils/utils.js' import Api from '@/api' import './index.scss' @@ -168,82 +169,9 @@ } } - enterManageView = () => { - let menulist = [{ - MenuID: Utils.getuuid(), - text: '閰嶇疆', - PageParam: {Icon: 'folder'}, - children: [{ - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1581067625930haged11ieaivpavv77k', - MenuNo: 'sDatasM', - MenuName: '鏁版嵁瀛楀吀', - text: '鏁版嵁瀛楀吀' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1581734956310scks442ul2d955g9tu5', - MenuNo: 'sVersionM', - MenuName: '浼犺緭鍙风鐞�', - text: '浼犺緭鍙风鐞�' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1583991994144ndddg0bhh0is6shi0v1', - MenuNo: 'sVersionQueryM', - MenuName: '浼犺緭鍙锋煡璇�', - text: '浼犺緭鍙锋煡璇�' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1583979633842550imkchl4qt4qppsiv', - MenuNo: 'sVersionMUpgrade', - MenuName: '鐗堟湰鍗囩骇', - text: '鐗堟湰鍗囩骇' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1578900109100np8aqd0a77q3na46oas', - MenuNo: 'sPrintTemplateM', - MenuName: '鎵撳嵃妯℃澘', - text: '鎵撳嵃妯℃澘' - }] - }, { - MenuID: Utils.getuuid(), - text: '鎺ュ彛', - PageParam: {Icon: 'folder'}, - children: [{ - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1582771068837vsv54a089lgp45migbg', - MenuNo: 'KUNTitleM', - MenuName: '鎺ュ彛涓绘暟鎹�', - text: '鎺ュ彛涓绘暟鎹�' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '1582777675954ifu05upurs465omoth7', - MenuNo: 'KUNMainM', - MenuName: '鏌ヨ鎺ュ彛', - text: '鏌ヨ鎺ュ彛' - }, { - src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', - MenuID: '158294809668898cklbv6c5bou8e1fpu', - MenuNo: 'KUNMainMOut_advanced', - MenuName: '楂橀樁鏌ヨ', - text: '楂橀樁鏌ヨ' - }] - }] + enterManageView = (type) => { + let menulist = SySMenuList[type] + this.setState({ subMenulist: menulist, rootSubmenuKeys: menulist.map(item => item.MenuID), @@ -279,7 +207,7 @@ UNSAFE_componentWillReceiveProps (nextProps) { if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { - this.enterManageView() + this.enterManageView(nextProps.mainMenu.MenuID) } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { // 涓昏彍鍗曞垏鎹紝璇锋眰2銆�3绾ц彍鍗曟暟鎹� this.loadsubmenu(nextProps.mainMenu) diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index a15b7b9..bd3e1f4 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -3,20 +3,29 @@ import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import {Tabs, Icon, Button, ConfigProvider, message, BackTop} from 'antd' -import {modifyTabview, toggleIsiframe, refreshTabView} from '@/store/action' -// import asyncComponent from '@/utils/asyncComponent' -import asyncComponent from '@/utils/asyncLoadComponent' -import NotFount from '@/components/404' import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' -import mzhCN from '@/locales/zh-CN/main.js' -import menUS from '@/locales/en-US/main.js' import moment from 'moment' import 'moment/locale/zh-cn' + +import {modifyTabview, toggleIsiframe, refreshTabView} from '@/store/action' +import asyncComponent from '@/utils/asyncLoadComponent' +import NotFount from '@/components/404' +import mzhCN from '@/locales/zh-CN/main.js' +import menUS from '@/locales/en-US/main.js' + import './index.scss' +const Home = asyncComponent(() => import('@/tabviews/home')) +const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) +const VerupTable = asyncComponent(() => import('@/tabviews/verup')) +const ManageTable = asyncComponent(() => import('@/tabviews/managetable')) +const Iframe = asyncComponent(() => import('@/tabviews/iframe')) +const DataManage = asyncComponent(() => import('@/tabviews/datamanage')) +const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) +const TabForm = asyncComponent(() => import('@/tabviews/tabform')) +const FormTab = asyncComponent(() => import('@/tabviews/formtab')) -let Comps = {} let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' if (process.env.NODE_ENV === 'production') { @@ -88,21 +97,23 @@ selectcomponent = (view) => { // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠� if (view.type === 'Home') { - return (<Comps.Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + return (<Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'CommonTable') { - return (<Comps.CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + } else if (view.type === 'VerupTable') { + return (<VerupTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'ManageTable') { - return (<Comps.CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + return (<ManageTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'DataManage') { - return (<Comps.DataManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + return (<DataManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'RolePermission') { - return (<Comps.RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) + return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'TabForm') { - return (<Comps.TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) + return (<TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'FormTab') { - return (<Comps.FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) + return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'iframe') { - return (<Comps.Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) + return (<Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) } else { return (<NotFount key={view.MenuID} />) } @@ -163,30 +174,6 @@ UNSAFE_componentWillReceiveProps (nextProps) { if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { - // tab绐楀彛椤靛鍔犳垨鍒犻櫎 - if (nextProps.tabviews.length > this.state.tabviews.length) { - // 鏌ョ湅鏂皌ab椤甸渶瑕佺粍浠舵槸鍚﹀姞杞� - let MenuIDs = this.state.tabviews.map(tab => {return tab.MenuID}) - let newtab = nextProps.tabviews.filter(tab => !MenuIDs.includes(tab.MenuID))[0] - if (!Comps.Home && newtab.type === 'Home') { - Comps.Home = asyncComponent(() => import('@/tabviews/home')) - } else if (!Comps.CommonTable && newtab.type === 'CommonTable') { - Comps.CommonTable = asyncComponent(() => import('@/tabviews/commontable')) - } else if (!Comps.CommonTable && newtab.type === 'ManageTable') { - Comps.CommonTable = asyncComponent(() => import('@/tabviews/managetable')) - } else if (!Comps.Iframe && newtab.type === 'iframe') { - Comps.Iframe = asyncComponent(() => import('@/tabviews/iframe')) - } else if (!Comps.DataManage && newtab.type === 'DataManage') { - Comps.DataManage = asyncComponent(() => import('@/tabviews/datamanage')) - } else if (!Comps.RoleManage && newtab.type === 'RolePermission') { - Comps.RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) - } else if (!Comps.TabForm && newtab.type === 'TabForm') { - Comps.TabForm = asyncComponent(() => import('@/tabviews/tabform')) - } else if (!Comps.FormTab && newtab.type === 'FormTab') { - Comps.FormTab = asyncComponent(() => import('@/tabviews/formtab')) - } - } - // 淇濆瓨淇敼鏍囩闆� this.setState({ tabviews: nextProps.tabviews @@ -198,10 +185,6 @@ } } } - - // shouldComponentUpdate(nextProps, nextState) { - // return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - // } render () { const { tabviews } = this.state diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 55a07e0..569d03a 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -61,7 +61,7 @@ } .main-copy { position: fixed; - z-index: 2; + z-index: 20; bottom: 65px; right: 30px; width: 40px; diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 5fb9c5f..921a207 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -13,7 +13,7 @@ import asyncLoadComponent from '@/utils/asyncLoadComponent' import {refreshTabView, modifyTabview} from '@/store/action' -import MainTable from './mainTable' +import MainTable from '@/tabviews/tableshare/normalTable' import MainAction from '@/tabviews/tableshare/actionList' import VerifyCard from '@/tabviews/tableshare/verifycard' import MainSearch from '@/tabviews/tableshare/topSearch' @@ -289,7 +289,7 @@ let istrigger = false actions.forEach(item => { - if (!item.shortcut || typeof(item.shortcut) !== 'object' || istrigger) return + if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { e.preventDefault() @@ -1005,6 +1005,7 @@ } <MainTable ref="mainTable" + tableId="mainTable" pickup={pickup} setting={setting} columns={columns} diff --git a/src/tabviews/managetable/index.jsx b/src/tabviews/managetable/index.jsx index 4b5087f..4616ada 100644 --- a/src/tabviews/managetable/index.jsx +++ b/src/tabviews/managetable/index.jsx @@ -14,12 +14,12 @@ import asyncLoadComponent from '@/utils/asyncLoadComponent' import {refreshTabView, modifyTabview} from '@/store/action' -import MainTable from '@/tabviews/commontable/mainTable' +import MainTable from '@/tabviews/tableshare/normalTable' +import MainAction from '@/tabviews/tableshare/actionList' import MainSearch from '@/tabviews/tableshare/topSearch' import NotFount from '@/components/404' import './index.scss' -const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable')) const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) const FormTab = asyncComponent(() => import('@/tabviews/formtab')) @@ -57,9 +57,7 @@ orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� BIDs: {}, // 涓婄骇琛╥d - setsingle: false, // 涓昏〃鍗曢�夊閫夊垏鎹� pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - isLinkMain: false, // 鏄惁瀛樺湪涓庝富琛ㄥ叧鑱旂殑瀛愯〃 popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 @@ -161,18 +159,6 @@ }) } - - let _isLinkMain = false // 妫�鏌ユ槸鍚︽湁涓庝富琛ㄥ叧鑱旂殑瀛愯〃 - config.tabgroups.forEach(groupId => { - if (!config[groupId] || config[groupId].length === 0) return - - config[groupId].forEach(tab => { - if (tab.supMenu === 'mainTable') { - _isLinkMain = true - } - }) - }) - this.setState({ loadingview: false, config: config, @@ -181,7 +167,6 @@ actions: _actions, columns: _columns, logcolumns: _logcolumns, - isLinkMain: _isLinkMain, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { @@ -533,9 +518,7 @@ orderBy: '', search: '', BIDs: {}, - setsingle: false, - pickup: false, - isLinkMain: false + pickup: false }, () => { this.loadconfig() }) @@ -647,22 +630,6 @@ [type]: id, [type + 'data']: data } - }) - } - - /** - * @description 琛ㄦ牸鍗曢�夊閫夊垏鎹� - */ - checkChange = () => { - const { setsingle, BIDs } = this.state - - let _BIDs = JSON.parse(JSON.stringify(BIDs)) - _BIDs.mainTable = '' - - this.setState({ - setsingle: !setsingle, - pickup: false, - BIDs: _BIDs }) } @@ -843,11 +810,11 @@ } render() { - const { view, setting, searchlist, actions, columns, loadingview, viewlost, setsingle, pickup, isLinkMain, config } = this.state + const { view, setting, searchlist, actions, columns, loadingview, viewlost, pickup, config } = this.state return ( <div> - {view === 'commontable' ? <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> + {view === 'commontable' ? <div className="commontable pick-control" id={this.state.ContainerId}> {loadingview && <Spin size="large" />} {searchlist && searchlist.length > 0 ? <MainSearch @@ -876,18 +843,17 @@ } {columns && setting.onload !== 'false' ? <div className="main-table-box"> - {isLinkMain ? + {this.state.data && this.state.data.length > 0 ? <div className="pickchange"> - {setting.tableType === 'checkbox' ? <Switch title="鍗曢�夊垏鎹�" checkedChildren="鍗�" unCheckedChildren="澶�" defaultChecked={setsingle} onChange={this.checkChange} /> : null} - {this.state.BIDs.mainTable && (setting.tableType === 'radio' || setsingle) ? <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null} + <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> </div> : null } <MainTable ref="mainTable" + tableId="mainTable" pickup={pickup} setting={setting} columns={columns} - setsingle={setsingle} dict={this.state.dict} data={this.state.data} total={this.state.total} diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index afbeaf9..438b4f2 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -11,17 +11,15 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' -import SubTable from './subTable' +import SubTable from '@/tabviews/tableshare/normalTable' import SubAction from '@/tabviews/tableshare/actionList' import SubSearch from '@/tabviews/tableshare/topSearch' import asyncLoadComponent from '@/utils/asyncLoadComponent' -// import asyncComponent from '@/utils/asyncComponent' import NotFount from '@/components/404' import './index.scss' const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable')) -// const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) class SubTabViewTable extends Component { static propTpyes = { @@ -632,8 +630,8 @@ /** * @description 琛ㄦ牸Id鍙樺寲 */ - handleTableId = (id = '', data = '') => { - this.props.handleTableId(this.props.Tab.uuid, id, data) + handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { + this.props.handleTableId(type, id, data) } /** @@ -697,7 +695,7 @@ /> : null } {actions ? - <div style={{minHeight: '25px'}}> + <div className="sub-action"> <SubAction ref="subButton" type="sub" @@ -726,6 +724,7 @@ } <SubTable ref="subTable" + tableId={this.props.Tab.uuid} pickup={pickup} setting={setting} columns={columns} diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index dd32050..1ad20da 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -1,12 +1,18 @@ .subtable { position: relative; min-height: 200px; - padding-top: 16px; + > .top-search { padding: 0 0px 20px; } - > .button-list { - padding: 10px 0px 5px; + >.sub-action { + min-height: 25px; + .button-list { + padding: 10px 0px 5px; + } + } + .normal-data-table { + padding: 0px; } .box404 { padding-top: 30px; diff --git a/src/tabviews/subtable/subTable/index.jsx b/src/tabviews/subtable/subTable/index.jsx deleted file mode 100644 index 502df0d..0000000 --- a/src/tabviews/subtable/subTable/index.jsx +++ /dev/null @@ -1,367 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Table, message, Button, Typography } from 'antd' -import './index.scss' - -const { Paragraph } = Typography - -export default class MainTable extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - MenuID: PropTypes.string, // 鑿滃崟Id - setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級 - columns: PropTypes.array, // 琛ㄦ牸鍒� - data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - total: PropTypes.number, // 鎬绘暟 - loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� - refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� - buttonTrigger: PropTypes.func, // 琛ㄦ牸涓寜閽Е鍙戞搷浣� - handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d - pickup: PropTypes.any // 鏁版嵁灞曞紑鍚堝苟鎺у埗 - } - - state = { - selectedRowKeys: [], // 琛ㄦ牸涓�変腑琛� - pageIndex: 1, // 鍒濆椤甸潰绱㈠紩 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - columns: null // 鏄剧ず鍒� - } - - UNSAFE_componentWillMount () { - const { columns } = this.props - let _columns = [] - - columns.forEach(item => { - let cell = { - align: item.Align, - dataIndex: item.field || item.uuid, - title: item.label, - sorter: item.field && item.IsSort === 'true', - width: item.Width || 120, - render: (text, record) => { - return this.getContent(item, record) - } - } - _columns.push(cell) - }) - - this.setState({columns: _columns}) - } - - getContent = (item, record) => { - if (item.type === 'text') { - let content = '' - let match = false - if (item.field && record.hasOwnProperty(item.field)) { - content = `${record[item.field]}` - } - - if (content && item.matchVal && content.indexOf(item.matchVal) > 0) { - match = true - } - - content = (item.prefix || '') + content + (item.postfix || '') - - return ( - <div className={match ? item.color : ''}> - <div className="background"></div> - <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {content} - </div> - </div> - ) - } else if (item.type === 'number') { - let content = '' - let match = false - if (item.field && record.hasOwnProperty(item.field)) { - content = +record[item.field] - } - - if (content && item.match && item.matchVal) { - if (item.match === '>') { - if (content > item.matchVal) { - match = true - } - } else if (item.match === '<') { - if (content < item.matchVal) { - match = true - } - } else if (item.match === '>=') { - if (content >= item.matchVal) { - match = true - } - } else if (item.match === '<=') { - if (content <= item.matchVal) { - match = true - } - } - } - - if (content && item.format === 'thdSeparator') { - content = `${content}` - content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') - } - - content = (item.prefix || '') + content + (item.postfix || '') - - return ( - <div className={match ? item.color : ''}> - <div className={'background'}></div> - <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {content} - </div> - </div> - ) - } else if (item.type === 'picture') { - let photos = '' - if (item.field && record.hasOwnProperty(item.field)) { - photos = record[item.field].split(',') - } else { - photos = '' - } - return ( - <div className="picture-col" style={{ minWidth: (item.Width || 120) + 'px' }}> - {photos && photos.map((url, i) => { - return <img key={`${i}`} src={url} alt=""/> - })} - </div> - ) - } else if (item.type === 'textarea') { - let content = '' - let match = false - if (item.field && record.hasOwnProperty(item.field)) { - content = `${record[item.field]}` - } - - if (content && item.matchVal && content.indexOf(item.matchVal) > 0) { - match = true - } - - content = (item.prefix || '') + content + (item.postfix || '') - - return ( - <div className={match ? item.color : ''}> - <div className="background"></div> - <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {content ? <Paragraph copyable ellipsis={{ rows: 3, expandable: true }}>{content}</Paragraph> : null} - </div> - </div> - ) - } else if (item.type === 'action') { - return ( - <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> - {item.operations.map(btn => { - return <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - key={btn.uuid} - onClick={(e) => {this.actionTrigger(e, btn, record)}} - >{btn.label}</Button> - })} - </div> - ) - } else if (item.type === 'colspan') { - if (item.subColumn.length === 0) return '' - - let contents = [] - // if (item.order === 'leftPicRightText' || item.order === 'topPicBottomText') { - // contents = { - // picture: [], - // texts: [] - // } - // } - - item.subColumn.forEach(col => { - let content = '' - if (col.type === 'text' || col.type === 'textarea') { - if (col.field && record.hasOwnProperty(col.field)) { - content = `${record[col.field]}` - } - - content = (col.prefix || '') + content + (col.postfix || '') - } else if (col.type === 'number') { - if (col.field && record.hasOwnProperty(col.field)) { - content = +record[col.field] - } - if (content && col.format === 'thdSeparator') { - content = `${content}` - content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') - } - content = (col.prefix || '') + content + (col.postfix || '') - } else if (col.type === 'picture') { - let photos = '' - if (col.field && record.hasOwnProperty(col.field)) { - photos = record[col.field].split(',') - } else { - photos = '' - } - content = <div className="picture-col"> - {photos && photos.map((url, i) => { - return <img key={`${i}`} src={url} alt=""/> - })} - </div> - } - - contents.push(content) - }) - - if (contents.length > 0 && item.order === 'vertical2') { - let _contents = [] - for(let i = 0; i < contents.length; i += 2) { - _contents.push(contents.slice(i, i + 2).join(' ')) - } - contents = _contents - } - - return ( - <div> - <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {contents && item.order === 'vertical' && contents.map((content, index) => { - return (<p key={index}>{content}</p>) - })} - {contents && item.order === 'vertical2' && contents.map((content, index) => { - return (<p key={index}>{content}</p>) - })} - {contents && item.order === 'horizontal' && contents.map((content, index) => { - return (<span key={index}>{content}</span>) - })} - {contents && item.order === 'leftPicRightText' && contents.map((content, index) => { - return (<span key={index}>{content}</span>) - })} - </div> - </div> - ) - } - } - - actionTrigger = (e, btn, record) => { - e.stopPropagation() - this.props.buttonTrigger(btn, record) - } - - copycontent = (e, content) => { - // 琛ㄦ牸涓唴瀹瑰鍒� - e.stopPropagation() - let oInput = document.createElement('input') - oInput.value = content - document.body.appendChild(oInput) - oInput.select() - document.execCommand('Copy') - oInput.className = 'oInput' - oInput.style.display='none' - message.success(this.props.dict['main.copy.success']) - } - - onSelectChange = selectedRowKeys => { - let index = '' - if (selectedRowKeys.length > 0) { - index = selectedRowKeys[selectedRowKeys.length - 1] - } - - this.changedata(index) - this.setState({ selectedRowKeys }) - } - - changeRow = (record, index) => { - // 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔 - if (!this.props.setting.tableType) return - - let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys)) - let _re = newkeys.includes(index) - - if (this.props.setting.tableType === 'radio') { - this.changedata(index) - this.setState({ selectedRowKeys: [index] }) - } else { - if (_re) { - newkeys = newkeys.filter(item => item !== index) - this.changedata('') - } else { - newkeys.push(index) - this.changedata(index) - } - - this.setState({ selectedRowKeys: newkeys }) - } - } - - changeTable = (pagination, filters, sorter) => { - this.setState({ - pageIndex: pagination.current, - pageSize: pagination.pageSize, - selectedRowKeys: [] - }) - this.props.refreshdata(pagination, filters, sorter) - } - - resetTable = () => { - this.setState({ - pageIndex: 1, - selectedRowKeys: [] - }) - } - - changedata = (index) => { - const { data, setting } = this.props - let _id = '' - let _data = '' - - if (data && data.length > 0 && index !== '') { - _id = data[index][setting.primaryKey] || '' - _data = data[index] || '' - } - - this.props.handleTableId(_id, _data) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - render() { - let { selectedRowKeys } = this.state - - let rowSelection = null - if (this.props.setting.tableType) { - rowSelection = { - selectedRowKeys, - type: this.props.setting.tableType === 'radio' ? 'radio' : 'checkbox', - onChange: this.onSelectChange - } - } - - let _data = this.props.data ? this.props.data : [] - if (this.props.pickup) { - _data = _data.filter((item, index) => selectedRowKeys.includes(index)) - } - - return ( - <div className="sub-table"> - <Table - size="middle" - bordered={true} - rowSelection={rowSelection} - columns={this.state.columns} - dataSource={_data} - loading={this.props.loading} - scroll={{ x: '100%', y: false }} - onRow={(record, index) => { - return { - onClick: () => {this.changeRow(record, index)} - } - }} - onChange={this.changeTable} - pagination={{ - current: this.state.pageIndex, - pageSize: this.state.pageSize, - pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], - showSizeChanger: true, - total: this.props.total, - showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` - }} - /> - </div> - ) - } -} diff --git a/src/tabviews/subtable/subTable/index.scss b/src/tabviews/subtable/subTable/index.scss deleted file mode 100644 index 9b37d59..0000000 --- a/src/tabviews/subtable/subTable/index.scss +++ /dev/null @@ -1,127 +0,0 @@ -.sub-table { - padding: 0; - table { - max-width: 100%; - width: 100%; - .ant-table-column-title { - white-space: nowrap; - } - .ant-table-selection-column { - width: 60px; - min-width: 60px; - max-width: 60px; - } - // .ant-table-tbody > tr td:not(.ant-table-selection-column) { - // padding: 0!important; - // } - // .ant-table-tbody > tr td .content { - // padding: 12px 8px; - // height: 100%; - // background: lightblue; - // } - .ant-table-tbody > tr.ant-table-row-selected td { - background-color: #c4ebfd; - } - .ant-table-tbody > tr.ant-table-row-selected:hover .ant-table-column-sort { - background-color: #c4ebfd; - } - } - .ant-table-body { - overflow-x: auto!important; - min-height: 90px; - border: 1px solid #e8e8e8; - border-radius: 4px; - border-top: none; - border-bottom: none; - table { - border-left: 0; - .ant-table-thead > tr > th:last-child { - border-right: 0; - } - .ant-table-tbody > tr > td:last-child { - border-right: 0; - } - .ant-table-tbody > tr > td { - vertical-align: top; - .content { - position: relative; - z-index: 1; - word-wrap: break-word; - word-break: break-word; - } - .picture-col { - img { - max-width: 100%; - } - } - } - .ant-table-tbody > tr > td.ant-table-column-has-actions { - position: relative; - .background { - position: absolute; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - } - - .red { - .content { - color: red; - } - } - .redbg { - .background { - background: lightcoral; - } - } - } - .ant-table-tbody > tr > td .content { - p { - margin-bottom: 5px; - } - span { - display: inline-block; - margin-right: 5px; - } - } - .ant-table-tbody > tr > td .button { - .ant-btn { - margin-bottom: 10px; - } - } - } - } - .ant-table-body::-webkit-scrollbar { - width: 8px; - height: 10px; - } - ::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); - background: rgba(0, 0, 0, 0.13); - } - ::-webkit-scrollbar-track {/*婊氬姩鏉¢噷闈㈣建閬�*/ - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); - } - .fix-header { - .ant-table-body { - min-height: unset - } - .ant-table-placeholder { - display: none; - } - .ant-table-wrapper { - display: none; - } - .ant-affix .ant-table-wrapper { - display: block; - } - // .ant-table-column-sorter, .anticon-filter { - // display: none; - // } - } -} \ No newline at end of file diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index c8c0d50..b57a970 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -11,15 +11,12 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' -// import asyncComponent from '@/utils/asyncComponent' -import SubTable from '@/tabviews/subtable/subTable' +import SubTable from '@/tabviews/tableshare/normalTable' import SubAction from '@/tabviews/tableshare/actionList' import SubSearch from '@/tabviews/tableshare/topSearch' import NotFount from '@/components/404' import './index.scss' - -// const SubAction = asyncComponent(() => import('@/tabviews/tableshare/actionList')) class SubTabModalTable extends Component { static propTpyes = { @@ -611,11 +608,6 @@ this.refs.subtabButton.actionTrigger(btn, record) } - /** - * @description 琛ㄦ牸Id鍙樺寲 - */ - handleTableId = () => {} - UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.loadconfig() @@ -669,6 +661,7 @@ {columns && <SubTable ref="subTable" + tableId="" dict={this.state.dict} MenuID={this.props.MenuID} setting={setting} @@ -679,7 +672,7 @@ logcolumns={this.state.logcolumns} refreshdata={this.refreshbytable} buttonTrigger={this.buttonTrigger} - handleTableId={this.handleTableId} + handleTableId={() => {}} /> } {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 1bbb6e4..5bccc5f 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -438,6 +438,7 @@ */ printOuterLoopRequest = (params, btn, _list, _resolve) => { let param = params.shift() + let _outParam = null new Promise(resolve => { // 鍐呴儴璇锋眰 @@ -470,6 +471,7 @@ }).then(res => { if (!res) return // 澶栭儴璇锋眰 + _outParam = JSON.parse(JSON.stringify(res)) if (this.props.menuType === 'HS') { if (btn.sysInterface === 'true' && options.cloudServiceApi) { @@ -489,12 +491,38 @@ res.func = btn.outerFunc } - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey - return Api.genericInterface(res) }).then(response => { if (!response) return + if (btn.callbackFunc) { + // 瀛樺湪鍥炶皟鍑芥暟鏃讹紝璋冪敤 + delete response.message + delete response.status + + response.func = btn.callbackFunc + + let _callbackparam = {..._outParam, ...response} + + return Api.genericInterface(_callbackparam) + } else if (response.status) { + response.data.forEach(_item => { + _list.push({data: _item, count: response.printCount}) + }) + + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� + if (params.length === 0) { + _resolve({next: 'getTemp', list: _list}) + } else { + this.printOuterLoopRequest(params, btn, _list, _resolve) + } + } else { + this.execError(response, btn) + _resolve({next: false, list: _list}) + } + }).then(response => { + if (!response) return + if (response.status) { response.data.forEach(_item => { _list.push({data: _item, count: response.printCount}) diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index d99b22d..bf68574 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -53,6 +53,7 @@ let readin = {} let fieldlen = {} let formlist = [] + if (action.groups.length > 0) { action.groups.forEach(group => { if (group.sublist.length === 0) return diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/tableshare/normalTable/index.jsx similarity index 95% rename from src/tabviews/commontable/mainTable/index.jsx rename to src/tabviews/tableshare/normalTable/index.jsx index 0d7425b..ec02ca6 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/tableshare/normalTable/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -// import { is, fromJS } from 'immutable' import { Table, message, Affix, Button, Typography } from 'antd' import './index.scss' @@ -8,6 +7,7 @@ export default class MainTable extends Component { static propTpyes = { + tableId: PropTypes.string, // 鍒楄〃Id dict: PropTypes.object, // 瀛楀吀椤� MenuID: PropTypes.string, // 鑿滃崟Id setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級 @@ -289,6 +289,9 @@ changedata = (index) => { const { data, setting } = this.props + + if (!this.props.tableId) return + let _id = '' let _data = '' @@ -297,7 +300,7 @@ _data = data[index] || '' } - this.props.handleTableId('mainTable', _id, _data) + this.props.handleTableId(this.props.tableId, _id, _data) } resetTable = () => { @@ -311,6 +314,7 @@ const { setting, pickup } = this.props let { selectedRowKeys } = this.state + // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� let rowSelection = null if (setting.tableType) { rowSelection = { @@ -319,9 +323,10 @@ onChange: this.onSelectChange } } + + // 琛ㄦ牸澶撮儴鍥哄畾浜庨《閮ㄦ椂锛屽垽鏂窛椤堕儴楂樺害 let offset = null - if (setting.columnfixed) { - // 琛ㄦ牸澶撮儴鍥哄畾浜庨《閮ㄦ椂锛屽垽鏂窛椤堕儴楂樺害 + if (this.props.tableId === 'mainTable' && setting.columnfixed) { if (!setting.actionfixed) { offset = 48 } else { @@ -334,6 +339,7 @@ } } + // 鏁版嵁鏀惰捣鏃讹紝杩囨护宸查�夋暟鎹� let _data = this.props.data ? this.props.data : [] if (pickup) { @@ -341,8 +347,8 @@ } return ( - <div className="main-table"> - {setting.columnfixed && <Affix offsetTop={offset} className="fix-header"> + <div className="normal-data-table"> + {offset && <Affix offsetTop={offset} className="fix-header"> <Table size="middle" bordered={true} diff --git a/src/tabviews/commontable/mainTable/index.scss b/src/tabviews/tableshare/normalTable/index.scss similarity index 88% rename from src/tabviews/commontable/mainTable/index.scss rename to src/tabviews/tableshare/normalTable/index.scss index 93f37b9..53cb0f4 100644 --- a/src/tabviews/commontable/mainTable/index.scss +++ b/src/tabviews/tableshare/normalTable/index.scss @@ -1,4 +1,4 @@ -.main-table { +.normal-data-table { padding: 0 20px 30px; table { max-width: 100%; @@ -11,14 +11,6 @@ min-width: 60px; max-width: 60px; } - // .ant-table-tbody > tr td:not(.ant-table-selection-column) { - // padding: 0!important; - // } - // .ant-table-tbody > tr td .content { - // padding: 12px 8px; - // height: 100%; - // background: lightblue; - // } .ant-table-tbody > tr.ant-table-row-selected td { background-color: #c4ebfd; } @@ -126,8 +118,5 @@ .ant-affix .ant-table-wrapper { display: block; } - // .ant-table-column-sorter, .anticon-filter { - // display: none; - // } } } \ No newline at end of file diff --git a/src/tabviews/tableshare/verifycard/index.jsx b/src/tabviews/tableshare/verifycard/index.jsx index 705a486..5fc7311 100644 --- a/src/tabviews/tableshare/verifycard/index.jsx +++ b/src/tabviews/tableshare/verifycard/index.jsx @@ -74,7 +74,7 @@ dataIndex: 'shortcut', width: '25%', render: (text, record) => { - if (!record.shortcut || typeof(record.shortcut) !== 'object') return '' + if (!record.shortcut || typeof(record.shortcut) !== 'object' || record.shortcut.length === 0) return '' let _text = keycode[record.shortcut[1]] return record.shortcut[0] + ' + ' + _text @@ -226,7 +226,16 @@ let node = document.getElementById('verify-card-box-tab').parentNode if (node && node.scrollTop) { - node.scrollTop = 0 + let inter = Math.ceil(node.scrollTop / 10) + + let timer = setInterval(() => { + if (node.scrollTop - inter > 0) { + node.scrollTop = node.scrollTop - inter + } else { + node.scrollTop = 0 + clearInterval(timer) + } + }, 10) } } diff --git a/src/tabviews/tableshare/verifycard/index.scss b/src/tabviews/tableshare/verifycard/index.scss index d751b21..9e7831a 100644 --- a/src/tabviews/tableshare/verifycard/index.scss +++ b/src/tabviews/tableshare/verifycard/index.scss @@ -37,7 +37,7 @@ padding-top: 0px; } .ant-input-disabled { - color: rgba(0, 0, 0, 0.75); + color: rgba(0, 0, 0, 0.65); cursor: default; } } diff --git a/src/tabviews/verup/actionList/index.jsx b/src/tabviews/verup/actionList/index.jsx new file mode 100644 index 0000000..010b7cb --- /dev/null +++ b/src/tabviews/verup/actionList/index.jsx @@ -0,0 +1,763 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import moment from 'moment' +import { Button, Modal, notification, message } from 'antd' +import MutilForm from '@/tabviews/tableshare/mutilform' +import Utils from '@/utils/utils.js' +import options from '@/store/options.js' +import Api from '@/api' +import './index.scss' + +const { confirm } = Modal + +class MainAction extends Component { + static propTpyes = { + BID: PropTypes.string, // 涓昏〃ID + BData: PropTypes.any, // 涓昏〃鏁版嵁 + Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� + type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� + MenuID: PropTypes.string, // 鑿滃崟ID + actions: PropTypes.array, // 鎸夐挳缁� + logcolumns: PropTypes.array, // 鏄剧ず鍒� + dict: PropTypes.object, // 瀛楀吀椤� + setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 + ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� + refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� + gettableselected: PropTypes.func // 鑾峰彇琛ㄦ牸涓暟鎹� + } + + state = { + visible: false, + formdata: null, + tabledata: null, + confirmLoading: false, + execAction: null, + loadingUuid: '', + configMap: {} + } + + refreshdata = (item, type) => { + this.props.refreshdata(item, type) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (item, record) => { + const { setting, type, Tab, BID } = this.props + + if (type === 'sub' && Tab && Tab.supMenu && !BID) { + notification.warning({ + top: 92, + message: '闇�瑕佷笂绾т富閿�硷紒', + duration: 10 + }) + return + } + + let _this = this + let data = this.props.gettableselected() || [] + + if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� + data = [record] + } + + if (item.Ot !== 'notRequired' && data.length === 0) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectline'], + duration: 10 + }) + return + } else if (item.Ot === 'requiredSgl' && data.length !== 1) { + // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectSingleLine'], + duration: 10 + }) + return + } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� + notification.warning({ + top: 92, + message: '鏈缃富閿紒', + duration: 10 + }) + return + } + + if (item.OpenType === 'prompt') { + confirm({ + title: this.props.dict['main.action.confirm.tip'], + onOk() { + return new Promise(resolve => { + _this.execSubmit(item, data, resolve) + }) + }, + onCancel() {} + }) + } else if (item.OpenType === 'exec') { + this.setState({loadingUuid: item.uuid}) + this.execSubmit(item, data, () => { + this.setState({loadingUuid: ''}) + }) + } else if (item.OpenType === 'pop') { + if (item.setting.display === 'prompt') { // 濡傛灉琛ㄥ崟浠ユ槸鍚︽灞曠ず锛屼笉璇锋眰涓嬫媺鑿滃崟淇℃伅 + this.setState({ + execAction: item, + tabledata: data + }, () => { + this.modelconfirm() + }) + } else { + this.setState({ + visible: true, + execAction: item, + tabledata: data + }) + } + } else { + notification.warning({ + top: 92, + message: '灏氫笉鏀寔姝ゅ姛鑳姐�傘�傘��', + duration: 10 + }) + } + } + + /** + * @description 鎸夐挳鎻愪氦鎵ц + */ + execSubmit = (btn, data, _resolve, formdata) => { + const { setting, logcolumns } = this.props + + if (btn.intertype === 'inner') { + // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� + // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔�(鏈夋壒閲忔坊鍔犲満鏅紝宸插幓闄�) + if ( + btn.Ot === 'notRequired' || + btn.Ot === 'requiredSgl' || + (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') + ) { + + let param = { // 绯荤粺瀛樺偍杩囩▼ + func: 'sPC_TableData_InUpDe', + BID: this.props.BID + } + let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' + + if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� + let ID = '' + if (btn.Ot === 'notRequired') { + + } else if (btn.Ot === 'requiredSgl') { + ID = data[0][setting.primaryKey] + } else if (btn.Ot === 'requiredOnce') { // id鍊兼嫾鎺� + let ids = data.map(d => { return d[setting.primaryKey]}) + ID = ids.join(',') + } + + if (btn.innerFunc) { // 浣跨敤鑷畾涔夊嚱鏁� + param.func = btn.innerFunc + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = ID + } + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 + if (btn.innerFunc) { + param.func = btn.innerFunc + + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = primaryId + } + + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + + } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid + primaryId = '' + if (formdata && setting.primaryKey) { // 琛ㄥ崟涓瓨鍦ㄤ富閿瓧娈碉紝涓婚敭鍊间互琛ㄥ崟涓殑鍊间负鍑� + let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] + if (_form) { + primaryId = _form.value + } + } + param.ID = primaryId || Utils.getguid() + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } + + Api.genericInterface(param).then((res) => { + if (res.status) { + this.execSuccess(btn, res) + } else { + this.execError(res, btn) + } + _resolve() + }) + } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { + let _formPrimaryId = '' + if (formdata && setting.primaryKey) { // 琛ㄥ崟涓瓨鍦ㄤ富閿瓧娈碉紝涓婚敭鍊间互琛ㄥ崟涓殑鍊间负鍑� + let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] + if (_form) { + _formPrimaryId = _form.value + } + } + + let _params = data.map((cell, index) => { + let param = { + func: 'sPC_TableData_InUpDe', + BID: this.props.BID + } + let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' + + if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� + + if (btn.innerFunc) { + param.func = btn.innerFunc + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 + if (btn.innerFunc) { + param.func = btn.innerFunc + + formdata.forEach(_data => { + if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { + param[_data.key] = cell[_data.key] + } else { + param[_data.key] = _data.value + } + }) + + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid + param.ID = _formPrimaryId || Utils.getguid() + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } else if (btn.sql) { + if (index !== 0) { + formdata = formdata.map(_data => { + if (_data.readin && cell.hasOwnProperty(_data.key)) { + _data.value = cell[_data.key] + } + return _data + }) + } + + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } + + return param + }) + + if (_params.length <= 20) { + let deffers = _params.map(param => { + return new Promise(resolve => { + Api.genericInterface(param).then(res => { + resolve(res) + }) + }) + }) + Promise.all(deffers).then(result => { + let iserror = false + let errorMsg = '' + result.forEach(res => { + if (res.status) { + errorMsg = res + } else { + iserror = true + errorMsg = res + } + }) + if (!iserror) { + this.execSuccess(btn, errorMsg) + } else { + this.execError(errorMsg, btn) + } + _resolve() + }) + } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц + this.innerLoopRequest(_params, btn, _resolve) + } + } + } else if (btn.intertype === 'outer') { + /** *********************璋冪敤澶栭儴鎺ュ彛************************* */ + + let _params = [] // 璇锋眰鍙傛暟鏁扮粍 + + if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { + let param = { + BID: this.props.BID + } + + if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + } + + // 鑾峰彇id + if (btn.Ot === 'notRequired') { + + } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { + param[setting.primaryKey] = data[0][setting.primaryKey] + } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { + let ids = data.map(d => { return d[setting.primaryKey]}) + param[setting.primaryKey] = ids.join(',') + } + + _params.push(param) + } else if (btn.Ot === 'required') { + // 閫夋嫨澶氳锛屽惊鐜皟鐢� + _params = data.map((cell, index) => { + let _cell = { + BID: this.props.BID, + } + + let _formparam = {} + if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 + formdata.forEach(_data => { + if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { + _formparam[_data.key] = cell[_data.key] + } else { + _formparam[_data.key] = _data.value + } + }) + } + + if (setting.primaryKey) { + _cell[setting.primaryKey] = cell[setting.primaryKey] + } + + _cell = {..._formparam, ..._cell} + + return _cell + }) + } + + // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛� + this.outerLoopRequest(_params, btn, _resolve) + } + } + + /** + * @description 鍐呴儴璇锋眰寰幆鎵ц + */ + innerLoopRequest = (params, btn, _resolve) => { + if (!params && params.length === 0) return + + let param = params.shift() + + Api.genericInterface(param).then(res => { + if (res.status) { + if (params.length === 0) { + this.execSuccess(btn, res) + _resolve() + } else { + this.innerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(res, btn) + _resolve() + } + }) + } + + /** + * @description 澶栭儴璇锋眰寰幆鎵ц + */ + outerLoopRequest = (params, btn, _resolve) => { + if (!params && params.length === 0) return + + let param = params.shift() + let _outParam = null + let _localParam = null + + new Promise(resolve => { + // 鍐呴儴璇锋眰 + if (btn.innerFunc) { + param.func = btn.innerFunc + // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞� + Api.genericInterface(param).then(res => { + if (res.status) { + delete res.ErrCode + delete res.ErrMesg + delete res.message + delete res.status + + // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛 + let keys = Object.keys(res) // 鎻愪氦澶栭儴鎺ュ彛鍓嶏紝娣诲姞BID + if (keys.filter(key => key.toLowerCase() === 'bid').length === 0) { + res.BID = this.props.BID + } + + resolve(res) + } else { + this.execError(res, btn) + resolve(false) + _resolve() + } + }) + } else { + resolve(param) + } + }).then(res => { + if (!res) return + // 澶栭儴璇锋眰 + _outParam = JSON.parse(JSON.stringify(res)) + + if (btn.sysInterface === 'true' && options.cloudServiceApi) { + res.rduri = options.cloudServiceApi + } else if (btn.sysInterface !== 'true') { + res.rduri = btn.interface + } + + if (btn.outerFunc) { + res.func = btn.outerFunc + } + + res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey + + return Api.genericInterface(res) + }).then(response => { + if (!response) return + // 鍥炶皟璇锋眰 + if (btn.callbackFunc) { + // 瀛樺湪鍥炶皟鍑芥暟鏃讹紝璋冪敤 + delete response.message + delete response.status + + response.func = btn.callbackFunc + + if (response.UpType === 'SSO' && window.GLOB.mainSystemApi) { + _localParam = {..._outParam, ...response} + + response.rduri = window.GLOB.mainSystemApi + } + delete response.UpType + + + let _callbackparam = {..._outParam, ...response} + return Api.genericInterface(_callbackparam) + } else { + if (response.status) { + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� + + if (params.length === 0) { + this.execSuccess(btn, response) + _resolve() + } else { + this.outerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(response, btn) + _resolve() + } + } + }).then(res => { + if (!res) return + + if (_localParam) { + + return Api.genericInterface(_localParam) + } else if (res.status) { + if (params.length === 0) { + this.execSuccess(btn, res) + _resolve() + } else { + this.outerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(res, btn) + _resolve() + } + }).then(res => { + if (!res) return + + if (res.status) { + if (params.length === 0) { + this.execSuccess(btn, res) + _resolve() + } else { + this.outerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(res, btn) + _resolve() + } + }) + } + + /** + * @description 鎿嶄綔鎴愬姛鍚庡鐞� + * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� + * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� + * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� + * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execSuccess = (btn, res) => { + if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 + notification.success({ + top: 92, + message: res.ErrMesg || this.props.dict['main.action.confirm.success'], + duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 + }) + } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 + Modal.success({ + title: res.ErrMesg || this.props.dict['main.action.confirm.success'] + }) + } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず + + } + + if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { + this.setState({ + visible: false + }) + } + + this.setState({ + loadingUuid: '' + }) + + this.refreshdata(btn, 'success') + } + + /** + * @description 鎿嶄綔澶辫触鍚庡鐞� + * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅 + * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execError = (res, btn) => { + if (res.ErrCode === 'E') { + Modal.error({ + title: res.message || res.ErrMesg, + }) + } else if (res.ErrCode === 'N') { + notification.error({ + top: 92, + message: res.message || res.ErrMesg, + duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 + }) + } else if (res.ErrCode === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: res.message || res.ErrMesg, + duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 15 + }) + } else if (res.ErrCode === 'NM') { + message.error(res.message || res.ErrMesg) + } + + this.setState({ + loadingUuid: '' + }) + + this.refreshdata(btn, 'error') + } + + modelconfirm = () => { + const { BData } = this.props + const { execAction, tabledata } = this.state + let _this = this + let _fields = [] + + if (execAction.groups.length > 0) { + execAction.groups.forEach(group => { + _fields = [..._fields, ...group.sublist] + }) + } else { + _fields = execAction.fields + } + + let result = _fields.map(item => { + let _readin = item.readin !== 'false' + let _initval = item.initval + + if (item.type === 'linkMain' || item.type === 'funcvar') { + _readin = false + } + + if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { + _initval = BData[item.field] + } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) { + _initval = tabledata[0][item.field] + } + + let _fieldlen = item.fieldlength || 50 + if (item.type === 'textarea' || item.type === 'fileupload') { + _fieldlen = item.fieldlength || 512 + } else if (item.type === 'number') { + _fieldlen = item.decimal ? item.decimal : 0 + } + + return { + key: item.field, + readonly: item.readonly === 'true', + readin: _readin, + fieldlen: _fieldlen, + type: item.type, + value: _initval + } + }) + + confirm({ + title: this.props.dict['main.action.confirm.tip'], + onOk() { + return new Promise(resolve => { + _this.execSubmit(execAction, tabledata, resolve, result) + }) + }, + onCancel() {} + }) + } + + /** + * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� + */ + handleOk = () => { + this.formRef.handleConfirm().then(res => { + this.setState({ + confirmLoading: true + }) + + this.execSubmit(this.state.execAction, this.state.tabledata, () => { + this.setState({ + confirmLoading: false + }) + }, res) + }, () => {}) + } + + /** + * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑� + */ + handleCancel = () => { + this.setState({ + visible: false + }) + } + + /** + * @description 鏄剧ず妯℃�佹 + */ + getModels = () => { + const { execAction } = this.state + + if (!execAction || !this.state.visible) return + + let title = '' + let width = '62vw' + let clickouter = false + let container = document.body + + if (execAction && execAction.setting) { + title = execAction.setting.title + width = execAction.setting.width + 'vw' + + if (execAction.setting.container === 'tab' && this.props.ContainerId) { + width = execAction.setting.width + '%' + container = () => document.getElementById(this.props.ContainerId) + } + + if (execAction.setting.clickouter === 'close') { + clickouter = true + } + } + + if (this.props.type === 'subtab') { + container = document.body + } + + return ( + <Modal + title={title} + maskClosable={clickouter} + getContainer={container} + wrapClassName='action-modal' + visible={this.state.visible} + width={width} + onOk={this.handleOk} + confirmLoading={this.state.confirmLoading} + onCancel={this.handleCancel} + destroyOnClose + > + <MutilForm + dict={this.props.dict} + action={execAction} + inputSubmit={this.handleOk} + configMap={this.state.configMap} + data={this.state.tabledata[0]} + BData={this.props.BData} + wrappedComponentRef={(inst) => this.formRef = inst} + /> + </Modal> + ) + } + + render() { + const { loadingUuid } = this.state + + return ( + <div className="button-list toolbar-button"> + {this.props.actions.map((item, index) => { + if (loadingUuid === item.uuid) { + return ( + <Button + className={'mk-btn mk-' + item.class} + icon={item.icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + loading + >{item.label}</Button> + ) + } else { + return ( + <Button + className={'mk-btn mk-' + item.class} + icon={item.icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + >{item.label}</Button> + ) + } + })} + {this.getModels()} + </div> + ) + } +} + +export default MainAction \ No newline at end of file diff --git a/src/tabviews/verup/actionList/index.scss b/src/tabviews/verup/actionList/index.scss new file mode 100644 index 0000000..9dd1f19 --- /dev/null +++ b/src/tabviews/verup/actionList/index.scss @@ -0,0 +1,44 @@ +.button-list.toolbar-button { + position: relative; + padding: 10px 20px 5px; + background: #ffffff; + button { + min-width: 65px; + margin-right: 15px; + margin-bottom: 10px; + overflow: hidden; + } + .ant-spin { + position: fixed; + z-index: 1010; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + } +} +// 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� +.action-modal { + .ant-modal { + max-width: 95vw; + } + .ant-modal-body { + max-height: calc(100vh - 235px); + min-height: 150px; + overflow-y: auto; + padding-bottom: 35px; + } + .ant-modal-body::-webkit-scrollbar { + width: 10px; + height: 10px; + } + .ant-modal-body::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); + background: rgba(0, 0, 0, 0.13); + } + .ant-modal-body::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + } +} \ No newline at end of file diff --git a/src/tabviews/verup/config.js b/src/tabviews/verup/config.js new file mode 100644 index 0000000..768fdea --- /dev/null +++ b/src/tabviews/verup/config.js @@ -0,0 +1,157 @@ +// 鐗堟湰鍗囩骇椤甸潰閰嶇疆 +export const verupMainTable = { + setting: { + tableName: 'sVersion', + tableType: 'radio', + interType: 'inner', + actionfixed: false, + columnfixed: false, + primaryKey: 'ID', + order: 'ID desc', + innerFunc: '', + dataresource: 'select * from sVersion_Local where deleted=0 and status=10 and appkey=@Appkey@', + queryType: 'query', + }, + search:[ + {label: '浼犺緭鍙�', field:'VersionName', type: 'text', initval:'',match: 'like', uuid: '1581736007223d84ddmht4gdfb1850nh'} + ], + action:[ + {label:'娣诲姞',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersiondetail_Up',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sVersion_Local_add',position:'toolbar',Ot:'notRequired',execSuccess:'grid',execError:'never',icon:'',class:'green',uuid:'1583979660949vpssdb2p2lsqff9abkr'}, + {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',Ot:'requiredSgl',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersion',sqlType:'LogicDelete',uuid:'1583979660949msql0p8bgiiedlu4r82', + verify: { + default: 'false', + invalid: 'true', + uniques: [], + contrasts: [], + accountdate: 'false', + customverifys: [], + billcodes: [], + voucher: {enabled: false}, + scripts:[ + { + sql: 'declare @Vid nvarchar(50)\nset @Vid=\'\'\nselect top 1 @Vid=id from sVersionDetail_Local where BID=@ID@ and Status =10\n\nif @Vid=\'\'\nbegin\n delete sVersion_Local where id =@ID@\n delete sVersionDetail_Local where bid =@ID@\nend\nelse\nbegin\n update sVersion_Local set deleted=1,Modifydate=getdate(),ModifyUserID=@UserID@ where id =@ID@\nend', + uuid: '15839986098557o6ri091qo9flrc5c0a' + } + ] + } + } + ], + columns:[ + {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736658674f11dg01sqdneu8bbn2q'}, + {label:'浼犺緭鍙�',field:'VersionName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'158173670848068ku8o5a7csuiepd4v8'}, + {label:'璇存槑',field:'ProgramName',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15817367246420ubig4dkim4on7bv3kp'}, + {label:'鐘舵��',field:'StatusName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736695990kvpkao3d14etkc88c12'}, + {label:'鍒涘缓鏃堕棿',field:'CreateDate',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736740656s2o0llughpc779l0qti'} + ], + gridBtn: {display: false}, + tabs:[ + {label:'鑴氭湰',type:'SubTable',linkTab:'15839835082267ac69e4gm0ig6ac00ob',icon:'',supMenu:'mainTable',equalTab:[],uuid:'1583979660949hguu6ildhut1ig5mco1'}, + {label:'宸叉墽琛�',type:'SubTable',linkTab:'1583984646423lo60vt7snppb55lslbt',icon:'',supMenu:'mainTable',equalTab:[],uuid:'1583984632864kedhlvu7l31us7pkmbq'} + ] +} + +export const buttonConfig = { + '1583979660949vpssdb2p2lsqff9abkr': { + type: 'Modal', + setting:{title: '娣诲姞',width:45,focus:'VersionName',cols:'1',finish:'close',clickouter:'unclose',container:'tab',display:'modal'}, + tables:[], + groups:[], + fields:[ + {label:'浼犺緭鍙�',field:'VersionName',type:'text',initval:'',regular:'letter&number',readonly:'false',required:'true',hidden:'false',fieldlength:20,readin:'true',uuid:'1581738428097qgoe876i5u0866373uu'} + ] + }, + '1583983849299g1qfd28g3c9n9e0e57a': { + type:'Modal', + setting:{ + title:'鎵ц', + width:60, + focus:'SrcID', + cols:'2', + finish:'close', + clickouter:'unclose', + container:'tab', + display:'prompt' + }, + groups: [], + fields: [ + {'label':'SrcID','field':'SrcID','type':'text','initval':'','regular':'','readonly':'false','required':'true','hidden':'false','fieldlength':50,'readin':'true','supField':'','uuid':'1584001255960ns626a3pkfkhk04hn7u'} + ] + } +} + +export const tabConfig = { + '15839835082267ac69e4gm0ig6ac00ob': { + tabName:'鑴氭湰', + tabNo:'sVersionDetail_LocalM', + Remark:'', + uuid:'15839835082267ac69e4gm0ig6ac00ob', + setting:{ + tableName:'sVersionDetail_Local', + tableType:'checkbox', + interType:'inner', + innerFunc:'', + dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=0', + queryType:'query', + primaryKey:'ID', + order:'Sort', + onload:'true' + }, + search:[ + {label:'缁煎悎鏌ヨ',field:'Remark,KeyWords,TypeName',type:'text',initval:'',match:'like','ratio':6,uuid:'1583983588787acl55md59fu9kpb52db'} + ], + action:[ + {label:'鎵ц',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersionDetail_Ltext',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sDataDictb_TBBack',position:'toolbar',execSuccess:'grid',execError:'never',icon:'',class:'primary',Ot:'required',uuid:'1583983849299g1qfd28g3c9n9e0e57a',verify:null}, + {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',Ot:'required',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersionDetail_Local',sqlType:'LogicDelete',uuid:'1583984089282i4i140hacimbki9s5gh', + verify:{ + default: 'true', + invalid: 'true', + uniques: [], + contrasts: [], + accountdate: 'false', + customverifys: [], + billcodes: [], + voucher: {enabled: false}, + scripts: [] + } + } + ], + columns:[ + {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983669503v35f3e7f52iosklnomg'}, + {label:'鍏抽敭瀛�',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839836784475gl5v26qgual768ab8u'}, + {label:'鎻忚堪',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839837044624m3k41m7omhs6q8f9fo'}, + {label:'绫诲瀷',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983717421ts67iu14hmmeqivel5e'}, + {label:'鎺掑簭',field:'Sort',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983728654ks05hor8mgiqbp61ivl'}, + {label:'SrcID',field:'SrcID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1584001165784gu23d35b43i860n0a19'} + ], + gridBtn: {display: false} + }, + '1583984646423lo60vt7snppb55lslbt': { + tabName:'宸叉墽琛�', + tabNo:'sVersionDetail_Local_ReadyM', + Remark:'', + uuid:'1583984646423lo60vt7snppb55lslbt', + setting:{ + tableName:'sVersionDetail_Local', + tableType:'checkbox', + interType:'inner', + innerFunc:'', + dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=10', + queryType:'query', + primaryKey:'ID', + order:'Sort', + onload:'true' + }, + search:[ + {label:'缁煎悎鏌ヨ',field:'Remark,KeyWords,TypeName',type:'text',initval:'',match:'like',uuid:'15839847143720ggaaukqtfhp3mirsuc'} + ], + action:[], + columns:[ + {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984775854fkg1kriv6un6v6r21mu'}, + {label:'鍏抽敭瀛�',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984782136vspicmogvs44o5c0u8n'}, + {label:'鎻忚堪',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984799089vi8v268uur6mhqmi71o'}, + {label:'绫诲瀷',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984810593u53835abq83e7h63vce'}, + {label:'鎺掑簭',field:'Sort',type:'number',Align:'left',Hide:'false',IsSort:'true',Width:120,'decimal':0,'format':'',prefix:'',postfix:'',match:'',matchVal:'',color:'',uuid:'1583984826744bttg6mt4oqskckpoasl'} + ], + gridBtn: {display: false} + } +} diff --git a/src/tabviews/verup/index.jsx b/src/tabviews/verup/index.jsx new file mode 100644 index 0000000..56fec4c --- /dev/null +++ b/src/tabviews/verup/index.jsx @@ -0,0 +1,519 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { notification, Tabs, Icon, Switch } from 'antd' +import moment from 'moment' + +import Api from '@/api' +import zhCN from '@/locales/zh-CN/main.js' +import enUS from '@/locales/en-US/main.js' +import Utils from '@/utils/utils.js' +import options from '@/store/options.js' +import asyncLoadComponent from '@/utils/asyncLoadComponent' +import { verupMainTable, buttonConfig } from './config.js' + +import MainTable from '@/tabviews/tableshare/normalTable' +import TopSearch from './topSearch' +import MainAction from './actionList' +import './index.scss' + +const SubTable = asyncLoadComponent(() => import('./subtabtable')) + +const { TabPane } = Tabs + +class VerupTable extends Component { + static propTpyes = { + MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuID: PropTypes.string // 鑿滃崟Id + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id + config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 + searchlist: [], // 鎼滅储鏉′欢 + actions: [], // 鎸夐挳闆� + columns: [], // 鏄剧ず鍒� + arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) + setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 + data: [], // 鍒楄〃鏁版嵁闆� + total: 0, // 鎬绘暟 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + pageIndex: 1, // 椤电爜 + pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 + orderBy: '', // 鎺掑簭 + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + BIDs: {}, // 涓婄骇琛╥d + pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 + refreshtabs: null // 闇�瑕佸埛鏂扮殑鏍囩闆� + } + + /** + * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 + */ + async loadconfig () { + let config = verupMainTable + + let _arrField = [] // 瀛楁闆� + let _columns = [] // 鏄剧ず鍒� + let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� + let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� + let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 + + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid + config.columns.forEach(col => { + if (col.field) { + _arrField.push(col.field) + + _logcolumns.push(col) + } + if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 + _hideCol = _hideCol.concat(col.sublist) + } else if (col.Hide === 'true') { + _hideCol.push(col.uuid) + } + colMap.set(col.uuid, col) + }) + + // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� + config.columns.forEach(col => { + if (_hideCol.includes(col.uuid)) return + + if (col.type === 'colspan' && col.sublist) { + let _col = JSON.parse(JSON.stringify(col)) + let subColumn = [] + _col.sublist.forEach(sub => { + if (colMap.has(sub)) { + subColumn.push(colMap.get(sub)) + } + }) + _col.subColumn = subColumn + _columns.push(_col) + } else { + _columns.push(col) + } + }) + + this.setState({ + config: config, + setting: config.setting, + searchlist: config.search, + actions: config.action.map(item => { + if (buttonConfig[item.uuid]) { + item = {...buttonConfig[item.uuid], ...item} + } + return item + }), + columns: _columns, + logcolumns: _logcolumns, + arr_field: _arrField.join(','), + search: Utils.initMainSearch(config.search) + }, () => { + this.setState({ + loading: true + }) + this.loadmaindata() + }) + } + + /** + * @description 涓昏〃鏁版嵁鍔犺浇 + */ + async loadmaindata () { + const { setting, BIDs } = this.state + let param = '' + + if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { + param = this.getCustomParam() + } else { + param = this.getDefaultParam() + } + + this.setState({ + pickup: false + }) + + this.handleTableId('mainTable', '', '') + + if (!param) { // 鏈幏鍙栧弬鏁版椂锛屼笉鍙戣姹� + return + } + + let result = await Api.genericInterface(param) + if (result.status) { + this.setState({ + data: result.data.map((item, index) => { + item.key = index + return item + }), + total: result.total, + loading: false, + BIDs: { + ...BIDs, + mainTable: '' + } + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 15 + }) + } + } + + /** + * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� + */ + getCustomParam = () => { + const { pageIndex, pageSize, orderBy, search, setting } = this.state + + let _search = Utils.formatCustomMainSearch(search) + + let param = { + PageIndex: pageIndex, + PageSize: pageSize, + OrderCol: orderBy || setting.order, + ..._search + } + + if (setting.interType === 'inner') { + param.func = setting.innerFunc + } else { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + + if (setting.outerFunc) { + param.func = setting.outerFunc + } + } + + return param + } + + /** + * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� + */ + getDefaultParam = () => { + const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state + + if (!arr_field) { + notification.warning({ + top: 92, + message: '鏈缃樉绀哄垪锛�', + duration: 10 + }) + return null + } + + let _search = Utils.joinMainSearchkey(search) + + _search = _search ? 'where ' + _search : '' + + let param = { + func: 'sPC_Get_TableData', + obj_name: 'data', + arr_field: arr_field, + appkey: window.GLOB.appkey || '' + } + + let _orderBy = orderBy || setting.order + let _dataresource = setting.dataresource + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } + + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + let options = search.map(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + return { + reg: new RegExp('@' + _field, 'ig'), + value: item.value + } + }) + + options.reverse() + + options.forEach(item => { + _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) + }) + + _search = '' + } + + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + let DateCount = `select count(1) as total from ${_dataresource} ${_search}` + + param.LText = Utils.formatOptions(LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.DateCount = Utils.formatOptions(DateCount) + + return param + } + + /** + * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 + * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� + */ + refreshbysearch = (searches) => { + this.refs.mainTable.resetTable() + + this.setState({ + loading: true, + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 + */ + refreshbytable = (pagination, filters, sorter) => { + if (sorter.order) { + let _chg = { + ascend: 'asc', + descend: 'desc' + } + sorter.order = _chg[sorter.order] + } + + this.setState({ + loading: true, + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鍒锋柊 + */ + reloadtable = () => { + this.refs.mainTable.resetTable() + this.setState({ + loading: true, + pageIndex: 1 + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� + */ + reloadview = () => { + this.setState({ + config: {}, + searchlist: [], + actions: [], + columns: [], + arr_field: '', + setting: {}, + data: [], + total: 0, + loading: false, + pageIndex: 1, + pageSize: 10, + orderBy: '', + search: '', + BIDs: {}, + pickup: false + }, () => { + this.loadconfig() + }) + } + + /** + * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� + */ + refreshbyaction = (btn, type) => { + if (btn.execSuccess === 'grid' && type === 'success') { + this.reloadtable() + } else if (btn.execError === 'grid' && type === 'error') { + this.reloadtable() + } else if (btn.execSuccess === 'view' && type === 'success') { + this.reloadview() + } else if (btn.execError === 'view' && type === 'error') { + this.reloadview() + } + } + + /** + * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� + */ + handleMainTable = (type, tab) => { + if (type === 'maingrid' && tab.supMenu === 'mainTable') { + this.reloadtable() + } else if (type === 'maingrid' && tab.supMenu) { + this.setState({ + refreshtabs: [tab.supMenu] + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { + this.setState({ + refreshtabs: tab.equalTab + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } + } + + /** + * @description 鑾峰彇琛ㄦ牸閫夋嫨椤� + */ + gettableselected = () => { + let data = [] + this.refs.mainTable.state.selectedRowKeys.forEach(item => { + data.push(this.refs.mainTable.props.data[item]) + }) + return data + } + + /** + * @description 琛ㄦ牸Id鍙樺寲 + */ + handleTableId = (type, id, data) => { + const { BIDs } = this.state + + this.setState({ + BIDs: { + ...BIDs, + [type]: id, + [type + 'data']: data + } + }) + } + + /** + * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 + */ + pickupChange = () => { + const { pickup } = this.state + this.setState({ + pickup: !pickup + }) + } + + UNSAFE_componentWillMount () { + // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 + this.loadconfig() + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { dict, searchlist, setting, actions, columns, pickup, config } = this.state + + return ( + <div className="veruptable pick-control" id={this.state.ContainerId}> + <TopSearch + dict={dict} + searchlist={searchlist} + refreshdata={this.refreshbysearch} + /> + <MainAction + BID="" + type="main" + setting={setting} + actions={actions} + dict={this.state.dict} + MenuID={this.props.MenuID} + logcolumns={this.state.logcolumns} + ContainerId={this.state.ContainerId} + refreshdata={this.refreshbyaction} + gettableselected={this.gettableselected} + /> + <div className="main-table-box"> + {this.state.data && this.state.data.length > 0 ? + <div className="pickchange"> + <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> + </div> : null + } + <MainTable + ref="mainTable" + tableId="mainTable" + pickup={pickup} + setting={setting} + columns={columns} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + MenuID={this.props.MenuID} + loading={this.state.loading} + refreshdata={this.refreshbytable} + buttonTrigger={() => {}} + handleTableId={this.handleTableId} + /> + </div> + <Tabs defaultActiveKey="0"> + {config.tabs && config.tabs.map((_tab, index) => { + return ( + <TabPane tab={ + <span> + {_tab.icon ? <Icon type={_tab.icon} /> : null} + {_tab.label} + </span> + } key={`${index}`}> + <SubTable + menuType="HS" + Tab={_tab} + MenuID={_tab.linkTab} + SupMenuID={this.props.MenuID} + refreshtabs={this.state.refreshtabs} + ContainerId={this.state.ContainerId} + BID={this.state.BIDs[_tab.supMenu] || ''} + BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} + handleTableId={this.handleTableId} + handleMainTable={(type) => this.handleMainTable(type, _tab)} + /> + </TabPane> + ) + })} + </Tabs> + </div> + ) + } +} + +export default VerupTable \ No newline at end of file diff --git a/src/tabviews/verup/index.scss b/src/tabviews/verup/index.scss new file mode 100644 index 0000000..f799b4b --- /dev/null +++ b/src/tabviews/verup/index.scss @@ -0,0 +1,115 @@ +.veruptable { + position: relative; + min-height: calc(100vh - 94px); + padding-top: 16px; + padding-bottom: 80px; + + .search-line { + padding: 0px 24px 0px; + border-bottom: 1px solid #efefef; + } + + .box404 { + padding-top: 30px; + } + .ant-modal-mask { + position: absolute; + } + .ant-modal-wrap { + position: absolute; + } + .action-modal .ant-modal { + top: 40px; + max-width: 95%; + .ant-modal-body { + max-height: calc(100vh - 265px); + } + } + > .ant-spin { + position: fixed; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + } + > .ant-card { + margin: 0 20px 20px; + > .ant-card-head { + border: 0; + padding: 0; + min-height: 30px; + .ant-card-head-title { + padding: 10px 0 0; + span { + color: #1890ff; + display: inline-block; + padding: 0 10px; + font-size: 15px; + border-bottom: 1px solid #1890ff; + i { + margin-right: 10px; + } + } + } + } + > .ant-card-body { + padding: 0; + } + } + .main-table-box { + position: relative; + .pickchange { + position: absolute; + right: 0px; + top: -25px; + .ant-switch { + z-index: 1; + float: right; + margin-right: 20px; + margin-bottom: 5px; + } + } + } + > .ant-tabs { + padding: 0px 20px; + margin-bottom: 20px; + .ant-tabs-tab:not(.ant-tabs-tab-active) { + cursor: pointer; + } + } + .common-table-copy { + position: fixed; + z-index: 2; + bottom: 65px; + right: 30px; + width: 40px; + height: 40px; + } +} +.commontable.pick-control { + >.button-list { + padding-right: 140px; + } +} +.popview-modal { + .ant-modal-body { + min-height: 300px; + } +} +.menu-tree-modal { + .ant-modal-body { + min-height: 300px; + .menu-header { + text-align: center; + span { + font-weight: 600; + margin-right: 20px; + } + .ant-typography { + font-weight: 600; + display: inline-block; + } + } + .ant-tree li .ant-tree-node-content-wrapper { + cursor: default; + } + } +} \ No newline at end of file diff --git a/src/tabviews/verup/subtabtable/index.jsx b/src/tabviews/verup/subtabtable/index.jsx new file mode 100644 index 0000000..55ab976 --- /dev/null +++ b/src/tabviews/verup/subtabtable/index.jsx @@ -0,0 +1,490 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { notification, Switch} from 'antd' +import moment from 'moment' + +import Api from '@/api' +import zhCN from '@/locales/zh-CN/main.js' +import enUS from '@/locales/en-US/main.js' +import Utils from '@/utils/utils.js' +import options from '@/store/options.js' +import { buttonConfig, tabConfig } from '../config.js' + +import SubTable from '@/tabviews/tableshare/normalTable' +import SubAction from '../actionList' +import SubSearch from '../topSearch' + +import './index.scss' + +class VerupSubTabViewTable extends Component { + static propTpyes = { + menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS + Tab: PropTypes.object, // 鏍囩淇℃伅 + BID: PropTypes.string, // 涓婄骇鏁版嵁ID + BData: PropTypes.any, // 涓婄骇鏁版嵁 + MenuID: PropTypes.string, // 鑿滃崟Id + SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id + ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID + handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d + handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 + refreshtabs:PropTypes.any + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 + searchlist: null, // 鎼滅储鏉′欢 + actions: null, // 鎸夐挳闆� + columns: null, // 鏄剧ず鍒� + logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) + arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 + data: null, // 鍒楄〃鏁版嵁闆� + total: 0, // 鎬绘暟 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + pageIndex: 1, // 椤电爜 + pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 + orderBy: '', // 鎺掑簭 + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� + popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 + visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 + pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + } + + /** + * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 + */ + UNSAFE_componentWillReceiveProps(nextProps) { + if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { + this.refs.subTable.resetTable() + this.loadmaindata(nextProps.BID, 'refresh') + } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { + + this.reloadtable() + } + } + + /** + * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 + */ + async loadconfig () { + const { Tab, BID } = this.props + + let config = tabConfig[this.props.MenuID] + + let _arrField = [] // 瀛楁闆� + let _columns = [] // 鏄剧ず鍒� + let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� + let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� + let colMap = new Map() + + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid + config.columns.forEach(col => { + if (col.field) { + _arrField.push(col.field) + + _logcolumns.push(col) + } + if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 + _hideCol = _hideCol.concat(col.sublist) + } else if (col.Hide === 'true') { + _hideCol.push(col.uuid) + } + colMap.set(col.uuid, col) + }) + + // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� + config.columns.forEach(col => { + if (_hideCol.includes(col.uuid)) return + + if (col.type === 'colspan' && col.sublist) { + let _col = JSON.parse(JSON.stringify(col)) + let subColumn = [] + _col.sublist.forEach(sub => { + if (colMap.has(sub)) { + subColumn.push(colMap.get(sub)) + } + }) + _col.subColumn = subColumn + _columns.push(_col) + } else { + _columns.push(col) + } + }) + + this.setState({ + config: config, + setting: config.setting, + searchlist: config.search, + actions: config.action.map(item => { + if (buttonConfig[item.uuid]) { + item = {...buttonConfig[item.uuid], ...item} + } + return item + }), + columns: _columns, + logcolumns: _logcolumns, + arr_field: _arrField.join(','), + search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 + }, () => { + if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 + this.setState({ + loading: true + }) + this.loadmaindata() + } + }) + } + + /** + * @description 瀛愯〃鏁版嵁鍔犺浇 + */ + async loadmaindata (bid, type) { + const { setting } = this.state + let param = '' + let _BID = this.props.BID + + if (type === 'refresh') { + _BID = bid + if (!bid) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 + this.setState({ + data: [], + total: 0, + loading: false + }) + + return + } + } + + if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { + param = this.getCustomParam(_BID) + } else { + param = this.getDefaultParam(_BID) + } + + this.handleTableId() + + let result = await Api.genericInterface(param) + if (result.status) { + this.setState({ + data: result.data.map((item, index) => { + item.key = index + return item + }), + total: result.total, + pickup: false, + loading: false + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 15 + }) + } + } + + /** + * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� + */ + getCustomParam = (BID) => { + const { pageIndex, pageSize, orderBy, search, setting } = this.state + + let _search = Utils.formatCustomMainSearch(search) + + let param = { + PageIndex: pageIndex, + PageSize: pageSize, + OrderCol: orderBy || setting.order, + BID: BID, + ..._search + } + + if (setting.interType === 'inner') { + param.func = setting.innerFunc + } else { + if (setting.sysInterface === 'true' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + } else if (setting.sysInterface !== 'true') { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + + if (setting.outerFunc) { + param.func = setting.outerFunc + } + } + + return param + } + + /** + * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� + */ + getDefaultParam = (BID) => { + const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state + + let _search = Utils.joinMainSearchkey(search) + _search = _search ? 'where ' + _search : '' + + let param = { + func: 'sPC_Get_TableData', + obj_name: 'data', + arr_field: arr_field, + BID: BID, + appkey: window.GLOB.appkey || '' + } + + let _orderBy = orderBy || setting.order + let _dataresource = setting.dataresource + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } + + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + let options = search.map(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + return { + reg: new RegExp('@' + _field, 'ig'), + value: item.value + } + }) + + options.reverse() + + options.forEach(item => { + _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) + }) + + _search = '' + } + + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + let DateCount = `select count(1) as total from ${_dataresource} ${_search}` + + param.LText = Utils.formatOptions(LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.DateCount = Utils.formatOptions(DateCount) + + return param + } + + /** + * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 + * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� + */ + refreshbysearch = (searches) => { + this.refs.subTable.resetTable() + + this.setState({ + loading: true, + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 + */ + refreshbytable = (pagination, filters, sorter) => { + if (sorter.order) { + let _chg = { + ascend: 'asc', + descend: 'desc' + } + sorter.order = _chg[sorter.order] + } + + this.setState({ + loading: true, + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鍒锋柊 + */ + reloadtable = () => { + this.refs.subTable.resetTable() + this.setState({ + loading: true, + pageIndex: 1 + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� + */ + reloadview = () => { + this.setState({ + config: null, + searchlist: null, + actions: null, + columns: null, + arr_field: '', + setting: null, + data: null, + total: 0, + loading: false, + pageIndex: 1, + pageSize: 10, + orderBy: '', + search: '' + }, () => { + this.loadconfig() + }) + } + + /** + * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� + */ + refreshbyaction = (btn, type) => { + if (btn.execSuccess === 'grid' && type === 'success') { + this.reloadtable() + } else if (btn.execError === 'grid' && type === 'error') { + this.reloadtable() + } else if (btn.execSuccess === 'view' && type === 'success') { + this.reloadview() + } else if (btn.execError === 'view' && type === 'error') { + this.reloadview() + } else if (btn.popClose === 'grid' && type === 'pop') { + this.reloadtable() + } else if (btn.popClose === 'view' && type === 'pop') { + this.reloadview() + } else if (btn.popClose === 'maingrid' && type === 'pop') { + this.props.handleMainTable('maingrid') + } + } + + /** + * @description 鑾峰彇琛ㄦ牸閫夋嫨椤� + */ + gettableselected = () => { + let data = [] + this.refs.subTable.state.selectedRowKeys.forEach(item => { + data.push(this.refs.subTable.props.data[item]) + }) + return data + } + + /** + * @description 琛ㄦ牸Id鍙樺寲 + */ + handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { + this.props.handleTableId(type, id, data) + } + + /** + * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 + */ + pickupChange = () => { + const { pickup } = this.state + + this.setState({ + pickup: !pickup + }) + } + + UNSAFE_componentWillMount() { + // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 + this.loadconfig() + } + + shouldComponentUpdate (nextProps, nextState) { // handleMainTable 鍑芥暟鍒ゆ柇鏃朵笉鐩哥瓑 + return !is(fromJS({...this.props, handleMainTable: '', handleTableId: ''}), fromJS({...nextProps, handleMainTable: '', handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { setting, searchlist, actions, columns, pickup } = this.state + + return ( + <div className="subtable" id={'subtable' + this.props.MenuID}> + {searchlist && searchlist.length > 0 ? + <SubSearch + dict={this.state.dict} + searchlist={searchlist} + refreshdata={this.refreshbysearch} + /> : null + } + {actions ? + <div className="sub-action"> + <SubAction + ref="subButton" + type="sub" + setting={setting} + actions={actions} + Tab={this.props.Tab} + BID={this.props.BID} + BData={this.props.BData} + dict={this.state.dict} + MenuID={this.props.SupMenuID} + logcolumns={this.state.logcolumns} + refreshdata={this.refreshbyaction} + ContainerId={this.props.ContainerId} + getexceloutparam={this.getexceloutparam} + gettableselected={this.gettableselected} + /> + </div> : null + } + {columns ? + <div className="subtable-box"> + {this.state.data && this.state.data.length > 0 ? + <Switch title="鏀惰捣" className="subtable-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null + } + <SubTable + ref="subTable" + tableId={this.props.Tab.uuid} + pickup={pickup} + setting={setting} + columns={columns} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + MenuID={this.props.MenuID} + loading={this.state.loading} + refreshdata={this.refreshbytable} + buttonTrigger={() => {}} + handleTableId={this.handleTableId} + /> + </div> : null + } + </div> + ) + } +} + +export default VerupSubTabViewTable \ No newline at end of file diff --git a/src/tabviews/verup/subtabtable/index.scss b/src/tabviews/verup/subtabtable/index.scss new file mode 100644 index 0000000..1ad20da --- /dev/null +++ b/src/tabviews/verup/subtabtable/index.scss @@ -0,0 +1,52 @@ +.subtable { + position: relative; + min-height: 200px; + + > .top-search { + padding: 0 0px 20px; + } + >.sub-action { + min-height: 25px; + .button-list { + padding: 10px 0px 5px; + } + } + .normal-data-table { + padding: 0px; + } + .box404 { + padding-top: 30px; + } + .ant-modal-mask { + position: absolute; + } + .ant-modal-wrap { + position: absolute; + } + .action-modal .ant-modal { + top: 40px; + max-width: 95%; + .ant-modal-body { + max-height: calc(100vh - 265px); + } + } + > .ant-spin { + position: absolute; + left: calc(50% - 22px); + top: 100px; + } + .subtable-box { + position: relative; + .subtable-pickup { + position: absolute; + right: 5px; + top: -22px; + z-index: 10; + } + } +} +.popview-modal { + .ant-modal-body { + min-height: 300px; + } +} \ No newline at end of file diff --git a/src/tabviews/verup/topSearch/index.jsx b/src/tabviews/verup/topSearch/index.jsx new file mode 100644 index 0000000..853f358 --- /dev/null +++ b/src/tabviews/verup/topSearch/index.jsx @@ -0,0 +1,120 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input, Button } from 'antd' +import './index.scss' + +class MainSearch extends Component { + static propTpyes = { + searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 + dict: PropTypes.object // 瀛楀吀椤� + } + + state = { + match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 + style: null, + searchlist: null + } + + UNSAFE_componentWillMount () { + let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) + let match = {} + let style = {} + let _list = [] + + searchlist.forEach(item => { + match[item.field] = item.match + style[item.field] = item.type + + _list.push(item) + }) + + this.setState({ + match: match, + style: style, + searchlist: _list + }) + } + + getFields() { + const { getFieldDecorator } = this.props.form + const fields = [] + + this.state.searchlist.forEach((item, index) => { + fields.push( + <Col span={6} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + ) + }) + + fields.push( + <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> + <Form.Item label={' '} colon={false}> + <Button type="primary" htmlType="submit"> + {this.props.dict['main.search']} + </Button> + <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> + {this.props.dict['main.reset']} + </Button> + </Form.Item> + </Col> + ) + + return fields + } + + handleSearch = (e) => { + // 鍥炶溅鎴栫偣鍑绘悳绱� + e.preventDefault() + this.props.form.validateFields((err, values) => { + let searches = this.getFieldsValues(values) + this.props.refreshdata(searches) + }) + } + + handleReset = () => { + // 閲嶇疆 + this.props.form.resetFields() + this.props.form.validateFields((err, values) => { + let searches = this.getFieldsValues(values) + this.props.refreshdata(searches) + }) + } + + getFieldsValues = (values) => { + // 鑾峰彇鎼滅储鏉′欢鍊� + let search = [] + Object.keys(values).forEach(key => { + search.push({ + type: this.state.style[key], + key: key, + value: values[key].replace(/(^\s*|\s*$)/ig, ''), + match: this.state.match[key] + }) + }) + return search + } + + render() { + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} className="verup-search-line" onSubmit={this.handleSearch}> + <Row gutter={24}>{this.getFields()}</Row> + </Form> + ) + } +} + +export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/verup/topSearch/index.scss b/src/tabviews/verup/topSearch/index.scss new file mode 100644 index 0000000..35cfc73 --- /dev/null +++ b/src/tabviews/verup/topSearch/index.scss @@ -0,0 +1,26 @@ +.verup-search-line { + padding: 0px 24px 20px; + border-bottom: 1px solid #efefef; + .ant-form-item { + display: flex; + margin-bottom: 10px; + } + .ant-form-item-control-wrapper { + flex: 1; + width: calc(100% - 100px); + } + .ant-form-item-label { + // width: 100px; + text-overflow: ellipsis; + } + .daterange .ant-calendar-picker-input { + padding: 4px 20px 4px 5px; + font-size: 13px; + } + .ant-select-dropdown { + z-index: 10 !important; + } + .ant-calendar-picker-container { + z-index: 10 !important; + } +} \ No newline at end of file diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 1c42a0e..3722c9a 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -125,7 +125,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (_funcType === 'print') { if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -228,7 +228,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (this.state.funcType === 'print') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -331,7 +331,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (value === 'print') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -372,7 +372,7 @@ } } else if (openType === 'funcbutton') { if (value === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index e63a3fa..e1e3787 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1207,6 +1207,7 @@ let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 鍒涘缓瀛樺偍杩囩▼sql let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql + let isExit = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 new Promise(resolve => { let sysDefer = new Promise(resolve => { @@ -1260,9 +1261,10 @@ let cloudfunc = '' let localfunc = '' res.forEach((item, index) => { - if (index === 0 && item.TVPText) { + if (index === 0 && item && item.TVPText) { cloudfunc = item.TVPText - } else if (index === 1 && item.Ltext) { + } else if (index === 1 && item && item.Ltext) { + isExit = true localfunc = Utils.formatOptions(item.Ltext) } }) @@ -1311,6 +1313,8 @@ duration: 10 }) return false + } else if (isExit) { + return 'drop' } else { return 'create' } diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 8e8a69a..27872ef 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -1051,6 +1051,7 @@ let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 鍒涘缓瀛樺偍杩囩▼sql let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql + let isExit = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 new Promise(resolve => { let sysDefer = new Promise(resolve => { @@ -1107,6 +1108,7 @@ if (index === 0 && item.TVPText) { cloudfunc = item.TVPText } else if (index === 1 && item.Ltext) { + isExit = true localfunc = Utils.formatOptions(item.Ltext) } }) @@ -1155,6 +1157,8 @@ duration: 10 }) return false + } else if (isExit) { + return 'drop' } else { return 'create' } diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index 6075f12..7e14ec5 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -135,7 +135,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (_funcType === 'print') { if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -256,7 +256,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (this.state.funcType === 'print') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -377,7 +377,7 @@ _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] } else if (value === 'print') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } @@ -419,7 +419,7 @@ } } else if (openType === 'funcbutton') { if (value === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } else { _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] } diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 5cb81ea..fc2a7e6 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -988,6 +988,7 @@ let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo}, config)) // 鍒涘缓瀛樺偍杩囩▼sql let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql + let isExit = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 new Promise(resolve => { let sysDefer = new Promise(resolve => { @@ -1044,6 +1045,7 @@ if (index === 0 && item.TVPText) { cloudfunc = item.TVPText } else if (index === 1 && item.Ltext) { + isExit = true localfunc = Utils.formatOptions(item.Ltext) } }) @@ -1092,6 +1094,8 @@ duration: 10 }) return false + } else if (isExit) { + return 'drop' } else { return 'create' } diff --git a/src/templates/tableshare/verifycard/index.jsx b/src/templates/tableshare/verifycard/index.jsx index 3ced595..6924e96 100644 --- a/src/templates/tableshare/verifycard/index.jsx +++ b/src/templates/tableshare/verifycard/index.jsx @@ -784,7 +784,16 @@ let node = document.getElementById('verify-card-box-tab').parentNode if (node && node.scrollTop) { - node.scrollTop = 0 + let inter = Math.ceil(node.scrollTop / 10) + + let timer = setInterval(() => { + if (node.scrollTop - inter > 0) { + node.scrollTop = node.scrollTop - inter + } else { + node.scrollTop = 0 + clearInterval(timer) + } + }, 10) } } diff --git a/src/templates/tableshare/verifycardexcelin/index.jsx b/src/templates/tableshare/verifycardexcelin/index.jsx index d31432a..0cc7084 100644 --- a/src/templates/tableshare/verifycardexcelin/index.jsx +++ b/src/templates/tableshare/verifycardexcelin/index.jsx @@ -267,7 +267,16 @@ let node = document.getElementById('verify-excel-box-tab').parentNode if (node && node.scrollTop) { - node.scrollTop = 0 + let inter = Math.ceil(node.scrollTop / 10) + + let timer = setInterval(() => { + if (node.scrollTop - inter > 0) { + node.scrollTop = node.scrollTop - inter + } else { + node.scrollTop = 0 + clearInterval(timer) + } + }, 10) } } diff --git a/src/templates/tableshare/verifycardexcelout/index.jsx b/src/templates/tableshare/verifycardexcelout/index.jsx index 24186f6..b43b33e 100644 --- a/src/templates/tableshare/verifycardexcelout/index.jsx +++ b/src/templates/tableshare/verifycardexcelout/index.jsx @@ -110,7 +110,16 @@ let node = document.getElementById('verify-excelout-box-tab').parentNode if (node && node.scrollTop) { - node.scrollTop = 0 + let inter = Math.ceil(node.scrollTop / 10) + + let timer = setInterval(() => { + if (node.scrollTop - inter > 0) { + node.scrollTop = node.scrollTop - inter + } else { + node.scrollTop = 0 + clearInterval(timer) + } + }, 10) } } diff --git a/src/templates/tableshare/verifycardprint/index.jsx b/src/templates/tableshare/verifycardprint/index.jsx index 484761d..6379135 100644 --- a/src/templates/tableshare/verifycardprint/index.jsx +++ b/src/templates/tableshare/verifycardprint/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select } from 'antd' +import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio } from 'antd' import moment from 'moment' import Api from '@/api' @@ -33,7 +33,8 @@ verify: { ..._verify, Template: _verify.Template || '' - } + }, + linkType: _verify.linkType || 'system' }) } @@ -166,10 +167,24 @@ }) } + changeLinkType = (e) => { + let value = e.target.value + + this.setState({ + linkType: value + }, () => { + if (value === 'system') { + this.props.form.setFieldsValue({ + linkUrl: '127.0.0.1:13529' + }) + } + }) + } + render() { const { getFieldDecorator } = this.props.form - const { verify } = this.state + const { verify, linkType } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -183,10 +198,22 @@ return ( <div id="verify-card-box-tab"> - <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> + <Tabs defaultActiveKey="1" className="verify-card-print-box" onChange={this.tabchange}> <TabPane tab="鎵撳嵃楠岃瘉" key="1"> <Form {...formItemLayout}> <Row gutter={24}> + <Col span={8}> + <Form.Item label={'閾炬帴绫诲瀷'}> + {getFieldDecorator('linkType', { + initialValue: linkType || 'system' + })( + <Radio.Group onChange={this.changeLinkType}> + <Radio value="system">绯荤粺</Radio> + <Radio value="custom">鑷畾涔�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> <Col span={8}> <Form.Item label={'閾炬帴鍦板潃'}> {getFieldDecorator('linkUrl', { @@ -197,7 +224,7 @@ message: this.props.dict['form.required.input'] + '閾炬帴鍦板潃!' } ] - })(<Input placeholder="" autoComplete="off" />)} + })(<Input placeholder="" autoComplete="off" disabled={linkType === 'system'} />)} </Form.Item> </Col> <Col span={8}> diff --git a/src/templates/tableshare/verifycardprint/index.scss b/src/templates/tableshare/verifycardprint/index.scss index e9b51d0..cdbf6b1 100644 --- a/src/templates/tableshare/verifycardprint/index.scss +++ b/src/templates/tableshare/verifycardprint/index.scss @@ -1,44 +1,13 @@ -.verify-card-box { +.verify-card-print-box { .ant-tabs-nav-scroll { text-align: center; } .ant-tabs-content { min-height: 40vh; } - table tr td { - word-wrap: break-word; - word-break: break-word; - } - .verify-form { - .ant-input-number { - width: 100%; - } - .sql { - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - padding-top: 4px; - } - } - .sqlfield { - .ant-form-item { - margin-bottom: 5px; - } - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - } - } - .add { - padding-top: 4px; - } - } - .custom-table .ant-empty { - margin: 20px 8px!important; + .ant-input-disabled { + color: rgba(0, 0, 0, 0.65); + cursor: default; } .errorval { display: inline-block; diff --git a/src/utils/utils.js b/src/utils/utils.js index 291c0fa..d96799c 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1391,6 +1391,8 @@ @BID nvarchar(50)='', @Ltext nvarchar(max)='', @sEPTMenuNo nvarchar(50)='${param.menuNo}', + @secretkey nvarchar(50)='', + @timestamp nvarchar(50)='', @lang nvarchar(50)='', @LoginUID nvarchar(50)='', @SessionUid nvarchar(50)='', -- Gitblit v1.8.0