leisure-core 0.4.41 → 0.4.43
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/index.js +3 -0
- package/le-common-page/index.js +7 -0
- package/le-common-page/src/main.vue +211 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
formatMoney,
|
|
5
5
|
formatCurrency,
|
|
6
6
|
} from "leisure-js/common/dformat";
|
|
7
|
+
import LeCommonPage from "./le-common-page/index.js";
|
|
7
8
|
import LeArea from "./le-area/index.js";
|
|
8
9
|
import LeLogin from "./le-login/index.js";
|
|
9
10
|
import LeHome from "./le-home/index.js";
|
|
@@ -93,6 +94,7 @@ const components = [
|
|
|
93
94
|
LeAdSpace,
|
|
94
95
|
LeAd,
|
|
95
96
|
LeCp,
|
|
97
|
+
LeCommonPage,
|
|
96
98
|
];
|
|
97
99
|
|
|
98
100
|
const install = function (Vue) {
|
|
@@ -210,4 +212,5 @@ export default {
|
|
|
210
212
|
LeAdSpace,
|
|
211
213
|
LeAd,
|
|
212
214
|
LeCp,
|
|
215
|
+
LeCommonPage,
|
|
213
216
|
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-container">
|
|
3
|
+
<el-form :inline="true" class="demo-form-inline" :model="searchData">
|
|
4
|
+
<slot name="paramSlot"></slot>
|
|
5
|
+
<el-form-item>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
<el-button type="primary" @click="onClickQuery()">查询</el-button>
|
|
8
|
+
<el-button type="primary" @click="addItem()" v-if="isDispAddBtn"
|
|
9
|
+
>新建</el-button
|
|
10
|
+
>
|
|
11
|
+
</el-form-item>
|
|
12
|
+
</el-form>
|
|
13
|
+
<el-table
|
|
14
|
+
:data="tableData"
|
|
15
|
+
border
|
|
16
|
+
row-key="id"
|
|
17
|
+
:header-cell-style="{ 'text-align': 'center' }"
|
|
18
|
+
:cell-style="{ 'text-align': 'center' }"
|
|
19
|
+
stripe
|
|
20
|
+
style="width: 100%"
|
|
21
|
+
>
|
|
22
|
+
<el-table-column
|
|
23
|
+
v-for="column in tableColumns"
|
|
24
|
+
:key="column.prop"
|
|
25
|
+
:prop="column.prop"
|
|
26
|
+
:label="column.label"
|
|
27
|
+
>
|
|
28
|
+
</el-table-column>
|
|
29
|
+
<el-table-column fixed="right" label="操作" align="center">
|
|
30
|
+
<template slot-scope="scope">
|
|
31
|
+
<div class="rowBtns">
|
|
32
|
+
<el-button type="primary" size="small" @click="editItem(scope.row)"
|
|
33
|
+
>编辑</el-button
|
|
34
|
+
>
|
|
35
|
+
<el-popconfirm
|
|
36
|
+
v-if="isDispDelBtn"
|
|
37
|
+
:title="`该操作不可逆,确定删除?`"
|
|
38
|
+
@confirm="del(scope.row.id)"
|
|
39
|
+
>
|
|
40
|
+
<template #reference>
|
|
41
|
+
<el-button type="danger" size="small" style="margin-left: 10px"
|
|
42
|
+
>删除
|
|
43
|
+
</el-button>
|
|
44
|
+
</template>
|
|
45
|
+
</el-popconfirm>
|
|
46
|
+
<div class="rowBtnsExt">
|
|
47
|
+
<slot name="rowBtns"></slot>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
</el-table-column>
|
|
52
|
+
</el-table>
|
|
53
|
+
<div style="text-align: center; margin-top: 30px">
|
|
54
|
+
<el-pagination
|
|
55
|
+
background
|
|
56
|
+
layout="prev, pager, next"
|
|
57
|
+
:current-page="searchData.pageNo"
|
|
58
|
+
:total="searchData.total"
|
|
59
|
+
:page-size="searchData.pageSize"
|
|
60
|
+
@current-change="current_change"
|
|
61
|
+
>
|
|
62
|
+
</el-pagination>
|
|
63
|
+
</div>
|
|
64
|
+
<le-dialog-container
|
|
65
|
+
title="商品详情"
|
|
66
|
+
:width="popFormWidth"
|
|
67
|
+
:showDialog="showDialog"
|
|
68
|
+
@close="closeDialog"
|
|
69
|
+
:showFooter="true"
|
|
70
|
+
@saveData="saveData"
|
|
71
|
+
>
|
|
72
|
+
<el-form
|
|
73
|
+
:model="formPop"
|
|
74
|
+
:rules="rulePop"
|
|
75
|
+
ref="ruleForm"
|
|
76
|
+
label-width="100px"
|
|
77
|
+
>
|
|
78
|
+
<el-form-item
|
|
79
|
+
v-for="(item, index) in tableColumns"
|
|
80
|
+
:key="index"
|
|
81
|
+
:label="item.label"
|
|
82
|
+
:prop="item.prop"
|
|
83
|
+
>
|
|
84
|
+
<el-input v-model="formPop[item.prop]" />
|
|
85
|
+
</el-form-item>
|
|
86
|
+
</el-form>
|
|
87
|
+
</le-dialog-container>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
<script>
|
|
91
|
+
export default {
|
|
92
|
+
name: "le-common-page",
|
|
93
|
+
props: {
|
|
94
|
+
tableData: {
|
|
95
|
+
type: Array,
|
|
96
|
+
default: () => [],
|
|
97
|
+
},
|
|
98
|
+
tableColumns: {
|
|
99
|
+
type: Array,
|
|
100
|
+
default: () => [],
|
|
101
|
+
},
|
|
102
|
+
queryParams: {
|
|
103
|
+
type: Object,
|
|
104
|
+
default: () => {},
|
|
105
|
+
},
|
|
106
|
+
rulePop: {
|
|
107
|
+
type: Object,
|
|
108
|
+
default: () => {},
|
|
109
|
+
},
|
|
110
|
+
searchParam: {
|
|
111
|
+
type: Object,
|
|
112
|
+
default: () => {},
|
|
113
|
+
},
|
|
114
|
+
isDispAddBtn: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: true,
|
|
117
|
+
},
|
|
118
|
+
isDispDelBtn: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
popFormWidth: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: "80%",
|
|
125
|
+
},
|
|
126
|
+
popLabelWidth: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: "100px",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
watch: {
|
|
132
|
+
searchParam: {
|
|
133
|
+
handler(val) {
|
|
134
|
+
this.searchData = Object.assign({}, this.searchData, val);
|
|
135
|
+
},
|
|
136
|
+
deep: true,
|
|
137
|
+
immediate: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
data() {
|
|
141
|
+
return {
|
|
142
|
+
formPop: {},
|
|
143
|
+
searchData: {
|
|
144
|
+
pageNo: 1,
|
|
145
|
+
total: 1,
|
|
146
|
+
pageSize: 10,
|
|
147
|
+
},
|
|
148
|
+
showDialog: false,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
computed: {},
|
|
152
|
+
mounted() {
|
|
153
|
+
this.getList();
|
|
154
|
+
},
|
|
155
|
+
methods: {
|
|
156
|
+
onClickQuery() {
|
|
157
|
+
this.searchData.pageNo = 1;
|
|
158
|
+
this.getList();
|
|
159
|
+
},
|
|
160
|
+
getList() {
|
|
161
|
+
let params = this.searchData;
|
|
162
|
+
this.$emit("getList", params);
|
|
163
|
+
},
|
|
164
|
+
current_change(currentPage) {
|
|
165
|
+
this.searchData.pageNo = currentPage;
|
|
166
|
+
this.getList();
|
|
167
|
+
},
|
|
168
|
+
del(id) {
|
|
169
|
+
this.$emit("delRow", id, () => {
|
|
170
|
+
this.getList();
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
editItem(row) {
|
|
174
|
+
this.formPop = row;
|
|
175
|
+
this.showDialog = true;
|
|
176
|
+
},
|
|
177
|
+
addItem() {
|
|
178
|
+
this.formPop = {};
|
|
179
|
+
this.showDialog = true;
|
|
180
|
+
},
|
|
181
|
+
saveData() {
|
|
182
|
+
let params = JSON.stringify(this.formPop);
|
|
183
|
+
if (params == "{}") return;
|
|
184
|
+
this.$refs["ruleForm"].validate((valid) => {
|
|
185
|
+
if (valid) {
|
|
186
|
+
this.$emit("saveForm", this.formPop, () => {
|
|
187
|
+
this.getList();
|
|
188
|
+
});
|
|
189
|
+
} else {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
closeDialog() {
|
|
195
|
+
this.formPop = {};
|
|
196
|
+
this.showDialog = false;
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
</script>
|
|
201
|
+
<style lang="less" scoped>
|
|
202
|
+
.rowBtns {
|
|
203
|
+
display: flex;
|
|
204
|
+
display: -webkit-flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.rowBtnsExt {
|
|
209
|
+
margin-left: 8px;
|
|
210
|
+
}
|
|
211
|
+
</style>
|