ol-base-components 2.7.6 → 2.7.8
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 +1 -1
- package/package.json +1 -1
- package/src/api/api.js +28 -3
- package/src/api/run.js +28 -3
- package/src/bin/add.js +27 -33
- package/src/bin/initTemplate.js +12 -16
- package/src/package/form/src/index.vue +5 -7
- package/src/package/formSearch/src/index.vue +23 -69
package/.prettierrc
CHANGED
package/package.json
CHANGED
package/src/api/api.js
CHANGED
|
@@ -8,7 +8,7 @@ const SwaggerClient = require("swagger-client");
|
|
|
8
8
|
const swaggerUrl = process.argv[2] ? `${process.argv[2]}/swagger/v1/swagger.json` : "";
|
|
9
9
|
const modulesDir = process.argv[3] ? process.argv[3] : "src/api/modules";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const defaultRemark = `/**
|
|
12
12
|
* ⚠️ 警告:此文件由脚本自动生成,请勿手动编辑!
|
|
13
13
|
* �� 如需修改,请重新运行生成脚本
|
|
14
14
|
* 📅 生成时间: ${new Date().toLocaleString()}
|
|
@@ -17,13 +17,38 @@ const spinnerChars = ["|", "/", "-", "\\"];
|
|
|
17
17
|
let spinnerIndex = 0;
|
|
18
18
|
let dotCount = 0;
|
|
19
19
|
const maxDots = 3;
|
|
20
|
+
|
|
21
|
+
const lyrics = [
|
|
22
|
+
"下个礼拜你有空吗",
|
|
23
|
+
"下个礼拜你有空吗",
|
|
24
|
+
"下个礼拜我们还在这里等着你",
|
|
25
|
+
"别说你太忙",
|
|
26
|
+
"别说你没空",
|
|
27
|
+
"有我们陪你一起放轻松",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
let currentLyricIndex = 0;
|
|
31
|
+
let lyricChangeTime = Date.now();
|
|
32
|
+
|
|
20
33
|
const spinner = setInterval(() => {
|
|
21
34
|
const dots = ".".repeat(dotCount);
|
|
22
|
-
|
|
35
|
+
const spinnerChar = spinnerChars[spinnerIndex];
|
|
36
|
+
|
|
37
|
+
if (Date.now() - lyricChangeTime > 2000) {
|
|
38
|
+
currentLyricIndex = (currentLyricIndex + 1) % lyrics.length;
|
|
39
|
+
lyricChangeTime = Date.now();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const currentLyric = lyrics[currentLyricIndex];
|
|
43
|
+
const rhythm = ["♪", "♫", "♬"][Math.floor(Date.now() / 500) % 3];
|
|
44
|
+
|
|
45
|
+
// 一行显示,用空格清除之前的内容
|
|
46
|
+
const displayText = `${rhythm} ${currentLyric} ${spinnerChar} 正在玩命加载中${dots}`;
|
|
47
|
+
process.stdout.write(`\r${displayText}${" ".repeat(50)}`);
|
|
48
|
+
|
|
23
49
|
spinnerIndex = (spinnerIndex + 1) % spinnerChars.length;
|
|
24
50
|
dotCount = (dotCount + 1) % (maxDots + 1);
|
|
25
51
|
}, 300);
|
|
26
|
-
|
|
27
52
|
// 设置文件为只读权限
|
|
28
53
|
function setFileReadOnly(filePath) {
|
|
29
54
|
try {
|
package/src/api/run.js
CHANGED
|
@@ -8,7 +8,7 @@ const path = require("path");
|
|
|
8
8
|
const swaggerUrl = process.argv[2] ? `${process.argv[2]}/swagger/v1/swagger.json` : "";
|
|
9
9
|
const outputPath = process.argv[3] || "src/api/swagger.js";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const defaultRemark = `/**
|
|
12
12
|
* ⚠️ 警告:此文件由脚本自动生成,请勿手动编辑!
|
|
13
13
|
* �� 如需修改,请重新运行生成脚本
|
|
14
14
|
* 📅 生成时间: ${new Date().toLocaleString()}
|
|
@@ -17,13 +17,38 @@ const spinnerChars = ["|", "/", "-", "\\"];
|
|
|
17
17
|
let spinnerIndex = 0;
|
|
18
18
|
let dotCount = 0;
|
|
19
19
|
const maxDots = 3;
|
|
20
|
+
|
|
21
|
+
const lyrics = [
|
|
22
|
+
"下个礼拜你有空吗",
|
|
23
|
+
"下个礼拜你有空吗",
|
|
24
|
+
"下个礼拜我们还在这里等着你",
|
|
25
|
+
"别说你太忙",
|
|
26
|
+
"别说你没空",
|
|
27
|
+
"有我们陪你一起放轻松",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
let currentLyricIndex = 0;
|
|
31
|
+
let lyricChangeTime = Date.now();
|
|
32
|
+
|
|
20
33
|
const spinner = setInterval(() => {
|
|
21
34
|
const dots = ".".repeat(dotCount);
|
|
22
|
-
|
|
35
|
+
const spinnerChar = spinnerChars[spinnerIndex];
|
|
36
|
+
|
|
37
|
+
if (Date.now() - lyricChangeTime > 2000) {
|
|
38
|
+
currentLyricIndex = (currentLyricIndex + 1) % lyrics.length;
|
|
39
|
+
lyricChangeTime = Date.now();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const currentLyric = lyrics[currentLyricIndex];
|
|
43
|
+
const rhythm = ["♪", "♫", "♬"][Math.floor(Date.now() / 500) % 3];
|
|
44
|
+
|
|
45
|
+
// 一行显示,用空格清除之前的内容
|
|
46
|
+
const displayText = `${rhythm} ${currentLyric} ${spinnerChar} 正在玩命加载中${dots}`;
|
|
47
|
+
process.stdout.write(`\r${displayText}${" ".repeat(50)}`);
|
|
48
|
+
|
|
23
49
|
spinnerIndex = (spinnerIndex + 1) % spinnerChars.length;
|
|
24
50
|
dotCount = (dotCount + 1) % (maxDots + 1);
|
|
25
51
|
}, 300);
|
|
26
|
-
|
|
27
52
|
// 设置文件为只读权限
|
|
28
53
|
function setFileReadOnly(filePath) {
|
|
29
54
|
try {
|
package/src/bin/add.js
CHANGED
|
@@ -112,6 +112,7 @@ try {
|
|
|
112
112
|
let editUrl = "";
|
|
113
113
|
let deleteUrl = "";
|
|
114
114
|
let detailUrl = "";
|
|
115
|
+
let rowId = "";
|
|
115
116
|
|
|
116
117
|
// 如果有新增/编辑/删除/详情功能,直接使用分页接口地址
|
|
117
118
|
if (operationsAnswer.operations.length > 0) {
|
|
@@ -137,11 +138,11 @@ try {
|
|
|
137
138
|
{
|
|
138
139
|
type: "input",
|
|
139
140
|
name: "idField",
|
|
140
|
-
message: "请输入ID字段名:",
|
|
141
|
+
message: "请输入url后缀ID字段名:",
|
|
141
142
|
default: "admissionInfoId",
|
|
142
143
|
validate: input => {
|
|
143
144
|
if (!input.trim()) {
|
|
144
|
-
return "ID字段名不能为空";
|
|
145
|
+
return "url后缀ID字段名不能为空";
|
|
145
146
|
}
|
|
146
147
|
return true;
|
|
147
148
|
},
|
|
@@ -164,6 +165,29 @@ try {
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
//如果有编辑/详情/删除,询问row中的id字段名
|
|
169
|
+
if (
|
|
170
|
+
operationsAnswer.operations.includes("edit") ||
|
|
171
|
+
operationsAnswer.operations.includes("delete") ||
|
|
172
|
+
operationsAnswer.operations.includes("detail")
|
|
173
|
+
) {
|
|
174
|
+
const rowIdAnswer = await inquirer.prompt([
|
|
175
|
+
{
|
|
176
|
+
type: "input",
|
|
177
|
+
name: "rowId",
|
|
178
|
+
message: "请输入行数据中ID字段的键名(用于编辑/详情/删除操作)",
|
|
179
|
+
default: "id",
|
|
180
|
+
validate: input => {
|
|
181
|
+
if (!input.trim()) {
|
|
182
|
+
return "ID字段的键名不能为空";
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
]);
|
|
188
|
+
rowId = rowIdAnswer.rowId;
|
|
189
|
+
}
|
|
190
|
+
|
|
167
191
|
// 4. 询问所有接口的模块名
|
|
168
192
|
const moduleAnswer = await inquirer.prompt([
|
|
169
193
|
{
|
|
@@ -213,6 +237,7 @@ try {
|
|
|
213
237
|
detailUrl: detailUrl,
|
|
214
238
|
swaggerModule: moduleAnswer.swaggerModule,
|
|
215
239
|
idField: idField,
|
|
240
|
+
rowId,
|
|
216
241
|
};
|
|
217
242
|
|
|
218
243
|
// 生成模板内容
|
|
@@ -227,37 +252,6 @@ try {
|
|
|
227
252
|
|
|
228
253
|
// 输出成功信息
|
|
229
254
|
console.log(`✅ 模板已生成并保存到 ${outputPath}`);
|
|
230
|
-
console.log(` 文件路径: ${outputPath}`);
|
|
231
|
-
|
|
232
|
-
// 输出功能总结
|
|
233
|
-
const features = [];
|
|
234
|
-
if (exportAnswer.hasExport) features.push("导出功能");
|
|
235
|
-
if (operationsAnswer.operations.includes("add")) features.push("新增功能");
|
|
236
|
-
if (operationsAnswer.operations.includes("edit")) features.push("编辑功能");
|
|
237
|
-
if (operationsAnswer.operations.includes("delete")) features.push("删除功能");
|
|
238
|
-
if (operationsAnswer.operations.includes("detail")) features.push("详情功能");
|
|
239
|
-
|
|
240
|
-
if (features.length > 0) {
|
|
241
|
-
console.log(`🔧 已添加功能: ${features.join(", ")}`);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
console.log(`📚 模块名: ${moduleAnswer.swaggerModule}`);
|
|
245
|
-
if (idField) {
|
|
246
|
-
console.log(`🆔 ID字段: ${idField}`);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// 显示接口地址预览
|
|
250
|
-
if (operationsAnswer.operations.length > 0) {
|
|
251
|
-
const pageUrl = pageUrlAnswer.pageUrl;
|
|
252
|
-
const baseUrl = pageUrl.replace(/-paged-result.*$/, "").replace(/\/[^\/]*$/, "");
|
|
253
|
-
console.log(`🔗 基础接口: ${baseUrl}`);
|
|
254
|
-
if (addUrl) console.log(`➕ 新增接口: ${addUrl}`);
|
|
255
|
-
if (editUrl) console.log(`✏️ 编辑接口: ${editUrl}`);
|
|
256
|
-
if (deleteUrl) console.log(`��️ 删除接口: ${deleteUrl}`);
|
|
257
|
-
if (detailUrl) console.log(`��️ 详情接口: ${detailUrl}`);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
console.log("\n 模板生成完成!");
|
|
261
255
|
} catch (error) {
|
|
262
256
|
stopSpinner();
|
|
263
257
|
console.error("❌ 发生错误:", error.message);
|
package/src/bin/initTemplate.js
CHANGED
|
@@ -29,8 +29,6 @@ function generateKeyName(url, method) {
|
|
|
29
29
|
return `${method.toLowerCase()}${key}`;
|
|
30
30
|
}
|
|
31
31
|
const vue2Template = (moduleName, config = {}) => {
|
|
32
|
-
console.log(888, config);
|
|
33
|
-
|
|
34
32
|
// 生成各种接口的key名称
|
|
35
33
|
let pageUrlKey = "",
|
|
36
34
|
exportUrlKey = "",
|
|
@@ -42,11 +40,17 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
42
40
|
|
|
43
41
|
if (config.pageUrl) pageUrlKey = generateKeyName(config.pageUrl, "get");
|
|
44
42
|
if (config.exportUrl) exportUrlKey = generateKeyName(config.exportUrl, "post");
|
|
45
|
-
if (config.detailUrl)
|
|
46
|
-
|
|
43
|
+
if (config.detailUrl) {
|
|
44
|
+
detailUrlKey = generateKeyName(config.detailUrl, "get");
|
|
45
|
+
baseUrlKey = `${detailUrlKey}CompleteUrl`; //补充后缀
|
|
46
|
+
}
|
|
47
|
+
if (config.editUrl) {
|
|
48
|
+
editUrlKey = generateKeyName(config.editUrl, "put");
|
|
49
|
+
baseUrlKey = `${editUrlKey}CompleteUrl`; //补充后缀
|
|
50
|
+
}
|
|
47
51
|
if (config.addUrl) baseUrlKey = addUrlKey = generateKeyName(config.addUrl, "post");
|
|
48
52
|
if (config.deleteUrl) deleteUrlKey = generateKeyName(config.deleteUrl, "delete");
|
|
49
|
-
|
|
53
|
+
|
|
50
54
|
// 生成导入语句
|
|
51
55
|
const generateImports = () => {
|
|
52
56
|
const imports = [];
|
|
@@ -69,14 +73,6 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
69
73
|
}`);
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
// if (config.hasEdit) {
|
|
73
|
-
// methods.push(`
|
|
74
|
-
// editBtnHandler() {
|
|
75
|
-
// this.form.type = 2;
|
|
76
|
-
// this.dialogVisible = true;
|
|
77
|
-
// }`);
|
|
78
|
-
// }
|
|
79
|
-
|
|
80
76
|
if (config.hasEdit) {
|
|
81
77
|
methods.push(`
|
|
82
78
|
${config.hasDetail ? `async ` : ``}editBtnHandler() {
|
|
@@ -86,7 +82,7 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
86
82
|
this.form.type = 2;
|
|
87
83
|
${
|
|
88
84
|
config.hasDetail
|
|
89
|
-
? `const { result = {} } = await ${detailUrlKey}(row.${config.
|
|
85
|
+
? `const { result = {} } = await ${detailUrlKey}(row.${config.rowId});
|
|
90
86
|
this.form.value = result || {};`
|
|
91
87
|
: `this.form.value = { ...row };`
|
|
92
88
|
}
|
|
@@ -113,7 +109,7 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
113
109
|
this.$message("新建成功");
|
|
114
110
|
}else if(form.type === 2){
|
|
115
111
|
//编辑
|
|
116
|
-
const res = await ${editUrlKey}(data['${config.
|
|
112
|
+
const res = await ${editUrlKey}(data['${config.rowId}'], data);
|
|
117
113
|
if(res.code !== 200) return;
|
|
118
114
|
this.$message("编辑成功");
|
|
119
115
|
this.init();
|
|
@@ -134,7 +130,7 @@ const vue2Template = (moduleName, config = {}) => {
|
|
|
134
130
|
cancelButtonText: '取消',
|
|
135
131
|
type: 'warning'
|
|
136
132
|
}).then(() => {
|
|
137
|
-
${deleteUrlKey}(row.${config.
|
|
133
|
+
${deleteUrlKey}(row.${config.rowId}).then(() => {
|
|
138
134
|
this.$message.success('删除成功');
|
|
139
135
|
this.init();
|
|
140
136
|
}).catch(() => {
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
</div>
|
|
169
169
|
</div>
|
|
170
170
|
</template>
|
|
171
|
-
|
|
171
|
+
<!--
|
|
172
172
|
# BaseForm 基础表单组件
|
|
173
173
|
|
|
174
174
|
## Props 属性
|
|
@@ -210,8 +210,7 @@
|
|
|
210
210
|
| onCancel | 取消按钮点击事件 | - |
|
|
211
211
|
| selectChange| 选择器值变化事件 | {obj: 当前项配置, val: 变化后的值} |
|
|
212
212
|
-->
|
|
213
|
-
|
|
214
|
-
import { getData } from "../../index.js";
|
|
213
|
+
<script>
|
|
215
214
|
import { initForm } from "../../../utils/initData.js";
|
|
216
215
|
|
|
217
216
|
// interface FormItem {
|
|
@@ -340,7 +339,7 @@ export default {
|
|
|
340
339
|
}
|
|
341
340
|
},
|
|
342
341
|
selectChange(obj, val) {
|
|
343
|
-
|
|
342
|
+
const temp = {
|
|
344
343
|
obj: obj,
|
|
345
344
|
val: val,
|
|
346
345
|
};
|
|
@@ -386,11 +385,10 @@ export default {
|
|
|
386
385
|
},
|
|
387
386
|
};
|
|
388
387
|
</script>
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
|
|
389
|
+
<style lang="scss" scoped>
|
|
391
390
|
.dialog-footer {
|
|
392
391
|
display: flex;
|
|
393
392
|
justify-content: flex-end;
|
|
394
393
|
}
|
|
395
394
|
</style>
|
|
396
|
-
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="formSearch formSearchArrowUp">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
5
|
-
formSearchData.tableSearch && formSearchData.tableSearch.length >= 0
|
|
6
|
-
"
|
|
4
|
+
v-if="formSearchData.tableSearch && formSearchData.tableSearch.length >= 0"
|
|
7
5
|
class="table-header"
|
|
8
6
|
>
|
|
9
7
|
<el-form
|
|
@@ -20,11 +18,7 @@
|
|
|
20
18
|
<!-- 'label-width': '100px', -->
|
|
21
19
|
<div
|
|
22
20
|
class="transitionGroup"
|
|
23
|
-
:class="[
|
|
24
|
-
formSearchData.expendShow
|
|
25
|
-
? 'formSearchBtnArrowDowns'
|
|
26
|
-
: 'formSearchBtnArrowUps',
|
|
27
|
-
]"
|
|
21
|
+
:class="[formSearchData.expendShow ? 'formSearchBtnArrowDowns' : 'formSearchBtnArrowUps']"
|
|
28
22
|
>
|
|
29
23
|
<el-form-item
|
|
30
24
|
v-for="item in findTableSearch"
|
|
@@ -113,11 +107,7 @@
|
|
|
113
107
|
style="width: 100%"
|
|
114
108
|
:placeholder="item.props.placeholder || '选择日期'"
|
|
115
109
|
v-bind="item.props || { type: 'date' }"
|
|
116
|
-
:default-time="
|
|
117
|
-
item.props.type == 'datetimerange'
|
|
118
|
-
? ['00:00:00', '23:59:59']
|
|
119
|
-
: ''
|
|
120
|
-
"
|
|
110
|
+
:default-time="item.props.type == 'datetimerange' ? ['00:00:00', '23:59:59'] : ''"
|
|
121
111
|
/>
|
|
122
112
|
<el-input
|
|
123
113
|
v-else
|
|
@@ -138,11 +128,7 @@
|
|
|
138
128
|
<el-form-item
|
|
139
129
|
style="word-break: keep-all; white-space: nowrap; margin-left: 10px"
|
|
140
130
|
class="fromBtn"
|
|
141
|
-
:class="[
|
|
142
|
-
formSearchData.expendShow
|
|
143
|
-
? 'formSearchBtnArrowDown'
|
|
144
|
-
: 'formSearchBtnArrowUp',
|
|
145
|
-
]"
|
|
131
|
+
:class="[formSearchData.expendShow ? 'formSearchBtnArrowDown' : 'formSearchBtnArrowUp']"
|
|
146
132
|
>
|
|
147
133
|
<el-button
|
|
148
134
|
v-if="formSearchData.reset"
|
|
@@ -197,9 +183,7 @@ export default {
|
|
|
197
183
|
"el-select-loadmore": {
|
|
198
184
|
bind(el, binding) {
|
|
199
185
|
// 获取element-ui定义好的scroll盒子
|
|
200
|
-
const SELECTWRAP_DOM = el.querySelector(
|
|
201
|
-
".el-select-dropdown .el-select-dropdown__wrap"
|
|
202
|
-
);
|
|
186
|
+
const SELECTWRAP_DOM = el.querySelector(".el-select-dropdown .el-select-dropdown__wrap");
|
|
203
187
|
SELECTWRAP_DOM.addEventListener("scroll", function () {
|
|
204
188
|
/**
|
|
205
189
|
* scrollHeight 获取元素内容高度(只读)
|
|
@@ -208,8 +192,7 @@ export default {
|
|
|
208
192
|
* 如果元素滚动到底, 下面等式返回true, 没有则返回false:
|
|
209
193
|
* ele.scrollHeight - ele.scrollTop === ele.clientHeight;
|
|
210
194
|
*/
|
|
211
|
-
const condition =
|
|
212
|
-
this.scrollHeight - this.scrollTop <= this.clientHeight;
|
|
195
|
+
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
|
|
213
196
|
if (condition > 0 && condition < 2) {
|
|
214
197
|
binding.value();
|
|
215
198
|
}
|
|
@@ -220,9 +203,7 @@ export default {
|
|
|
220
203
|
bind(el, binding, vnode) {
|
|
221
204
|
// console.log(binding.value)
|
|
222
205
|
const _that = vnode.context; // 当前vue对象
|
|
223
|
-
const SELECTWRAP_DOM = el.querySelector(
|
|
224
|
-
".el-select-dropdown .el-select-dropdown__wrap"
|
|
225
|
-
);
|
|
206
|
+
const SELECTWRAP_DOM = el.querySelector(".el-select-dropdown .el-select-dropdown__wrap");
|
|
226
207
|
SELECTWRAP_DOM.addEventListener("scroll", function () {
|
|
227
208
|
// console.log(SELECTWRAP_DOM.scrollHeight) // 文档内容的实际高度
|
|
228
209
|
// console.log(SELECTWRAP_DOM.scrollTop) // 滚动条滚动高度
|
|
@@ -240,9 +221,7 @@ export default {
|
|
|
240
221
|
unbind(el, binding, vnode) {
|
|
241
222
|
// 解除事件监听
|
|
242
223
|
const _that = vnode.context; // 当前vue对象
|
|
243
|
-
const SELECTWRAP_DOM = el.querySelector(
|
|
244
|
-
".el-select-dropdown .el-select-dropdown__wrap"
|
|
245
|
-
);
|
|
224
|
+
const SELECTWRAP_DOM = el.querySelector(".el-select-dropdown .el-select-dropdown__wrap");
|
|
246
225
|
if (SELECTWRAP_DOM) {
|
|
247
226
|
SELECTWRAP_DOM.removeEventListener("scroll", function () {
|
|
248
227
|
binding.value.SELECTWRAP_DOM_index = 0;
|
|
@@ -320,11 +299,10 @@ export default {
|
|
|
320
299
|
methods: {
|
|
321
300
|
async init() {
|
|
322
301
|
const swaggerData = await getData();
|
|
323
|
-
const swaggersearchColumns =
|
|
324
|
-
|
|
325
|
-
swaggersearchColumns.forEach((item) => {
|
|
302
|
+
const swaggersearchColumns = swaggerData.paths[this.url].get.parameters || [];
|
|
303
|
+
swaggersearchColumns.forEach(item => {
|
|
326
304
|
let tempItem = this.formSearchData.tableSearch.find(
|
|
327
|
-
|
|
305
|
+
e => e.value.toLowerCase() === item.name.toLowerCase()
|
|
328
306
|
);
|
|
329
307
|
if (tempItem) {
|
|
330
308
|
// 匹配到
|
|
@@ -340,7 +318,7 @@ export default {
|
|
|
340
318
|
if (item.schema.enum && Array.isArray(item.schema.enum)) {
|
|
341
319
|
//枚举值
|
|
342
320
|
pushItem.inputType = "select";
|
|
343
|
-
pushItem.children = item.schema.enum.map(
|
|
321
|
+
pushItem.children = item.schema.enum.map(e => ({
|
|
344
322
|
key: e,
|
|
345
323
|
value: e,
|
|
346
324
|
}));
|
|
@@ -357,13 +335,13 @@ export default {
|
|
|
357
335
|
});
|
|
358
336
|
|
|
359
337
|
const tableHasCreatedTime = this.formSearchData.tableSearch.some(
|
|
360
|
-
|
|
338
|
+
e => e.value === "createdTime"
|
|
361
339
|
);
|
|
362
340
|
if (!tableHasCreatedTime) {
|
|
363
341
|
// 单独处理创建时间 就是BeginTime,EndTime
|
|
364
342
|
const requiredNames = ["BeginTime", "EndTime"];
|
|
365
|
-
const hseCreatedTime = requiredNames.every(
|
|
366
|
-
swaggersearchColumns.some(
|
|
343
|
+
const hseCreatedTime = requiredNames.every(name =>
|
|
344
|
+
swaggersearchColumns.some(item => item.name === name)
|
|
367
345
|
);
|
|
368
346
|
if (hseCreatedTime) {
|
|
369
347
|
this.formSearchData.tableSearch.push({
|
|
@@ -385,10 +363,7 @@ export default {
|
|
|
385
363
|
this.formSearchData.tableSearch.length > this.tableSearchSlice
|
|
386
364
|
? this.formSearchData.tableSearch.slice(0, this.tableSearchSlice)
|
|
387
365
|
: this.formSearchData.tableSearch;
|
|
388
|
-
console.log(
|
|
389
|
-
`\x1b[36m\x1b[4mol插件-搜索框渲染`,
|
|
390
|
-
this.formSearchData.tableSearch
|
|
391
|
-
);
|
|
366
|
+
console.log(`\x1b[36m\x1b[4mol插件-搜索框渲染`, this.formSearchData.tableSearch);
|
|
392
367
|
},
|
|
393
368
|
// 树形下拉
|
|
394
369
|
getValue(val) {
|
|
@@ -405,7 +380,7 @@ export default {
|
|
|
405
380
|
}
|
|
406
381
|
const tempFormSearch = Object.assign({}, this.formSearch);
|
|
407
382
|
if (this.formSearchData.rules) {
|
|
408
|
-
return this.$refs[formName].validate(
|
|
383
|
+
return this.$refs[formName].validate(valid => {
|
|
409
384
|
if (!valid) return false;
|
|
410
385
|
this.$emit("handleSearch", tempFormSearch, item);
|
|
411
386
|
});
|
|
@@ -421,25 +396,13 @@ export default {
|
|
|
421
396
|
this.$refs[formName].resetFields();
|
|
422
397
|
if (this.formSearchData.reset) {
|
|
423
398
|
for (const key in this.formSearch) {
|
|
424
|
-
if (
|
|
425
|
-
Object.prototype.toString.call(this.formSearch[key]) ===
|
|
426
|
-
"[object String]"
|
|
427
|
-
) {
|
|
399
|
+
if (Object.prototype.toString.call(this.formSearch[key]) === "[object String]") {
|
|
428
400
|
this.formSearch[key] = null;
|
|
429
|
-
} else if (
|
|
430
|
-
Object.prototype.toString.call(this.formSearch[key]) ===
|
|
431
|
-
"[object Array]"
|
|
432
|
-
) {
|
|
401
|
+
} else if (Object.prototype.toString.call(this.formSearch[key]) === "[object Array]") {
|
|
433
402
|
this.formSearch[key] = [];
|
|
434
|
-
} else if (
|
|
435
|
-
Object.prototype.toString.call(this.formSearch[key]) ===
|
|
436
|
-
"[object Object]"
|
|
437
|
-
) {
|
|
403
|
+
} else if (Object.prototype.toString.call(this.formSearch[key]) === "[object Object]") {
|
|
438
404
|
this.formSearch[key] = {};
|
|
439
|
-
} else if (
|
|
440
|
-
Object.prototype.toString.call(this.formSearch[key]) ===
|
|
441
|
-
"[object Boolean]"
|
|
442
|
-
) {
|
|
405
|
+
} else if (Object.prototype.toString.call(this.formSearch[key]) === "[object Boolean]") {
|
|
443
406
|
this.formSearch[key] = false;
|
|
444
407
|
} else {
|
|
445
408
|
this.formSearch[key] = null;
|
|
@@ -458,10 +421,7 @@ export default {
|
|
|
458
421
|
handleExpend() {
|
|
459
422
|
this.expend = !this.expend; // 展开和收起
|
|
460
423
|
this.findTableSearch = this.expend
|
|
461
|
-
? this.formSearchData.tableSearch.slice(
|
|
462
|
-
0,
|
|
463
|
-
this.formSearchData.tableSearch.length
|
|
464
|
-
)
|
|
424
|
+
? this.formSearchData.tableSearch.slice(0, this.formSearchData.tableSearch.length)
|
|
465
425
|
: this.formSearchData.tableSearch.slice(0, this.tableSearchSlice);
|
|
466
426
|
|
|
467
427
|
this.$emit("btnHandleExpend", this.expend);
|
|
@@ -475,13 +435,7 @@ export default {
|
|
|
475
435
|
keyInput(item, e) {
|
|
476
436
|
if (item.inputType === "number") {
|
|
477
437
|
let key = e.key;
|
|
478
|
-
if (
|
|
479
|
-
key === "e" ||
|
|
480
|
-
key === "E" ||
|
|
481
|
-
key === "-" ||
|
|
482
|
-
key === "+" ||
|
|
483
|
-
key === "."
|
|
484
|
-
) {
|
|
438
|
+
if (key === "e" || key === "E" || key === "-" || key === "+" || key === ".") {
|
|
485
439
|
e.returnValue = false;
|
|
486
440
|
return false;
|
|
487
441
|
}
|