n20-project-component 1.0.3 → 1.0.6

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.
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <el-checkbox-group v-model="checkArrayCalc" :max="maxLength" class="popover-check-box" @change="checkChange">
3
+ <vue-draggable
4
+ :list="filterList"
5
+ :animation="200"
6
+ group="dragBox"
7
+ :handle="'.n20-icon-tuodong'"
8
+ @change="dragChange"
9
+ >
10
+ <div v-for="(item, index) in filterList" :key="index" class="n20-drag-list-item">
11
+ <el-checkbox :disabled="item.static" :label="item.id" :checked="item.checked">{{ item.label }}</el-checkbox
12
+ ><i class="n20-drag-icon n20-icon-tuodong"></i>
13
+ </div>
14
+ </vue-draggable>
15
+ </el-checkbox-group>
16
+ </template>
17
+
18
+ <script>
19
+ import importGlobal from 'n20-common-lib/src/utils/importGlobal.js'
20
+ export default {
21
+ name: 'FilterItem',
22
+ components: {
23
+ vueDraggable: () => importGlobal('vuedraggable', () => import(/*webpackChunkName: "vuedraggable"*/ 'vuedraggable'))
24
+ },
25
+ props: {
26
+ filterList: {
27
+ type: Array,
28
+ default: () => []
29
+ },
30
+ checkArray: {
31
+ type: Array,
32
+ default: () => []
33
+ },
34
+ maxLength: {
35
+ type: Number
36
+ }
37
+ },
38
+ computed: {
39
+ checkArrayCalc: {
40
+ get() {
41
+ return this.checkArray
42
+ },
43
+ set(value) {
44
+ // 处理初始化时候的报错
45
+ if (typeof value !== 'boolean') {
46
+ this.$emit('update:checkArray', value)
47
+ }
48
+ return value
49
+ }
50
+ }
51
+ },
52
+ methods: {
53
+ checkChange(keys) {
54
+ if (keys.length > this.maxLength) {
55
+ return this.$message.warning(`${$lc('最多只能添加')}${this.maxLength}${$lc('个')}${$lc('筛选条件!')}`)
56
+ }
57
+ this.$emit('checked', keys)
58
+ },
59
+ dragChange() {
60
+ this.$emit('checked', this.checkArrayCalc)
61
+ }
62
+ }
63
+ }
64
+ </script>