gm-printer 10.28.10 → 10.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.28.10",
3
+ "version": "10.29.0-beta.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1021,6 +1021,7 @@ class EditorStore {
1021
1021
  specialConfig: { style: {} },
1022
1022
  dataKey: defaultTableDataKey, // 默认
1023
1023
  subtotal: defaultTableSubtotal, // 默认的每页合计配置
1024
+ customerTag: false, // 特殊标记,用于提供用户干预功能标记
1024
1025
  columns: [
1025
1026
  {
1026
1027
  head: i18next.t('表头'),
@@ -10,6 +10,7 @@ import EditorSelect from '../common/editor_select'
10
10
  import EditorField from '../common/editor_edit_field'
11
11
  import EditorAddField from '../common/editor_add_field'
12
12
  import EditorSpecialTable from './editor_special_table'
13
+ import EditorSumTable from './editor_sum_table'
13
14
  import ContextMenu from './context_menu'
14
15
  import i18next from '../../locales'
15
16
  import withStore from '../common/hoc_with_store'
@@ -47,7 +48,8 @@ class Editor extends React.Component {
47
48
  <EditorAddField addFields={addFields} />
48
49
  <Gap height='5px' />
49
50
  <EditorSpecialTable addFields={addFields} />
50
-
51
+ <Gap height='5px' />
52
+ <EditorSumTable addFields={addFields} />
51
53
  <div id='gm-printer-tip' />
52
54
 
53
55
  <div id='gm-printer-modal' />
@@ -0,0 +1,48 @@
1
+ /* eslint-disable react/prop-types */
2
+ import i18next from '../../locales'
3
+ // @ts-ignore
4
+ import React, { Component } from 'react'
5
+ import { Flex, Switch } from '../components/index'
6
+ import { inject, observer } from 'mobx-react'
7
+
8
+ // @ts-ignore
9
+ @inject('editStore')
10
+ // @ts-ignore
11
+ @observer
12
+ class TableDetailEditor extends Component {
13
+ handleSwitchChange = val => {
14
+ const { editStore } = this.props
15
+ editStore.doSomething(val)
16
+ }
17
+
18
+ render() {
19
+ const { editStore } = this.props
20
+ console.log(this.props)
21
+ const {
22
+ addFields: { sumTableConfig }
23
+ } = this.props
24
+ if (editStore.computedRegionIsTable) {
25
+ return (
26
+ <div className='gm-margin-top-5'>
27
+ <Flex>
28
+ <div className='gm-margin-right-10'>
29
+ {sumTableConfig.label || i18next.t('配置')}
30
+ </div>
31
+ <Switch
32
+ checked={editStore.customerTag}
33
+ onChange={this.handleSwitchChange}
34
+ />
35
+ </Flex>
36
+ {sumTableConfig.showTips && (
37
+ <div className='gm-margin-top-5' style={{ color: 'red' }}>
38
+ {sumTableConfig.tips}
39
+ </div>
40
+ )}
41
+ </div>
42
+ )
43
+ }
44
+ return null
45
+ }
46
+ }
47
+
48
+ export default TableDetailEditor
@@ -1,13 +1,20 @@
1
1
  import EditorStore from '../common/editor_store'
2
- import { action } from 'mobx'
2
+ import { action, observable } from 'mobx'
3
3
  import i18next from '../../locales'
4
4
 
5
5
  class Store extends EditorStore {
6
6
  constructor({ defaultTableDataKey }) {
7
7
  super()
8
8
  this.defaultTableDataKey = defaultTableDataKey // 修改默认dataKey
9
+ const arr = this.selectedRegion?.split('.')
10
+ if (arr?.length > 2) {
11
+ this.customerTag = this.config.contents[arr[2]].customerTag
12
+ }
9
13
  }
10
14
 
15
+ @observable
16
+ customerTag = false
17
+
11
18
  /* start---------设置采购明细相关--------- */
12
19
  @action.bound
13
20
  setPurchaseTableKey(dataKey) {
@@ -99,6 +106,12 @@ class Store extends EditorStore {
99
106
  }
100
107
 
101
108
  /* end---------设置采购明细相关--------- */
109
+ @action.bound
110
+ doSomething(val) {
111
+ const arr = this.selectedRegion.split('.')
112
+ this.config.contents[arr[2]].customerTag = val
113
+ this.customerTag = val
114
+ }
102
115
  }
103
116
 
104
117
  export default new Store({ defaultTableDataKey: 'purchase_no_detail' })
@@ -89,7 +89,7 @@ function toDoPrintBatch(list, isPrint = true) {
89
89
  // isPrint &&
90
90
  // templateType !== 'longPrint' &&
91
91
  // $printer.contentWindow.print()
92
- console.log('templateType', templateType)
92
+ // console.log('templateType', templateType)
93
93
  isPrint && $printer.contentWindow.print()
94
94
  resolve()
95
95
  }, $app)