ol-base-components 0.3.0 → 0.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/README.md +304 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,305 @@
|
|
|
1
1
|
# base-component
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
二次封装的通用组件库,包含表格(Table)和表单(Form)等组件。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
您可以通过 npm 安装这个组件库:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install ol-base-components
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 使用说明
|
|
14
|
+
|
|
15
|
+
在您的 Vue 项目中,您需要在入口文件(通常是 `main.js` 或 `app.js`)中导入并使用该组件库:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
// main.js
|
|
19
|
+
import Vue from "vue";
|
|
20
|
+
import App from "./App.vue";
|
|
21
|
+
import OlBaseComponents from "ol-base-components"; // 导入组件库
|
|
22
|
+
|
|
23
|
+
// 使用组件库
|
|
24
|
+
Vue.use(OlBaseComponents);
|
|
25
|
+
|
|
26
|
+
new Vue({
|
|
27
|
+
render: (h) => h(App),
|
|
28
|
+
}).$mount("#app");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 组件示例
|
|
32
|
+
|
|
33
|
+
### 搜索框组件
|
|
34
|
+
|
|
35
|
+
您可以在您的组件中使用搜索框组件组件,例如:
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<div>
|
|
40
|
+
<ol-search
|
|
41
|
+
:form-search-data="formSearchData"
|
|
42
|
+
@handleSearch="handleSearch"
|
|
43
|
+
@handleReset="handleReset"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
export default {
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
formSearchData: {
|
|
53
|
+
reset: true,
|
|
54
|
+
expendShow: false,
|
|
55
|
+
value: {
|
|
56
|
+
WarehouseCode: null,
|
|
57
|
+
WarehouseName: null,
|
|
58
|
+
},
|
|
59
|
+
tableSearch: [
|
|
60
|
+
{
|
|
61
|
+
label: "仓库编码",
|
|
62
|
+
value: "WarehouseCode",
|
|
63
|
+
inputType: "text",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "仓库名称",
|
|
67
|
+
value: "WarehouseName",
|
|
68
|
+
inputType: "text",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
mounted() {
|
|
75
|
+
this.getTable();
|
|
76
|
+
},
|
|
77
|
+
method: {
|
|
78
|
+
getTable() {
|
|
79
|
+
// this.get({
|
|
80
|
+
// url: Basic.getWarehoseList,
|
|
81
|
+
// isLoading: true,
|
|
82
|
+
// data: Object.assign(this.formSearchData.value, {
|
|
83
|
+
// Page: this.paginations.page,
|
|
84
|
+
// MaxResultCount: this.paginations.limit,
|
|
85
|
+
// }),
|
|
86
|
+
// }).then((res) => {
|
|
87
|
+
// this.tableData.rows = res.result.items;
|
|
88
|
+
// this.paginations.total = res.result.totalCount;
|
|
89
|
+
// this.tableData.emptyImg = true;
|
|
90
|
+
// });
|
|
91
|
+
},
|
|
92
|
+
handleSearch(from) {
|
|
93
|
+
var self = this;
|
|
94
|
+
self.formSearchData.value = { ...from };
|
|
95
|
+
self.paginations.page = 1;
|
|
96
|
+
this.getTable(); // 获取表格数据
|
|
97
|
+
},
|
|
98
|
+
handleReset() {},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 表格组件
|
|
105
|
+
|
|
106
|
+
您可以在您的组件中使用表格组件组件,例如:
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<template>
|
|
110
|
+
<div>
|
|
111
|
+
<ol-table
|
|
112
|
+
:paginations="paginations"
|
|
113
|
+
:btnlist="this.hasBtn(this)"
|
|
114
|
+
:empty-img="tableData.emptyImg"
|
|
115
|
+
:table-data="tableData"
|
|
116
|
+
:multiple-selection="multipleSelection"
|
|
117
|
+
@SelectionChange="SelectionChange"
|
|
118
|
+
@handleSizeChange="handleSizeChange"
|
|
119
|
+
@handleindexChange="handleindexChange"
|
|
120
|
+
>
|
|
121
|
+
<template slot="classes" slot-scope="scope">
|
|
122
|
+
<div style="color: #1682e6; cursor: pointer" @click="config(scope)">
|
|
123
|
+
设置
|
|
124
|
+
</div>
|
|
125
|
+
</template>
|
|
126
|
+
</ol-table>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
export default {
|
|
132
|
+
data() {
|
|
133
|
+
return {
|
|
134
|
+
multipleSelection: [],
|
|
135
|
+
tableData: {
|
|
136
|
+
loading: false,
|
|
137
|
+
emptyImg: true,
|
|
138
|
+
options: {
|
|
139
|
+
selection: true, //多选框
|
|
140
|
+
index: null, //序号
|
|
141
|
+
headTool: true, //开启头部工具栏
|
|
142
|
+
refreshBtn: true, //开启表格头部刷新按钮
|
|
143
|
+
downloadBtn: true, //开启表格头部下载按钮
|
|
144
|
+
}, //序号和复选框
|
|
145
|
+
rows: [], //表数据
|
|
146
|
+
columns: [
|
|
147
|
+
{
|
|
148
|
+
label: "",
|
|
149
|
+
minWidth: "",
|
|
150
|
+
type: "selection",
|
|
151
|
+
show: true,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
prop: "warehouseCode",
|
|
155
|
+
label: "仓库编码",
|
|
156
|
+
minWidth: "",
|
|
157
|
+
sortable: false,
|
|
158
|
+
show: true,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
prop: "warehouseName",
|
|
162
|
+
label: "仓库名称",
|
|
163
|
+
minWidth: "",
|
|
164
|
+
sortable: false,
|
|
165
|
+
show: true,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
prop: "enabledDesc",
|
|
169
|
+
label: "状态",
|
|
170
|
+
minWidth: "",
|
|
171
|
+
sortable: false,
|
|
172
|
+
show: true,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
prop: "createdUser",
|
|
176
|
+
label: "创建人",
|
|
177
|
+
minWidth: "",
|
|
178
|
+
sortable: false,
|
|
179
|
+
show: true,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
prop: "createTime",
|
|
183
|
+
label: "创建时间",
|
|
184
|
+
minWidth: "",
|
|
185
|
+
show: true,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
prop: "classes",
|
|
189
|
+
label: "班次",
|
|
190
|
+
minWidth: "",
|
|
191
|
+
show: true,
|
|
192
|
+
renderSlot: true,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
prop: "remark",
|
|
196
|
+
label: "备注",
|
|
197
|
+
minWidth: "",
|
|
198
|
+
show: true,
|
|
199
|
+
},
|
|
200
|
+
], //表头
|
|
201
|
+
operates: [], //表格里面的操作按钮
|
|
202
|
+
tableHeightDiff: 300,
|
|
203
|
+
},
|
|
204
|
+
paginations: {
|
|
205
|
+
page: 1, //当前位于那页面
|
|
206
|
+
total: 10, //总数
|
|
207
|
+
limit: 30, //一页显示多少条
|
|
208
|
+
pagetionShow: true,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
methods: {
|
|
213
|
+
SelectionChange(row) {
|
|
214
|
+
this.multipleSelection = row;
|
|
215
|
+
},
|
|
216
|
+
handleSizeChange(val) {
|
|
217
|
+
this.paginations.page = 1;
|
|
218
|
+
this.paginations.limit = val;
|
|
219
|
+
this.getTable();
|
|
220
|
+
},
|
|
221
|
+
handleindexChange(val) {
|
|
222
|
+
this.paginations.page = val;
|
|
223
|
+
this.getTable();
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
</script>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 表单弹框组件
|
|
231
|
+
|
|
232
|
+
您可以在您的组件中使用表单弹框组件组件,例如:
|
|
233
|
+
|
|
234
|
+
```vue
|
|
235
|
+
<template>
|
|
236
|
+
<div>
|
|
237
|
+
<ol-dialogTemplate :form="form" />
|
|
238
|
+
</ol-table>
|
|
239
|
+
</div>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<script>
|
|
243
|
+
export default {
|
|
244
|
+
data() {
|
|
245
|
+
return {
|
|
246
|
+
form: {
|
|
247
|
+
dialogFormVisible: false,
|
|
248
|
+
title: "",
|
|
249
|
+
model: [
|
|
250
|
+
|
|
251
|
+
{
|
|
252
|
+
label: "字典编码",
|
|
253
|
+
type: "input",
|
|
254
|
+
prop: "code",
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
label: "字典名称",
|
|
258
|
+
type: "input",
|
|
259
|
+
prop: "displayName",
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// {
|
|
263
|
+
// label: "启用",
|
|
264
|
+
// type: "switch",
|
|
265
|
+
// prop: "enabled",
|
|
266
|
+
// },
|
|
267
|
+
|
|
268
|
+
{
|
|
269
|
+
label: "备注",
|
|
270
|
+
type: "textarea",
|
|
271
|
+
prop: "remark",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
rules: {
|
|
275
|
+
displayName: [{ required: true, message: "必填", trigger: "blur" }],
|
|
276
|
+
code: [{ required: true, message: "必填", trigger: "blur" }],
|
|
277
|
+
},
|
|
278
|
+
value: {
|
|
279
|
+
code: "",
|
|
280
|
+
displayName: "",
|
|
281
|
+
// enabled: true,
|
|
282
|
+
remark: "",
|
|
283
|
+
},
|
|
284
|
+
requestData: {
|
|
285
|
+
flage: "add",
|
|
286
|
+
url: PublicAggregate.dictionaries,
|
|
287
|
+
fn: this.getTable,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
methods: {
|
|
293
|
+
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
</script>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## 贡献
|
|
300
|
+
|
|
301
|
+
欢迎任何形式的贡献!如果您有建议或发现问题,请提交 issue 或 pull request。
|
|
302
|
+
|
|
303
|
+
## License
|
|
304
|
+
|
|
305
|
+
MIT License
|