useSendToPrinterStore.js
1.63 KB
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
import { defineStore } from 'pinia';
import { reactive, ref, watch } from 'vue';
export const useSendToPrinterStore = defineStore('send-2Printer', () => {
const account = ref('aaa');
const selecteditem = ref('queue');
const remarks = ref('');
const purposeitems = reactive([
{
key: 'purpose1'
},
{
key: 'purpose2'
},
{
key: 'purpose3'
}
]);
const productitems = reactive([
{
key: 'product1'
},
{
key: 'product2'
},
{
key: 'product3'
}
]);
const printeritems = reactive([
{
key: 'printer1'
},
{
key: 'printer2'
},
{
key: 'printer3'
}
]);
const selectedPurpose = ref('');
const selectedProduct = ref('');
const selectedPrinter = ref('');
const handleSelectPurpose = (key) => {
selectedPurpose.value = key;
};
const handleSelectProduct = (key) => {
selectedProduct.value = key;
};
const handleSelectPrinter = (key) => {
selectedPrinter.value = key;
};
watch(
() => account.value,
() => {
selecteditem.value = account.value === 'aaa' ? 'queue' : 'auto';
}
);
return {
account,
selecteditem,
remarks,
purposeitems,
productitems,
printeritems,
selectedPurpose,
selectedProduct,
selectedPrinter,
handleSelectPurpose,
handleSelectProduct,
handleSelectPrinter
};
});