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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
| import { ref, onMounted, reactive, computed, watch, nextTick } 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 url = ref('')
|
| const dataSource = ref<any[]>([])
|
| const innerValue = ref('')
|
| const tableRef = ref()
|
| const checkedList = ref<any[]>([])
|
| const imageRef = ref()
|
| const printName = ref('')
|
| const printVisible = ref(false)
|
| const columns = computed(() => [
| {
| title: _t('序号'),
| type: 'seq',
| width: '60',
| },
| {
| field: 'templateName',
| title: _t('模板名称'),
| },
| {
| field: 'remark',
| title: _t('备注'),
| },
| ])
|
| const onClose = () => {
| visible.value = false
| }
|
| const onConfirm = async () => {
| ctx.emit('confirm', checkedList.value)
| }
|
| const onSearch = async () => {
| const data: any[] = await tableRef.value?.getList()
| dataSource.value = data.filter((item: any) =>
| item.templateName.includes(innerValue.value)
| )
| }
|
| const onCheck = (list: any) => {
| checkedList.value = list
| }
|
| const selections = computed(() => {
| return props.data?.map((item: any) => item.templateName) ?? []
| })
|
| const onOpen = () => {
| // console.log(dataSource.value, selections, props.data)
| }
|
| const onPreview = (row: any) => {
| url.value = `/api/v1/labelmanagement/label/preview?printerName=${row.printerName}&templateName=${row.templateName}`
| printName.value = row.printerName
| printVisible.value = true
| }
|
| return {
| selections,
| columns,
| dataSource,
| tableRef,
| innerValue,
| visible,
| url,
| imageRef,
| printName,
| printVisible,
| onPreview,
| onSearch,
| onCheck,
| onOpen,
| onClose,
| onConfirm,
| }
| }
|
|