ttk-app-core
Version:
enterprise develop framework
63 lines (52 loc) • 1.99 kB
JavaScript
import React from 'react'
import { action as MetaAction, AppLoader } from 'edf-meta-engine'
import {Icon} from 'edf-component'
import config from './config'
import {Tree} from 'edf-component'
import { FormDecorator } from 'edf-component'
import extend from './extend'
import moment from 'moment'
class action {
constructor(option) {
this.metaAction = option.metaAction
this.extendAction = option.extendAction
this.voucherAction = option.voucherAction
this.config = config.current
this.webapi = this.config.webapi
}
onInit = ({ component, injections }) => {
this.extendAction.gridAction.onInit({ component, injections })
this.component = component
this.injections = injections
if (this.component.props.setOkListener) {
this.component.props.setOkListener(this.onOk)
}
injections.reduce('init')
this.load()
}
load = async () => {
let enabledPeriod = this.component.props.enabledPeriod
if(enabledPeriod) this.injections.reduce('load', enabledPeriod)
}
selectMethod = (v) => {
this.metaAction.sf('data.form.methodId', v)
}
//确定
onOk = async () => {
// let value = this.metaAction.gf('data.other.beginDate')
// let res = await this.webapi.dateCard.createDate({paramValue: value})
}
// 关闭弹框和页面
// onCancel = () => {
// this.component.props.tabEdit('存货期初','remove')
// }
}
export default function creator(option) {
const metaAction = new MetaAction(option),
extendAction = extend.actionCreator({ ...option, metaAction }),
voucherAction = FormDecorator.actionCreator({ ...option, metaAction }),
o = new action({ ...option, metaAction, extendAction,voucherAction }),
ret = { ...metaAction, ...extendAction.gridAction,...voucherAction, ...o }
metaAction.config({ metaHandlers: ret })
return ret
}