ttk-app-core
Version:
enterprise develop framework
43 lines (36 loc) • 1.11 kB
JavaScript
import React from 'react'
import { action as MetaAction, AppLoader } from 'edf-meta-engine'
import { LoadingMask } from 'edf-component'
import config from './config'
class action {
constructor(option) {
this.metaAction = option.metaAction
this.config = config.current
this.webapi = this.config.webapi
}
onInit = ({ component, injections }) => {
this.component = component
this.injections = injections
injections.reduce('init')
this.load()
}
load = async () => {
let option = this.component.props.option
this.metaAction.sf('data.other.loading', true)
let res = await this.webapi.asset.history(option.cardId)
this.metaAction.sf('data.other.loading', false)
if(res){
this.injections.reduce('load', res)
}
}
getListRowsCount = () => {
return this.metaAction.gf('data.list').size
}
}
export default function creator(option) {
const metaAction = new MetaAction(option),
o = new action({ ...option, metaAction }),
ret = { ...metaAction, ...o }
metaAction.config({ metaHandlers: ret })
return ret
}