el-plus-crud 0.1.13 → 0.1.14
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/.eslintignore +18 -18
- package/.eslintrc.js +78 -78
- package/.lintstagedrc +3 -3
- package/.prettierrc.js +39 -39
- package/CHANGELOG.md +261 -259
- package/LICENSE +21 -21
- package/README.md +19 -19
- package/build.js +31 -31
- package/dist/el-plus-crud.mjs +1952 -1952
- package/example/App.vue +252 -252
- package/example/main.js +18 -18
- package/example/style.css +4 -4
- package/index.html +13 -13
- package/lib/components/el-plus-form/ElPlusForm.vue +4 -7
- package/lib/components/el-plus-form/ElPlusFormDialog.vue +93 -93
- package/lib/components/el-plus-form/ElPlusFormGroup.vue +201 -201
- package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +65 -65
- package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +72 -72
- package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +81 -81
- package/lib/components/el-plus-form/components/ElPlusFormImage.vue +115 -115
- package/lib/components/el-plus-form/components/ElPlusFormLink.vue +285 -285
- package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +98 -98
- package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +69 -69
- package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +185 -185
- package/lib/components/el-plus-form/components/ElPlusFormStatus.vue +102 -102
- package/lib/components/el-plus-form/components/ElPlusFormText.vue +113 -113
- package/lib/components/el-plus-form/components/ElPlusFormTree.vue +79 -79
- package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +62 -62
- package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
- package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
- package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
- package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
- package/lib/components/el-plus-form/components/index.ts +17 -17
- package/lib/components/el-plus-form/data/file.ts +74 -74
- package/lib/components/el-plus-form/util/validate.ts +346 -346
- package/lib/components/el-plus-table/ElPlusTable.vue +972 -972
- package/lib/components/el-plus-table/components/columnItem.vue +220 -220
- package/lib/components/el-plus-table/components/header.vue +345 -345
- package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
- package/lib/index.d.ts +4 -4
- package/lib/util/index.ts +390 -390
- package/package.json +70 -70
- package/tsconfig.json +78 -78
- package/types/global.d.ts +13 -13
- package/types/index.d.ts +561 -561
- package/vite.config.ts +78 -78
|
@@ -1,285 +1,285 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-plus-form-link">
|
|
3
|
-
<el-select ref="selectRef" style="width: 100%" :class="desc.class" :style="desc.style" v-bind="topAttrs" :disabled="disabled || desc.disabled" :teleported="false" :loading="loading" :modelValue="values" @visible-change="handelVisibleChange" @clear="handelClear" v-on="onEvents">
|
|
4
|
-
<el-option v-for="option in options" :key="option.value" v-bind="option" />
|
|
5
|
-
</el-select>
|
|
6
|
-
<!-- 弹框 -->
|
|
7
|
-
<el-dialog :width="desc.dialogWidth || '1000px'" :title="desc.title || desc.placeholder || '请选择' + desc.label" draggable :closeOnClickModal="false" showCancel v-model="isShowDialog" append-to-body destroy-on-close>
|
|
8
|
-
<div style="width: 100%" class="form-link-dialog">
|
|
9
|
-
<div class="panel-left">
|
|
10
|
-
<!-- 左侧列表 -->
|
|
11
|
-
<ElPlusTable v-if="tableConfig" ref="multipleTableRef" :selectList="selectList" :tableConfig="tableConfig" :type="multiple ? 'selection' : 'index'" :isIndex="false" :rowKey="vkey" @selection="handelTableSelection" />
|
|
12
|
-
</div>
|
|
13
|
-
<div v-if="multiple" class="panel-right">
|
|
14
|
-
<div class="right-title">已选中项:</div>
|
|
15
|
-
<el-scrollbar height="480px" class="tag-list">
|
|
16
|
-
<el-tag class="tag-item" style="margin-right: 10px; margin-bottom: 10px" v-for="tag in selectData" :key="tag.value" closable @close="() => handelTagRemove(tag)">
|
|
17
|
-
{{ tag.label }}
|
|
18
|
-
</el-tag>
|
|
19
|
-
</el-scrollbar>
|
|
20
|
-
<div class="btn-panel">
|
|
21
|
-
<el-button @click="cancel">取消</el-button>
|
|
22
|
-
<el-button type="primary" @click="submit">确定</el-button>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</el-dialog>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
<script lang="ts">
|
|
30
|
-
export default {
|
|
31
|
-
name: 'ElPlusFormLink',
|
|
32
|
-
inheritAttrs: false,
|
|
33
|
-
typeName: 'link',
|
|
34
|
-
customOptions: {}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
37
|
-
<script lang="ts" setup>
|
|
38
|
-
import { cloneDeep } from 'lodash'
|
|
39
|
-
import { ref, reactive, watch, onMounted, computed } from 'vue'
|
|
40
|
-
import { IBtnBack, ITableConfig } from '../../../../types'
|
|
41
|
-
|
|
42
|
-
interface ILinkItem {
|
|
43
|
-
label: string
|
|
44
|
-
value: string
|
|
45
|
-
dataItem: { [key: string]: any }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const props = defineProps<{
|
|
49
|
-
modelValue?: []
|
|
50
|
-
field?: string
|
|
51
|
-
loading?: boolean
|
|
52
|
-
desc: { [key: string]: any }
|
|
53
|
-
formData?: { [key: string]: any }
|
|
54
|
-
disabled?: boolean
|
|
55
|
-
}>()
|
|
56
|
-
|
|
57
|
-
const onEvents = ref(props.desc?.on || {})
|
|
58
|
-
|
|
59
|
-
const emits = defineEmits(['update:modelValue', 'change', 'input', 'validateThis'])
|
|
60
|
-
|
|
61
|
-
const currentValue = ref(props.modelValue as any[])
|
|
62
|
-
emits('update:modelValue', currentValue)
|
|
63
|
-
|
|
64
|
-
// 顶部的select
|
|
65
|
-
const selectRef = ref()
|
|
66
|
-
const values = reactive([] as any[])
|
|
67
|
-
const options = reactive([] as any[])
|
|
68
|
-
const selectList = ref([] as any[])
|
|
69
|
-
|
|
70
|
-
const topAttrs = reactive({
|
|
71
|
-
multiple: true,
|
|
72
|
-
size: props.desc.size,
|
|
73
|
-
collapseTags: true,
|
|
74
|
-
collapseTagsTooltip: true,
|
|
75
|
-
clearable: true,
|
|
76
|
-
placeholder: props.desc.placeholder || '请选择' + props.desc.label
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
// 显示弹框
|
|
80
|
-
const isShowDialog = ref(false)
|
|
81
|
-
const tableConfig = ref({} as any)
|
|
82
|
-
const vkey = computed(() => (props.desc.vkey as string) || 'id')
|
|
83
|
-
|
|
84
|
-
const multiple = ref(false)
|
|
85
|
-
|
|
86
|
-
const multipleTableRef = ref()
|
|
87
|
-
|
|
88
|
-
// 存储的值
|
|
89
|
-
const selectData = reactive([] as ILinkItem[])
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 处理点击事件
|
|
93
|
-
* @param val
|
|
94
|
-
*/
|
|
95
|
-
function handelVisibleChange(val: any) {
|
|
96
|
-
if (val) {
|
|
97
|
-
selectRef.value.blur()
|
|
98
|
-
isShowDialog.value = true
|
|
99
|
-
selectList.value = cloneDeep(selectData.map((item) => item.dataItem))
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* 处理清空选项
|
|
105
|
-
*/
|
|
106
|
-
function handelClear() {
|
|
107
|
-
selectData.splice(0, selectData.length)
|
|
108
|
-
submit()
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* 处理列表批量选中
|
|
113
|
-
* @param selection
|
|
114
|
-
*/
|
|
115
|
-
function handelTableSelection(selection: any[]) {
|
|
116
|
-
// 这里全是新增
|
|
117
|
-
selectData.splice(0, selectData.length)
|
|
118
|
-
selection.map((row) => {
|
|
119
|
-
selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 处理表格操作列单个选中
|
|
125
|
-
* @param btnBack
|
|
126
|
-
*/
|
|
127
|
-
function handelSignleSelect({ row }: IBtnBack) {
|
|
128
|
-
selectData.splice(0, selectData.length)
|
|
129
|
-
selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
|
|
130
|
-
// 直接关闭
|
|
131
|
-
submit()
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* 处理删除标签
|
|
136
|
-
* @param item
|
|
137
|
-
*/
|
|
138
|
-
function handelTagRemove(item: ILinkItem) {
|
|
139
|
-
selectData.splice(
|
|
140
|
-
selectData.findIndex((i) => i.value === item.value),
|
|
141
|
-
1
|
|
142
|
-
)
|
|
143
|
-
// 通知table刷新
|
|
144
|
-
multipleTableRef.value.changeSelect([{ [vkey.value]: item.value }])
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 取消按钮
|
|
149
|
-
*/
|
|
150
|
-
function cancel() {
|
|
151
|
-
isShowDialog.value = false
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* 确认按钮
|
|
156
|
-
*/
|
|
157
|
-
function submit() {
|
|
158
|
-
options.splice(0, options.length, ...selectData)
|
|
159
|
-
const tempIds = [] as string[]
|
|
160
|
-
const tempNames = [] as string[]
|
|
161
|
-
values.splice(0, values.length)
|
|
162
|
-
|
|
163
|
-
// 遍历数据
|
|
164
|
-
selectData.map((item) => {
|
|
165
|
-
values.push(item.value)
|
|
166
|
-
tempIds.push(item.value)
|
|
167
|
-
tempNames.push(item.label)
|
|
168
|
-
})
|
|
169
|
-
// 设置值
|
|
170
|
-
currentValue.value = selectData.length > 0 ? [tempIds, tempNames] : []
|
|
171
|
-
|
|
172
|
-
// 触发外部change事件
|
|
173
|
-
if (onEvents.value.change) {
|
|
174
|
-
onEvents.value.change(cloneDeep(selectData))
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
isShowDialog.value = false
|
|
178
|
-
emits('validateThis')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// 表格配置
|
|
182
|
-
watch(
|
|
183
|
-
() => props.desc.tableConfig,
|
|
184
|
-
(val) => {
|
|
185
|
-
let tempConfig = {} as ITableConfig
|
|
186
|
-
if (val) {
|
|
187
|
-
tempConfig = cloneDeep(val)
|
|
188
|
-
if (typeof props.desc.multiple === 'function') {
|
|
189
|
-
multiple.value = props.desc.multiple(props.formData || {})
|
|
190
|
-
} else {
|
|
191
|
-
multiple.value = props.desc.multiple
|
|
192
|
-
}
|
|
193
|
-
// 如果是多选
|
|
194
|
-
if (multiple.value) {
|
|
195
|
-
// TODO
|
|
196
|
-
} else if (!multiple.value && tempConfig.column && tempConfig.column[tempConfig.column.length - 1].label !== '操作') {
|
|
197
|
-
// 如果是单选
|
|
198
|
-
tempConfig.column.push({ label: '操作', width: '120px', fixed: 'right', type: 'btns', btns: [{ label: '选中', on: { click: handelSignleSelect } }] })
|
|
199
|
-
}
|
|
200
|
-
tempConfig.maxHeight = 400
|
|
201
|
-
}
|
|
202
|
-
tableConfig.value = tempConfig
|
|
203
|
-
},
|
|
204
|
-
{ deep: true, immediate: true }
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
onMounted(async () => {})
|
|
208
|
-
</script>
|
|
209
|
-
<style lang="scss" scoped>
|
|
210
|
-
.el-plus-form-link {
|
|
211
|
-
width: 100%;
|
|
212
|
-
|
|
213
|
-
.items-panel {
|
|
214
|
-
:deep(.el-input__inner) {
|
|
215
|
-
cursor: pointer;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:deep(.el-tag__close) {
|
|
220
|
-
display: none !important;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
</style>
|
|
224
|
-
<style lang="scss">
|
|
225
|
-
.form-link-dialog {
|
|
226
|
-
width: 100%;
|
|
227
|
-
display: flex;
|
|
228
|
-
box-sizing: border-box;
|
|
229
|
-
|
|
230
|
-
.panel-left {
|
|
231
|
-
// flex: 1;
|
|
232
|
-
min-width: 60%;
|
|
233
|
-
// height: 500px;
|
|
234
|
-
display: flex;
|
|
235
|
-
flex-direction: column;
|
|
236
|
-
|
|
237
|
-
.dept-breadcrumb {
|
|
238
|
-
width: 100%;
|
|
239
|
-
padding: 0 10px;
|
|
240
|
-
margin-bottom: 20px;
|
|
241
|
-
cursor: pointer;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.panel-right {
|
|
246
|
-
min-width: 40%;
|
|
247
|
-
max-width: 40%;
|
|
248
|
-
margin-left: 20px;
|
|
249
|
-
border-left: 1px var(--el-border-color) var(--el-border-style);
|
|
250
|
-
padding: 20px;
|
|
251
|
-
display: flex;
|
|
252
|
-
overflow: hidden;
|
|
253
|
-
flex-direction: column;
|
|
254
|
-
|
|
255
|
-
.right-title {
|
|
256
|
-
width: 100%;
|
|
257
|
-
font-size: 14px;
|
|
258
|
-
color: #999999;
|
|
259
|
-
margin-bottom: 20px;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.tag-list {
|
|
263
|
-
width: 100%;
|
|
264
|
-
height: 400px;
|
|
265
|
-
overflow: hidden;
|
|
266
|
-
.tag-item {
|
|
267
|
-
.el-tag__content {
|
|
268
|
-
max-width: 100px;
|
|
269
|
-
text-overflow: ellipsis;
|
|
270
|
-
overflow: hidden;
|
|
271
|
-
white-space: nowrap;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.btn-panel {
|
|
277
|
-
width: 100%;
|
|
278
|
-
min-height: 50px;
|
|
279
|
-
padding-top: 10px;
|
|
280
|
-
display: flex;
|
|
281
|
-
justify-content: center;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-plus-form-link">
|
|
3
|
+
<el-select ref="selectRef" style="width: 100%" :class="desc.class" :style="desc.style" v-bind="topAttrs" :disabled="disabled || desc.disabled" :teleported="false" :loading="loading" :modelValue="values" @visible-change="handelVisibleChange" @clear="handelClear" v-on="onEvents">
|
|
4
|
+
<el-option v-for="option in options" :key="option.value" v-bind="option" />
|
|
5
|
+
</el-select>
|
|
6
|
+
<!-- 弹框 -->
|
|
7
|
+
<el-dialog :width="desc.dialogWidth || '1000px'" :title="desc.title || desc.placeholder || '请选择' + desc.label" draggable :closeOnClickModal="false" showCancel v-model="isShowDialog" append-to-body destroy-on-close>
|
|
8
|
+
<div style="width: 100%" class="form-link-dialog">
|
|
9
|
+
<div class="panel-left">
|
|
10
|
+
<!-- 左侧列表 -->
|
|
11
|
+
<ElPlusTable v-if="tableConfig" ref="multipleTableRef" :selectList="selectList" :tableConfig="tableConfig" :type="multiple ? 'selection' : 'index'" :isIndex="false" :rowKey="vkey" @selection="handelTableSelection" />
|
|
12
|
+
</div>
|
|
13
|
+
<div v-if="multiple" class="panel-right">
|
|
14
|
+
<div class="right-title">已选中项:</div>
|
|
15
|
+
<el-scrollbar height="480px" class="tag-list">
|
|
16
|
+
<el-tag class="tag-item" style="margin-right: 10px; margin-bottom: 10px" v-for="tag in selectData" :key="tag.value" closable @close="() => handelTagRemove(tag)">
|
|
17
|
+
{{ tag.label }}
|
|
18
|
+
</el-tag>
|
|
19
|
+
</el-scrollbar>
|
|
20
|
+
<div class="btn-panel">
|
|
21
|
+
<el-button @click="cancel">取消</el-button>
|
|
22
|
+
<el-button type="primary" @click="submit">确定</el-button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</el-dialog>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
export default {
|
|
31
|
+
name: 'ElPlusFormLink',
|
|
32
|
+
inheritAttrs: false,
|
|
33
|
+
typeName: 'link',
|
|
34
|
+
customOptions: {}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
<script lang="ts" setup>
|
|
38
|
+
import { cloneDeep } from 'lodash'
|
|
39
|
+
import { ref, reactive, watch, onMounted, computed } from 'vue'
|
|
40
|
+
import { IBtnBack, ITableConfig } from '../../../../types'
|
|
41
|
+
|
|
42
|
+
interface ILinkItem {
|
|
43
|
+
label: string
|
|
44
|
+
value: string
|
|
45
|
+
dataItem: { [key: string]: any }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const props = defineProps<{
|
|
49
|
+
modelValue?: []
|
|
50
|
+
field?: string
|
|
51
|
+
loading?: boolean
|
|
52
|
+
desc: { [key: string]: any }
|
|
53
|
+
formData?: { [key: string]: any }
|
|
54
|
+
disabled?: boolean
|
|
55
|
+
}>()
|
|
56
|
+
|
|
57
|
+
const onEvents = ref(props.desc?.on || {})
|
|
58
|
+
|
|
59
|
+
const emits = defineEmits(['update:modelValue', 'change', 'input', 'validateThis'])
|
|
60
|
+
|
|
61
|
+
const currentValue = ref(props.modelValue as any[])
|
|
62
|
+
emits('update:modelValue', currentValue)
|
|
63
|
+
|
|
64
|
+
// 顶部的select
|
|
65
|
+
const selectRef = ref()
|
|
66
|
+
const values = reactive([] as any[])
|
|
67
|
+
const options = reactive([] as any[])
|
|
68
|
+
const selectList = ref([] as any[])
|
|
69
|
+
|
|
70
|
+
const topAttrs = reactive({
|
|
71
|
+
multiple: true,
|
|
72
|
+
size: props.desc.size,
|
|
73
|
+
collapseTags: true,
|
|
74
|
+
collapseTagsTooltip: true,
|
|
75
|
+
clearable: true,
|
|
76
|
+
placeholder: props.desc.placeholder || '请选择' + props.desc.label
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// 显示弹框
|
|
80
|
+
const isShowDialog = ref(false)
|
|
81
|
+
const tableConfig = ref({} as any)
|
|
82
|
+
const vkey = computed(() => (props.desc.vkey as string) || 'id')
|
|
83
|
+
|
|
84
|
+
const multiple = ref(false)
|
|
85
|
+
|
|
86
|
+
const multipleTableRef = ref()
|
|
87
|
+
|
|
88
|
+
// 存储的值
|
|
89
|
+
const selectData = reactive([] as ILinkItem[])
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 处理点击事件
|
|
93
|
+
* @param val
|
|
94
|
+
*/
|
|
95
|
+
function handelVisibleChange(val: any) {
|
|
96
|
+
if (val) {
|
|
97
|
+
selectRef.value.blur()
|
|
98
|
+
isShowDialog.value = true
|
|
99
|
+
selectList.value = cloneDeep(selectData.map((item) => item.dataItem))
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 处理清空选项
|
|
105
|
+
*/
|
|
106
|
+
function handelClear() {
|
|
107
|
+
selectData.splice(0, selectData.length)
|
|
108
|
+
submit()
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 处理列表批量选中
|
|
113
|
+
* @param selection
|
|
114
|
+
*/
|
|
115
|
+
function handelTableSelection(selection: any[]) {
|
|
116
|
+
// 这里全是新增
|
|
117
|
+
selectData.splice(0, selectData.length)
|
|
118
|
+
selection.map((row) => {
|
|
119
|
+
selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 处理表格操作列单个选中
|
|
125
|
+
* @param btnBack
|
|
126
|
+
*/
|
|
127
|
+
function handelSignleSelect({ row }: IBtnBack) {
|
|
128
|
+
selectData.splice(0, selectData.length)
|
|
129
|
+
selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
|
|
130
|
+
// 直接关闭
|
|
131
|
+
submit()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 处理删除标签
|
|
136
|
+
* @param item
|
|
137
|
+
*/
|
|
138
|
+
function handelTagRemove(item: ILinkItem) {
|
|
139
|
+
selectData.splice(
|
|
140
|
+
selectData.findIndex((i) => i.value === item.value),
|
|
141
|
+
1
|
|
142
|
+
)
|
|
143
|
+
// 通知table刷新
|
|
144
|
+
multipleTableRef.value.changeSelect([{ [vkey.value]: item.value }])
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 取消按钮
|
|
149
|
+
*/
|
|
150
|
+
function cancel() {
|
|
151
|
+
isShowDialog.value = false
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 确认按钮
|
|
156
|
+
*/
|
|
157
|
+
function submit() {
|
|
158
|
+
options.splice(0, options.length, ...selectData)
|
|
159
|
+
const tempIds = [] as string[]
|
|
160
|
+
const tempNames = [] as string[]
|
|
161
|
+
values.splice(0, values.length)
|
|
162
|
+
|
|
163
|
+
// 遍历数据
|
|
164
|
+
selectData.map((item) => {
|
|
165
|
+
values.push(item.value)
|
|
166
|
+
tempIds.push(item.value)
|
|
167
|
+
tempNames.push(item.label)
|
|
168
|
+
})
|
|
169
|
+
// 设置值
|
|
170
|
+
currentValue.value = selectData.length > 0 ? [tempIds, tempNames] : []
|
|
171
|
+
|
|
172
|
+
// 触发外部change事件
|
|
173
|
+
if (onEvents.value.change) {
|
|
174
|
+
onEvents.value.change(cloneDeep(selectData))
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
isShowDialog.value = false
|
|
178
|
+
emits('validateThis')
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 表格配置
|
|
182
|
+
watch(
|
|
183
|
+
() => props.desc.tableConfig,
|
|
184
|
+
(val) => {
|
|
185
|
+
let tempConfig = {} as ITableConfig
|
|
186
|
+
if (val) {
|
|
187
|
+
tempConfig = cloneDeep(val)
|
|
188
|
+
if (typeof props.desc.multiple === 'function') {
|
|
189
|
+
multiple.value = props.desc.multiple(props.formData || {})
|
|
190
|
+
} else {
|
|
191
|
+
multiple.value = props.desc.multiple
|
|
192
|
+
}
|
|
193
|
+
// 如果是多选
|
|
194
|
+
if (multiple.value) {
|
|
195
|
+
// TODO
|
|
196
|
+
} else if (!multiple.value && tempConfig.column && tempConfig.column[tempConfig.column.length - 1].label !== '操作') {
|
|
197
|
+
// 如果是单选
|
|
198
|
+
tempConfig.column.push({ label: '操作', width: '120px', fixed: 'right', type: 'btns', btns: [{ label: '选中', on: { click: handelSignleSelect } }] })
|
|
199
|
+
}
|
|
200
|
+
tempConfig.maxHeight = 400
|
|
201
|
+
}
|
|
202
|
+
tableConfig.value = tempConfig
|
|
203
|
+
},
|
|
204
|
+
{ deep: true, immediate: true }
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
onMounted(async () => {})
|
|
208
|
+
</script>
|
|
209
|
+
<style lang="scss" scoped>
|
|
210
|
+
.el-plus-form-link {
|
|
211
|
+
width: 100%;
|
|
212
|
+
|
|
213
|
+
.items-panel {
|
|
214
|
+
:deep(.el-input__inner) {
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:deep(.el-tag__close) {
|
|
220
|
+
display: none !important;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
224
|
+
<style lang="scss">
|
|
225
|
+
.form-link-dialog {
|
|
226
|
+
width: 100%;
|
|
227
|
+
display: flex;
|
|
228
|
+
box-sizing: border-box;
|
|
229
|
+
|
|
230
|
+
.panel-left {
|
|
231
|
+
// flex: 1;
|
|
232
|
+
min-width: 60%;
|
|
233
|
+
// height: 500px;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
|
|
237
|
+
.dept-breadcrumb {
|
|
238
|
+
width: 100%;
|
|
239
|
+
padding: 0 10px;
|
|
240
|
+
margin-bottom: 20px;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.panel-right {
|
|
246
|
+
min-width: 40%;
|
|
247
|
+
max-width: 40%;
|
|
248
|
+
margin-left: 20px;
|
|
249
|
+
border-left: 1px var(--el-border-color) var(--el-border-style);
|
|
250
|
+
padding: 20px;
|
|
251
|
+
display: flex;
|
|
252
|
+
overflow: hidden;
|
|
253
|
+
flex-direction: column;
|
|
254
|
+
|
|
255
|
+
.right-title {
|
|
256
|
+
width: 100%;
|
|
257
|
+
font-size: 14px;
|
|
258
|
+
color: #999999;
|
|
259
|
+
margin-bottom: 20px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.tag-list {
|
|
263
|
+
width: 100%;
|
|
264
|
+
height: 400px;
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
.tag-item {
|
|
267
|
+
.el-tag__content {
|
|
268
|
+
max-width: 100px;
|
|
269
|
+
text-overflow: ellipsis;
|
|
270
|
+
overflow: hidden;
|
|
271
|
+
white-space: nowrap;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.btn-panel {
|
|
277
|
+
width: 100%;
|
|
278
|
+
min-height: 50px;
|
|
279
|
+
padding-top: 10px;
|
|
280
|
+
display: flex;
|
|
281
|
+
justify-content: center;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</style>
|