ol-base-components 2.2.8 → 2.3.1
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 +6 -3
- package/src/api/api.js +1 -1
- package/src/api/run.js +1 -1
- package/src/bin/init.js +27 -0
- package/src/bin/initTemplate.js +118 -0
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ol-base-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "src/package/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"run": "src/api/run.js",
|
|
8
|
-
"api": "src/api/api.js"
|
|
8
|
+
"api": "src/api/api.js",
|
|
9
|
+
"init": "src/bin/init.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"serve": "vue-cli-service serve --no-verify",
|
|
12
13
|
"build": "vue-cli-service build",
|
|
13
|
-
"lint": "vue-cli-service lint"
|
|
14
|
+
"lint": "vue-cli-service lint",
|
|
15
|
+
"init": "node src/bin/init.js"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
18
|
+
"commander": "^14.0.0",
|
|
16
19
|
"core-js": "^3.8.3",
|
|
17
20
|
"element-ui": "^2.15.14",
|
|
18
21
|
"eslint": "^8.57.1",
|
package/src/api/api.js
CHANGED
package/src/api/run.js
CHANGED
package/src/bin/init.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { Command } = require("commander");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const vue2Template = require("./initTemplate");
|
|
6
|
+
const program = new Command();
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.version("0.1.0")
|
|
10
|
+
.argument("<moduleName>", "name of the module to create")
|
|
11
|
+
.option("-p, --path <customPath>", "custom path to create the module")
|
|
12
|
+
.action((moduleName, options) => {
|
|
13
|
+
const dir = path.join(options.path || process.cwd(), moduleName);
|
|
14
|
+
if (!fs.existsSync(dir)) {
|
|
15
|
+
fs.mkdirSync(dir);
|
|
16
|
+
console.log(`创建文件夹: ${dir}`);
|
|
17
|
+
const templateContent = vue2Template(moduleName);
|
|
18
|
+
fs.writeFileSync(path.join(dir, `index.vue`), templateContent);
|
|
19
|
+
} else {
|
|
20
|
+
console.log(`创建失败,文件夹 ${dir} 已存在`);
|
|
21
|
+
}
|
|
22
|
+
if (options.debug) {
|
|
23
|
+
console.log("调试信息:", options);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const vue2Template = (moduleName) => {
|
|
2
|
+
return `<!--
|
|
3
|
+
Filename: ${moduleName}.vue
|
|
4
|
+
name: ${moduleName}
|
|
5
|
+
Created Date: ${new Date().toLocaleString()}
|
|
6
|
+
Author:
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div>
|
|
10
|
+
<ol-search
|
|
11
|
+
:url="swaggerUrl.getAdmissioninfoPagedresult"
|
|
12
|
+
:form-search-data="formSearchData"
|
|
13
|
+
@handleSearch="handleSearch"
|
|
14
|
+
@handleReset="handleReset"
|
|
15
|
+
/>
|
|
16
|
+
<ol-table
|
|
17
|
+
:url="swaggerUrl.getAdmissioninfoPagedresult"
|
|
18
|
+
:paginations="paginations"
|
|
19
|
+
:btnlist="this.hasBtn(this)"
|
|
20
|
+
:empty-img="tableData.emptyImg"
|
|
21
|
+
:table-data="tableData"
|
|
22
|
+
:multiple-selection="multipleSelection"
|
|
23
|
+
@SelectionChange="SelectionChange"
|
|
24
|
+
@handleSizeChange="handleSizeChange"
|
|
25
|
+
@handleindexChange="handleindexChange"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<script>
|
|
30
|
+
import { getAdmissioninfoPagedresult } from "@/api/modules";
|
|
31
|
+
import { AdmissionInfo } from '@/api/swagger'
|
|
32
|
+
export default {
|
|
33
|
+
name: "${moduleName}",
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
swaggerUrl: AdmissionInfo,
|
|
37
|
+
multipleSelection: [],
|
|
38
|
+
// 查询表单
|
|
39
|
+
formSearchData: {
|
|
40
|
+
reset: true, // 重置
|
|
41
|
+
expendShow: true, // 展开
|
|
42
|
+
value: {},
|
|
43
|
+
tableSearch: []
|
|
44
|
+
},
|
|
45
|
+
// 表格数据
|
|
46
|
+
tableData: {
|
|
47
|
+
loading: false,
|
|
48
|
+
emptyImg: true,
|
|
49
|
+
options: {
|
|
50
|
+
selection: true, // 多选框
|
|
51
|
+
index: null, // 序号
|
|
52
|
+
headTool: true, // 开启头部工具栏
|
|
53
|
+
refreshBtn: true, // 开启表格头部刷新按钮
|
|
54
|
+
downloadBtn: true // 开启表格头部下载按钮
|
|
55
|
+
}, // 序号和复选框
|
|
56
|
+
rows: [], // 表数据
|
|
57
|
+
columns: [],
|
|
58
|
+
operatesAttrs: {},
|
|
59
|
+
operates: [], // 表格里面的操作按钮
|
|
60
|
+
tableHeightDiff: 330
|
|
61
|
+
},
|
|
62
|
+
paginations: {
|
|
63
|
+
page: 1, // 当前位于那页面
|
|
64
|
+
total: 10, // 总数
|
|
65
|
+
limit: 30, // 一页显示多少条
|
|
66
|
+
pagetionShow: true
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
created() {
|
|
71
|
+
this.init();
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
async init() {
|
|
75
|
+
const params = {
|
|
76
|
+
...this.formSearchData.value,
|
|
77
|
+
Page: this.paginations.page,
|
|
78
|
+
MaxResultCount: this.paginations.limit
|
|
79
|
+
};
|
|
80
|
+
const { result: { items = [], totalCount = 0 } = {} } = await getAdmissioninfoPagedresult(params, {
|
|
81
|
+
isLoading: true
|
|
82
|
+
});
|
|
83
|
+
this.tableData.rows = items;
|
|
84
|
+
this.paginations.total = totalCount;
|
|
85
|
+
this.tableData.emptyImg = true;
|
|
86
|
+
},
|
|
87
|
+
handleSearch(from) {
|
|
88
|
+
this.formSearchData.value = { ...from };
|
|
89
|
+
this.paginations.page = 1;
|
|
90
|
+
this.init();
|
|
91
|
+
},
|
|
92
|
+
handleReset() {
|
|
93
|
+
for (let key in this.formSearchData.value) {
|
|
94
|
+
this.formSearchData.value[key] = null;
|
|
95
|
+
}
|
|
96
|
+
this.paginations.page = 1;
|
|
97
|
+
},
|
|
98
|
+
SelectionChange(row) {
|
|
99
|
+
this.multipleSelection = row;
|
|
100
|
+
},
|
|
101
|
+
handleSizeChange(val) {
|
|
102
|
+
this.paginations.page = 1;
|
|
103
|
+
this.paginations.limit = val;
|
|
104
|
+
this.init();
|
|
105
|
+
},
|
|
106
|
+
handleindexChange(val) {
|
|
107
|
+
this.paginations.page = val;
|
|
108
|
+
this.init();
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
<style lang="scss" scoped>
|
|
114
|
+
</style>
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
module.exports = vue2Template; // Use CommonJS export
|