tianheng-ui 0.1.55 → 0.1.56

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.1.55",
4
+ "version": "0.1.56",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -136,8 +136,8 @@ export default {
136
136
  },
137
137
  mounted() {
138
138
  this.generateModle(this.formConfig.list, this.models);
139
- console.log("models =>", this.models);
140
139
  this.showForm = true;
140
+ this.handleMountedRemotData();
141
141
  },
142
142
  methods: {
143
143
  generateModle(genList, modelObj) {
@@ -268,6 +268,37 @@ export default {
268
268
  item.options.remoteOptions = initOptions(resultData);
269
269
  });
270
270
  },
271
+ handleMountedRemotData() {
272
+ if (!this.formConfig.config.mounted.api) return;
273
+
274
+ const api = this.formConfig.config.network[
275
+ this.formConfig.config.mounted.api
276
+ ];
277
+ if (!api) return this.$message.warning("未知的接口,请检查配置信息");
278
+
279
+ const requestConfig = {
280
+ url: api.url,
281
+ method: api.method,
282
+ headers: api.headers
283
+ };
284
+ const params = {};
285
+ for (let e of api.inParams) {
286
+ const value = getProperty(this.query, e.alias) || null;
287
+ setProperty(params, e.alias, value);
288
+ }
289
+ if (api.needPage) {
290
+ params.pageNum = params.pageNum || 1;
291
+ params.pageSize = params.pageSize || 20;
292
+ }
293
+ if (["get", "delete"].includes(api.method.toLowerCase()))
294
+ requestConfig.params = params;
295
+ else requestConfig.data = params;
296
+
297
+ this.axios(requestConfig).then(res => {
298
+ const resultData = api.needPage ? res.data.records : res.data;
299
+ this.models = Object.assign(this.models, resultData);
300
+ });
301
+ },
271
302
  handleButtonSubmit(val) {
272
303
  const api = this.formConfig.config.network[val];
273
304
  if (!api) return this.$message.warning("未知的接口,请检查配置信息");
@@ -326,6 +357,7 @@ export default {
326
357
  setConfig(json) {
327
358
  this.formConfig = json;
328
359
  this.generateModle(this.formConfig.list, this.models);
360
+ this.handleMountedRemotData();
329
361
  }
330
362
  }
331
363
  };
@@ -450,7 +450,6 @@ export default {
450
450
 
451
451
  // 操作事件
452
452
  handleActionClick(action, item, callback) {
453
- console.log("handleActionClick =>", action, item);
454
453
  switch (action.type) {
455
454
  case "add":
456
455
  case "edit":