vue2-client 1.22.2 → 1.22.3
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/.claude/settings.local.json +30 -30
- package/.env.his +19 -19
- package/.eslintrc.js +74 -74
- package/.history/.eslintrc_20260521171150.js +74 -0
- package/.history/.eslintrc_20260521171213.js +74 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154443.vue +726 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154700.vue +478 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175435.vue +706 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175450.vue +694 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260611152602.vue +755 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513145941.vue +524 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513153133.vue +731 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513160316.vue +525 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260601144150.vue +1046 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310142713.vue +512 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310145118.vue +511 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260311094834.vue +696 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260320143028.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260409101450.vue +677 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164645.vue +758 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164714.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508171651.vue +716 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509133717.vue +695 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509171115.vue +664 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140637.vue +1455 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140935.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513150818.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153119.vue +1442 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153126.vue +1486 -0
- package/.history/src/base-client/components/common/XForm/XFormItem_20260513140854.vue +1607 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140403.vue +643 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140829.vue +628 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519142824.vue +104 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519143155.vue +102 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171231.vue +1241 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171441.vue +1223 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612174826.vue +472 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612175839.vue +538 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260615103331.vue +650 -0
- package/.history/src/base-client/components/his/XHDescriptions/XHDescriptions_20260424134504.vue +1469 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171133.vue +788 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171151.vue +780 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511170841.vue +585 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511171138.vue +787 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260512141830.vue +739 -0
- package/.history/src/components/STable/index_20260409155138.js +806 -0
- package/.history/src/components/STable/index_20260409155218.js +814 -0
- package/.history/src/expression/core/Expression_20260305164427.js +1371 -0
- package/.history/src/expression/core/Expression_20260305170258.js +1358 -0
- package/.history/src/expression/core/Program_20260305111830.js +944 -0
- package/.history/src/expression/core/Program_20260305112041.js +931 -0
- package/.history/src/logic/LogicRunner_20260304154306.js +170 -0
- package/.history/src/logic/LogicRunner_20260304155553.js +112 -0
- package/.history/src/logic/LogicRunner_20260305105834.js +112 -0
- package/.history/src/logic/LogicRunner_20260305112718.js +129 -0
- package/.history/src/logic/LogicRunner_20260305182436.js +133 -0
- package/.history/src/logic/LogicRunner_20260306151301.js +213 -0
- package/.history/src/logic/LogicRunner_20260306152419.js +213 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154159.js +61 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154217.js +44 -0
- package/.history/src/logic/plugins/common/DateTools_20260305161014.js +44 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305164352.js +80 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305170258.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305171634.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260306152419.js +72 -0
- package/.history/src/services/api/restTools_20260427142149.js +245 -0
- package/.history/src/services/api/restTools_20260427142853.js +230 -0
- package/.history/src/services/api/restTools_20260519135558.js +230 -0
- package/.history/src/services/api/restTools_20260519140825.js +230 -0
- package/.history/src/services/api/restTools_20260519151223.js +230 -0
- package/.history/src/utils/indexedDB_20260306150918.js +593 -0
- package/.history/src/utils/indexedDB_20260306151301.js +586 -0
- package/.idea/af-vue2-client.iml +9 -0
- package/.idea/codeStyles/Project.xml +62 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +1 -1
- package/Components.md +60 -60
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/package.json +1 -1
- package/preview-input-box.html +180 -0
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/HIS/HButtons/HButtons.vue +55 -1
- package/src/base-client/components/common/HIS/HForm/HForm.vue +1186 -1186
- package/src/base-client/components/common/HIS/HTab/HTab.vue +88 -1
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddReport/XAddReport.vue +16 -1
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +382 -382
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XInput/XInput.vue +32 -1
- package/src/base-client/components/common/XInspectionDetailDrawer/index.vue +1 -1
- package/src/base-client/components/common/XMarkdownViewer/demo.vue +102 -102
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/his/HAi/HAi.vue +1177 -436
- package/src/base-client/components/his/XList/XList.vue +337 -58
- package/src/base-client/components/his/XSidebar/XSidebar.vue +36 -12
- package/src/base-client/components/his/XTransfer/index.md +327 -327
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/index.js +953 -953
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/services/api/cas.js +79 -79
- package/src/store/modules/setting.js +119 -119
- package/src/utils/errorCode.js +6 -6
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -7
- package/.idea/google-java-format.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -24
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/vue2-client.iml +0 -12
- package/.vscode/settings.json +0 -28
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="x-transfer-wrapper">
|
|
3
|
+
<div class="transfer-header">
|
|
4
|
+
<slot name="title">
|
|
5
|
+
<span class="header-title">{{ title }}</span>
|
|
6
|
+
</slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="transfer-content">
|
|
9
|
+
<div class="x-transfer-component">
|
|
10
|
+
<a-spin :spinning="loading">
|
|
11
|
+
<div class="x-transfer-container">
|
|
12
|
+
<!-- 左侧:可选项列表 -->
|
|
13
|
+
<div class="transfer-panel left-panel">
|
|
14
|
+
<div class="panel-header" v-if="showLeftHeader">
|
|
15
|
+
<span class="panel-title">{{ leftTitle }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="panel-body">
|
|
18
|
+
<!-- 分组列表 -->
|
|
19
|
+
<template v-if="localGroupDataSource.length > 0">
|
|
20
|
+
<div
|
|
21
|
+
v-for="group in localGroupDataSource"
|
|
22
|
+
:key="group.key"
|
|
23
|
+
class="group-section"
|
|
24
|
+
>
|
|
25
|
+
<div class="group-label-row" @click="toggleGroup(group.key)">
|
|
26
|
+
<span class="group-label">{{ group.label }}</span>
|
|
27
|
+
<a-icon
|
|
28
|
+
type="right"
|
|
29
|
+
class="item-icon icon-right"
|
|
30
|
+
@click.stop="addGroupItems(group)"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="group-items" v-show="isGroupExpanded(group.key)">
|
|
34
|
+
<div
|
|
35
|
+
v-for="item in group.items"
|
|
36
|
+
:key="item.key"
|
|
37
|
+
class="item-row item-row-left"
|
|
38
|
+
:class="{ selected: localValue.includes(item.key) }"
|
|
39
|
+
:title="item.title"
|
|
40
|
+
@dblclick="addItem(item.key)"
|
|
41
|
+
>
|
|
42
|
+
<span class="item-title">{{ item.title }}</span>
|
|
43
|
+
<a-icon type="right" class="item-icon icon-right" @click.stop="addItem(item.key)"/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<!-- 简单列表 -->
|
|
50
|
+
<template v-else>
|
|
51
|
+
<div
|
|
52
|
+
v-for="item in localDataSource"
|
|
53
|
+
:key="item.key"
|
|
54
|
+
class="item-row"
|
|
55
|
+
:class="{ selected: localValue.includes(item.key) }"
|
|
56
|
+
:title="item.title"
|
|
57
|
+
@dblclick="addItem(item.key)"
|
|
58
|
+
>
|
|
59
|
+
<span class="item-title">{{ item.title }}</span>
|
|
60
|
+
<a-icon type="right" class="item-icon icon-right" @click.stop="addItem(item.key)"/>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<a-empty v-if="localDataSource.length === 0 && !loading"/>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<!-- 中间:操作按钮容器(上下结构) -->
|
|
69
|
+
<div class="transfer-actions">
|
|
70
|
+
<div class="action-box" @click="selectAll">
|
|
71
|
+
<span class="action-text">{{ allText }}</span>
|
|
72
|
+
<a-icon type="right"/>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="action-box" @click="clearAll">
|
|
75
|
+
<span class="action-text">{{ allText }}</span>
|
|
76
|
+
<a-icon type="left"/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<!-- 右侧:已选列表 -->
|
|
81
|
+
<div class="transfer-panel right-panel">
|
|
82
|
+
<div class="panel-header" v-if="showRightHeader">
|
|
83
|
+
<span v-if="rightTitle" class="panel-title">{{ rightTitle }}</span>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="panel-body">
|
|
86
|
+
<div
|
|
87
|
+
v-for="key in localValue"
|
|
88
|
+
:key="key"
|
|
89
|
+
class="item-row selected-item"
|
|
90
|
+
:title="getItemTitle(key)"
|
|
91
|
+
@dblclick="removeItem(key)"
|
|
92
|
+
>
|
|
93
|
+
<a-icon type="left" class="item-icon icon-left" @click.stop="removeItem(key)"/>
|
|
94
|
+
<span class="item-title">{{ getItemTitle(key) }}</span>
|
|
95
|
+
</div>
|
|
96
|
+
<a-empty v-if="localValue.length === 0"/>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</a-spin>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup>
|
|
107
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
108
|
+
import { query, runLogic, getConfigByName } from '@vue2-client/services/api/common'
|
|
109
|
+
|
|
110
|
+
const props = defineProps({
|
|
111
|
+
queryParamsName: { type: String, default: '' },
|
|
112
|
+
configName: { type: String, default: '' },
|
|
113
|
+
serverName: { type: String, default: 'af-his' },
|
|
114
|
+
logicName: { type: String, default: '' },
|
|
115
|
+
parameter: { type: Object, default: () => ({}) },
|
|
116
|
+
rowKey: { type: String, default: 'key' },
|
|
117
|
+
displayKey: { type: String, default: 'title' },
|
|
118
|
+
groupKey: { type: String, default: 'group' },
|
|
119
|
+
groupLabelKey: { type: String, default: 'label' },
|
|
120
|
+
groupItemsKey: { type: String, default: 'items' },
|
|
121
|
+
leftTitle: { type: String, default: '' },
|
|
122
|
+
rightTitle: { type: String, default: '' },
|
|
123
|
+
allText: { type: String, default: 'All' },
|
|
124
|
+
addHint: { type: String, default: '双击添加' },
|
|
125
|
+
removeHint: { type: String, default: '双击移除' },
|
|
126
|
+
initialValue: { type: Array, default: () => [] },
|
|
127
|
+
disabled: { type: Boolean, default: false },
|
|
128
|
+
data: { type: Array, default: null },
|
|
129
|
+
config: { type: Object, default: null },
|
|
130
|
+
env: { type: String, default: 'prod' }
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
const emit = defineEmits(['update:value', 'change', 'loaded'])
|
|
134
|
+
|
|
135
|
+
const loading = ref(false)
|
|
136
|
+
const localValue = ref([])
|
|
137
|
+
const localDataSource = ref([])
|
|
138
|
+
const localGroupDataSource = ref([])
|
|
139
|
+
const localConfig = ref(null)
|
|
140
|
+
const expandedGroups = ref([])
|
|
141
|
+
|
|
142
|
+
const isDev = computed(() => props.env === 'prod' ? false : true)
|
|
143
|
+
|
|
144
|
+
const getConfig = (key, defaultValue) => {
|
|
145
|
+
if (props.config && props.config[key] !== undefined) {
|
|
146
|
+
return props.config[key]
|
|
147
|
+
}
|
|
148
|
+
if (localConfig.value && localConfig.value[key] !== undefined) {
|
|
149
|
+
return localConfig.value[key]
|
|
150
|
+
}
|
|
151
|
+
if (props[key] !== undefined) {
|
|
152
|
+
return props[key]
|
|
153
|
+
}
|
|
154
|
+
return defaultValue
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const logicName = computed(() => getConfig('logicName', props.logicName || ''))
|
|
158
|
+
const queryParamsName = computed(() => getConfig('queryParamsName', props.queryParamsName || props.configName || ''))
|
|
159
|
+
const parameter = computed(() => getConfig('parameter', props.parameter || {}))
|
|
160
|
+
|
|
161
|
+
const allText = computed(() => getConfig('allText', 'All'))
|
|
162
|
+
const addHint = computed(() => getConfig('addHint', '双击添加'))
|
|
163
|
+
const removeHint = computed(() => getConfig('removeHint', '双击移除'))
|
|
164
|
+
const leftTitle = computed(() => getConfig('leftTitle', ''))
|
|
165
|
+
const rightTitle = computed(() => getConfig('rightTitle', ''))
|
|
166
|
+
const disabled = computed(() => getConfig('disabled', false))
|
|
167
|
+
const title = computed(() => getConfig('title', ''))
|
|
168
|
+
const initialValue = computed(() => getConfig('initialValue', []))
|
|
169
|
+
|
|
170
|
+
const showLeftHeader = computed(() => !!leftTitle.value)
|
|
171
|
+
const showRightHeader = computed(() => !!rightTitle.value)
|
|
172
|
+
|
|
173
|
+
const totalCount = computed(() => localDataSource.value.length)
|
|
174
|
+
|
|
175
|
+
watch(() => getConfig('value', undefined), (newVal) => {
|
|
176
|
+
if (newVal !== undefined && JSON.stringify(newVal) !== JSON.stringify(localValue.value)) {
|
|
177
|
+
localValue.value = [...newVal]
|
|
178
|
+
}
|
|
179
|
+
}, { immediate: true })
|
|
180
|
+
|
|
181
|
+
watch(localValue, (newVal) => {
|
|
182
|
+
emit('update:value', newVal)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const loadData = async () => {
|
|
186
|
+
loading.value = true
|
|
187
|
+
try {
|
|
188
|
+
await loadByConfig()
|
|
189
|
+
} catch (e) {
|
|
190
|
+
console.error('[XTransfer] Load error:', e)
|
|
191
|
+
} finally {
|
|
192
|
+
loading.value = false
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const loadByConfig = () => {
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
console.log('[XTransfer] getConfigByName:', queryParamsName.value, props.serverName)
|
|
199
|
+
getConfigByName(queryParamsName.value, props.serverName, async (config) => {
|
|
200
|
+
console.log('[XTransfer] config loaded:', config)
|
|
201
|
+
if (!config) {
|
|
202
|
+
console.error('[XTransfer] config is null')
|
|
203
|
+
loading.value = false
|
|
204
|
+
resolve()
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
localConfig.value = config
|
|
209
|
+
|
|
210
|
+
if (config.logicName) {
|
|
211
|
+
try {
|
|
212
|
+
const result = await loadByLogicWithConfig(config)
|
|
213
|
+
const { data, initialValue: logicInitialValue } = result
|
|
214
|
+
|
|
215
|
+
parseData(data)
|
|
216
|
+
|
|
217
|
+
const initValue = logicInitialValue.length > 0 ? logicInitialValue : initialValue.value
|
|
218
|
+
if (initValue.length > 0) {
|
|
219
|
+
localValue.value = [...initValue]
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
emit('loaded', {
|
|
223
|
+
dataSource: localDataSource.value,
|
|
224
|
+
groupDataSource: localGroupDataSource.value,
|
|
225
|
+
initialValue: initValue
|
|
226
|
+
})
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.error('[XTransfer] Load error:', e)
|
|
229
|
+
}
|
|
230
|
+
} else if (config.data && Array.isArray(config.data)) {
|
|
231
|
+
parseData(config.data)
|
|
232
|
+
if (initialValue.value.length > 0) {
|
|
233
|
+
localValue.value = [...initialValue.value]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
loading.value = false
|
|
238
|
+
resolve()
|
|
239
|
+
}, isDev.value)
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const parseData = (data) => {
|
|
244
|
+
if (!data || !Array.isArray(data)) {
|
|
245
|
+
localDataSource.value = []
|
|
246
|
+
localGroupDataSource.value = []
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const rowKey = getConfig('rowKey', 'key')
|
|
251
|
+
const displayKey = getConfig('displayKey', 'title')
|
|
252
|
+
const groupKey = getConfig('groupKey', 'group')
|
|
253
|
+
const groupLabelKey = getConfig('groupLabelKey', 'label')
|
|
254
|
+
const groupItemsKey = getConfig('groupItemsKey', 'items')
|
|
255
|
+
|
|
256
|
+
const firstItem = data[0]
|
|
257
|
+
const hasGroup = firstItem && (firstItem[groupKey] || firstItem[groupLabelKey])
|
|
258
|
+
|
|
259
|
+
console.log('[XTransfer] parseData hasGroup:', hasGroup)
|
|
260
|
+
|
|
261
|
+
if (hasGroup) {
|
|
262
|
+
localGroupDataSource.value = data.map((group, index) => ({
|
|
263
|
+
key: group[rowKey] || group.key || `group-${index}`,
|
|
264
|
+
label: group[groupLabelKey] || group.label || '未命名',
|
|
265
|
+
items: transformItems(group[groupItemsKey] || group.items || []),
|
|
266
|
+
_rawData: group
|
|
267
|
+
}))
|
|
268
|
+
|
|
269
|
+
localDataSource.value = []
|
|
270
|
+
data.forEach(group => {
|
|
271
|
+
const items = group[groupItemsKey] || group.items || []
|
|
272
|
+
localDataSource.value.push(...transformItems(items))
|
|
273
|
+
})
|
|
274
|
+
} else {
|
|
275
|
+
localDataSource.value = transformItems(data)
|
|
276
|
+
localGroupDataSource.value = []
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const loadByLogicWithConfig = async (config) => {
|
|
281
|
+
const logic = config.logicName || logicName.value
|
|
282
|
+
const params = config.parameter || parameter.value
|
|
283
|
+
const server = config.serverName || props.serverName
|
|
284
|
+
|
|
285
|
+
console.log('[XTransfer] loadByLogic:', logic, params, server)
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
const res = await runLogic(logic, params, server, isDev.value)
|
|
289
|
+
console.log('[XTransfer] logic result:', res)
|
|
290
|
+
|
|
291
|
+
if (res === null || res === undefined) {
|
|
292
|
+
return { data: [], initialValue: [] }
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (Array.isArray(res)) {
|
|
296
|
+
return { data: res, initialValue: [] }
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (typeof res === 'object') {
|
|
300
|
+
return {
|
|
301
|
+
data: res.data || res.result || [],
|
|
302
|
+
initialValue: res.initialValue || res.selected || res.defaultValue || []
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return { data: [], initialValue: [] }
|
|
307
|
+
} catch (e) {
|
|
308
|
+
console.error('[XTransfer] logic error:', e)
|
|
309
|
+
return { data: [], initialValue: [] }
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const transformItems = (items) => {
|
|
314
|
+
if (!items || !Array.isArray(items)) return []
|
|
315
|
+
|
|
316
|
+
const rowKey = getConfig('rowKey', 'key')
|
|
317
|
+
const displayKey = getConfig('displayKey', 'title')
|
|
318
|
+
|
|
319
|
+
return items.map((item, index) => ({
|
|
320
|
+
key: String(getNestedValue(item, rowKey) || item.key || `item-${index}`),
|
|
321
|
+
title: String(getNestedValue(item, displayKey) || item.title || `选项${index + 1}`),
|
|
322
|
+
disabled: item.disabled === true,
|
|
323
|
+
_rawData: item
|
|
324
|
+
}))
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const getNestedValue = (obj, path) => {
|
|
328
|
+
if (!path || !obj) return null
|
|
329
|
+
return path.split('.').reduce((acc, part) => {
|
|
330
|
+
if (acc === null || acc === undefined) return null
|
|
331
|
+
return acc[part]
|
|
332
|
+
}, obj)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const addItem = (key) => {
|
|
336
|
+
if (disabled.value) return
|
|
337
|
+
if (!localValue.value.includes(key)) {
|
|
338
|
+
localValue.value = [...localValue.value, key]
|
|
339
|
+
emitChange()
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const addGroupItems = (group) => {
|
|
344
|
+
if (disabled.value) return
|
|
345
|
+
const keys = group.items.map(item => item.key)
|
|
346
|
+
const newKeys = keys.filter(key => !localValue.value.includes(key))
|
|
347
|
+
if (newKeys.length > 0) {
|
|
348
|
+
localValue.value = [...localValue.value, ...newKeys]
|
|
349
|
+
emitChange()
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const toggleGroup = (groupKey) => {
|
|
354
|
+
const index = expandedGroups.value.indexOf(groupKey)
|
|
355
|
+
if (index > -1) {
|
|
356
|
+
expandedGroups.value.splice(index, 1)
|
|
357
|
+
} else {
|
|
358
|
+
expandedGroups.value.push(groupKey)
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const isGroupExpanded = (groupKey) => {
|
|
363
|
+
return expandedGroups.value.includes(groupKey)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const removeItem = (key) => {
|
|
367
|
+
if (disabled.value) return
|
|
368
|
+
localValue.value = localValue.value.filter(k => k !== key)
|
|
369
|
+
emitChange()
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const selectAll = () => {
|
|
373
|
+
if (disabled.value) return
|
|
374
|
+
const allKeys = localDataSource.value.map(item => item.key)
|
|
375
|
+
localValue.value = [...allKeys]
|
|
376
|
+
emitChange()
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const clearAll = () => {
|
|
380
|
+
if (disabled.value) return
|
|
381
|
+
localValue.value = []
|
|
382
|
+
emitChange()
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const emitChange = () => {
|
|
386
|
+
emit('change', {
|
|
387
|
+
value: localValue.value,
|
|
388
|
+
data: getSelectedData()
|
|
389
|
+
})
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const getSelectedData = () => {
|
|
393
|
+
return localValue.value.map(key => {
|
|
394
|
+
const item = localDataSource.value.find(d => d.key === key)
|
|
395
|
+
return item?._rawData
|
|
396
|
+
}).filter(Boolean)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const getItemTitle = (key) => {
|
|
400
|
+
const item = localDataSource.value.find(d => d.key === key)
|
|
401
|
+
return item?.title || key
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const init = (config) => {
|
|
405
|
+
console.log('[XTransfer] init with config:', config)
|
|
406
|
+
if (config) {
|
|
407
|
+
localConfig.value = config
|
|
408
|
+
loadData()
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const refresh = () => {
|
|
413
|
+
loadData()
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
defineExpose({
|
|
417
|
+
loadData,
|
|
418
|
+
init,
|
|
419
|
+
refresh,
|
|
420
|
+
getSelectedData,
|
|
421
|
+
getSelectedKeys: () => [...localValue.value],
|
|
422
|
+
clear: clearAll,
|
|
423
|
+
setValue: (keys) => { localValue.value = keys }
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
onMounted(() => {
|
|
427
|
+
console.log('[XTransfer] mounted, queryParamsName:', props.queryParamsName, 'logicName:', props.logicName)
|
|
428
|
+
loadData()
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
watch(() => [props.queryParamsName, props.logicName, props.config, props.data], () => {
|
|
432
|
+
loadData()
|
|
433
|
+
}, { deep: true })
|
|
434
|
+
</script>
|
|
435
|
+
|
|
436
|
+
<style scoped>
|
|
437
|
+
.x-transfer-wrapper {
|
|
438
|
+
width: 100%;
|
|
439
|
+
height: 189px;
|
|
440
|
+
border: none;
|
|
441
|
+
background: transparent;
|
|
442
|
+
display: flex;
|
|
443
|
+
flex-direction: column;
|
|
444
|
+
box-sizing: border-box;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.transfer-header {
|
|
448
|
+
height: 41px;
|
|
449
|
+
display: flex;
|
|
450
|
+
align-items: center;
|
|
451
|
+
padding-left: 24px;
|
|
452
|
+
flex-shrink: 0;
|
|
453
|
+
box-sizing: border-box;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.transfer-content {
|
|
457
|
+
flex: 1;
|
|
458
|
+
padding-left: 99px;
|
|
459
|
+
box-sizing: border-box;
|
|
460
|
+
display: flex;
|
|
461
|
+
align-items: flex-start;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.x-transfer-component {
|
|
465
|
+
width: 100%;
|
|
466
|
+
font-family: 'Source Han Sans', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.x-transfer-container {
|
|
470
|
+
display: flex !important;
|
|
471
|
+
flex-direction: row !important;
|
|
472
|
+
gap: 0px;
|
|
473
|
+
align-items: flex-start;
|
|
474
|
+
width: 100%;
|
|
475
|
+
height: 100%;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.transfer-panel {
|
|
479
|
+
width: 324px;
|
|
480
|
+
height: 143px;
|
|
481
|
+
border: 1px solid #E5E9F0;
|
|
482
|
+
border-radius: 6px;
|
|
483
|
+
background: #fff;
|
|
484
|
+
flex: 0 0 auto;
|
|
485
|
+
box-sizing: border-box;
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
padding: 4px 0px 4px 8px;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.panel-header {
|
|
492
|
+
padding: 0 12px;
|
|
493
|
+
background: #fafafa;
|
|
494
|
+
border-bottom: 1px solid #E5E9F0;
|
|
495
|
+
display: flex;
|
|
496
|
+
align-items: center;
|
|
497
|
+
gap: 8px;
|
|
498
|
+
height: 37px;
|
|
499
|
+
box-sizing: border-box;
|
|
500
|
+
flex-shrink: 0;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.panel-title {
|
|
504
|
+
font-family: 'Source Han Sans', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
|
|
505
|
+
font-size: 16px;
|
|
506
|
+
font-weight: normal;
|
|
507
|
+
line-height: 37px;
|
|
508
|
+
letter-spacing: 0em;
|
|
509
|
+
font-feature-settings: "kern" on;
|
|
510
|
+
color: #313131;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.panel-count {
|
|
514
|
+
font-family: 'Source Han Sans', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
|
|
515
|
+
font-size: 16px;
|
|
516
|
+
font-weight: normal;
|
|
517
|
+
line-height: 37px;
|
|
518
|
+
letter-spacing: 0em;
|
|
519
|
+
font-feature-settings: "kern" on;
|
|
520
|
+
color: #313131;
|
|
521
|
+
background: #f0f0f0;
|
|
522
|
+
padding: 0 8px;
|
|
523
|
+
border-radius: 10px;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.panel-count.selected {
|
|
527
|
+
background: #1890ff;
|
|
528
|
+
color: #fff;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.hint {
|
|
532
|
+
font-family: 'Source Han Sans', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
|
|
533
|
+
font-size: 16px;
|
|
534
|
+
font-weight: normal;
|
|
535
|
+
line-height: 37px;
|
|
536
|
+
letter-spacing: 0em;
|
|
537
|
+
font-feature-settings: "kern" on;
|
|
538
|
+
color: #94979E;
|
|
539
|
+
width: 100%;
|
|
540
|
+
text-align: center;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.transfer-actions {
|
|
544
|
+
display: flex;
|
|
545
|
+
flex-direction: column;
|
|
546
|
+
gap: 3px;
|
|
547
|
+
align-items: center;
|
|
548
|
+
justify-content: center;
|
|
549
|
+
flex-shrink: 0;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.action-box {
|
|
553
|
+
width: 68px;
|
|
554
|
+
height: 78px;
|
|
555
|
+
border-radius: 6px;
|
|
556
|
+
opacity: 1;
|
|
557
|
+
background: #FFFFFF;
|
|
558
|
+
box-sizing: border-box;
|
|
559
|
+
border: 1px solid #E5E9F0;
|
|
560
|
+
display: flex;
|
|
561
|
+
align-items: center;
|
|
562
|
+
justify-content: center;
|
|
563
|
+
cursor: pointer;
|
|
564
|
+
margin: 3px 5px;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.action-box + .action-box {
|
|
568
|
+
margin-top: 0;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.action-text {
|
|
572
|
+
font-family: 'Source Han Sans', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
|
|
573
|
+
font-size: 16px;
|
|
574
|
+
font-weight: normal;
|
|
575
|
+
line-height: 1;
|
|
576
|
+
letter-spacing: 0em;
|
|
577
|
+
font-feature-settings: "kern" on;
|
|
578
|
+
color: #313131;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.action-arrow {
|
|
582
|
+
width: 9.51px;
|
|
583
|
+
height: 12.26px;
|
|
584
|
+
flex-shrink: 0;
|
|
585
|
+
display: flex;
|
|
586
|
+
align-items: center;
|
|
587
|
+
justify-content: center;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.action-arrow svg {
|
|
591
|
+
width: 100%;
|
|
592
|
+
height: 100%;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.action-arrow.left {
|
|
596
|
+
transform: rotate(180deg);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.action-box:hover {
|
|
600
|
+
opacity: 0.7;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.action-box.disabled {
|
|
604
|
+
opacity: 0.3;
|
|
605
|
+
cursor: not-allowed;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.panel-body {
|
|
609
|
+
padding: 0;
|
|
610
|
+
overflow-y: auto;
|
|
611
|
+
flex: 1;
|
|
612
|
+
min-height: 100%;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.group-section:last-child {
|
|
616
|
+
margin-bottom: 0;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.group-label-row {
|
|
620
|
+
display: flex;
|
|
621
|
+
align-items: center;
|
|
622
|
+
height: 37px;
|
|
623
|
+
line-height: 37px;
|
|
624
|
+
padding: 0 8px; /* 添加左右内边距 */
|
|
625
|
+
box-sizing: border-box;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.group-label {
|
|
629
|
+
font-family: 'Source Han Sans';
|
|
630
|
+
font-size: 16px;
|
|
631
|
+
font-weight: normal;
|
|
632
|
+
letter-spacing: 0em;
|
|
633
|
+
font-feature-settings: "kern" on;
|
|
634
|
+
color: #313131;
|
|
635
|
+
flex: 1;
|
|
636
|
+
overflow: hidden;
|
|
637
|
+
text-overflow: ellipsis;
|
|
638
|
+
white-space: nowrap;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.group-items {
|
|
642
|
+
overflow: hidden;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.item-row {
|
|
646
|
+
border-bottom: 1px solid #E5E9F0;
|
|
647
|
+
cursor: pointer;
|
|
648
|
+
display: flex;
|
|
649
|
+
align-items: center;
|
|
650
|
+
transition: background-color 0.15s;
|
|
651
|
+
user-select: none;
|
|
652
|
+
height: 23px;
|
|
653
|
+
line-height: 23px;
|
|
654
|
+
box-sizing: border-box;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.item-row-left {
|
|
658
|
+
padding-left: 12px;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.item-row:last-child {
|
|
662
|
+
border-bottom: none;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.item-row.selected {
|
|
666
|
+
color: #0057FE;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
.item-title {
|
|
670
|
+
font-family: 'Source Han Sans';
|
|
671
|
+
font-size: 16px;
|
|
672
|
+
font-weight: normal;
|
|
673
|
+
line-height: 37px;
|
|
674
|
+
letter-spacing: 0em;
|
|
675
|
+
font-feature-settings: "kern" on;
|
|
676
|
+
flex: 1;
|
|
677
|
+
color: #313131;
|
|
678
|
+
flex-shrink: 0;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.item-desc {
|
|
682
|
+
font-family: 'Source Han Sans';
|
|
683
|
+
font-size: 16px;
|
|
684
|
+
font-weight: normal;
|
|
685
|
+
line-height: 37px;
|
|
686
|
+
letter-spacing: 0em;
|
|
687
|
+
color: #94979E;
|
|
688
|
+
margin-left: 8px;
|
|
689
|
+
flex: 1;
|
|
690
|
+
overflow: hidden;
|
|
691
|
+
text-overflow: ellipsis;
|
|
692
|
+
white-space: nowrap;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
.item-icon {
|
|
696
|
+
font-size: 16px;
|
|
697
|
+
color: #94979E;
|
|
698
|
+
flex-shrink: 0;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.icon-left {
|
|
702
|
+
margin-right: 17px;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.icon-right {
|
|
706
|
+
margin-right: 9px;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.selected-item {
|
|
710
|
+
background: #fff;
|
|
711
|
+
border-color: #E5E9F0;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.selected-item:hover {
|
|
715
|
+
background: #f5f5f5 !important;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
*::-webkit-scrollbar {
|
|
719
|
+
width: 5px;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
*::-webkit-scrollbar-track {
|
|
723
|
+
background: transparent;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
*::-webkit-scrollbar-thumb {
|
|
727
|
+
background: #E5E5E5;
|
|
728
|
+
border-radius: 25px;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
732
|
+
background: #D0D0D0;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
* {
|
|
736
|
+
scrollbar-width: thin;
|
|
737
|
+
scrollbar-color: #E5E5E5 transparent;
|
|
738
|
+
}
|
|
739
|
+
</style>
|