tianheng-ui 0.1.56 → 0.1.58

Sign up to get free protection for your applications and to get access to all the features.
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.1.56",
4
+ "version": "0.1.58",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -98,7 +98,7 @@ export default {
98
98
  data() {
99
99
  return {
100
100
  formConfig: this.config,
101
- models: {},
101
+ models: this.value,
102
102
  query: {},
103
103
  componentsData: [],
104
104
  axios: null,
@@ -108,7 +108,6 @@ export default {
108
108
  computed: {
109
109
  formWidth() {
110
110
  if (this.formConfig.config.width) return this.formConfig.config.width;
111
-
112
111
  return "";
113
112
  }
114
113
  },
@@ -116,17 +115,8 @@ export default {
116
115
  config(val) {
117
116
  this.setConfig(val);
118
117
  },
119
- formConfig: {
120
- handler(val) {
121
- this.$emit("update:config", val);
122
- },
123
- deep: true
124
- },
125
- value: {
126
- deep: true,
127
- handler(val) {
128
- this.models = { ...this.models, ...val };
129
- }
118
+ value(val) {
119
+ if (val) this.models = val;
130
120
  }
131
121
  },
132
122
  created() {
@@ -136,11 +126,11 @@ export default {
136
126
  },
137
127
  mounted() {
138
128
  this.generateModle(this.formConfig.list, this.models);
139
- this.showForm = true;
140
129
  this.handleMountedRemotData();
130
+ this.showForm = true;
141
131
  },
142
132
  methods: {
143
- generateModle(genList, modelObj) {
133
+ generateModle(genList, modelObj, pModel) {
144
134
  if (!genList) return;
145
135
  genList.map(item => {
146
136
  if (item.type === "grid") {
@@ -149,7 +139,7 @@ export default {
149
139
  modelObj[item.model] = dic;
150
140
 
151
141
  item.options.columns.forEach(item => {
152
- this.generateModle(item.list, dic);
142
+ this.generateModle(item.list, dic, item.model);
153
143
  });
154
144
  } else {
155
145
  item.options.columns.forEach(item => {
@@ -172,14 +162,7 @@ export default {
172
162
  modelObj[item.model] = arr || [dic];
173
163
 
174
164
  this.generateModle(item.options.columns, dic);
175
- }
176
- // else if (modelObj) {
177
- // if (!modelObj[item.model]) {
178
- // this.$set(modelObj, item.model, item.options.defaultValue);
179
- // }
180
- // this.generateRules(item);
181
- // }
182
- else if (item.type === "blank") {
165
+ } else if (item.type === "blank") {
183
166
  const value = eval(`this.value.${item.model}`);
184
167
  const defaultValue = { String: "", Object: {}, Array: [] }[
185
168
  item.options.defaultType
@@ -283,8 +266,10 @@ export default {
283
266
  };
284
267
  const params = {};
285
268
  for (let e of api.inParams) {
286
- const value = getProperty(this.query, e.alias) || null;
287
- setProperty(params, e.alias, value);
269
+ const value =
270
+ getProperty(this.models, e.pAlias) ||
271
+ getProperty(this.query, e.pAlias);
272
+ setProperty(params, e.pAlias, value);
288
273
  }
289
274
  if (api.needPage) {
290
275
  params.pageNum = params.pageNum || 1;
@@ -166,6 +166,7 @@
166
166
  v-if="dialog.show"
167
167
  :config="formData"
168
168
  :oauthConfig="oauthConfig"
169
+ :value="{ user: { name: '123' }, name: '111' }"
169
170
  :slotKeys="slotKeys"
170
171
  @change="handleDataChange"
171
172
  @button-submit="handleButtonSubmit"