vue的element组件时间轴刚刚出来,可以自定义图标和颜色等。
拿过来作为document flow的历史流程记录,效果很好。
element table的在线编辑组件extends更新很快,前面还存在不能刷新页面数据的bug,到现在已经好了,并且安装的使用都变得简单了,不需要vuex,也不需要拷贝store,也不需要拷贝colum.vue之类了。
https://github.com/3xxx/flow-vue.js
同时,也为flow添加了一点新的代码,即查询文档的历史操作记录。
type DocEventsHistory struct {
FromState string
DocAction string
ToState string
Group string
Data string
Ctime time.Time
}
// DocEventsHistory answers the possible document wf_docevent_application.
func (_DocEvents) DocEventsHistory(dtype DocTypeID, id DocumentID) ([]*DocEventsHistory, error) {
q := `
SELECT dsm1.name, dam.name, dsm2.name, gm.name, de.data, de.ctime
FROM wf_docevent_application dea
JOIN wf_docstates_master dsm1 ON dsm1.id = dea.from_state_id
JOIN wf_docstates_master dsm2 ON dsm2.id = dea.to_state_id
JOIN wf_docevents de ON de.id = dea.docevent_id
JOIN wf_docactions_master dam ON dam.id = de.docaction_id
JOIN wf_groups_master gm ON gm.id = de.group_id
WHERE dea.doctype_id = ? AND dea.doc_id = ? ORDER BY de.ctime DESC
`
rows, err := db.Query(q, dtype, id)
if err != nil {
return nil, err
}
defer rows.Close()
ary := make([]*DocEventsHistory, 0, 10)
for rows.Next() {
var elem DocEventsHistory
err = rows.Scan(&elem.FromState, &elem.DocAction, &elem.ToState, &elem.Group, &elem.Data, &elem.Ctime)
if err != nil {
return nil, err
}
ary = append(ary, &elem)
}
if err = rows.Err(); err != nil {
return nil, err
}
return ary, nil
}