ttk-app-core
Version:
enterprise develop framework
947 lines (856 loc) • 33.7 kB
JavaScript
import React from 'react'
import { action as MetaAction, AppLoader } from 'edf-meta-engine'
import { fromJS, toJS } from 'immutable'
import config from './config'
import { TableOperate, Select, Button, Modal, Checkbox, ActiveLabelSelect } from 'edf-component'
import sortSearchOption from './utils/sortSearchOption'
import moment from 'moment'
import utils from 'edf-utils'
import { FormDecorator } from 'edf-component'
import changeToOption from './utils/changeToOption'
const Option = Select.Option
import { consts } from 'edf-consts'
import renderColumns from './utils/renderColumns'
import { LoadingMask } from 'edf-component'
import sortBaseArchives from './utils/sortBaseArchives'
class action {
constructor(option) {
this.metaAction = option.metaAction
this.config = config.current
this.webapi = this.config.webapi
this.voucherAction = option.voucherAction
this.selectedOption = []
}
onInit = ({ component, injections }) => {
this.component = component
this.injections = injections
injections.reduce('init')
this.load(null, this.component.props.linkInSearchValue)
let addEventListener = this.component.props.addEventListener
if (addEventListener) {
addEventListener('onTabFocus', :: this.onTabFocus)
addEventListener('enlargeClick', () => this.onResize({}))
}
}
componentDidMount = () => {
this.onResize()
// this.showPickerDidMount()
const win = window
if (win.addEventListener) {
win.addEventListener('resize', this.onResize, false)
} else if (win.attachEvent) {
win.attachEvent('onresize', this.onResize)
} else {
win.onresize = this.onResize
}
}
onTabFocus = (params) => {
const data = this.metaAction.gf('data.assistForm.assistFormOption').toJS()
console.log(params)
params = params.toJS()
if( params.accessType == 0 ){
this.load(true)
}else{
this.load(true, params.linkInSearchValue, params.linkInAccountName)
}
}
load = async(formTab, initSearchValue) => {
console.log(initSearchValue)
await this.getEnableDate(formTab)
const res = await this.webapi.person.queryBaseArchives()
this.injections.reduce('tableLoading', false)
const group = sortBaseArchives(res)
if( formTab ){
this.updateBaseArchives(group)
}else{
this.initBaseArchives(group, formTab)
}
if( initSearchValue ){
this.initSearchValue(initSearchValue)
}
const searchValue = this.metaAction.gf('data.searchValue').toJS()
const assistFormSelectValue = this.metaAction.gf('data.assistForm.assistFormSelectValue').toJS()
const whereStr = searchValue.whereStr || ''
const groupStr = searchValue.groupStr || assistFormSelectValue.join(',')
this.searchValueChange({
...searchValue,
groupStr: groupStr,
whereStr: whereStr
}, null, initSearchValue ? initSearchValue.accountCode : null, true)
setTimeout(()=>{
this.onResize()
}, 20)
}
filterAccountOption = (inputValue, option) => {
if (option && option.props && option.props.value) {
let accountingSubjects = this.metaAction.gf('data.other.accountlist')
let itemData = accountingSubjects.find(o => o.get('code') == option.props.value)
let accountName = ''
if (itemData.get('name') && itemData.get('code')) {
accountName = itemData.get('name').replace(itemData.get('code'), '')
}
if ((itemData.get('code') && itemData.get('code').indexOf(inputValue) == 0)
|| (accountName.indexOf(inputValue) != -1)) {
//将滚动条置顶
let select = document.getElementsByClassName('ant-select-dropdown-menu')
if (select.length > 0 && select[0].scrollTop > 0) {
select[0].scrollTop = 0
}
return true
}
else {
return false
}
}
return true
}
// 支持联查传递参数。
initSearchValue = (searChValue) => {
const { accountCode, date_end, date_start, assitForm } = searChValue
const { assistFormOption, initOption } = this.metaAction.gf('data.assistForm').toJS()
const assistFormSelectValue = []
let whereStrArr = []
for( let [key, value] of Object.entries(assitForm) ){
// 判断带过来的值数据中是否存在
if( typeof(value) != 'object' ){
const findOne = assistFormOption.find(item => item.key == key)
if( findOne ){
const flag = findOne.children.find(item => item.value == value)
console.log(flag)
if( !flag ){
value = null
}
}
}
assistFormSelectValue.push(key)
if( value ){
if( typeof(value) == 'object' && value.length > 0){
whereStrArr.push(`${key}:${value}`)
}else if( typeof(value) != 'object' ){
whereStrArr.push(`${key}:${value}`)
}
}
assistFormOption.forEach((item, index) => {
if( item.key == key){
assistFormOption[index].value = typeof(value) == 'object' ? value : [`${value}`]
}
})
}
const whereStr = whereStrArr.join(';')
this.injections.reduce('updateArr', [
{
path: 'data.searchValue',
value: {
accountCode,
date_end,
date_start,
whereStr
}
},
{
path: 'data.assistForm.assistFormSelectValue',
value: assistFormSelectValue
},
{
path: 'data.assistForm.assistFormOption',
value: assistFormOption
}
])
}
updateBaseArchives = (data) => {
const { assistFormOption, initOption, assistFormSelectValue, activeValue } = this.metaAction.gf('data.assistForm').toJS()
const arrAssitForm = []
data.forEach(item => {
const oldItem = assistFormOption.find(index => index.key == item.key)
if( oldItem ){
const oldValue = oldItem.value
if( oldValue ){
// 附上刚才选择的值
const newArr = oldValue.filter(x => {
const flag = item.children.find(y => y.value == x)
return flag ? true : false
})
item.value = newArr
}
}
arrAssitForm.push(item)
})
arrAssitForm.sort((a, b) => {
let a1 = assistFormOption.findIndex(index => a.key == index.key)
let b1 = assistFormOption.findIndex(index => b.key == index.key)
if( a1 == -1 ){
a1 = 1000
}
if( b1 == -1 ){
b1 = 1000
}
return a1 > b1
})
const arrAssitFormSelectValue = []
assistFormSelectValue.forEach(item => {
const flag = data.find( index => index.key == item )
if( flag ){
arrAssitFormSelectValue.push(item)
}
})
this.injections.reduce('updateArr', [
{
path: 'data.assistForm.initOption',
value: data
},{
path: 'data.assistForm.assistFormOption',
value: arrAssitForm
},{
path: 'data.assistForm.assistFormSelectValue',
value: assistFormSelectValue
}, {
path: 'data.assistForm.activeValue',
value: ''
}
])
}
initBaseArchives = (data) => {
this.injections.reduce('updateArr', [
{
path: 'data.assistForm.initOption',
value: data
},{
path: 'data.assistForm.assistFormOption',
value: data
},{
path: 'data.assistForm.assistFormSelectValue',
value: ['customerId']
}, {
path: 'data.assistForm.activeValue',
value: ''
}
])
}
renderActiveSearch = () => {
const { assistFormSelectValue, assistFormOption, activeValue } = this.metaAction.gf('data.assistForm').toJS()
// 找到排名靠前的并且选中的辅助项
const one = assistFormOption.find(item => {
return assistFormSelectValue.includes(item.key)
})
return <ActiveLabelSelect
option={assistFormOption}
selectLabel={one && one.key ? one.key : ''}
value={activeValue}
onChange={this.activeLabelSelectChange}
/>
}
getEnableDate = async(formTab) => {
const { DisplayDate, EnableDate } = await this.webapi.person.getDisplayDate()
let { date_end, date_start } = this.metaAction.gf('data.searchValue').toJS()
const momentEnableDate = utils.date.transformMomentDate(EnableDate)
let date_start2 = utils.date.transformMomentDate(DisplayDate)
let date_end2 = utils.date.transformMomentDate(DisplayDate)
this.injections.reduce('updateArr', [{
path: 'data.other.enableddate',
value: utils.date.transformMomentDate(EnableDate)
},{
path: 'data.searchValue.date_end',
value: !date_end ? date_end2 : this.transformDateToNum(date_end) >= this.transformDateToNum(momentEnableDate) ? date_end : date_end2
},{
path: 'data.searchValue.date_start',
value: !date_start ? date_start2 : this.transformDateToNum(date_start) >= this.transformDateToNum(momentEnableDate) ? date_start : date_start2
}])
return
}
componentWillReceiveProps = ({ keydown }) => {
if (keydown && keydown.event) {
let e = keydown.event
if( e.keyCode == 39 || e.keyCode == 40 ) {
this.accountlistBtn('right')
}else if ( e.keyCode == 37 || e.keyCode == 38 ) {
this.accountlistBtn('left')
}
}
}
// 简单搜索条件发生变化仅限时间
normalSearchChange = (path, value) => {
if( path == 'date' ){
this.onPanelChange(value)
}
}
// 简单搜索辅助项选择发生改变
activeLabelSelectChange = (label, value) => {
let { initOption, assistFormOption } = this.metaAction.gf('data.assistForm').toJS()
// 保持原来的顺序不变
let sortInitOption = assistFormOption.map(item => {
return initOption.find(index => index.key == item.key)
})
const init = JSON.parse(JSON.stringify(initOption))
let assistFormSelectValue = []
assistFormSelectValue.push(label)
const index = initOption.findIndex(item => item.key == label)
if( index != -1 ) {
if( value ) {
initOption[index].value = [value]
}else{
initOption[index].value = []
}
}
this.injections.reduce('update', {
path: 'data.assistForm',
value: {
initOption: init,
assistFormOption: sortInitOption,
assistFormSelectValue: assistFormSelectValue,
activeValue: value
}
})
const searchValue = this.metaAction.gf('data.searchValue').toJS()
searchValue.groupStr=label
if( value ) {
searchValue.whereStr = `${label}:${value}`
}else {
searchValue.whereStr = ``
}
this.searchValueChange(searchValue)
}
// 高级搜索组件搜索条件发生变化 和辅助总账不同 改账目在请求科目的时候可以将列表信息统一带回来
searchValueChange = async (value, assitForm, preAccountCode, fromLoad) => {
const { accountCode, needRepeatSend } = await this.getAccountList(value, preAccountCode, fromLoad)
console.log(accountCode, needRepeatSend)
const arr = []
this.injections.reduce('updateSearchValue', {
...value,
accountCode
})
if( assitForm && assitForm.selectValue ) {
arr.push({
path: 'data.assistForm.assistFormSelectValue',
value: assitForm.selectValue
},{
path: 'data.assistForm.assistFormOption',
value: assitForm.option
},{
path: 'data.assistForm.activeValue',
value: ''
})
}
this.injections.reduce('updateArr', arr)
const accountList = this.metaAction.gf('data.other.accountlist').toJS()
const item = accountList.find(item => {
return item.code == accountCode
})
this.showCheckboxInit(item)
if( accountCode && needRepeatSend ){
this.sortParmas()
}
_hmt && _hmt.push(['_trackEvent', '财务', '辅助明细账', '高级查询' + value.groupStr])
}
// 搜索条件发生改变,先请求科目列表
getAccountList = async( value, accountCode, fromLoad ) => {
const params = this.sortParmas(value, null, 'get')
const preAccountCode = this.metaAction.gf('data.searchValue.accountCode')
if ( !fromLoad ){
params.page.currentPage = 1
}
params.currencyId = null
params.accountCode = accountCode ? accountCode : preAccountCode
const res = await this.webapi.person.queryForAuxRpt(params)
const { accountList, dataList } = res
const page = dataList.page
this.injections.reduce('update', {
path: 'data.other.accountlist',
value: accountList
})
if( !dataList.data ){
dataList.data= []
}
this.injections.reduce('updateArr',[
{
path: 'data.list',
value: dataList.data ? dataList.data : []
},{
path: 'data.style',
value: this.getRowSpan(dataList.style),
},{
path: 'data.pagination',
value: {
currentPage: !page ? 1 : page.currentPage,
totalCount: !page ? 0 : page.totalCount,
pageSize: !page ? params.page.pageSize : page.pageSize,
totalPage: !page ? 0 : page.totalCount
}
}
])
const haveInAccountList = accountList.find(item => {
return item.code == preAccountCode
})
let finalAccountCode = accountCode ? accountCode : ( haveInAccountList ? preAccountCode :( accountList[0] ? accountList[0].code : null))
let needRepeatSend = !accountCode && !haveInAccountList &&preAccountCode ? true : false
return {
accountCode: finalAccountCode,
needRepeatSend: needRepeatSend
}
}
// 科目搜索条件发生变化 点击左右按钮进行改变
accountlistBtn = (type) => {
const accountlist = this.metaAction.gf('data.other.accountlist').toJS()
const accountCode = this.metaAction.gf('data.searchValue.accountCode')
let index = accountlist.findIndex(item => item.code == accountCode)
let code
switch (type){
case 'right':
code = accountlist[index+1]&& accountlist[index+1].code ? accountlist[index+1].code : accountCode
break
case 'left':
code = accountlist[index - 1] && accountlist[index - 1].code ? accountlist[index - 1].code : accountCode
break
default:
code = accountCode
break
}
if( index == -1 ){
code = accountlist[0]
}
this.accountlistChange(code)
}
//科目发生改变直接点击搜索项
accountlistChange = (value) => {
const accountlist = this.metaAction.gf('data.other.accountlist').toJS()
const item = accountlist.find(index => {
return index.code == value
})
this.injections.reduce('update', { path: 'data.searchValue.accountCode', value })
this.showCheckboxInit(item)
this.sortParmas()
}
// 组装搜索条件
sortParmas = (search, pages, type) => {
if( !search ){
search = this.metaAction.gf('data.searchValue').toJS()
}
const changeData = {
'date_start': {
'beginDate': (data) => data ? data.format('YYYY-MM') : null,
},
'date_end': {
'endDate': (data) => data ? data.format('YYYY-MM') : null,
}
}
const searchValue = sortSearchOption(search, changeData)
if( !pages ){
pages = this.metaAction.gf('data.pagination').toJS()
}
if( type == 'get' ) {
return {...searchValue, page: {currentPage: pages.currentPage, pageSize: pages.pageSize}}
}
this.requestData({...searchValue, page: {currentPage: pages.currentPage, pageSize: pages.pageSize}})
}
// 发送请求
requestData = async (params) => {
// 没有科目的时候不发送请求
if( !params.accountCode ){
this.injections.reduce('updateArr',[
{
path: 'data.list',
value: []
},{
path: 'data.style',
value: {},
},{
path: 'data.pagination',
value: {
currentPage: 1,
totalCount: 0,
pageSize: params.page.pageSize,
totalPage: 0
}
}
])
return
}
let loading = this.metaAction.gf('data.loading')
if(!loading){
this.injections.reduce('tableLoading', true)
}
const response = await this.webapi.person.query(params)
this.injections.reduce('tableLoading', false)
const{ page } = response
this.injections.reduce('updateArr',[
{
path: 'data.list',
value: response.data ? response.data : []
},{
path: 'data.style',
value: this.getRowSpan(response.style),
},{
path: 'data.pagination',
value: {
currentPage: page.currentPage,
totalCount: page.totalCount,
pageSize: page.pageSize,
totalPage: page.totalCount
}
}
])
setTimeout(()=>{
this.onResize()
}, 20)
}
getRowSpan = (data) => {
let result = {}
if( !data ){
return result
}
const arr = data.split(';')
arr.forEach(item => {
if( !item ){
return
}
const str = item.replace(/\]\[/g, '\];\[')
let [key, valueArr] = str.split(':')
if( !result[key] ) {
result[key] = {}
}
const arr2 = valueArr.split(';')
arr2.forEach(x => {
const y = JSON.parse(x)
result[key][y[0]] = y[1] - y[0] + 1
})
})
return result
}
// render辅助选项
renderFormList = () => {
return <AssistForm/>
}
// 点击刷新按钮
refreshBtnClick = () => {
this.sortParmas()
}
//获取时间选项
getNormalDateValue = () => {
const data = this.metaAction.gf('data.searchValue').toJS()
const arr = []
arr.push(data.date_start)
arr.push(data.date_end)
return arr
}
onPanelChange = (value) => {
let date = {
date_end: value[1],
date_start: value[0]
}
const searchValue = this.metaAction.gf('data.searchValue').toJS()
this.injections.reduce('searchUpdate', { ...searchValue, ...date })
this.sortParmas({ ...searchValue, ...date })
}
getNormalSearchValue = () => {
const data = this.metaAction.gf('data.searchValue').toJS()
let date = [data.date_start, data.date_end]
return { date}
}
//分页发生变化
pageChanged = (current, pageSize) => {
let page = this.metaAction.gf('data.pagination').toJS()
page = {
...page,
'currentPage': current,
'pageSize': pageSize ? pageSize : page.pageSize
}
this.injections.reduce('update', {
path: 'data.pagination',
value: page
})
this.sortParmas(null, page)
}
shareClick = (e) => {
switch (e.key) {
case 'weixinShare':
this.weixinShare()
break;
case 'mailShare':
this.mailShare()
break;
}
}
weixinShare = async () => {
let data = await this.sortParmas(null, null, 'get')
if(this.metaAction.gf('data.list').toJS().length == 0){
this.metaAction.toast('warning', '当前暂无数据可分享')
return
}
let params = {
beginDate: data.beginDate,
endDate: data.endDate,
accountCode: data.accountCode || '',
groupStr: data.groupStr,
whereStr: data.whereStr
}
const ret = this.metaAction.modal('show', {
title: '微信/QQ分享',
width: 300,
footer: null,
children: this.metaAction.loadApp('app-weixin-share', {
store: this.component.props.store,
initData: '/v1/gl/report/gldetailauxrpt/share',
params: params
})
})
_hmt && _hmt.push(['_trackEvent', '财务', '辅助明细账', '分享微信/QQ'])
}
mailShare = async () => {
let data = await this.sortParmas(null, null, 'get')
if(this.metaAction.gf('data.list').toJS().length == 0){
this.metaAction.toast('warning', '当前暂无数据可分享')
return
}
const { num, currency } = this.metaAction.gf('data.showOption').toJS()
data.isMultiCalc = currency
data.isQuantityCalc = num
const ret = this.metaAction.modal('show', {
title: '邮件分享',
width: 400,
children: this.metaAction.loadApp('app-mail-share', {
store: this.component.props.store,
params: data,
shareUrl: '/v1/gl/report/gldetailauxrpt/share',
mailShareUrl: '/v1/gl/report/gldetailauxrpt/sendShareMail',
printShareUrl: '/v1/gl/report/gldetailauxrpt/print',
period: `${data.beginDate.replace('-','.')}-${data.endDate.replace('-','.')}`,
})
})
_hmt && _hmt.push(['_trackEvent', '财务', '辅助明细账', '邮件分享'])
}
rowSpan = (text, row, index) => {
const obj = {
children: <span>{text}</span>,
props: {
rowSpan: this.calcRowSpan(row.docId, 'docId', index),
},
}
return obj
}
export = async() => {
let list = this.metaAction.gf('data.list').toJS()
if(list.length == 0){
this.metaAction.toast('warning', '当前没有可导出数据')
return
}
const params = await this.sortParmas(null, null, 'get')
const { num, currency } = this.metaAction.gf('data.showOption').toJS()
params.isMultiCalc = currency
params.isQuantityCalc = num
let data = await this.webapi.person.export(params)
}
print = async() => {
let list = this.metaAction.gf('data.list').toJS()
if(list.length == 0){
this.metaAction.toast('warning', '当前没有可打印数据')
return
}
const params = this.sortParmas(null, null, 'get')
const { num, currency } = this.metaAction.gf('data.showOption').toJS()
params.isMultiCalc = currency
params.isQuantityCalc = num
let data = await this.webapi.person.print(params)
}
showCheckboxInit = (item) => {
this.injections.reduce('update', {
path: 'data.showCheckbox',
value: {
quantity: false,
multi: false
}
})
this.injections.reduce('update', {
path: 'data.showOption',
value: {
num: false,
currency: false
}
})
}
showOptionsChange = (key, value) => {
this.injections.reduce('showOptionsChange', {
path: `data.showOption.${key}`,
value: value
})
}
checkBoxisShow = (key) => {
const showCheckbox = this.metaAction.gf('data.showCheckbox').toJS()
return { display: showCheckbox[key] ? 'inline-block' : 'none'}
}
rowSpan2 = (text, row, index) => {
const num = this.calcRowSpan(row.accountDate, 'accountDate', index)
const tmpstr = typeof (text) == 'string' && text ? text.replace(/\s/g, '') : ''
const obj = {
children: <span>{text}</span>,
props: {
rowSpan: num,
},
}
return obj
}
calcRowSpan(text, columnKey, currentRowIndex) {
const list = this.metaAction.gf('data.list')
if (!list) return
const rowCount = list.size
if (rowCount == 0 || rowCount == 1) return 1
if (currentRowIndex > 0
&& currentRowIndex <= rowCount
&& text == list.getIn([currentRowIndex - 1, columnKey])) {
return 0
}
var rowSpan = 1
for (let i = currentRowIndex + 1; i < rowCount; i++) {
if (text == list.getIn([i, columnKey]))
rowSpan++
else
break
}
return rowSpan
}
checkShowSpan = (index, data) => {
let num = 1
if( !data ){
return num
}
for( const [key, value] of Object.entries(data) ) {
if( index > parseInt(key) && index <= key + value) {
num = 0
}
}
return num
}
renderColSpan = (text, key, index) => {
const style = this.metaAction.gf('data.style').toJS()
let num = 1
if( style[key]&&style[key][index] ) {
num = style[key][index]
}else if( style[key] ) {
num = this.checkShowSpan(index, style[key])
}
const tmpstr = typeof (text) == 'string' && text ? text.replace(/\s/g, '') : ''
return {
children: <span title={text}>{text}</span>,
props: {
rowSpan: num
}
}
}
openMoreContent = async (docId) => {
this.component.props.setPortalContent &&
this.component.props.setPortalContent('填制凭证', 'app-proof-of-charge', { accessType: 1, initData: { id: docId } })
}
tableColumns = () => {
const showOption = this.metaAction.gf('data.showOption').toJS()
let type
if ( showOption.num && showOption.currency) {
type = 3
}else if( showOption.num && !showOption.currency ) {
type = 2
}else if( !showOption.num && showOption.currency ) {
type = 1
}else {
type = 0
}
let arr = renderColumns(this.openMoreContent, type)
let arr2 = []
const { assistFormOption, assistFormSelectValue } = this.metaAction.gf('data.assistForm').toJS()
assistFormOption.forEach(item => {
if( assistFormSelectValue.includes(item.key) ) {
if( item.key.includes('isExCalc') ){
let keyStr = item.key ? `e${item.key.slice(3)}Name` : item.key
arr2.push({
title: <span title={item.name}>{item.name}</span>,
name: keyStr,
dataIndex: keyStr,
key: keyStr,
width: 222,
render: (text, record, index, ) => this.renderColSpan(text, item.key, index)
})
}else{
arr2.push({
title: <span title={item.name}>{item.name}</span>,
name: item.key ? item.key.replace(/Id/, 'Name') : item.key,
dataIndex: item.key ? item.key.replace(/Id/, 'Name') : item.key,
key: item.key ? item.key.replace(/Id/, 'Name') : item.key,
width: 222,
render: (text, record, index, ) => this.renderColSpan(text, item.key, index)
})
}
}
})
return [...arr2, ...arr]
}
/**
* current 每个月份
* pointTime 指定比较的时间
* type 'pre' 前 'next' 后
* return 返回 true 代表禁用
*/
disabledDate = (current, pointTime, type) => {
const enableddate = this.metaAction.gf('data.other.enableddate')
if (type == 'pre') {
let currentMonth = this.transformDateToNum(current)
let enableddateMonth = this.transformDateToNum(enableddate)
return currentMonth < enableddateMonth
} else {
let currentMonth = this.transformDateToNum(current)
let pointTimeMonth = this.transformDateToNum(pointTime)
let enableddateMonth = this.transformDateToNum(enableddate)
return currentMonth < pointTimeMonth || currentMonth < enableddateMonth
}
}
transformDateToNum=(date)=>{
if( !date ){
return 0
}
let time = date
if( typeof date == 'string' ){
time = moment(date)
}
return parseInt(`${time.year()}${time.month() < 10 ? `0${time.month()}` : `${time.month()}`}`)
}
onResize = (e) => {
let keyRandomTab = Math.floor(Math.random() * 10000)
this.keyRandomTab = keyRandomTab
setTimeout(()=>{
if( keyRandomTab == this.keyRandomTab ){
this.getTableScroll('app-auxdetailaccount-rpt-Body', 'ant-table-thead', 0 , 'ant-table-body', 'data.tableOption', e)
}
},200)
}
getTableScroll = (contaienr, head, num, target, path, e) => {
try{
const tableCon = document.getElementsByClassName(contaienr)[0]
if( !tableCon ){
if( e ){
return
}
setTimeout(()=>{
this.getTableScroll(contaienr, head, num, target, path)
}, 500)
return
}
const header = tableCon.getElementsByClassName(head)[0]
const body = tableCon.getElementsByClassName(target)[0].getElementsByTagName('table')[0]
const pre = this.metaAction.gf(path).toJS()
const y = tableCon.offsetHeight - header.offsetHeight - num
const bodyHeight = body.offsetHeight
if( bodyHeight > y && y != pre.y ){
this.metaAction.sf(path, fromJS({...pre, y}))
}else if( bodyHeight < y && pre.y != null ){
this.metaAction.sf(path, fromJS({...pre, y: null}))
}else {
return false
}
}catch(err){
console.log(err)
}
}
}
export default function creator(option) {
const metaAction = new MetaAction(option),
voucherAction = FormDecorator.actionCreator({ ...option, metaAction }),
o = new action({ ...option, metaAction, voucherAction }),
ret = { ...metaAction, ...voucherAction, ...o }
metaAction.config({ metaHandlers: ret })
return ret
}