centaline-data-driven-v3 0.1.59 → 0.1.60
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/dist/centaline-data-driven-v3.umd.js +118 -118
- package/package.json +1 -1
- package/src/components/app/FormList.vue +215 -19
- package/src/components/web/File.vue +21 -2
- package/src/components/web/Form.vue +236 -8
- package/src/components/web/SearchList/SearchTable.vue +21 -5
- package/src/components/web/SearchList/TableToolbar.vue +9 -5
- package/src/components/web/SearchList.vue +1 -1
- package/src/components/web/ViewerFile/ViewerImage.vue +1 -1
- package/src/components/web/ViewerFile.vue +63 -21
- package/src/components/web/dialog.vue +18 -7
- package/src/loader/src/File.js +38 -22
- package/src/loader/src/SearchTable.js +58 -17
- package/src/main.js +3 -3
- package/src/utils/useDraggable.js +100 -0
- package/src/views/SearchList.vue +2 -2
package/package.json
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
</template>
|
|
33
33
|
<template v-else>
|
|
34
|
-
<div v-if="model.
|
|
35
|
-
<h5>{{ model.
|
|
34
|
+
<div v-if="model.controlLabel" class="list-title">
|
|
35
|
+
<h5>{{ model.controlLabel }}</h5>
|
|
36
36
|
</div>
|
|
37
37
|
<div class="list-button">
|
|
38
38
|
<component v-if="model.selectRouter !== null" :is="model.selectRouter.is" size="small"
|
|
@@ -48,24 +48,34 @@
|
|
|
48
48
|
<thead ref="tableHead" class="right-no-fixation-th">
|
|
49
49
|
<tr class="ct-tr" ref="headTr">
|
|
50
50
|
<th class="ct-th th-edit"
|
|
51
|
-
v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0">
|
|
51
|
+
v-if="model.rows[0].edit || model.rows[0].delete || (model.buttons.length > 0 && model.buttonsShow.length > 0)">
|
|
52
52
|
<span>操作</span>
|
|
53
53
|
</th>
|
|
54
54
|
<template v-for="(column, i) in model.rows[0].field" :key="i">
|
|
55
|
-
<th v-if="column.show" class="ct-th" :
|
|
56
|
-
:colspan="column.colspan">
|
|
55
|
+
<th v-if="column.show" class="ct-th" :class="column.sortAction"
|
|
56
|
+
:rowspan="column.rowspan" :colspan="column.colspan">
|
|
57
57
|
<span>{{ column.controlLabel }}</span>
|
|
58
|
+
<span class="caret-wrapper" v-if="column.autoSearch"
|
|
59
|
+
@click="toSort($event, column)"
|
|
60
|
+
@contextmenu.prevent="clearSort($event, column)">
|
|
61
|
+
<i class="sort-caret ascending"
|
|
62
|
+
@click.left="toSort($event, column, 'asc')"
|
|
63
|
+
@contextmenu.prevent="clearSort($event, column)"></i>
|
|
64
|
+
<i class="sort-caret descending"
|
|
65
|
+
@click.left="toSort($event, column, 'desc')"
|
|
66
|
+
@contextmenu.prevent="clearSort($event, column)"></i>
|
|
67
|
+
</span>
|
|
58
68
|
</th>
|
|
59
69
|
</template>
|
|
60
70
|
</tr>
|
|
61
71
|
</thead>
|
|
62
72
|
<!--表体-->
|
|
63
73
|
<tbody>
|
|
64
|
-
<template v-if="
|
|
65
|
-
<tr v-for="(row, rowindex) in
|
|
66
|
-
|
|
74
|
+
<template v-if="renderList.length > 0">
|
|
75
|
+
<tr v-for="(row, rowindex) in renderList" :key="rowindex" :ref="'rows.' + rowindex"
|
|
76
|
+
class="ct-tr">
|
|
67
77
|
<template
|
|
68
|
-
v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0">
|
|
78
|
+
v-if="model.rows[0].edit || model.rows[0].delete || (model.buttons.length > 0 && model.buttonsShow.length > 0)">
|
|
69
79
|
<td class="ct-td td-edit" align="center" valign="middle">
|
|
70
80
|
<van-image v-if="row.edit || row.isSet"
|
|
71
81
|
style="cursor: pointer;margin-right: 5px;" width="20" height="20"
|
|
@@ -74,7 +84,7 @@
|
|
|
74
84
|
|
|
75
85
|
<van-image v-if="row.delete && !row.isSet"
|
|
76
86
|
style="cursor: pointer;margin-right: 5px;" width="20" height="20"
|
|
77
|
-
@click="deleteRow(
|
|
87
|
+
@click="deleteRow(row.$sourceIndex)"
|
|
78
88
|
:src="util.getAssetsImage('btn_del.png')" />
|
|
79
89
|
</td>
|
|
80
90
|
<template v-for="(b, vi) in model.buttons" :key="vi">
|
|
@@ -87,8 +97,14 @@
|
|
|
87
97
|
<template v-for="(column, i) in model.rows[0].field" :key="i">
|
|
88
98
|
<td v-if="column.show" class="ct-td" :rowspan="column.rowspan"
|
|
89
99
|
:colspan="column.colspan">
|
|
90
|
-
<
|
|
91
|
-
:
|
|
100
|
+
<span v-if="column.router" :class="'cell'" style="display: flex;">
|
|
101
|
+
<Tablecurrency :router="column.router"
|
|
102
|
+
:colValue="row[column.fieldName1].code1" :rowData="row"
|
|
103
|
+
@click="rolRouterClickHandler">
|
|
104
|
+
</Tablecurrency>
|
|
105
|
+
</span>
|
|
106
|
+
<ct-span v-else-if="row[column.fieldName1]"
|
|
107
|
+
:vmodel="row[column.fieldName1]" :rowData="row"></ct-span>
|
|
92
108
|
</td>
|
|
93
109
|
</template>
|
|
94
110
|
</tr>
|
|
@@ -96,7 +112,7 @@
|
|
|
96
112
|
<template v-else>
|
|
97
113
|
<tr class="ct-tr" ref="headTr">
|
|
98
114
|
<td class="ct-td" :colspan="colspansum" style="text-align: center;">
|
|
99
|
-
<span>
|
|
115
|
+
<span> {{ common.LocalizedString('暂无数据', '暫無數據') }}</span>
|
|
100
116
|
</td>
|
|
101
117
|
</tr>
|
|
102
118
|
</template>
|
|
@@ -135,6 +151,8 @@ import Enum from '../../utils/Enum'
|
|
|
135
151
|
import common from '../../utils/common'
|
|
136
152
|
import util from '../../utils/pub-use'
|
|
137
153
|
import draggable from "vuedraggable";
|
|
154
|
+
import Tablecurrency from './SearchList/Tablecurrency.vue';
|
|
155
|
+
|
|
138
156
|
const emit = defineEmits(['click', 'input', 'change', 'popupSearchList', 'tableButtonClick'])
|
|
139
157
|
const props = defineProps({
|
|
140
158
|
parameterAction: String,
|
|
@@ -149,6 +167,8 @@ const Fields = ref()
|
|
|
149
167
|
const colspansum = ref(0)
|
|
150
168
|
const sumsList = ref([])
|
|
151
169
|
const itemKey = ref(0)
|
|
170
|
+
const renderList = ref([])
|
|
171
|
+
const sortInfo = ref(null)
|
|
152
172
|
const dragOptions = {
|
|
153
173
|
animation: 200,
|
|
154
174
|
group: model.value.fieldName1,
|
|
@@ -167,7 +187,7 @@ function Init() {
|
|
|
167
187
|
model.value.validExcute = () => {
|
|
168
188
|
var rtn = fieldsValidExcute();
|
|
169
189
|
if (!rtn) {
|
|
170
|
-
model.value.displayValidMessage = common.LocalizedString('请填写','請填寫')+'[' + model.value.controlLabel + ']'
|
|
190
|
+
model.value.displayValidMessage = common.LocalizedString('请填写', '請填寫') + '[' + model.value.controlLabel + ']'
|
|
171
191
|
}
|
|
172
192
|
return fieldsValidExcute();
|
|
173
193
|
}
|
|
@@ -185,6 +205,26 @@ function Init() {
|
|
|
185
205
|
colspansum.value++;
|
|
186
206
|
}
|
|
187
207
|
}
|
|
208
|
+
refreshRenderList()
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
function refreshRenderList() {
|
|
212
|
+
// 拷贝一份全新数组,防止sort原地修改原始数据
|
|
213
|
+
const copyArr = [...model.value.tableData]
|
|
214
|
+
if (sortInfo.value) {
|
|
215
|
+
const { prop, order } = sortInfo.value
|
|
216
|
+
copyArr.sort((a, b) => {
|
|
217
|
+
const aValue = getLableShow(a[prop])
|
|
218
|
+
const bValue = getLableShow(b[prop])
|
|
219
|
+
if (typeof a === 'number') {
|
|
220
|
+
return order === 'asc' ? aValue - bValue : bValue - aValue
|
|
221
|
+
} else {
|
|
222
|
+
const res = aValue.localeCompare(bValue, 'zh-CN')
|
|
223
|
+
return order === 'asc' ? res : -res
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
renderList.value = copyArr
|
|
188
228
|
}
|
|
189
229
|
function popupSearchListHandle(field) {
|
|
190
230
|
if (field.isSearchPageWithList) {
|
|
@@ -204,18 +244,24 @@ function addRow() {
|
|
|
204
244
|
return
|
|
205
245
|
}
|
|
206
246
|
FormList.addRow(model.value);
|
|
247
|
+
refreshRenderList()
|
|
207
248
|
}
|
|
208
249
|
//修改
|
|
209
250
|
function editRow(index) {
|
|
210
251
|
FormList.editRow(index, model.value);
|
|
252
|
+
refreshRenderList()
|
|
211
253
|
}
|
|
212
254
|
//删除
|
|
213
|
-
function deleteRow(
|
|
255
|
+
function deleteRow(sourceIndex) {
|
|
214
256
|
FormList.deleteRow(sourceIndex, model.value, () => {
|
|
215
|
-
model.value.tableData.
|
|
257
|
+
const targetIndex = model.value.tableData.findIndex(v => v.$sourceIndex === sourceIndex)
|
|
258
|
+
if (targetIndex > -1) {
|
|
259
|
+
model.value.tableData.splice(targetIndex, 1)
|
|
260
|
+
}
|
|
216
261
|
model.value.onChanged = model.value.formListChange;
|
|
217
262
|
model.value.createText = '';
|
|
218
263
|
model.value.disabled = false;
|
|
264
|
+
refreshRenderList()
|
|
219
265
|
emit('change', model.value);
|
|
220
266
|
});
|
|
221
267
|
}
|
|
@@ -230,7 +276,7 @@ function fieldsValidExcute() {
|
|
|
230
276
|
if (model.value.form && model.value.form.fields) {
|
|
231
277
|
const currentIndex = model.value.form.fields.findIndex(v => v.fieldName1 === model.value.fieldName1);
|
|
232
278
|
if (currentIndex - 1 >= 0) {
|
|
233
|
-
if (model.value.form.fields[currentIndex - 1].controlType == Enum.ControlType.Group){
|
|
279
|
+
if (model.value.form.fields[currentIndex - 1].controlType == Enum.ControlType.Group) {
|
|
234
280
|
controlLabel = model.value.form.fields[currentIndex - 1].controlLabel;
|
|
235
281
|
}
|
|
236
282
|
}
|
|
@@ -284,11 +330,14 @@ function changeHandler(field, index) {
|
|
|
284
330
|
model.value.currentEventField = field;
|
|
285
331
|
emit('change', model.value);
|
|
286
332
|
}
|
|
333
|
+
function rolRouterClickHandler(field, rowData, rowindex) {
|
|
334
|
+
buttonClick(rowData, field);
|
|
335
|
+
}
|
|
287
336
|
|
|
288
337
|
function buttonClick(row, button) {
|
|
289
338
|
var submitData = {};
|
|
290
339
|
button.submitFormField.forEach((v) => {
|
|
291
|
-
submitData[v] =
|
|
340
|
+
submitData[v] = common.getDataOfUpperLower(row, v).code1;
|
|
292
341
|
});
|
|
293
342
|
model.value.currentRowIndex = model.value.source.rows.findIndex(v => v.$sourceIndex === row.$sourceIndex);
|
|
294
343
|
|
|
@@ -339,13 +388,18 @@ function getSummaries() {
|
|
|
339
388
|
function rolRouterCellClickHandler(routerKey, rowindex, sourceIndex) {
|
|
340
389
|
if (routerKey == 'edit') {
|
|
341
390
|
FormList.editRow(sourceIndex, model.value);
|
|
391
|
+
refreshRenderList()
|
|
342
392
|
}
|
|
343
393
|
else if (routerKey == 'delete') {
|
|
344
394
|
FormList.deleteRow(sourceIndex, model.value, () => {
|
|
345
|
-
model.value.tableData.
|
|
395
|
+
const targetIndex = model.value.tableData.findIndex(v => v.$sourceIndex === sourceIndex)
|
|
396
|
+
if (targetIndex > -1) {
|
|
397
|
+
model.value.tableData.splice(targetIndex, 1)
|
|
398
|
+
}
|
|
346
399
|
model.value.onChanged = model.value.formListChange;
|
|
347
400
|
model.value.createText = '';
|
|
348
401
|
model.value.disabled = false;
|
|
402
|
+
refreshRenderList()
|
|
349
403
|
emit('change', model.value);
|
|
350
404
|
});
|
|
351
405
|
} else {
|
|
@@ -401,6 +455,107 @@ function delRow(row) {
|
|
|
401
455
|
function deleteAll() {
|
|
402
456
|
FormList.deleteAll(model.value);
|
|
403
457
|
}
|
|
458
|
+
function toSort(ev, col, action) {
|
|
459
|
+
model.value.rows[0].field.forEach((v1) => {
|
|
460
|
+
v1.sortAction = "";
|
|
461
|
+
});
|
|
462
|
+
if (sortInfo.value && sortInfo.value.prop == col.fieldName1 && sortInfo.value.order == action) {
|
|
463
|
+
sortInfo.value = null
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
sortInfo.value = {
|
|
467
|
+
prop: col.fieldName1,
|
|
468
|
+
order: action
|
|
469
|
+
}
|
|
470
|
+
col.sortAction = action;
|
|
471
|
+
}
|
|
472
|
+
refreshRenderList()
|
|
473
|
+
ev.cancelBubble = true;
|
|
474
|
+
ev.stopPropagation();
|
|
475
|
+
}
|
|
476
|
+
function getLableShow(data) {
|
|
477
|
+
let labelShow = data.name1;
|
|
478
|
+
if (!labelShow) {
|
|
479
|
+
labelShow = data.code1;
|
|
480
|
+
}
|
|
481
|
+
if (labelShow && data.unitName1) {
|
|
482
|
+
labelShow = labelShow + data.unitName1;
|
|
483
|
+
}
|
|
484
|
+
switch (data.controlType) {
|
|
485
|
+
case Enum.ControlType.Label:
|
|
486
|
+
if (data.value) {
|
|
487
|
+
labelShow = data.value;
|
|
488
|
+
}
|
|
489
|
+
break;
|
|
490
|
+
case Enum.ControlType.MultiSelectNoSearch:
|
|
491
|
+
case Enum.ControlType.MultiSelectWithSearch:
|
|
492
|
+
labelShow = '';
|
|
493
|
+
if (data.code1) {
|
|
494
|
+
JSON.parse(data.code1).forEach((op) => {
|
|
495
|
+
if (op.flagDeleted !== 1) {
|
|
496
|
+
if (op.flagDeleted != undefined && op.flagDeleted == true) {
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
labelShow += op['name'] + ' ';
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
break;
|
|
505
|
+
case Enum.ControlType.PhoneNumberText:
|
|
506
|
+
case Enum.ControlType.EmailText:
|
|
507
|
+
if (data.code2) {
|
|
508
|
+
labelShow = data.name1 + data.code2;
|
|
509
|
+
}
|
|
510
|
+
break;
|
|
511
|
+
case Enum.ControlType.NumericRange:
|
|
512
|
+
if (data.code1 && data.code2) {
|
|
513
|
+
}
|
|
514
|
+
else if (data.code1) {
|
|
515
|
+
labelShow = data.code1 + (data.unitName1 ? data.unitName1 : '') + '以上';
|
|
516
|
+
}
|
|
517
|
+
else if (data.code2) {
|
|
518
|
+
labelShow = data.code2 + (data.unitName1 ? data.unitName1 : '') + '以下';
|
|
519
|
+
}
|
|
520
|
+
break;
|
|
521
|
+
case Enum.ControlType.DateTimeRange:
|
|
522
|
+
case Enum.ControlType.DateRange:
|
|
523
|
+
if (data.code1 && data.code2) {
|
|
524
|
+
}
|
|
525
|
+
else if (data.code1) {
|
|
526
|
+
labelShow = data.code1 + (data.unitName1 ? data.unitName1 : '') + '以后';
|
|
527
|
+
}
|
|
528
|
+
else if (data.code2) {
|
|
529
|
+
labelShow = data.code2 + (data.unitName1 ? data.unitName1 : '') + '以前';
|
|
530
|
+
}
|
|
531
|
+
break;
|
|
532
|
+
case Enum.ControlType.Time:
|
|
533
|
+
case Enum.ControlType.TimeRange:
|
|
534
|
+
if (data.flagrange) {
|
|
535
|
+
if (data.code1 && data.code2) {
|
|
536
|
+
labelShow = data.code1 + '-' + data.code2;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
if (data.code1) {
|
|
541
|
+
labelShow = data.code1
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
break;
|
|
545
|
+
case Enum.ControlType.CheckBoxList:
|
|
546
|
+
labelShow = data.getCheckedName();;
|
|
547
|
+
break;
|
|
548
|
+
case Enum.ControlType.Switch:
|
|
549
|
+
labelShow = data.value ? '开启' : '关闭';
|
|
550
|
+
break;
|
|
551
|
+
case Enum.ControlType.CheckBox:
|
|
552
|
+
labelShow = data.value ? '是' : '否';
|
|
553
|
+
break;
|
|
554
|
+
default:
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
return labelShow;
|
|
558
|
+
}
|
|
404
559
|
defineExpose({
|
|
405
560
|
model
|
|
406
561
|
})
|
|
@@ -483,4 +638,45 @@ th.th-edit {
|
|
|
483
638
|
z-index: 1;
|
|
484
639
|
background-color: #ffffff;
|
|
485
640
|
}
|
|
641
|
+
|
|
642
|
+
.ct-th>.caret-wrapper {
|
|
643
|
+
display: inline-flex;
|
|
644
|
+
flex-direction: column;
|
|
645
|
+
align-items: center;
|
|
646
|
+
height: 34px;
|
|
647
|
+
width: 10px;
|
|
648
|
+
vertical-align: middle;
|
|
649
|
+
cursor: pointer;
|
|
650
|
+
overflow: initial;
|
|
651
|
+
position: relative;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.ct-th>.caret-wrapper>.sort-caret {
|
|
655
|
+
width: 0;
|
|
656
|
+
height: 0;
|
|
657
|
+
border: 5px solid transparent;
|
|
658
|
+
position: absolute;
|
|
659
|
+
left: 7px;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.ct-th>.caret-wrapper>.sort-caret.ascending {
|
|
663
|
+
border-bottom-color: var(--centalinePlaceholder);
|
|
664
|
+
top: 5px;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.ct-th>.caret-wrapper>.sort-caret.descending {
|
|
668
|
+
border-top-color: var(--centalinePlaceholder);
|
|
669
|
+
bottom: 7px;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
.ct-th.asc>.caret-wrapper>.sort-caret.ascending {
|
|
674
|
+
border-bottom-color: #409eff;
|
|
675
|
+
top: 5px;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.ct-th.desc>.caret-wrapper>.sort-caret.descending {
|
|
679
|
+
border-top-color: #409eff;
|
|
680
|
+
bottom: 7px;
|
|
681
|
+
}
|
|
486
682
|
</style>
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
</template>
|
|
167
167
|
</template>
|
|
168
168
|
<script setup lang="ts">
|
|
169
|
-
import { ref, nextTick, computed, onBeforeUnmount } from 'vue'
|
|
169
|
+
import { ref, nextTick, computed, onBeforeUnmount,inject ,watch } from 'vue'
|
|
170
170
|
import { ElMessage, UploadProps } from 'element-plus'
|
|
171
171
|
import common from '../../utils/common'
|
|
172
172
|
import { changeHandler } from '../../utils/mixins';
|
|
@@ -623,12 +623,31 @@ function addClass(el, className) {
|
|
|
623
623
|
newClassName.push(className);
|
|
624
624
|
el.className = newClassName.join(" ");
|
|
625
625
|
}
|
|
626
|
+
const injectedViewerFileToggle = inject('onViewerFileToggle')
|
|
626
627
|
|
|
627
628
|
|
|
628
629
|
//预览文件
|
|
629
630
|
function viewerfile(file) {
|
|
630
|
-
|
|
631
|
+
|
|
632
|
+
File.viewerfile(file, model.value, function (MediaAlbum, groupIndex, index) {
|
|
633
|
+
injectedViewerFileToggle(true, MediaAlbum, groupIndex, index);
|
|
634
|
+
})
|
|
631
635
|
}
|
|
636
|
+
const ChangeFileList = inject('ChangeFileList')
|
|
637
|
+
|
|
638
|
+
watch(
|
|
639
|
+
() => model.value?.fileList, // 直接监听 fileList 数组
|
|
640
|
+
(newFileList) => {
|
|
641
|
+
nextTick(() => {
|
|
642
|
+
if (model.value?.mediaViewPageType === 3) {
|
|
643
|
+
const { album } = File.buildMediaAlbum(model.value);
|
|
644
|
+
const MediaAlbum = [album];
|
|
645
|
+
ChangeFileList(MediaAlbum, 0, 0);
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
},
|
|
649
|
+
{ deep: true } // 深度监听,以便捕获数组内元素属性变化(与原 JSON.stringify 效果一致)
|
|
650
|
+
);
|
|
632
651
|
|
|
633
652
|
function PasteUpload(event) {
|
|
634
653
|
if (!model.value.locked && !model.value.disableUpload) {
|