vue2server7 7.0.103 → 7.0.104
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 +1 -1
- package/test/11231231 +137 -0
package/package.json
CHANGED
package/test/11231231
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-model="visible"
|
|
4
|
+
title="切换机构"
|
|
5
|
+
width="420px"
|
|
6
|
+
:close-on-click-modal="false"
|
|
7
|
+
>
|
|
8
|
+
<el-form label-width="80px">
|
|
9
|
+
<el-form-item label="机构">
|
|
10
|
+
<el-select
|
|
11
|
+
v-model="selectedOrgId"
|
|
12
|
+
placeholder="请选择机构"
|
|
13
|
+
style="width: 100%"
|
|
14
|
+
filterable
|
|
15
|
+
>
|
|
16
|
+
<el-option
|
|
17
|
+
v-for="item in orgList"
|
|
18
|
+
:key="item.id"
|
|
19
|
+
:label="item.name"
|
|
20
|
+
:value="item.id"
|
|
21
|
+
/>
|
|
22
|
+
</el-select>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
</el-form>
|
|
25
|
+
|
|
26
|
+
<template #footer>
|
|
27
|
+
<el-button @click="handleCancel">取消</el-button>
|
|
28
|
+
<el-button type="primary" @click="handleConfirm">
|
|
29
|
+
确定切换
|
|
30
|
+
</el-button>
|
|
31
|
+
</template>
|
|
32
|
+
</el-dialog>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup>
|
|
36
|
+
import { ref, watch } from 'vue'
|
|
37
|
+
import { ElMessage } from 'element-plus'
|
|
38
|
+
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
orgList: {
|
|
45
|
+
type: Array,
|
|
46
|
+
default: () => []
|
|
47
|
+
},
|
|
48
|
+
currentOrgId: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
default: ''
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits([
|
|
55
|
+
'update:modelValue',
|
|
56
|
+
'confirm'
|
|
57
|
+
])
|
|
58
|
+
|
|
59
|
+
const visible = ref(false)
|
|
60
|
+
const selectedOrgId = ref('')
|
|
61
|
+
|
|
62
|
+
watch(
|
|
63
|
+
() => props.modelValue,
|
|
64
|
+
val => {
|
|
65
|
+
visible.value = val
|
|
66
|
+
if (val) {
|
|
67
|
+
selectedOrgId.value = props.currentOrgId
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
watch(visible, val => {
|
|
73
|
+
emit('update:modelValue', val)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const handleCancel = () => {
|
|
77
|
+
visible.value = false
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const handleConfirm = () => {
|
|
81
|
+
if (!selectedOrgId.value) {
|
|
82
|
+
ElMessage.warning('请选择机构')
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
emit('confirm', selectedOrgId.value)
|
|
87
|
+
visible.value = false
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
、、、<template>
|
|
91
|
+
<el-button type="primary" @click="showOrgDialog = true">
|
|
92
|
+
切换机构
|
|
93
|
+
</el-button>
|
|
94
|
+
|
|
95
|
+
<OrgSwitchDialog
|
|
96
|
+
v-model="showOrgDialog"
|
|
97
|
+
:org-list="orgList"
|
|
98
|
+
:current-org-id="currentOrgId"
|
|
99
|
+
@confirm="handleSwitchOrg"
|
|
100
|
+
/>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script setup>
|
|
104
|
+
import { ref } from 'vue'
|
|
105
|
+
import { ElMessage } from 'element-plus'
|
|
106
|
+
import OrgSwitchDialog from '@/components/OrgSwitchDialog.vue'
|
|
107
|
+
|
|
108
|
+
const showOrgDialog = ref(false)
|
|
109
|
+
|
|
110
|
+
const currentOrgId = ref(1)
|
|
111
|
+
|
|
112
|
+
const orgList = ref([
|
|
113
|
+
{
|
|
114
|
+
id: 1,
|
|
115
|
+
name: '总部机构'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 2,
|
|
119
|
+
name: '上海分公司'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 3,
|
|
123
|
+
name: '北京分公司'
|
|
124
|
+
}
|
|
125
|
+
])
|
|
126
|
+
|
|
127
|
+
const handleSwitchOrg = orgId => {
|
|
128
|
+
currentOrgId.value = orgId
|
|
129
|
+
|
|
130
|
+
const org = orgList.value.find(item => item.id === orgId)
|
|
131
|
+
|
|
132
|
+
ElMessage.success(`已切换到:${org?.name || ''}`)
|
|
133
|
+
|
|
134
|
+
// 这里可以调用接口
|
|
135
|
+
// await switchOrgApi(orgId)
|
|
136
|
+
}
|
|
137
|
+
</script>
|