ol-base-components 0.3.0 → 0.3.2
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 +302 -1
- package/package.json +1 -1
- package/src/assets/effectPicture.png +0 -0
package/README.md
CHANGED
|
@@ -1,2 +1,303 @@
|
|
|
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
|
+

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