tianheng-ui 0.1.57 → 0.1.59

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.57",
4
+ "version": "0.1.59",
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() {
@@ -140,7 +130,7 @@ export default {
140
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
@@ -312,7 +295,7 @@ export default {
312
295
  if (item.children) {
313
296
  initParams(item.children);
314
297
  } else {
315
- const value = getProperty(this.models, item.pAlias);
298
+ const value = getProperty(this.models, item.pAlias) || "null";
316
299
  setProperty(params, item.pAlias, value);
317
300
  }
318
301
  });
@@ -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"
@@ -81,15 +81,15 @@ export default {
81
81
  this.loadingDel = false;
82
82
  this.pop = false;
83
83
  },
84
- handleClick(item, callback) {
85
- this.$emit("click", item, this.scope.row, callback);
84
+ handleClick(action, callback) {
85
+ this.$emit("click", action, this.scope.row, callback);
86
86
  },
87
- handleDelete(item) {
87
+ handleDelete(action) {
88
88
  this.loadingDel = true;
89
89
  const callback = bool => {
90
90
  bool ? this.handleCancel() : (this.loadingDel = false);
91
91
  };
92
- this.handleClick(item, callback);
92
+ this.handleClick(action, callback);
93
93
  },
94
94
  handleMore(value, index, item) {
95
95
  for (let i = 0; i < item.children.length; i++) {
@@ -454,8 +454,7 @@ export default {
454
454
  case "add":
455
455
  case "edit":
456
456
  case "look":
457
- this.dialog = { show: true, data: item, action: action };
458
- this.requestFormConfigData(action);
457
+ this.$emit("form-action", action, item, callback);
459
458
  break;
460
459
  case "delete":
461
460
  this.requestDeleteData(item, action, callback);
@@ -845,8 +845,8 @@ export default {
845
845
  };
846
846
  this.$emit("remote-params", apiId, callback);
847
847
  } else {
848
- initParams(deepClone(api.inParams), null, false);
849
- initParams(deepClone(api.outParams), null, false);
848
+ initParams(api.inParams, null, false);
849
+ initParams(api.outParams, null, false);
850
850
  if (isFields) {
851
851
  this.fieldsData.inParams = deepClone(api.inParams || []);
852
852
  initParams(this.fieldsData.inParams, null, true);