@leevan/jtui 2.0.2-alpha1 → 2.0.5

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": "@leevan/jtui",
3
- "version": "2.0.2-alpha1",
3
+ "version": "2.0.5",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -3,8 +3,10 @@ import VXETable from 'vxe-table';
3
3
  import XEUtils from 'xe-utils'
4
4
 
5
5
  import TabsBtn from './components/tabsBtn.vue';
6
+ import TabsCheckbox from './components/tabsCheckbox.vue';
6
7
 
7
8
  Vue.component(TabsBtn.name, TabsBtn)
9
+ Vue.component(TabsCheckbox.name,TabsCheckbox)
8
10
 
9
11
  VXETable.renderer.add('TabsBtn',{
10
12
  renderDefault (h, renderOpts, params) {
@@ -14,4 +16,14 @@ VXETable.renderer.add('TabsBtn',{
14
16
  ></tabs-btn>
15
17
  ]
16
18
  }
19
+ })
20
+
21
+ VXETable.renderer.add('TabsCheckbox',{
22
+ renderDefault (h, renderOpts, params) {
23
+ const { events , parentRow } = renderOpts;
24
+ return [
25
+ <tabs-checkbox params={ params } events={ events } parentRow={ parentRow }
26
+ ></tabs-checkbox>
27
+ ]
28
+ }
17
29
  })
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div>
3
+ <el-checkbox-group v-model="radio_value" size="mini" @change="btnsClick"
4
+ v-if="dataType !== 'string'">
5
+ <el-checkbox-button
6
+ v-for="(item, index) in fullData"
7
+ :key="index"
8
+ :label="item.value"
9
+ >{{ item.label }}</el-checkbox-button
10
+ >
11
+ </el-checkbox-group>
12
+ <div v-else>
13
+ {{rowData}}
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: "TabsCheckbox",
21
+ data() {
22
+ return {
23
+ radio_value: [],
24
+ fullData: [],
25
+ oldValue: "",
26
+ dataType: '',
27
+ rowData: ''
28
+ };
29
+ },
30
+ props: {
31
+ params: Object,
32
+ },
33
+ created() {
34
+ this.load();
35
+ },
36
+ methods: {
37
+ load() {
38
+ const { row, column } = this.params;
39
+ if (row) {
40
+ this.rowData = row[column.property];
41
+ this.dataType = typeof this.rowData;
42
+ }
43
+ if (this.rowData && this.rowData.enum) {
44
+ this.fullData = this.rowData.enum;
45
+ this.radio_value = this.rowData.selected;
46
+ this.oldValue = this.rowData.selected;
47
+ }
48
+ },
49
+ async btnsClick(val) {
50
+ const { row, column } = this.params;
51
+ const { events, parentRow } = this.$attrs;
52
+ const result = await events.checkboxChange({
53
+ row,
54
+ property: column.property,
55
+ val,
56
+ params: parentRow,
57
+ });
58
+ if (result) {
59
+ this.oldValue = val;
60
+ } else {
61
+ this.radio_value = this.oldValue;
62
+ }
63
+ },
64
+ },
65
+ };
66
+ </script>
67
+
68
+ <style lang="scss" scoped>
69
+
70
+ </style>