1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
| <template>
| <j-popup
| v-bind="popupProps"
| @input="handlePopupInput"
| />
| </template>
|
| <script>
| import JVxeCellMixins, { dispatchEvent, vModel } from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
|
| export default {
| name: 'JVxePopupCell',
| mixins: [JVxeCellMixins],
| computed: {
| popupProps() {
| const {innerValue, originColumn: col, caseId, cellProps} = this
| return {
| ...cellProps,
| value: innerValue,
| field: col.field || col.key,
| code: col.popupCode,
| orgFields: col.orgFields,
| destFields: col.destFields,
| groupId: caseId,
| param: col.param,
| sorter: col.sorter,
| }
| },
| },
| methods: {
| /** popup回调 */
| handlePopupInput(value, others) {
| const {row, originColumn: col} = this
| // 存储输入的值
| let popupValue = value
| if (others && Object.keys(others).length > 0) {
| Object.keys(others).forEach(key => {
| let currentValue = others[key]
| // 当前列直接赋值,其他列通过vModel赋值
| if (key === col.key) {
| popupValue = currentValue
| } else {
| vModel.call(this, currentValue, row, key)
| }
| })
| }
| this.handleChangeCommon(popupValue)
| },
| },
| // 【组件增强】注释详见:JVxeCellMixins.js
| enhanced: {
| aopEvents: {
| editActived(event) {
| // 【issues/3854】附表控件类型为popup必填时未选择值提交表单会报错
| if (event.$event && event.$event.type === 'valid-error') {
| return;
| }
| dispatchEvent.call(this, event, 'ant-input')
| },
| },
| },
| }
| </script>
|
| <style scoped>
|
| </style>
|
|