xs-common-plugins 1.4.7 → 1.4.8

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xs-common-plugins",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "向上公共代码部分",
5
5
  "author": "祝玲云 <1902733517@qq.com>",
6
6
  "main": "index.js",
@@ -1,62 +1,59 @@
1
- <template>
2
- <div class="checkbox-wrap">
3
- <el-checkbox-group v-model="checkList" @change="handleChecked">
4
- <el-checkbox
5
- v-for="(item,index) in checkSourceList"
6
- :key="index"
7
- :label="item.Id"
8
- >{{ item.Text }}</el-checkbox>
9
- </el-checkbox-group>
10
- </div>
11
- </template>
12
- <script>
13
- export default {
14
- props: {
15
- value: [String, Number],
16
- sourceData: {
17
- type: Array,
18
- default: () => []
19
- }
20
- },
21
- data() {
22
- return {
23
- checkSourceList: this.sourceData,
24
- checkList: [],
25
- selfValue: this.value
26
- }
27
- },
28
- watch: {
29
- value: {
30
- immediate: true,
31
- handler(val) {
32
- this.selfValue = val
33
- }
34
- }
35
- },
36
- created() {
37
- this.backFill()
38
- },
39
- methods: {
40
- handleChecked(val) {
41
- let count = 0
42
- val.forEach((item) => {
43
- this.checkSourceList.forEach((_item) => {
44
- if (item == _item.Id) {
45
- count += item
46
- }
47
- })
48
- })
49
- this.$emit('input', count)
50
- },
51
- backFill() {
52
- const _this = this
53
- const arr = this.checkSourceList.map(item => { return item.Id })
54
- arr.forEach((item, index) => {
55
- if ((_this.selfValue & item) > 0) {
56
- this.checkList.push(this.checkSourceList[index].Id)
57
- }
58
- })
59
- }
60
- }
61
- }
62
- </script>
1
+ <template>
2
+ <div class="checkbox-wrap">
3
+ <el-checkbox-group v-model="checkList" @change="handleChecked">
4
+ <el-checkbox v-for="(item, index) in checkSourceList" :key="index" :label="item.Id">{{ item.Text }}</el-checkbox>
5
+ </el-checkbox-group>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ props: {
11
+ value: [String, Number],
12
+ sourceData: {
13
+ type: Array,
14
+ default: () => []
15
+ }
16
+ },
17
+ data() {
18
+ return {
19
+ checkSourceList: this.sourceData,
20
+ checkList: [],
21
+ selfValue: this.value
22
+ }
23
+ },
24
+ watch: {
25
+ value: {
26
+ immediate: true,
27
+ handler(val) {
28
+ this.selfValue = val
29
+ this.checkList = []
30
+ this.backFill()
31
+ }
32
+ }
33
+ },
34
+ methods: {
35
+ handleChecked(val) {
36
+ let count = 0
37
+ val.forEach(item => {
38
+ this.checkSourceList.forEach(_item => {
39
+ if (item == _item.Id) {
40
+ count += item
41
+ }
42
+ })
43
+ })
44
+ this.$emit('input', count)
45
+ },
46
+ backFill() {
47
+ const _this = this
48
+ const arr = this.checkSourceList.map(item => {
49
+ return item.Id
50
+ })
51
+ arr.forEach((item, index) => {
52
+ if ((_this.selfValue & item) > 0) {
53
+ this.checkList.push(this.checkSourceList[index].Id)
54
+ }
55
+ })
56
+ }
57
+ }
58
+ }
59
+ </script>