ol-base-components 2.9.1 → 2.9.3
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
package/src/api/api.js
CHANGED
|
@@ -75,6 +75,10 @@ SwaggerClient(swaggerUrl)
|
|
|
75
75
|
|
|
76
76
|
Object.keys(apiModules).forEach(fileName => {
|
|
77
77
|
const outputPath = path.join(modulesDir, `${fileName}.js`);
|
|
78
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
79
|
+
if (fs.existsSync(outputPath)) {
|
|
80
|
+
fs.unlinkSync(outputPath);
|
|
81
|
+
}
|
|
78
82
|
fs.writeFileSync(outputPath, apiModules[fileName], "utf-8");
|
|
79
83
|
setFileReadOnly(outputPath);
|
|
80
84
|
console.log(`API接口已生成并保存到 ${outputPath}(只读)`);
|
|
@@ -97,6 +101,10 @@ function createIndexFile(apiModules) {
|
|
|
97
101
|
str += `export * from "./${fileName}";\n`;
|
|
98
102
|
});
|
|
99
103
|
const outputPath = path.join(modulesDir, `index.js`);
|
|
104
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
105
|
+
if (fs.existsSync(outputPath)) {
|
|
106
|
+
fs.unlinkSync(outputPath);
|
|
107
|
+
}
|
|
100
108
|
fs.writeFileSync(outputPath, str, "utf-8");
|
|
101
109
|
// 设置 index.js 也为只读
|
|
102
110
|
setFileReadOnly(outputPath);
|
package/src/api/run.js
CHANGED
|
@@ -77,6 +77,10 @@ http
|
|
|
77
77
|
|
|
78
78
|
// 输出到文件
|
|
79
79
|
// const outputPath = path.join(__dirname, "swagger.js");
|
|
80
|
+
// 如果文件已存在,先删除(包括只读文件)
|
|
81
|
+
if (fs.existsSync(outputPath)) {
|
|
82
|
+
fs.unlinkSync(outputPath);
|
|
83
|
+
}
|
|
80
84
|
fs.writeFileSync(outputPath, apiEndpoints, "utf-8");
|
|
81
85
|
clearInterval(spinner);
|
|
82
86
|
process.stdout.write("\r");
|
|
@@ -113,7 +113,11 @@
|
|
|
113
113
|
v-else-if="item.inputType === 'numberRange'"
|
|
114
114
|
v-model="formSearch[item.value]"
|
|
115
115
|
v-bind="item.props || {}"
|
|
116
|
-
v-on="{
|
|
116
|
+
v-on="{
|
|
117
|
+
...item.listeners,
|
|
118
|
+
change: val =>
|
|
119
|
+
item.listeners && item.listeners.change && item.listeners.change({ item, val }),
|
|
120
|
+
}"
|
|
117
121
|
></ol-number-range>
|
|
118
122
|
<el-input
|
|
119
123
|
v-else
|
|
@@ -274,6 +278,11 @@ export default {
|
|
|
274
278
|
rulesLength: {
|
|
275
279
|
type: Boolean,
|
|
276
280
|
},
|
|
281
|
+
//获取swagger后的钩子,返回swagger结构数据。用于处理swagger数据
|
|
282
|
+
swaggerColumnsProcessor: {
|
|
283
|
+
type: Function,
|
|
284
|
+
default: null,
|
|
285
|
+
},
|
|
277
286
|
},
|
|
278
287
|
data() {
|
|
279
288
|
return {
|
|
@@ -311,7 +320,13 @@ export default {
|
|
|
311
320
|
methods: {
|
|
312
321
|
async init() {
|
|
313
322
|
const swaggerData = await getData();
|
|
314
|
-
|
|
323
|
+
let swaggersearchColumns = swaggerData.paths[this.url].get.parameters || [];
|
|
324
|
+
if (typeof this.swaggerColumnsProcessor === "function") {
|
|
325
|
+
try {
|
|
326
|
+
const res = await this.swaggerColumnsProcessor({ swaggersearchColumns });
|
|
327
|
+
swaggersearchColumns = res;
|
|
328
|
+
} catch (err) {}
|
|
329
|
+
}
|
|
315
330
|
swaggersearchColumns.forEach(item => {
|
|
316
331
|
let tempItem = this.formSearchData.tableSearch.find(
|
|
317
332
|
e => e.value.toLowerCase() === item.name.toLowerCase()
|
|
@@ -566,6 +566,10 @@ export default {
|
|
|
566
566
|
obj.prop = `${key}Desc`;
|
|
567
567
|
obj.label = item.description.replace(/(枚举|枚举值)/g, "");
|
|
568
568
|
}
|
|
569
|
+
// 如果是boolean类型,加上Text后缀
|
|
570
|
+
if (item.type === "boolean") {
|
|
571
|
+
obj.prop = `${key}Text`;
|
|
572
|
+
}
|
|
569
573
|
this.tableData.columns.push(obj);
|
|
570
574
|
}
|
|
571
575
|
});
|