ol-base-components 2.7.2 → 2.7.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/.prettierrc CHANGED
@@ -6,9 +6,8 @@
6
6
  "trailingComma": "es5",
7
7
  "bracketSpacing": true,
8
8
  "arrowParens": "avoid",
9
- "endOfLine": "lf",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
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
  }
@@ -32,21 +32,21 @@ const vue2Template = (moduleName, config = {}) => {
32
32
  console.log(888, config);
33
33
 
34
34
  // 生成各种接口的key名称
35
- let pageUrlKey = "";
36
- let exportUrlKey = "";
37
- let addUrlKey = "";
38
- let editUrlKey = "";
39
- let deleteUrlKey = "";
40
- let detailUrlKey = "";
41
- let baseUrlKey = "";
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.addUrl) addUrlKey = generateKeyName(config.addUrl, "post");
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
- if (config.detailUrl) detailUrlKey = generateKeyName(config.detailUrl, "get");
49
- if (config.baseUrl) baseUrlKey = generateKeyName(config.baseUrl, "post"); //这里先直接用新增接口的,后期可改为各自接口
49
+
50
50
  // 生成导入语句
51
51
  const generateImports = () => {
52
52
  const imports = [];
@@ -104,8 +104,6 @@ const vue2Template = (moduleName, config = {}) => {
104
104
 
105
105
  // onSubmit
106
106
  if (config.hasAdd || config.hasEdit) {
107
- // editUrlKey
108
- // addUrlKey
109
107
  methods.push(`
110
108
  async onSubmit({ form, data }) {
111
109
  if(form.type === 1){
@@ -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
- const entity = swaggerData.paths[url].post;
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
- const schema = entity.requestBody.content["application/json"].schema;
36
- const properties = schema.properties;
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 => {