ol-base-components 2.7.9 → 2.7.10

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -70,7 +70,7 @@ const vue2Template = (moduleName, config = {}) => {
70
70
  if (config.hasAdd || config.hasEdit || config.hasDetail) {
71
71
  methods.push(`
72
72
  onCancel() {
73
- this.dialogVisible = false;
73
+ this.formConfig.dialogVisible = false;
74
74
  }`);
75
75
  }
76
76
 
@@ -98,8 +98,10 @@ const vue2Template = (moduleName, config = {}) => {
98
98
  if (config.hasAdd) {
99
99
  methods.push(`
100
100
  addBtnHandler() {
101
- this.type = 1;
102
- this.dialogVisible = true;
101
+ this.formConfig.title = "新增";
102
+ this.formConfig.type = 1;
103
+ this.formConfig.formData = {};
104
+ this.formConfig.dialogVisible = true;
103
105
  }`);
104
106
  }
105
107
 
@@ -112,11 +114,12 @@ const vue2Template = (moduleName, config = {}) => {
112
114
  ${
113
115
  config.hasDetail
114
116
  ? `const { result = {} } = await ${detailUrlKey}(row.${config.rowId});
115
- this.formData = result || {};`
116
- : `this.formData = { ...row };`
117
+ this.formConfig.formData = result || {};`
118
+ : `this.formConfig.formData = { ...row };`
117
119
  }
118
- this.type = 2;
119
- this.dialogVisible = true;
120
+ this.formConfig.title = "编辑";
121
+ this.formConfig.type = 2;
122
+ this.formConfig.dialogVisible = true;
120
123
  }`);
121
124
  }
122
125
 
@@ -128,9 +131,10 @@ const vue2Template = (moduleName, config = {}) => {
128
131
  if(data.length !== 1) return this.$message.info("请选择一条数据");
129
132
  const row = data[0];
130
133
  const { result = {} } = await ${detailUrlKey}(row.${config.rowId});
131
- this.formData = result || {};
132
- this.type = 0;
133
- this.dialogVisible = true;
134
+ this.formConfig.formData = result || {};
135
+ this.formConfig.title = "详情";
136
+ this.formConfig.type = 0;
137
+ this.formConfig.dialogVisible = true;
134
138
  }`);
135
139
  }
136
140
 
@@ -204,10 +208,11 @@ const vue2Template = (moduleName, config = {}) => {
204
208
  />
205
209
  ${
206
210
  config.hasDialog
207
- ? `<el-dialog :title="this.form.title" :visible.sync="dialogVisible" width="80%">
211
+ ? `<el-dialog :title="formConfig.title" :visible.sync="formConfig.dialogVisible" width="80%">
208
212
  <FormModule
209
- v-if="dialogVisible"
210
- :formData="formData"
213
+ v-if="formConfig.dialogVisible"
214
+ :formData="formConfig.formData"
215
+ :type="formConfig.type"
211
216
  @onCancel="onCancel"
212
217
  @onSubmit="onSubmit"
213
218
  />
@@ -265,9 +270,12 @@ export default {
265
270
  },
266
271
  ${
267
272
  config.hasDialog
268
- ? `type: 1,
269
- formData: {},
270
- dialogVisible: false`
273
+ ? `formConfig: {
274
+ type: 1,
275
+ formData: {},
276
+ title:"",
277
+ dialogVisible: false
278
+ }`
271
279
  : ""
272
280
  }
273
281
  }
@@ -387,7 +395,7 @@ export default {
387
395
  }
388
396
  },
389
397
  created(){
390
- this.form.value = { ...this.formData };
398
+ if(this.type !== 1) this.form.value = { ...this.formData };
391
399
  },
392
400
  methods: {
393
401
  onCancel() {