@leevan/jtui 2.0.3 → 2.0.4

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.3",
3
+ "version": "2.0.4",
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>
@@ -936,6 +936,7 @@ export default {
936
936
  default: () => ({
937
937
  parentRow: Object,
938
938
  radioChange: () => {},
939
+ checkBoxChange: () => {}
939
940
  }),
940
941
  },
941
942
  //展开行配置
@@ -989,7 +990,7 @@ export default {
989
990
  pageTotal: 0,
990
991
  dataTotal: 0,
991
992
  dataTreeObj: {},
992
- treeTempData: [],
993
+ treeTempData: []
993
994
  };
994
995
  },
995
996
  methods: {
@@ -1036,6 +1037,12 @@ export default {
1036
1037
  events: { radioChange: this.cellRenderMethods.radioChange },
1037
1038
  parentRow: this.cellRenderMethods?.parentRow,
1038
1039
  };
1040
+ case "TabsCheckbox":
1041
+ return {
1042
+ name:'TabsCheckbox',
1043
+ events:{checkboxChange:this.cellRenderMethods.checkboxChange},
1044
+ parentRow: this.cellRenderMethods?.parentRow,
1045
+ }
1039
1046
  }
1040
1047
  },
1041
1048
  //枚举转换
@@ -1274,7 +1281,14 @@ export default {
1274
1281
  },
1275
1282
  //操作列点击事件派发
1276
1283
  handlerColClick(value, row, rowIndex) {
1277
- this.$set(row, "activeValue", value);
1284
+ //检索
1285
+ if(value === 'stcd_search'){
1286
+ this.$set(row, "activeValue", value);
1287
+ }
1288
+ //刷新
1289
+ if(value === 'reflash'){
1290
+ this.reloadTreeChilds(row);
1291
+ };
1278
1292
  this.$emit("handlerClick", value, row, rowIndex);
1279
1293
  },
1280
1294
  //普通表格转树表(仅支持一层)
@@ -1381,7 +1395,6 @@ export default {
1381
1395
  this.dataTreeObj[idx + 1]
1382
1396
  );
1383
1397
  },
1384
- //树 懒加载方法
1385
1398
  // async loadChildrenMethod({ row }){
1386
1399
  // const { data } = await this.$axios.post(this.treeTypeConfig.path + row.path);
1387
1400
  // return new Promise((resolve) => {
@@ -1400,9 +1413,10 @@ export default {
1400
1413
  // }
1401
1414
  // })
1402
1415
  // },
1416
+ //树 懒加载方法
1403
1417
  loadChildrenMethod({ row }) {
1404
1418
  return new Promise(async (resolve) => {
1405
- if (row.activeValue === "stcd_search") {
1419
+ if (row.activeValue.indexOf("search") !== -1 ) {
1406
1420
  resolve(this.treeTempData);
1407
1421
  } else {
1408
1422
  const { data } = await this.$axios.post(
@@ -275,6 +275,7 @@ export function data23(){
275
275
  "label": "村级名称",
276
276
  "type": "String",
277
277
  "align": "center",
278
+ "cellRender":"TabsCheckbox",
278
279
  "enum": []
279
280
  },
280
281
  {
@@ -405,7 +406,10 @@ html:[{
405
406
  "xzrzw": "镇长",
406
407
  "jcrdh": "13408181100",
407
408
  "id": "2",
408
- "village": "高石社区三组",
409
+ "village": {
410
+ enum:[{label:'多选1',value:1},{label:'多选2',value:2},{label:'多选3',value:3}],
411
+ selected:[1,2]
412
+ },
409
413
  "yjrdh": "15984498223",
410
414
  "_XID": "row_4"
411
415
  },