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
68
69
70
71
72
73
74
75
76
77
78
79
| import { ref, onMounted, reactive, computed, watch } from 'vue'
| import { _t } from '@/libs/Language/Language'
|
| export const useSelectDialog = (props: any, ctx: any) => {
| const visible = computed({
| get() {
| return props.modelValue
| },
| set(val) {
| ctx.emit('update:modelValue', val)
| },
| })
|
| const dataSource = ref<any[]>([])
|
| const innerValue = ref('')
|
| const tableRef = ref()
|
| const checkedList = ref<any[]>([])
|
| const columns = computed(() => [
| {
| title: _t('序号'),
| type: 'seq',
| width: '60',
| },
| {
| field: 'workSection.name',
| title: _t('工序名称'),
| },
| {
| field: 'name',
| title: _t('工位名称'),
| },
| {
| field: 'remark',
| title: _t('备注'),
| },
| ])
|
| const onClose = () => {
| visible.value = false
| }
|
| const onConfirm = async () => {
| ctx.emit('confirm', checkedList.value)
| }
|
| const onSearch = () => {
| tableRef.value?.getList()
| }
|
| const onCheck = (list: any) => {
| checkedList.value = list
| }
|
| const selections = computed(() => {
| return props.data?.map((item: any) => item.id) ?? []
| })
|
| const onOpen = () => {
| // console.log(dataSource.value, selections, props.data)
| }
|
| return {
| selections,
| dataSource,
| columns,
| tableRef,
| innerValue,
| visible,
| onSearch,
| onOpen,
| onCheck,
| onClose,
| onConfirm,
| }
| }
|
|