gm-printer 11.0.2-beta.2 → 11.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/demo.js +9 -9
- package/package.json +1 -1
- package/src/common/editor_store.js +2 -37
- package/src/common/editor_title.js +4 -10
- package/src/editor/index.js +0 -2
- package/src/editor_settle/editor.js +1 -2
- package/src/index.js +1 -5
- package/src/printer/page_summary.js +46 -21
- package/src/printer/printer.js +3 -3
- package/src/printer/store.js +5 -8
- package/src/printer/table_diy_overallOrder_tr.js +21 -7
- package/src/printer/table_diy_summary_tr.js +54 -14
- package/src/printer/table_subtotal_tr.js +48 -45
- package/src/util.js +104 -1
- package/src/editor/context_menu_config.js +0 -335
- package/src/editor/editor_menu_config.js +0 -140
- package/src/examining_report_editor/context_menu.js +0 -94
- package/src/examining_report_editor/editor.js +0 -85
- package/src/examining_report_editor/index.js +0 -4
- package/src/examining_report_editor/store.js +0 -78
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
import { Flex } from '../components'
|
|
5
|
-
import { Gap, Title } from '../common/component'
|
|
6
|
-
import editStore from './store'
|
|
7
|
-
import { observer, inject } from 'mobx-react'
|
|
8
|
-
import EditorTitle from '../common/editor_title'
|
|
9
|
-
import EditorSelect from '../common/editor_select'
|
|
10
|
-
import EditorField from '../common/editor_edit_field'
|
|
11
|
-
import EditorAddField from '../common/editor_add_field'
|
|
12
|
-
import ContextMenu from './context_menu'
|
|
13
|
-
import i18next from '../../locales'
|
|
14
|
-
import withStore from '../common/hoc_with_store'
|
|
15
|
-
|
|
16
|
-
const tableDataKeyList = [
|
|
17
|
-
{
|
|
18
|
-
value: 'examiningDetail',
|
|
19
|
-
text: i18next.t('检测明细'),
|
|
20
|
-
hasSubtotalBtn: true
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
@withStore(editStore)
|
|
25
|
-
@inject('editStore')
|
|
26
|
-
@observer
|
|
27
|
-
class Editor extends React.Component {
|
|
28
|
-
render() {
|
|
29
|
-
const { onSave, showEditor, addFields, menuConfig } = this.props
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className='gm-printer-edit'>
|
|
33
|
-
<Flex className='gm-printer-edit-title-fixed'>
|
|
34
|
-
<Title
|
|
35
|
-
title={i18next.t('模板预览')}
|
|
36
|
-
text={
|
|
37
|
-
<span className='gm-text-desc gm-padding-left-5'>
|
|
38
|
-
{i18next.t(
|
|
39
|
-
'说明:选中内容进行编辑,可拖动字段移动位置,右键使用更多功能'
|
|
40
|
-
)}
|
|
41
|
-
</span>
|
|
42
|
-
}
|
|
43
|
-
/>
|
|
44
|
-
</Flex>
|
|
45
|
-
|
|
46
|
-
{showEditor && (
|
|
47
|
-
<div className='gm-printer-edit-zone'>
|
|
48
|
-
<EditorTitle onSave={onSave} />
|
|
49
|
-
<Gap height='10px' />
|
|
50
|
-
<EditorSelect />
|
|
51
|
-
<Gap height='5px' />
|
|
52
|
-
<EditorField tableDataKeyList={tableDataKeyList} />
|
|
53
|
-
<Gap height='5px' />
|
|
54
|
-
<EditorAddField addFields={addFields} />
|
|
55
|
-
|
|
56
|
-
<div id='gm-printer-tip' />
|
|
57
|
-
<div id='gm-printer-modal' />
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
|
|
61
|
-
<div className='gm-printer-edit-wrap'>
|
|
62
|
-
<ContextMenu menuConfig={menuConfig} />
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Editor.propTypes = {
|
|
70
|
-
config: PropTypes.object.isRequired,
|
|
71
|
-
onSave: PropTypes.func,
|
|
72
|
-
showEditor: PropTypes.bool,
|
|
73
|
-
mockData: PropTypes.object.isRequired,
|
|
74
|
-
addFields: PropTypes.object.isRequired,
|
|
75
|
-
menuConfig: PropTypes.oneOfType([
|
|
76
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
77
|
-
PropTypes.object
|
|
78
|
-
])
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
Editor.defaultProps = {
|
|
82
|
-
onSave: _.noop
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default Editor
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import EditorStore from '../common/editor_store'
|
|
2
|
-
import { action, toJS } from 'mobx'
|
|
3
|
-
import i18next from '../../locales'
|
|
4
|
-
|
|
5
|
-
const DEFAULT_TABLE_COLUMNS = [
|
|
6
|
-
{
|
|
7
|
-
head: i18next.t('序号'),
|
|
8
|
-
text: i18next.t('{{列.序号}}'),
|
|
9
|
-
style: { textAlign: 'center' },
|
|
10
|
-
headStyle: { textAlign: 'center' }
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
head: i18next.t('样品名称'),
|
|
14
|
-
text: i18next.t('{{列.样品名称}}'),
|
|
15
|
-
style: { textAlign: 'center' },
|
|
16
|
-
headStyle: { textAlign: 'center' }
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
head: i18next.t('样品编码'),
|
|
20
|
-
text: i18next.t('{{列.样品编码}}'),
|
|
21
|
-
style: { textAlign: 'center' },
|
|
22
|
-
headStyle: { textAlign: 'center' }
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
head: i18next.t('检测结果'),
|
|
26
|
-
text: i18next.t('{{列.检测结果}}'),
|
|
27
|
-
style: { textAlign: 'center' },
|
|
28
|
-
headStyle: { textAlign: 'center' }
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
class Store extends EditorStore {
|
|
33
|
-
constructor({ defaultTableDataKey }) {
|
|
34
|
-
super()
|
|
35
|
-
this.defaultTableDataKey = defaultTableDataKey
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getDefaultTableConfig() {
|
|
39
|
-
return {
|
|
40
|
-
dataKey: this.defaultTableDataKey,
|
|
41
|
-
subtotal: { show: false },
|
|
42
|
-
columns: [
|
|
43
|
-
{
|
|
44
|
-
head: i18next.t('表头'),
|
|
45
|
-
text: i18next.t('{{列.表头}}'),
|
|
46
|
-
style: { textAlign: 'center' },
|
|
47
|
-
headStyle: { textAlign: 'center' }
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@action
|
|
54
|
-
init(config, data) {
|
|
55
|
-
super.init(config, data)
|
|
56
|
-
this.defaultTableDataKey = 'examiningDetail'
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@action.bound
|
|
60
|
-
addContent(name, index, type, tableConfig = null) {
|
|
61
|
-
super.addContent(name, index, type, tableConfig)
|
|
62
|
-
this.config = toJS(this.config)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@action
|
|
66
|
-
changeTableDataKey(name, key, options = {}) {
|
|
67
|
-
super.changeTableDataKey(name, key, options)
|
|
68
|
-
this.config = toJS(this.config)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@action
|
|
72
|
-
removeContent(name) {
|
|
73
|
-
super.removeContent(name)
|
|
74
|
-
this.config = toJS(this.config)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default new Store({ defaultTableDataKey: 'examiningDetail' })
|