leisure-core 0.4.40 → 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 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,7 @@
1
+ import LeCommonPage from "./src/main.vue";
2
+
3
+ LeCommonPage.install = function (Vue) {
4
+ Vue.component(LeCommonPage.name, LeCommonPage);
5
+ };
6
+
7
+ export default LeCommonPage;
@@ -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>
@@ -224,7 +224,14 @@ export default {
224
224
  this.$store.getters.userinfo.nick || this.$store.getters.userinfo.account;
225
225
  let tab_top_dom = document.getElementsByClassName("el-tabs_");
226
226
  tab_top_dom[0].oncontextmenu = this.openContextMenu;
227
- this.$store.commit("setCname", this.companyInfo.name);
227
+ if (
228
+ this.companyInfo &&
229
+ this.companyInfo.name &&
230
+ this.companyInfo.name.length > 0
231
+ ) {
232
+ this.$store.commit("setCname", this.companyInfo.name);
233
+ }
234
+
228
235
  let dict = [
229
236
  {
230
237
  title: "是",
@@ -141,8 +141,11 @@ export default {
141
141
 
142
142
  loginAfter(res) {
143
143
  if (res.data.code == "10000") {
144
- this.$store.commit("setCid", res.data.data.cid??"");
145
- this.$store.commit("setUserInfo", res.data.data);
144
+ let data = res.data.data;
145
+ if (data && data.cid && data.cid.length > 0) {
146
+ this.$store.commit("setCid", data.cid);
147
+ }
148
+ this.$store.commit("setUserInfo", data);
146
149
  setToken(res.data.data.token);
147
150
  }
148
151
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.4.40",
3
+ "version": "0.4.43",
4
4
  "description": "leisure-core是leisure-ui-core的简称,是京心数据基于vue2.0开发的一套后台系统框架与js库,包含登录,首页框架等",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",