|
@@ -50,7 +50,7 @@
|
|
|
v-hasPermi="['system:appUser:remove']"
|
|
|
>删除</el-button>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
+ <!-- <el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
icon="el-icon-download"
|
|
@@ -58,16 +58,39 @@
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['system:appUser:export']"
|
|
|
>导出</el-button>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column type="selection" width="30" align="center" />
|
|
|
<el-table-column label="昵称" align="center" prop="nickName" />
|
|
|
- <el-table-column label="头像" align="center" prop="avatar" />
|
|
|
+ <el-table-column label="头像" align="center" >
|
|
|
+ <template scope="scope">
|
|
|
+ <img width="40" height="40" :src="scope.row.avatar" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="性别"
|
|
|
+ align="center"
|
|
|
+ prop="gender"
|
|
|
+ :formatter="genderFormat"
|
|
|
+ width="50"
|
|
|
+ />
|
|
|
<el-table-column label="手机号码" align="center" prop="mobile" />
|
|
|
- <el-table-column label="已加入家族" align="center" prop="join" />
|
|
|
+ <el-table-column
|
|
|
+ label="已加入家族"
|
|
|
+ align="center"
|
|
|
+ prop="joins"
|
|
|
+ :formatter="joinsFormat"
|
|
|
+ width="100"
|
|
|
+ />
|
|
|
+ <el-table-column label="IP地址" align="center" prop="loginIp" />
|
|
|
+ <el-table-column label="最后登录时间" align="center" prop="loginTime" width="160">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.loginTime) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
@@ -98,31 +121,47 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 添加或修改会员对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="750px" append-to-body :close-on-click-modal=false>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="页面模板id" prop="templateId">
|
|
|
- <el-input v-model="form.templateId" placeholder="请输入页面模板id" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="昵称" prop="nickName">
|
|
|
- <el-input v-model="form.nickName" placeholder="请输入昵称" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="头像url" prop="avatar">
|
|
|
- <el-input v-model="form.avatar" placeholder="请输入头像url" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="二维码code" prop="qrcode">
|
|
|
- <el-input v-model="form.qrcode" placeholder="请输入二维码code" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="手机号码" prop="mobile">
|
|
|
- <el-input v-model="form.mobile" placeholder="请输入手机号码" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="openid" prop="openid">
|
|
|
- <el-input v-model="form.openid" placeholder="请输入openid" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="openid" prop="verCode">
|
|
|
- <el-input v-model="form.verCode" placeholder="请输入openid" />
|
|
|
- </el-form-item>
|
|
|
+ <el-row :gutter="0" type="flex" justify="start">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="昵称" prop="nickName">
|
|
|
+ <el-input v-model="form.nickName" placeholder="请输入昵称" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机" prop="mobile">
|
|
|
+ <el-input v-model="form.mobile" placeholder="请输入手机号码" :readonly="readonly" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="页面模板" prop="templateId">
|
|
|
+ <el-input v-model="form.templateId" placeholder="请选择页面模板" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="性别">
|
|
|
+ <el-select v-model="form.gender" placeholder="请选择">
|
|
|
+ <el-option v-for="dict in genderOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="状态">
|
|
|
+ <el-select v-model="form.state" placeholder="请选择">
|
|
|
+ <el-option v-for="dict in stateOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label-width="0px" prop="avatar">
|
|
|
+ <div class="text-center">
|
|
|
+ <appUserAvatar :personal="form" :key="reFresh" />
|
|
|
+ ID: {{form.qrcode}}
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入内容" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -135,15 +174,20 @@
|
|
|
|
|
|
<script>
|
|
|
import { listUser, getUser, delUser, addUser, updateUser, exportUser } from "@/api/system/appUser";
|
|
|
+import appUserAvatar from "./detail/appUserAvatar";
|
|
|
|
|
|
export default {
|
|
|
name: "AppUser",
|
|
|
+ components: {
|
|
|
+ appUserAvatar
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
// 选中数组
|
|
|
ids: [],
|
|
|
+ nicknames: [],
|
|
|
// 非单个禁用
|
|
|
single: true,
|
|
|
// 非多个禁用
|
|
@@ -160,12 +204,20 @@ export default {
|
|
|
open: false,
|
|
|
// 日期范围
|
|
|
dateRange: [],
|
|
|
+ // 加入 数据字典
|
|
|
+ joinsOptions: [],
|
|
|
+ // 性别 数据字典
|
|
|
+ genderOptions: [],
|
|
|
+ // 状态 数据字典
|
|
|
+ stateOptions: [],
|
|
|
+ readonly: false,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
searchValue: null,
|
|
|
},
|
|
|
+ reFresh: 1,
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
@@ -173,8 +225,24 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ // 监听form值,只要有改变,则key值reFresh变更。
|
|
|
+ // 然后自定义上传图片组件apUserAvatar重新渲染
|
|
|
+ form(){
|
|
|
+ ++this.reFresh
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
this.getList();
|
|
|
+ this.getDicts("sys_yes_no").then(response => {
|
|
|
+ this.joinsOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getDicts("sys_user_sex").then((response) => {
|
|
|
+ this.genderOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getDicts("app_member_state").then((response) => {
|
|
|
+ this.stateOptions = response.data;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询会员列表 */
|
|
@@ -186,6 +254,15 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ // 加入 字典翻译
|
|
|
+ joinsFormat(row, column) {
|
|
|
+ return this.selectDictLabel(this.joinsOptions, row.joins);
|
|
|
+ },
|
|
|
+ // 性别 字典翻译
|
|
|
+ genderFormat(row, column) {
|
|
|
+ debugger
|
|
|
+ return this.selectDictLabel(this.genderOptions, row.gender);
|
|
|
+ },
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
@@ -202,11 +279,9 @@ export default {
|
|
|
mobile: null,
|
|
|
openid: null,
|
|
|
verCode: null,
|
|
|
- createBy: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null
|
|
|
+ remark: null,
|
|
|
+ gender: null,
|
|
|
+ state: null,
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -223,21 +298,25 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
+ this.ids = selection.map(item => item.userId)
|
|
|
+ this.nicknames = selection.map(item => item.nickName)
|
|
|
this.single = selection.length!==1
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
+ this.readonly = false;
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
this.title = "添加会员";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
+ this.readonly = true;
|
|
|
this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
+ const id = row.userId || this.ids;
|
|
|
getUser(id).then(response => {
|
|
|
+ debugger
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
this.title = "修改会员";
|
|
@@ -247,30 +326,21 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (this.form.id != null) {
|
|
|
- updateUser(this.form).then(response => {
|
|
|
- if (response.code === 200) {
|
|
|
- this.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- addUser(this.form).then(response => {
|
|
|
- if (response.code === 200) {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ updateUser(this.form).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- const ids = row.id || this.ids;
|
|
|
- this.$confirm('是否确认删除会员编号为"' + ids + '"的数据项?', "警告", {
|
|
|
+ const ids = row.userId || this.ids;
|
|
|
+ const nicknames = row.nickName || this.nicknames;
|
|
|
+ this.$confirm('是否确认删除会员[' + nicknames + ']?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|