n20-common-lib 2.22.42 → 2.22.44
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
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
{{ item.appOrPc === '1' ? 'PC端审批' : item.appOrPc === '2' ? '外部系统审批' : 'App端审批' | $lc }}
|
|
80
80
|
</span>
|
|
81
81
|
</div>
|
|
82
|
-
<div class="approval-info-cost">
|
|
82
|
+
<div v-if="item.approvalCost" class="approval-info-cost">
|
|
83
83
|
<span>审批时长:</span>
|
|
84
84
|
<span>{{ item.approvalCost }}</span>
|
|
85
85
|
</div>
|
|
@@ -533,7 +533,7 @@ export default {
|
|
|
533
533
|
let approvalData = []
|
|
534
534
|
data?.forEach((item) => {
|
|
535
535
|
let _item = {
|
|
536
|
-
approvalCost: item.approvalCost
|
|
536
|
+
approvalCost: item.approvalCost,
|
|
537
537
|
job: item.job || '',
|
|
538
538
|
isShow: item.isShow, //是否显示
|
|
539
539
|
endTime: item.endTime || '',
|
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
<div class="n20-date-picker-por" :class="{ 'has-long-term': showLongTermCheckbox }">
|
|
3
|
+
<el-date-picker
|
|
4
|
+
ref="date-picker"
|
|
5
|
+
v-model="valueC"
|
|
6
|
+
class="n20-date-editor"
|
|
7
|
+
:class="{
|
|
8
|
+
'has-value': clearable && valueC,
|
|
9
|
+
[this.$attrs && this.$attrs['rule-form']]: !valueC
|
|
10
|
+
}"
|
|
11
|
+
:popper-class="
|
|
12
|
+
!clearable && pickerType === 'datetimerange'
|
|
13
|
+
? 'clearable-datetimerange' + ' ' + $attrs['popper-class']
|
|
14
|
+
: $attrs['popper-class']
|
|
15
|
+
"
|
|
16
|
+
:type="pickerType"
|
|
17
|
+
:value-format="valueFormat"
|
|
18
|
+
:placeholder="'选择日期' | $lc"
|
|
19
|
+
:start-placeholder="'开始日期' | $lc"
|
|
20
|
+
:end-placeholder="'结束日期' | $lc"
|
|
21
|
+
:picker-options="pickerOptionsAs"
|
|
22
|
+
:clearable="clearable"
|
|
23
|
+
v-bind="$attrs"
|
|
24
|
+
v-on="listeners"
|
|
25
|
+
/>
|
|
26
|
+
<el-checkbox
|
|
27
|
+
v-if="showLongTermCheckbox"
|
|
28
|
+
v-model="longTermC"
|
|
29
|
+
class="n20-date-picker-por__long-term"
|
|
30
|
+
:disabled="longTermDisabled"
|
|
31
|
+
>
|
|
32
|
+
{{ '长期' | $lc }}
|
|
33
|
+
</el-checkbox>
|
|
34
|
+
</div>
|
|
25
35
|
</template>
|
|
26
36
|
|
|
27
37
|
<script>
|
|
28
|
-
import { $lc } from '../../utils/i18n/index'
|
|
29
38
|
import dayjs from 'dayjs'
|
|
39
|
+
|
|
40
|
+
import { $lc } from '../../utils/i18n/index'
|
|
41
|
+
|
|
30
42
|
let startDate = ''
|
|
31
43
|
|
|
32
44
|
const onPick = ({ maxDate, minDate }) => {
|
|
@@ -251,25 +263,20 @@ export default {
|
|
|
251
263
|
type: Boolean,
|
|
252
264
|
default: true
|
|
253
265
|
},
|
|
266
|
+
showLongTerm: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: false
|
|
269
|
+
},
|
|
270
|
+
longTerm: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: false
|
|
273
|
+
},
|
|
254
274
|
pickerOptions: {
|
|
255
275
|
type: Object,
|
|
256
276
|
default: () => ({})
|
|
257
277
|
}
|
|
258
278
|
},
|
|
259
279
|
data() {
|
|
260
|
-
let shortcuts = undefined
|
|
261
|
-
if (this.shortcuts && ['daterange', 'datetimerange'].includes(this.type))
|
|
262
|
-
shortcuts = this.startStop ? shortcuts_2 : shortcuts_1
|
|
263
|
-
|
|
264
|
-
this.pickerOptionsAs = Object.assign(
|
|
265
|
-
{
|
|
266
|
-
disabledDate: this.minNow ? disabledDate_1 : this.maxNow ? disabledDate_2 : undefined,
|
|
267
|
-
shortcuts
|
|
268
|
-
// onPick
|
|
269
|
-
},
|
|
270
|
-
this.pickerOptions
|
|
271
|
-
)
|
|
272
|
-
|
|
273
280
|
this.listeners = Object.assign({}, this.$listeners, {
|
|
274
281
|
input: () => {},
|
|
275
282
|
change: () => {}
|
|
@@ -278,9 +285,56 @@ export default {
|
|
|
278
285
|
return {}
|
|
279
286
|
},
|
|
280
287
|
computed: {
|
|
288
|
+
isRangeType() {
|
|
289
|
+
return ['daterange', 'monthrange', 'datetimerange'].includes(this.type)
|
|
290
|
+
},
|
|
291
|
+
showLongTermCheckbox() {
|
|
292
|
+
return this.showLongTerm && this.isRangeType
|
|
293
|
+
},
|
|
294
|
+
isLongTerm() {
|
|
295
|
+
return this.showLongTermCheckbox && this.longTerm
|
|
296
|
+
},
|
|
297
|
+
pickerType() {
|
|
298
|
+
if (!this.isLongTerm) return this.type
|
|
299
|
+
const typeMap = {
|
|
300
|
+
daterange: 'date',
|
|
301
|
+
datetimerange: 'datetime',
|
|
302
|
+
monthrange: 'month'
|
|
303
|
+
}
|
|
304
|
+
return typeMap[this.type] || this.type
|
|
305
|
+
},
|
|
306
|
+
pickerOptionsAs() {
|
|
307
|
+
let shortcuts = undefined
|
|
308
|
+
if (!this.isLongTerm && this.shortcuts && ['daterange', 'datetimerange'].includes(this.type)) {
|
|
309
|
+
shortcuts = this.startStop ? shortcuts_2 : shortcuts_1
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return Object.assign(
|
|
313
|
+
{
|
|
314
|
+
disabledDate: this.minNow ? disabledDate_1 : this.maxNow ? disabledDate_2 : undefined,
|
|
315
|
+
shortcuts
|
|
316
|
+
// onPick
|
|
317
|
+
},
|
|
318
|
+
this.pickerOptions
|
|
319
|
+
)
|
|
320
|
+
},
|
|
321
|
+
longTermC: {
|
|
322
|
+
get() {
|
|
323
|
+
return this.longTerm
|
|
324
|
+
},
|
|
325
|
+
set(val) {
|
|
326
|
+
this.handleLongTermChange(val)
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
longTermDisabled() {
|
|
330
|
+
return this.$attrs.disabled === '' || this.$attrs.disabled === true || this.$attrs.disabled === 'disabled'
|
|
331
|
+
},
|
|
281
332
|
valueC: {
|
|
282
333
|
get() {
|
|
283
|
-
if (
|
|
334
|
+
if (this.isRangeType) {
|
|
335
|
+
if (this.isLongTerm) {
|
|
336
|
+
return this.startDate || null
|
|
337
|
+
}
|
|
284
338
|
if (this.startDate && this.endDate) {
|
|
285
339
|
return [this.startDate, this.endDate]
|
|
286
340
|
} else {
|
|
@@ -291,7 +345,11 @@ export default {
|
|
|
291
345
|
}
|
|
292
346
|
},
|
|
293
347
|
set(val) {
|
|
294
|
-
if (
|
|
348
|
+
if (this.isRangeType) {
|
|
349
|
+
if (this.isLongTerm) {
|
|
350
|
+
this.handleLongTermDateChange(val)
|
|
351
|
+
return
|
|
352
|
+
}
|
|
295
353
|
if (val && val[0]) {
|
|
296
354
|
if (this.type === 'monthrange' && ['yyyy-MM-dd', 'yyyy-MM-dd HH:mm:ss'].includes(this.valueFormat)) {
|
|
297
355
|
let end = new Date(val[1])
|
|
@@ -329,6 +387,51 @@ export default {
|
|
|
329
387
|
}
|
|
330
388
|
},
|
|
331
389
|
methods: {
|
|
390
|
+
handleLongTermChange(val) {
|
|
391
|
+
this.$emit('update:long-term', val)
|
|
392
|
+
|
|
393
|
+
if (val) {
|
|
394
|
+
this.$emit('update:end-date', undefined)
|
|
395
|
+
this.$emit('end', undefined)
|
|
396
|
+
this.$emit('changeLongTerm', {
|
|
397
|
+
longTerm: true,
|
|
398
|
+
startTime: this.startDate || null
|
|
399
|
+
})
|
|
400
|
+
} else {
|
|
401
|
+
this.$emit('update:start-date', null)
|
|
402
|
+
this.$emit('update:end-date', null)
|
|
403
|
+
this.$emit('start', null)
|
|
404
|
+
this.$emit('end', null)
|
|
405
|
+
this.$emit('changeLongTerm', {
|
|
406
|
+
longTerm: false,
|
|
407
|
+
startTime: null
|
|
408
|
+
})
|
|
409
|
+
this.$emit('change', null)
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
handleLongTermDateChange(val) {
|
|
413
|
+
if (val) {
|
|
414
|
+
this.$emit('update:start-date', val)
|
|
415
|
+
this.$emit('update:end-date', undefined)
|
|
416
|
+
this.$emit('start', val)
|
|
417
|
+
this.$emit('end', undefined)
|
|
418
|
+
this.$emit('change', [val, undefined])
|
|
419
|
+
this.$emit('changeLongTerm', {
|
|
420
|
+
longTerm: true,
|
|
421
|
+
startTime: val
|
|
422
|
+
})
|
|
423
|
+
} else {
|
|
424
|
+
this.$emit('update:start-date', null)
|
|
425
|
+
this.$emit('update:end-date', undefined)
|
|
426
|
+
this.$emit('start', null)
|
|
427
|
+
this.$emit('end', undefined)
|
|
428
|
+
this.$emit('change', val)
|
|
429
|
+
this.$emit('changeLongTerm', {
|
|
430
|
+
longTerm: true,
|
|
431
|
+
startTime: null
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
},
|
|
332
435
|
HandleBlur() {
|
|
333
436
|
let startSh = shortcuts_2.find((s) => s.text.includes($lc('开始')))
|
|
334
437
|
let endSh = shortcuts_2.find((s) => s.text.includes($lc('截止')))
|
|
@@ -348,3 +451,29 @@ export default {
|
|
|
348
451
|
}
|
|
349
452
|
}
|
|
350
453
|
</script>
|
|
454
|
+
|
|
455
|
+
<style scoped>
|
|
456
|
+
.n20-date-picker-por {
|
|
457
|
+
display: inline-block;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.n20-date-picker-por > .n20-date-editor {
|
|
461
|
+
width: 100%;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.n20-date-picker-por.has-long-term {
|
|
465
|
+
display: inline-flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.n20-date-picker-por.has-long-term > .n20-date-editor {
|
|
470
|
+
flex: 1;
|
|
471
|
+
width: auto;
|
|
472
|
+
min-width: 0;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.n20-date-picker-por__long-term {
|
|
476
|
+
margin-left: 8px;
|
|
477
|
+
white-space: nowrap;
|
|
478
|
+
}
|
|
479
|
+
</style>
|
|
@@ -32,15 +32,11 @@
|
|
|
32
32
|
:height="height"
|
|
33
33
|
border
|
|
34
34
|
@selection-change="(selection) => (selectionList = selection)"
|
|
35
|
+
@sort-change="onSortChange"
|
|
35
36
|
>
|
|
36
37
|
<slot name="selection-column">
|
|
37
38
|
<el-table-column type="selection" width="50" align="center" />
|
|
38
39
|
</slot>
|
|
39
|
-
<el-table-column :label="'排序' | $lc" width="50" align="center">
|
|
40
|
-
<template slot-scope="{ row }">
|
|
41
|
-
<i class="n20-icon-tuodong file-upload-table__drag-handle" :data-row-key="row[keys.rowKey]"></i>
|
|
42
|
-
</template>
|
|
43
|
-
</el-table-column>
|
|
44
40
|
<template v-if="dataPorp.slotHeader">
|
|
45
41
|
<el-table-column
|
|
46
42
|
v-for="item in dataPorp.slotHeader"
|
|
@@ -77,7 +73,7 @@
|
|
|
77
73
|
</div>
|
|
78
74
|
</slot>
|
|
79
75
|
</el-table-column>
|
|
80
|
-
<el-table-column :label="'附件名称' | $lc" :prop="keys.name">
|
|
76
|
+
<el-table-column :label="'附件名称' | $lc" :prop="keys.name" sortable="custom">
|
|
81
77
|
<slot slot="header" slot-scope="scope" name="name-header" :column="scope.column">{{ '附件名称' | $lc }}</slot>
|
|
82
78
|
<slot slot-scope="{ row }" name="name" :row="row">
|
|
83
79
|
<span v-if="readonly">{{ row[keys.name] ? row[keys.name].replace(/\.[A-z0-9]+$/, '') : '' }}</span>
|
|
@@ -322,7 +318,6 @@ import aiCheckDialog from './aiCheckDialog.vue'
|
|
|
322
318
|
import getJsonc from '../../assets/getJsonc.js'
|
|
323
319
|
import _axios from 'axios'
|
|
324
320
|
import dayjs from 'dayjs'
|
|
325
|
-
import Sortable from 'sortablejs'
|
|
326
321
|
import XEUtils from 'xe-utils'
|
|
327
322
|
|
|
328
323
|
import 'viewerjs/dist/viewer.css'
|
|
@@ -506,8 +501,7 @@ export default {
|
|
|
506
501
|
previewName: undefined,
|
|
507
502
|
previewSameOrg: false,
|
|
508
503
|
seeRow: {},
|
|
509
|
-
officeStatus: false
|
|
510
|
-
sortable: null
|
|
504
|
+
officeStatus: false
|
|
511
505
|
}
|
|
512
506
|
},
|
|
513
507
|
computed: {
|
|
@@ -550,63 +544,31 @@ export default {
|
|
|
550
544
|
},
|
|
551
545
|
immediate: true,
|
|
552
546
|
deep: true
|
|
553
|
-
},
|
|
554
|
-
tableKey() {
|
|
555
|
-
this.initSortable()
|
|
556
547
|
}
|
|
557
548
|
},
|
|
558
549
|
mounted() {
|
|
559
550
|
this.getConfiguration()
|
|
560
|
-
this.initSortable()
|
|
561
|
-
},
|
|
562
|
-
beforeDestroy() {
|
|
563
|
-
this.destroySortable()
|
|
564
551
|
},
|
|
565
552
|
methods: {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
if (!$tbody) {
|
|
572
|
-
return
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
this.sortable = Sortable.create($tbody, {
|
|
576
|
-
handle: '.file-upload-table__drag-handle',
|
|
577
|
-
ghostClass: 'file-upload-table__sortable-ghost',
|
|
578
|
-
setData(dataTransfer) {
|
|
579
|
-
dataTransfer.setData('Text', '')
|
|
580
|
-
},
|
|
581
|
-
onEnd: ({ oldIndex, newIndex }) => {
|
|
582
|
-
if (
|
|
583
|
-
oldIndex === newIndex ||
|
|
584
|
-
oldIndex === undefined ||
|
|
585
|
-
newIndex === undefined ||
|
|
586
|
-
oldIndex < 0 ||
|
|
587
|
-
newIndex < 0
|
|
588
|
-
) {
|
|
589
|
-
return
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const targetRow = this.tableData.splice(oldIndex, 1)[0]
|
|
593
|
-
if (!targetRow) {
|
|
594
|
-
return
|
|
595
|
-
}
|
|
596
|
-
this.tableData.splice(newIndex, 0, targetRow)
|
|
597
|
-
this.$emit('sort', this.tableData.slice())
|
|
598
|
-
this.saveFileSort().catch(() => {
|
|
599
|
-
this.$message.error($lc('附件排序保存失败'))
|
|
600
|
-
})
|
|
601
|
-
}
|
|
602
|
-
})
|
|
603
|
-
})
|
|
604
|
-
},
|
|
605
|
-
destroySortable() {
|
|
606
|
-
if (this.sortable) {
|
|
607
|
-
this.sortable.destroy()
|
|
608
|
-
this.sortable = null
|
|
553
|
+
// 点击附件名称表头排序(替代原拖动排序)
|
|
554
|
+
onSortChange({ prop, order }) {
|
|
555
|
+
// 仅处理附件名称列;order 为 null(取消排序)时不处理
|
|
556
|
+
if (prop !== this.keys.name || !order) {
|
|
557
|
+
return
|
|
609
558
|
}
|
|
559
|
+
const nameKey = this.keys.name
|
|
560
|
+
// 与显示一致:去除扩展名后再比较
|
|
561
|
+
const stripName = (v) => (v == null ? '' : String(v).replace(/\.[A-z0-9]+$/, ''))
|
|
562
|
+
const dir = order === 'ascending' ? 1 : -1
|
|
563
|
+
const sorted = [...this.tableData].sort(
|
|
564
|
+
(a, b) => stripName(a[nameKey]).localeCompare(stripName(b[nameKey]), 'zh-CN', { numeric: true }) * dir
|
|
565
|
+
)
|
|
566
|
+
// 原地更新 tableData(沿用现有 splice 修改 prop 数组的模式)
|
|
567
|
+
this.tableData.splice(0, this.tableData.length, ...sorted)
|
|
568
|
+
this.$emit('sort', this.tableData.slice())
|
|
569
|
+
this.saveFileSort().catch(() => {
|
|
570
|
+
this.$message.error($lc('附件排序保存失败'))
|
|
571
|
+
})
|
|
610
572
|
},
|
|
611
573
|
async saveFileSort() {
|
|
612
574
|
const sortList = this.tableData
|
|
@@ -1091,21 +1053,4 @@ export default {
|
|
|
1091
1053
|
right: 46px;
|
|
1092
1054
|
top: 10px;
|
|
1093
1055
|
}
|
|
1094
|
-
|
|
1095
|
-
.file-upload-table__drag-handle {
|
|
1096
|
-
display: inline-block;
|
|
1097
|
-
color: #909399;
|
|
1098
|
-
font-size: 16px;
|
|
1099
|
-
cursor: move;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
.file-upload-table__drag-handle:hover {
|
|
1103
|
-
color: #606266;
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
.file-upload-table__sortable-ghost {
|
|
1107
|
-
opacity: 0.8;
|
|
1108
|
-
color: #fff !important;
|
|
1109
|
-
background: #42b983 !important;
|
|
1110
|
-
}
|
|
1111
1056
|
</style>
|
package/src/utils/theme.js
CHANGED
|
@@ -2,20 +2,26 @@ export function setTheme(val) {
|
|
|
2
2
|
if (!val) return
|
|
3
3
|
|
|
4
4
|
var links = document.querySelectorAll('link[rel="stylesheet"]')
|
|
5
|
-
var link, newLink
|
|
5
|
+
var link, newLink
|
|
6
6
|
links.forEach(function (el) {
|
|
7
7
|
if (el.href && el.href.indexOf('/theme/') !== -1) {
|
|
8
8
|
link = el
|
|
9
9
|
}
|
|
10
10
|
})
|
|
11
11
|
if (link) {
|
|
12
|
-
pEl = link.parentNode
|
|
13
|
-
nextEl = link.nextElementSibling
|
|
14
|
-
|
|
15
12
|
newLink = document.createElement('link')
|
|
16
13
|
newLink.href = link.href.replace(/\/[^/]+$/, '/' + val + '.css')
|
|
17
14
|
newLink.rel = 'stylesheet'
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* 将主题 <link> 追加到 <head> 末尾,确保它位于所有 <style> 标签之后。
|
|
18
|
+
*
|
|
19
|
+
* rootvar.scss 编译后会把 :root 变量(默认蓝色)打入 <style> 标签,
|
|
20
|
+
* 主题 CSS 也使用 :root 选择器(相同特异性)。
|
|
21
|
+
* CSS 层叠规则:同特异性时,DOM 中后出现的规则胜出。
|
|
22
|
+
* 因此将主题 <link> 放在最后,即可让它覆盖 <style> 标签中的默认值。
|
|
23
|
+
*/
|
|
24
|
+
document.head.appendChild(newLink)
|
|
19
25
|
|
|
20
26
|
newLink.addEventListener('load', function () {
|
|
21
27
|
link.setAttribute('disabled', 'disabled')
|