leisure-common 0.4.99
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 +20 -0
- package/le-com-activity/index.js +6 -0
- package/le-com-activity/src/main.vue +289 -0
- package/le-com-company/index.js +6 -0
- package/le-com-company/src/main.vue +118 -0
- package/le-com-employee/index.js +7 -0
- package/le-com-employee/src/main.vue +265 -0
- package/package.json +19 -0
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import LeComEmployee from "./le-com-employee/index.js";
|
|
2
|
+
import LeComActivity from "./le-com-activity/index.js";
|
|
3
|
+
import LeComCompany from "./le-com-company/index.js";
|
|
4
|
+
|
|
5
|
+
const components = [LeComEmployee, LeComActivity, LeComCompany];
|
|
6
|
+
|
|
7
|
+
const install = function (Vue) {
|
|
8
|
+
if (install.installed) return;
|
|
9
|
+
|
|
10
|
+
components.forEach((component) => {
|
|
11
|
+
Vue.component(component.name, component);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
install,
|
|
17
|
+
LeComEmployee,
|
|
18
|
+
LeComActivity,
|
|
19
|
+
LeComCompany,
|
|
20
|
+
};
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-container">
|
|
3
|
+
<el-form :inline="true" class="demo-form-inline">
|
|
4
|
+
<el-form-item>
|
|
5
|
+
<el-button type="primary" @click="getActivityList()"> 查询 </el-button>
|
|
6
|
+
<el-button type="info" @click="resetSearch()">重置</el-button>
|
|
7
|
+
<el-button type="success" @click="addActivity()"> 新增活动 </el-button>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
</el-form>
|
|
10
|
+
<el-table :data="tableData" border row-key="id" stripe style="width: 100%">
|
|
11
|
+
<el-table-column prop="title" label="活动标题" align="center">
|
|
12
|
+
</el-table-column>
|
|
13
|
+
<el-table-column prop="code" label="速记码" align="center">
|
|
14
|
+
</el-table-column>
|
|
15
|
+
<el-table-column prop="section" label="活动部门" align="center">
|
|
16
|
+
<template slot-scope="scope">
|
|
17
|
+
<span v-if="scope.row.section == 1">商城</span>
|
|
18
|
+
<span v-if="scope.row.section == 2">旅游</span>
|
|
19
|
+
<span v-if="scope.row.section == 3">旅游+商城</span>
|
|
20
|
+
</template>
|
|
21
|
+
</el-table-column>
|
|
22
|
+
<el-table-column prop="isenabled" label="状态" align="center">
|
|
23
|
+
<template slot-scope="scope">
|
|
24
|
+
<span v-if="scope.row.isenabled == 0">暂未启用</span>
|
|
25
|
+
<span v-if="scope.row.isenabled == 1">已经启用</span>
|
|
26
|
+
</template>
|
|
27
|
+
</el-table-column>
|
|
28
|
+
<el-table-column prop="cdate" label="创建日期" align="center">
|
|
29
|
+
<template slot-scope="scope">
|
|
30
|
+
<span>{{ dateFormat(scope.row.cdate) }}</span>
|
|
31
|
+
</template>
|
|
32
|
+
</el-table-column>
|
|
33
|
+
<el-table-column fixed="right" label="操作" align="center" width="180">
|
|
34
|
+
<template slot-scope="scope">
|
|
35
|
+
<el-button
|
|
36
|
+
type="primary"
|
|
37
|
+
size="small"
|
|
38
|
+
@click="editActivity(scope.row)"
|
|
39
|
+
>编辑</el-button
|
|
40
|
+
>
|
|
41
|
+
<el-popconfirm
|
|
42
|
+
:title="`该操作不可逆,确定删除?`"
|
|
43
|
+
@confirm="del(scope.row.id)"
|
|
44
|
+
>
|
|
45
|
+
<template #reference>
|
|
46
|
+
<el-button type="danger" size="small" style="margin-left: 10px"
|
|
47
|
+
>删除
|
|
48
|
+
</el-button>
|
|
49
|
+
</template>
|
|
50
|
+
</el-popconfirm>
|
|
51
|
+
</template>
|
|
52
|
+
</el-table-column>
|
|
53
|
+
</el-table>
|
|
54
|
+
<div style="text-align: center; margin-top: 30px" v-if="total > 0">
|
|
55
|
+
<el-pagination
|
|
56
|
+
background
|
|
57
|
+
layout="prev, pager, next"
|
|
58
|
+
:current-page="pageNo"
|
|
59
|
+
:total="total"
|
|
60
|
+
:page-size="pageSize"
|
|
61
|
+
@current-change="current_change"
|
|
62
|
+
>
|
|
63
|
+
</el-pagination>
|
|
64
|
+
</div>
|
|
65
|
+
<el-dialog
|
|
66
|
+
v-el-drag-dialog
|
|
67
|
+
title="添加/编辑活动"
|
|
68
|
+
:visible.sync="showAddPageModal"
|
|
69
|
+
:close-on-click-modal="false"
|
|
70
|
+
width="80%"
|
|
71
|
+
@close="handleClose"
|
|
72
|
+
>
|
|
73
|
+
<el-form
|
|
74
|
+
:model="ruleForm"
|
|
75
|
+
:rules="rules"
|
|
76
|
+
ref="ruleForm"
|
|
77
|
+
label-width="140px"
|
|
78
|
+
>
|
|
79
|
+
<el-form-item label="活动标题" prop="title">
|
|
80
|
+
<el-input v-model="ruleForm.title"></el-input>
|
|
81
|
+
</el-form-item>
|
|
82
|
+
<el-form-item label="速记码" prop="code">
|
|
83
|
+
<el-input v-model="ruleForm.code"></el-input>
|
|
84
|
+
</el-form-item>
|
|
85
|
+
<el-form-item label="使用场景" prop="section">
|
|
86
|
+
<el-select v-model="ruleForm.section" placeholder="请选择">
|
|
87
|
+
<el-option label="商城" :value="1" key="1"></el-option>
|
|
88
|
+
<el-option label="旅游" :value="2" key="2"></el-option>
|
|
89
|
+
<el-option label="全部" :value="3" key="3"></el-option>
|
|
90
|
+
</el-select>
|
|
91
|
+
</el-form-item>
|
|
92
|
+
<el-form-item label="是否启用">
|
|
93
|
+
<el-radio-group v-model="ruleForm.isenabled">
|
|
94
|
+
<el-radio :label="0">否</el-radio>
|
|
95
|
+
<el-radio :label="1">是</el-radio>
|
|
96
|
+
</el-radio-group>
|
|
97
|
+
<span style="margin-left: 10px"></span>
|
|
98
|
+
</el-form-item>
|
|
99
|
+
<el-form-item label="介绍" prop="comment">
|
|
100
|
+
<le-editor
|
|
101
|
+
v-if="showAddPageModal"
|
|
102
|
+
v-model="ruleForm.comment"
|
|
103
|
+
useCustomImageHandler
|
|
104
|
+
@image-added="vueEditorHandleImageAdded"
|
|
105
|
+
></le-editor>
|
|
106
|
+
</el-form-item>
|
|
107
|
+
</el-form>
|
|
108
|
+
<span slot="footer" class="dialog-footer">
|
|
109
|
+
<el-button @click="handleClose">取 消</el-button>
|
|
110
|
+
<el-button type="primary" @click="savetravelNarrator">确 定</el-button>
|
|
111
|
+
</span>
|
|
112
|
+
</el-dialog>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
<script>
|
|
116
|
+
import {
|
|
117
|
+
add as activityCreate,
|
|
118
|
+
del as activityDel,
|
|
119
|
+
edit as activityEdit,
|
|
120
|
+
list as activityList,
|
|
121
|
+
} from "@/api/systemactivity";
|
|
122
|
+
import { LeEditor } from "leisure-editor";
|
|
123
|
+
import { uploadFile } from "@/api/upload";
|
|
124
|
+
import { Base64 } from "js-base64";
|
|
125
|
+
|
|
126
|
+
export default {
|
|
127
|
+
name:'le-com-activity',
|
|
128
|
+
components: { LeEditor },
|
|
129
|
+
data() {
|
|
130
|
+
return {
|
|
131
|
+
pageNo: 1,
|
|
132
|
+
total: 0,
|
|
133
|
+
pageSize: 10,
|
|
134
|
+
tableData: [],
|
|
135
|
+
showSelectDialog: false,
|
|
136
|
+
choseContent: "",
|
|
137
|
+
ruleForm: {
|
|
138
|
+
id: "",
|
|
139
|
+
title: "",
|
|
140
|
+
code: "",
|
|
141
|
+
comment: "",
|
|
142
|
+
section: 2,
|
|
143
|
+
isenabled: 0,
|
|
144
|
+
},
|
|
145
|
+
selectImage: 0,
|
|
146
|
+
rules: {
|
|
147
|
+
title: [
|
|
148
|
+
{ required: true, message: "请输入活动标题", trigger: "blur" },
|
|
149
|
+
{
|
|
150
|
+
min: 1,
|
|
151
|
+
max: 100,
|
|
152
|
+
message: "长度在 1 到 100 个字符",
|
|
153
|
+
trigger: "blur",
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
code: [
|
|
157
|
+
{ required: true, message: "请输入速记码", trigger: "blur" },
|
|
158
|
+
{
|
|
159
|
+
min: 1,
|
|
160
|
+
max: 6,
|
|
161
|
+
message: "长度在 1 到 6 个字符",
|
|
162
|
+
trigger: "blur",
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
comment: [
|
|
166
|
+
{ required: true, message: "请输入活动内容", trigger: "blur" },
|
|
167
|
+
{
|
|
168
|
+
min: 6,
|
|
169
|
+
message: "最少6个字符",
|
|
170
|
+
trigger: "blur",
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
showAddPageModal: false,
|
|
175
|
+
isEditActivity: false,
|
|
176
|
+
activityEditId: "",
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
computed: {},
|
|
180
|
+
mounted() {
|
|
181
|
+
this.getActivityList();
|
|
182
|
+
},
|
|
183
|
+
methods: {
|
|
184
|
+
async vueEditorHandleImageAdded(
|
|
185
|
+
file,
|
|
186
|
+
Editor,
|
|
187
|
+
cursorLocation,
|
|
188
|
+
resetUploader
|
|
189
|
+
) {
|
|
190
|
+
var formData = new FormData();
|
|
191
|
+
formData.append("files", file);
|
|
192
|
+
uploadFile(formData).then((res) => {
|
|
193
|
+
let address = res.data.data;
|
|
194
|
+
if (address && address.length > 0) {
|
|
195
|
+
address.forEach((item) => {
|
|
196
|
+
Editor.insertEmbed(cursorLocation, "image", item);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
resetUploader();
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
resetSearch() {
|
|
203
|
+
this.pageNo = 1;
|
|
204
|
+
this.searchName = "";
|
|
205
|
+
this.searchCode = "";
|
|
206
|
+
this.getActivityList();
|
|
207
|
+
},
|
|
208
|
+
current_change(page) {
|
|
209
|
+
this.pageNo = page;
|
|
210
|
+
this.getActivityList();
|
|
211
|
+
},
|
|
212
|
+
addActivity() {
|
|
213
|
+
this.showAddPageModal = true;
|
|
214
|
+
this.activityEditId = "";
|
|
215
|
+
this.isEditActivity = false;
|
|
216
|
+
},
|
|
217
|
+
editActivity(row) {
|
|
218
|
+
this.ruleForm = JSON.parse(JSON.stringify(row));
|
|
219
|
+
if (this.ruleForm.comment) {
|
|
220
|
+
this.ruleForm.comment = Base64.decode(this.ruleForm.comment);
|
|
221
|
+
}
|
|
222
|
+
this.activityEditId = row.id;
|
|
223
|
+
this.isEditActivity = true;
|
|
224
|
+
this.showAddPageModal = true;
|
|
225
|
+
},
|
|
226
|
+
savetravelNarrator() {
|
|
227
|
+
let params = JSON.parse(JSON.stringify(this.ruleForm));
|
|
228
|
+
this.$refs["ruleForm"].validate((valid) => {
|
|
229
|
+
if (valid) {
|
|
230
|
+
params.comment = Base64.encode(params.comment);
|
|
231
|
+
if (this.isEditActivity) {
|
|
232
|
+
params.id = this.activityEditId;
|
|
233
|
+
activityEdit(params).then(() => {
|
|
234
|
+
this.$message.success("修改活动成功~");
|
|
235
|
+
this.getActivityList(this.pageNo);
|
|
236
|
+
this.handleClose();
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
239
|
+
activityCreate(params).then(() => {
|
|
240
|
+
this.$message.success("添加活动成功~");
|
|
241
|
+
this.getActivityList(this.pageNo);
|
|
242
|
+
this.handleClose();
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
handleClose() {
|
|
251
|
+
this.showAddPageModal = false;
|
|
252
|
+
this.travelNarratorEditId = "";
|
|
253
|
+
this.ruleForm = {};
|
|
254
|
+
delete this.ruleForm.id;
|
|
255
|
+
},
|
|
256
|
+
getActivityList() {
|
|
257
|
+
let params = {
|
|
258
|
+
pageNo: this.pageNo,
|
|
259
|
+
};
|
|
260
|
+
activityList(params).then((res) => {
|
|
261
|
+
this.tableData = res.data.data.list || [];
|
|
262
|
+
this.total = res.data.data.count || 0;
|
|
263
|
+
this.pageSize = res.data.data.pageSize || 10;
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
del(id) {
|
|
267
|
+
activityDel(id).then((response) => {
|
|
268
|
+
this.getActivityList(this.pageNo);
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
selectContent(val) {
|
|
272
|
+
this.choseContent = val;
|
|
273
|
+
},
|
|
274
|
+
selsetContentClose() {
|
|
275
|
+
this.showSelectDialog = false;
|
|
276
|
+
},
|
|
277
|
+
saveSelect() {
|
|
278
|
+
if (this.selectImage == 0) {
|
|
279
|
+
this.travelNarratorMp3s[this.currentRow].mp3 = this.choseContent;
|
|
280
|
+
}
|
|
281
|
+
if (this.selectImage == 1) {
|
|
282
|
+
this.ruleForm.photo = this.choseContent;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.showSelectDialog = false;
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
</script>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<le-list
|
|
4
|
+
ref="commonPage"
|
|
5
|
+
:tableColumns="tableColumns"
|
|
6
|
+
:tableData="tableData"
|
|
7
|
+
:searchParam="searchParam"
|
|
8
|
+
:isDispAddBtn="false"
|
|
9
|
+
:isDispDelBtn="false"
|
|
10
|
+
:totalData="totalData"
|
|
11
|
+
dialogTitle="公司信息维护"
|
|
12
|
+
dialogWidth="50%"
|
|
13
|
+
@handleStatus="handleStatus"
|
|
14
|
+
@getList="list"
|
|
15
|
+
>
|
|
16
|
+
<template #sub="{ rowItem }">
|
|
17
|
+
<le-list-form
|
|
18
|
+
:formColumns="formColumns"
|
|
19
|
+
:rules="rules"
|
|
20
|
+
:formData="rowItem"
|
|
21
|
+
:fieldOptions="fieldOptions"
|
|
22
|
+
:handleStatus="status"
|
|
23
|
+
@closeDialog="closeDialog"
|
|
24
|
+
@saveData="saveForm"
|
|
25
|
+
></le-list-form>
|
|
26
|
+
</template>
|
|
27
|
+
</le-list>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
<script>
|
|
31
|
+
import {
|
|
32
|
+
list as companylist,
|
|
33
|
+
del as companyDel,
|
|
34
|
+
add as companyAdd,
|
|
35
|
+
edit as companyEdit,
|
|
36
|
+
} from "@/api/company";
|
|
37
|
+
export default {
|
|
38
|
+
name: "le-com-company",
|
|
39
|
+
components: {},
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
tableData: [],
|
|
43
|
+
totalData: 0,
|
|
44
|
+
tableColumns: [
|
|
45
|
+
{ prop: "name", label: "名称", default: "默认名称" },
|
|
46
|
+
{ prop: "title", label: "系统标题" },
|
|
47
|
+
{ prop: "phone", label: "手机" },
|
|
48
|
+
{
|
|
49
|
+
prop: "note",
|
|
50
|
+
label: "备注",
|
|
51
|
+
type: "url",
|
|
52
|
+
formatter: (row, column, cellValue) => {
|
|
53
|
+
return cellValue ?? "无";
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
formColumns: [
|
|
58
|
+
{ prop: "name", label: "名称" },
|
|
59
|
+
{ prop: "title", label: "系统标题" },
|
|
60
|
+
{ prop: "phone", label: "手机" },
|
|
61
|
+
{
|
|
62
|
+
prop: "note",
|
|
63
|
+
label: "备注",
|
|
64
|
+
type: "select",
|
|
65
|
+
kv: { label: "label", key: "value" },
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
rules: {
|
|
69
|
+
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
|
70
|
+
},
|
|
71
|
+
fieldOptions: {
|
|
72
|
+
note: [
|
|
73
|
+
{ label: "第一", value: 1 },
|
|
74
|
+
{ label: "第二", value: 2 },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
searchParam: { phone: "" },
|
|
78
|
+
status: 0, //0:详情 1:新增 2:编辑
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
mounted() {
|
|
82
|
+
// this.list();
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
list() {
|
|
86
|
+
companylist().then((res) => {
|
|
87
|
+
this.tableData = res.data.data;
|
|
88
|
+
this.totalData = res.data.count;
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
delRow(id, callBack) {
|
|
92
|
+
companyDel(id).then((res) => {
|
|
93
|
+
this.$message.success("删除成功");
|
|
94
|
+
if (callBack) callBack();
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
handleStatus(status) {
|
|
98
|
+
this.status = status;
|
|
99
|
+
},
|
|
100
|
+
closeDialog() {
|
|
101
|
+
this.$refs.commonPage.closeDialog();
|
|
102
|
+
},
|
|
103
|
+
saveForm(params, callBack) {
|
|
104
|
+
if (params && params.id && params.id.length > 0) {
|
|
105
|
+
companyEdit(params).then((response) => {
|
|
106
|
+
if (callBack) callBack();
|
|
107
|
+
this.$message.success(response.data.info);
|
|
108
|
+
});
|
|
109
|
+
} else if (params) {
|
|
110
|
+
companyAdd(params).then((response) => {
|
|
111
|
+
if (callBack) callBack();
|
|
112
|
+
this.$message.success(response.data.info);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-container">
|
|
3
|
+
<el-form :inline="true" class="demo-form-inline">
|
|
4
|
+
<el-form-item>
|
|
5
|
+
<el-button type="primary" @click="getemployeeList()">查询</el-button>
|
|
6
|
+
<el-button type="primary" @click="addemployee()">新建员工</el-button>
|
|
7
|
+
</el-form-item>
|
|
8
|
+
</el-form>
|
|
9
|
+
<el-table
|
|
10
|
+
:data="tableData"
|
|
11
|
+
border
|
|
12
|
+
row-key="id"
|
|
13
|
+
stripe
|
|
14
|
+
style="width: 100%"
|
|
15
|
+
>
|
|
16
|
+
<el-table-column prop="name" label="员工名称" align="center">
|
|
17
|
+
</el-table-column>
|
|
18
|
+
<!-- <el-table-column prop="id" label="员工id" align="center">
|
|
19
|
+
</el-table-column> -->
|
|
20
|
+
<el-table-column prop="departName" label="部门" align="center">
|
|
21
|
+
</el-table-column>
|
|
22
|
+
<el-table-column prop="storeName" label="门店" align="center">
|
|
23
|
+
</el-table-column>
|
|
24
|
+
<el-table-column prop="phone" label="手机号" align="center">
|
|
25
|
+
</el-table-column>
|
|
26
|
+
<el-table-column prop="note" label="备注" align="center">
|
|
27
|
+
</el-table-column>
|
|
28
|
+
<el-table-column fixed="right" label="操作" align="center" width="180">
|
|
29
|
+
<template slot-scope="scope">
|
|
30
|
+
<el-button
|
|
31
|
+
type="primary"
|
|
32
|
+
size="small"
|
|
33
|
+
@click="editemployee(scope.row)"
|
|
34
|
+
>编辑</el-button
|
|
35
|
+
>
|
|
36
|
+
<el-popconfirm
|
|
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
|
+
</template>
|
|
47
|
+
</el-table-column>
|
|
48
|
+
</el-table>
|
|
49
|
+
|
|
50
|
+
<el-dialog
|
|
51
|
+
v-el-drag-dialog
|
|
52
|
+
title="新建/编辑员工"
|
|
53
|
+
:visible.sync="showAddPageModal"
|
|
54
|
+
:close-on-click-modal="false"
|
|
55
|
+
width="50%"
|
|
56
|
+
@close="handleClose"
|
|
57
|
+
>
|
|
58
|
+
<el-form
|
|
59
|
+
:model="ruleForm"
|
|
60
|
+
:rules="rules"
|
|
61
|
+
ref="ruleForm"
|
|
62
|
+
label-width="140px"
|
|
63
|
+
>
|
|
64
|
+
<el-form-item label="员工名称" prop="name">
|
|
65
|
+
<el-input v-model="ruleForm.name"></el-input>
|
|
66
|
+
</el-form-item>
|
|
67
|
+
<el-form-item label="部门" prop="did">
|
|
68
|
+
<el-select
|
|
69
|
+
v-model="ruleForm.did"
|
|
70
|
+
filterable
|
|
71
|
+
@change="changeDepart"
|
|
72
|
+
placeholder="请选择"
|
|
73
|
+
>
|
|
74
|
+
<el-option
|
|
75
|
+
v-for="item in departData"
|
|
76
|
+
:key="item.id"
|
|
77
|
+
:label="item.name"
|
|
78
|
+
:value="item.id"
|
|
79
|
+
>
|
|
80
|
+
</el-option>
|
|
81
|
+
</el-select>
|
|
82
|
+
</el-form-item>
|
|
83
|
+
<el-form-item label="门店" prop="sid">
|
|
84
|
+
<el-select
|
|
85
|
+
v-model="ruleForm.sid"
|
|
86
|
+
filterable
|
|
87
|
+
@change="changeStore"
|
|
88
|
+
placeholder="请选择"
|
|
89
|
+
>
|
|
90
|
+
<el-option
|
|
91
|
+
v-for="item in storeData"
|
|
92
|
+
:key="item.id"
|
|
93
|
+
:label="item.name"
|
|
94
|
+
:value="item.id"
|
|
95
|
+
>
|
|
96
|
+
</el-option>
|
|
97
|
+
</el-select>
|
|
98
|
+
</el-form-item>
|
|
99
|
+
<el-form-item label="联系电话">
|
|
100
|
+
<el-input v-model="ruleForm.phone"></el-input>
|
|
101
|
+
</el-form-item>
|
|
102
|
+
<el-form-item label="备注">
|
|
103
|
+
<el-input
|
|
104
|
+
type="textarea"
|
|
105
|
+
placeholder="请输入内容"
|
|
106
|
+
maxlength="100"
|
|
107
|
+
show-word-limit
|
|
108
|
+
v-model="ruleForm.note"
|
|
109
|
+
>
|
|
110
|
+
</el-input>
|
|
111
|
+
</el-form-item>
|
|
112
|
+
</el-form>
|
|
113
|
+
<span slot="footer" class="dialog-footer">
|
|
114
|
+
<el-button @click="handleClose">取 消</el-button>
|
|
115
|
+
<el-button type="primary" @click="saveemployee">确 定</el-button>
|
|
116
|
+
</span>
|
|
117
|
+
</el-dialog>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
<script>
|
|
121
|
+
import {
|
|
122
|
+
employeeCreate,
|
|
123
|
+
employeeDel,
|
|
124
|
+
employeeEdit,
|
|
125
|
+
employeeList,
|
|
126
|
+
} from "@/api/employee";
|
|
127
|
+
import { storeList } from "@/api/store";
|
|
128
|
+
import { departList } from "@/api/depart";
|
|
129
|
+
export default {
|
|
130
|
+
name:'le-com-employee',
|
|
131
|
+
components: {},
|
|
132
|
+
data() {
|
|
133
|
+
return {
|
|
134
|
+
tableData: [],
|
|
135
|
+
ruleForm: {
|
|
136
|
+
name: "",
|
|
137
|
+
did: "",
|
|
138
|
+
note: "",
|
|
139
|
+
departName: "",
|
|
140
|
+
phone: "",
|
|
141
|
+
sid: "",
|
|
142
|
+
storeName: "",
|
|
143
|
+
},
|
|
144
|
+
rules: {
|
|
145
|
+
name: [{ required: true, message: "请输入员工名称", trigger: "blur" }],
|
|
146
|
+
|
|
147
|
+
phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
|
|
148
|
+
sid: [{ required: true, message: "请输入门店ID", trigger: "blur" }],
|
|
149
|
+
|
|
150
|
+
did: [{ required: true, message: "请输入部门ID", trigger: "blur" }],
|
|
151
|
+
},
|
|
152
|
+
showAddPageModal: false,
|
|
153
|
+
isEditemployee: false,
|
|
154
|
+
employeeEditId: "",
|
|
155
|
+
configDetailsShow: false,
|
|
156
|
+
type: 0,
|
|
157
|
+
pid: "",
|
|
158
|
+
departData: [],
|
|
159
|
+
storeData: [],
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
computed: {},
|
|
163
|
+
mounted() {
|
|
164
|
+
this.getemployeeList();
|
|
165
|
+
this.getstoreList();
|
|
166
|
+
this.getdepartList();
|
|
167
|
+
},
|
|
168
|
+
methods: {
|
|
169
|
+
addemployee() {
|
|
170
|
+
this.showAddPageModal = true;
|
|
171
|
+
this.employeeEditId = "";
|
|
172
|
+
this.isEditemployee = false;
|
|
173
|
+
},
|
|
174
|
+
editemployee(row) {
|
|
175
|
+
this.ruleForm = JSON.parse(JSON.stringify(row));
|
|
176
|
+
this.showAddPageModal = true;
|
|
177
|
+
this.employeeEditId = row.id;
|
|
178
|
+
this.isEditemployee = true;
|
|
179
|
+
},
|
|
180
|
+
saveemployee() {
|
|
181
|
+
let params = {
|
|
182
|
+
name: this.ruleForm.name,
|
|
183
|
+
phone: this.ruleForm.phone,
|
|
184
|
+
did: this.ruleForm.did,
|
|
185
|
+
note: this.ruleForm.note,
|
|
186
|
+
departName: this.ruleForm.departName,
|
|
187
|
+
sid: this.ruleForm.sid,
|
|
188
|
+
storeName: this.ruleForm.storeName,
|
|
189
|
+
};
|
|
190
|
+
this.$refs["ruleForm"].validate((valid) => {
|
|
191
|
+
if (valid) {
|
|
192
|
+
if (this.isEditemployee) {
|
|
193
|
+
params.id = this.employeeEditId;
|
|
194
|
+
employeeEdit(params).then(() => {
|
|
195
|
+
this.$message.success("修改员工成功~");
|
|
196
|
+
this.getemployeeList(this.pageNo);
|
|
197
|
+
this.handleClose();
|
|
198
|
+
});
|
|
199
|
+
} else {
|
|
200
|
+
employeeCreate(params).then(() => {
|
|
201
|
+
this.$message.success("新建员工成功~");
|
|
202
|
+
this.getemployeeList(this.pageNo);
|
|
203
|
+
this.handleClose();
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
console.log("error submit!!");
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
handleClose() {
|
|
213
|
+
this.showAddPageModal = false;
|
|
214
|
+
this.employeeEditId = "";
|
|
215
|
+
this.ruleForm.name = "";
|
|
216
|
+
this.ruleForm.departName = "";
|
|
217
|
+
this.ruleForm.phone = "";
|
|
218
|
+
this.ruleForm.sid = "";
|
|
219
|
+
this.ruleForm.storeName = "";
|
|
220
|
+
this.ruleForm.note = "";
|
|
221
|
+
this.ruleForm.did = "";
|
|
222
|
+
delete this.ruleForm.id;
|
|
223
|
+
},
|
|
224
|
+
getemployeeList() {
|
|
225
|
+
employeeList().then((res) => {
|
|
226
|
+
this.tableData = res.data.data.list || [];
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
del(id) {
|
|
230
|
+
employeeDel({
|
|
231
|
+
id: id,
|
|
232
|
+
}).then((response) => {
|
|
233
|
+
this.getemployeeList(this.pageNo);
|
|
234
|
+
this.$message.success("删除员工成功");
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
getstoreList() {
|
|
239
|
+
storeList().then((res) => {
|
|
240
|
+
this.storeData = res.data.data || [];
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
getdepartList() {
|
|
245
|
+
departList().then((res) => {
|
|
246
|
+
this.departData = res.data.data || [];
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
changeDepart(val) {
|
|
250
|
+
for (let i = 0; i < this.departData.length; i++) {
|
|
251
|
+
if (val == this.departData[i].id) {
|
|
252
|
+
this.ruleForm.departName = this.departData[i].name;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
changeStore(val) {
|
|
257
|
+
for (let i = 0; i < this.storeData.length; i++) {
|
|
258
|
+
if (val == this.storeData[i].id) {
|
|
259
|
+
this.ruleForm.storeName = this.storeData[i].name;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
</script>
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "leisure-common",
|
|
3
|
+
"version": "0.4.99",
|
|
4
|
+
"description": "leisure-common是京心数据在leisure-core基础上开发的一套后台管理系统基于故事的电商行业组件库,封装了大量实用的UI控件模板,方便开发者快速搭建前端应用",
|
|
5
|
+
"private": false,
|
|
6
|
+
"author": "北方乐逍遥(zcx7878)",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"leisure",
|
|
9
|
+
"leisure-common",
|
|
10
|
+
"京心数据"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"leisure-core": "^0.4.99"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {}
|
|
19
|
+
}
|