tianheng-ui 0.0.82 → 0.0.83

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.82",
4
+ "version": "0.0.83",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -72,8 +72,13 @@ export default {
72
72
  };
73
73
  },
74
74
  watch: {
75
- fields(val) {
76
- this.initConfig();
75
+ fields: {
76
+ handler(val, oldVal) {
77
+ if (oldVal.length === 0) {
78
+ this.initConfig();
79
+ }
80
+ },
81
+ deep: true
77
82
  },
78
83
  config(val) {
79
84
  this.initConfig();
@@ -84,22 +89,39 @@ export default {
84
89
  },
85
90
  methods: {
86
91
  initConfig() {
87
- this.searchFields = [];
92
+ const searchFields = [];
88
93
  const searchFieldsIndexs = [];
89
94
  if (this.config.search) {
90
- const search = this.config.search.options;
91
- for (const item of search) {
95
+ const searchOptions = this.config.search.options;
96
+ for (const item of searchOptions) {
92
97
  for (let i = 0; i < this.fields.length; i++) {
93
98
  const element = this.fields[i];
94
99
  if (element.prop === item.prop) {
95
- this.searchFields.push(item);
100
+ searchFields.push(item);
96
101
  searchFieldsIndexs.push(i);
97
102
  }
98
103
  }
99
104
  }
100
105
  }
101
-
106
+ this.searchFields = searchFields;
102
107
  this.$refs.configRef.search.fields = searchFieldsIndexs;
108
+
109
+ const tableFields = [];
110
+ const tableFieldsIndexs = [];
111
+ if (this.config.table) {
112
+ const tableOptions = this.config.table.options;
113
+ for (const item of tableOptions) {
114
+ for (let i = 0; i < this.fields.length; i++) {
115
+ const element = this.fields[i];
116
+ if (element.prop === item.prop) {
117
+ tableFields.push(item);
118
+ tableFieldsIndexs.push(i);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ this.tableFields = tableFields;
124
+ this.$refs.configRef.table.fields = tableFieldsIndexs;
103
125
  },
104
126
  handleFieldsChange(val) {
105
127
  const type = val.type;
@@ -50,7 +50,7 @@
50
50
  label-width="80px"
51
51
  size="mini"
52
52
  >
53
- <el-collapse v-model="tableCollapse" @change="handleChange">
53
+ <el-collapse v-model="tableCollapse">
54
54
  <el-collapse-item title="表格配置" name="1">
55
55
  <el-form-item label="高级查询">
56
56
  <el-switch v-model="tableConfig.search.show"> </el-switch>