tianheng-ui 0.0.81 → 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.81",
4
+ "version": "0.0.83",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -396,6 +396,7 @@ export default {
396
396
  GenerateForm
397
397
  },
398
398
  props: {
399
+ formName: String,
399
400
  data: {
400
401
  type: Object,
401
402
  default: () => {
@@ -539,7 +540,10 @@ export default {
539
540
  this.widgetFormSelect = this.data.list[0];
540
541
  }
541
542
  if (this.data && this.data.config) {
542
- this.widgetFormData.config = this.data.config;
543
+ this.widgetFormData.config = Object.assign(
544
+ this.widgetFormData.config,
545
+ this.data.config
546
+ );
543
547
  }
544
548
  },
545
549
  methods: {
@@ -56,6 +56,12 @@ export default {
56
56
  default: () => {
57
57
  return [];
58
58
  }
59
+ },
60
+ config: {
61
+ type: Object,
62
+ default: () => {
63
+ return {};
64
+ }
59
65
  }
60
66
  },
61
67
  data() {
@@ -65,8 +71,58 @@ export default {
65
71
  client: "monitor"
66
72
  };
67
73
  },
68
- mounted() {},
74
+ watch: {
75
+ fields: {
76
+ handler(val, oldVal) {
77
+ if (oldVal.length === 0) {
78
+ this.initConfig();
79
+ }
80
+ },
81
+ deep: true
82
+ },
83
+ config(val) {
84
+ this.initConfig();
85
+ }
86
+ },
87
+ mounted() {
88
+ this.initConfig();
89
+ },
69
90
  methods: {
91
+ initConfig() {
92
+ const searchFields = [];
93
+ const searchFieldsIndexs = [];
94
+ if (this.config.search) {
95
+ const searchOptions = this.config.search.options;
96
+ for (const item of searchOptions) {
97
+ for (let i = 0; i < this.fields.length; i++) {
98
+ const element = this.fields[i];
99
+ if (element.prop === item.prop) {
100
+ searchFields.push(item);
101
+ searchFieldsIndexs.push(i);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ this.searchFields = searchFields;
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;
125
+ },
70
126
  handleFieldsChange(val) {
71
127
  const type = val.type;
72
128
  const data = val.data;
@@ -113,7 +169,7 @@ export default {
113
169
  const tableConfig = this.$refs.configRef.getJson();
114
170
  tableConfig.search.options = this.searchFields;
115
171
  tableConfig.table.options = this.tableFields;
116
- return tableConfig
172
+ return tableConfig;
117
173
  }
118
174
  }
119
175
  };
@@ -317,7 +317,8 @@ const tableConfig = {
317
317
  delete: { show: true, name: "删除", position: 2 },
318
318
  batchDelete: { show: true, name: "批量删除", position: 1 },
319
319
  export: { show: true, name: "导出", position: 1 },
320
- import: { show: true, name: "导入", position: 1 }
320
+ import: { show: true, name: "导入", position: 1 },
321
+ key_123456:{}
321
322
  },
322
323
  network: {
323
324
  mounted: {
@@ -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>