ol-base-components 2.7.2 → 2.7.4
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/.prettierrc +2 -3
- package/package.json +1 -1
- package/src/api/run.js +6 -0
- package/src/bin/initTemplate.js +14 -15
- package/src/utils/initData.js +7 -3
package/.prettierrc
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
"trailingComma": "es5",
|
|
7
7
|
"bracketSpacing": true,
|
|
8
8
|
"arrowParens": "avoid",
|
|
9
|
-
"endOfLine": "
|
|
9
|
+
"endOfLine": "crlf",
|
|
10
10
|
"vueIndentScriptAndStyle": true,
|
|
11
11
|
"htmlWhitespaceSensitivity": "css",
|
|
12
|
-
"singleAttributePerLine": false
|
|
13
|
-
"trimTrailingWhitespace": true
|
|
12
|
+
"singleAttributePerLine": false
|
|
14
13
|
}
|
package/package.json
CHANGED
package/src/api/run.js
CHANGED
|
@@ -122,6 +122,12 @@ const generateApiModules = swagger => {
|
|
|
122
122
|
if (apiModules[tag]) {
|
|
123
123
|
const summary = details.summary || "";
|
|
124
124
|
apiModules[tag][key] = `${key}: "${removeCurlyBraces(url)}", //${method} ${summary}\n`;
|
|
125
|
+
// 不去出带花括号的,键名加上特殊字段
|
|
126
|
+
if (url.includes("{")) {
|
|
127
|
+
apiModules[tag][
|
|
128
|
+
`${key}CompleteUrl`
|
|
129
|
+
] = `${key}CompleteUrl: "${url}", //${method} ${summary}\n`;
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
});
|
|
127
133
|
}
|
package/src/bin/initTemplate.js
CHANGED
|
@@ -32,29 +32,30 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
32
32
|
console.log(888, config);
|
|
33
33
|
|
|
34
34
|
// 生成各种接口的key名称
|
|
35
|
-
let pageUrlKey = ""
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
let pageUrlKey = "",
|
|
36
|
+
exportUrlKey = "",
|
|
37
|
+
addUrlKey = "",
|
|
38
|
+
editUrlKey = "",
|
|
39
|
+
deleteUrlKey = "",
|
|
40
|
+
detailUrlKey = "",
|
|
41
|
+
baseUrlKey = ""; //接口选择优先级:新增 > 编辑 > 详,
|
|
42
42
|
|
|
43
43
|
if (config.pageUrl) pageUrlKey = generateKeyName(config.pageUrl, "get");
|
|
44
44
|
if (config.exportUrl) exportUrlKey = generateKeyName(config.exportUrl, "post");
|
|
45
|
-
if (config.
|
|
46
|
-
if (config.editUrl) editUrlKey = generateKeyName(config.editUrl, "put");
|
|
45
|
+
if (config.detailUrl) baseUrlKey = detailUrlKey = generateKeyName(config.detailUrl, "get");
|
|
46
|
+
if (config.editUrl) baseUrlKey = editUrlKey = generateKeyName(config.editUrl, "put");
|
|
47
|
+
if (config.addUrl) baseUrlKey = addUrlKey = generateKeyName(config.addUrl, "post");
|
|
47
48
|
if (config.deleteUrl) deleteUrlKey = generateKeyName(config.deleteUrl, "delete");
|
|
48
|
-
|
|
49
|
-
if (config.baseUrl) baseUrlKey = generateKeyName(config.baseUrl, "post"); //这里先直接用新增接口的,后期可改为各自接口
|
|
49
|
+
|
|
50
50
|
// 生成导入语句
|
|
51
51
|
const generateImports = () => {
|
|
52
52
|
const imports = [];
|
|
53
53
|
if (config.pageUrl) imports.push(`${pageUrlKey}`);
|
|
54
|
-
if (config.
|
|
54
|
+
if (config.baseUrl) imports.push(`${baseUrlKey}`);
|
|
55
|
+
if (config.addUrl) imports.push(`${addUrlKey}`);
|
|
55
56
|
if (config.editUrl) imports.push(`${editUrlKey}`);
|
|
56
|
-
if (config.deleteUrl) imports.push(`${deleteUrlKey}`);
|
|
57
57
|
if (config.detailUrl) imports.push(`${detailUrlKey}`);
|
|
58
|
+
if (config.deleteUrl) imports.push(`${deleteUrlKey}`);
|
|
58
59
|
return imports.join(", ");
|
|
59
60
|
};
|
|
60
61
|
|
|
@@ -104,8 +105,6 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
104
105
|
|
|
105
106
|
// onSubmit
|
|
106
107
|
if (config.hasAdd || config.hasEdit) {
|
|
107
|
-
// editUrlKey
|
|
108
|
-
// addUrlKey
|
|
109
108
|
methods.push(`
|
|
110
109
|
async onSubmit({ form, data }) {
|
|
111
110
|
if(form.type === 1){
|
package/src/utils/initData.js
CHANGED
|
@@ -29,11 +29,15 @@ const javaTypeToformType = javaType => {
|
|
|
29
29
|
export const initForm = options => {
|
|
30
30
|
const { url, form } = options;
|
|
31
31
|
getData().then(swaggerData => {
|
|
32
|
-
|
|
32
|
+
// swagger数据可以来源于,新增接口/编辑接口/详情接口(优先级:新增接口>编辑接口>详情接口)
|
|
33
|
+
let entity = {},
|
|
34
|
+
schema = {},
|
|
35
|
+
properties = {};
|
|
36
|
+
entity = swaggerData.paths[url].post;
|
|
33
37
|
// 添加title
|
|
34
38
|
// if (!form.title) form.title = entity.summary;
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
schema = entity.requestBody.content["application/json"].schema;
|
|
40
|
+
properties = schema.properties;
|
|
37
41
|
// 生成model
|
|
38
42
|
// 1.循环model,将properties中prop相同的匹配,属性合并,model权限大,properties权限小,且保持响应式
|
|
39
43
|
form.model.forEach(item => {
|