Commit 136c06df by YG8429

后台修改绑定人用户

parent 2235840f
import request from '@/utils/request'
// 查询分享活动绑定关系列表
export function listActivities(query) {
return request({
url: '/system/activities/list',
method: 'get',
params: query
})
}
// 查询分享活动绑定关系详细
export function getActivities(id) {
return request({
url: '/system/activities/' + id,
method: 'get'
})
}
// 新增分享活动绑定关系
export function addActivities(data) {
return request({
url: '/system/activities',
method: 'post',
data: data
})
}
// 修改分享活动绑定关系
export function updateActivities(data) {
return request({
url: '/system/activities',
method: 'put',
data: data
})
}
// 删除分享活动绑定关系
export function delActivities(id) {
return request({
url: '/system/activities/' + id,
method: 'delete'
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="上级用户昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入上级用户昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="下级用户昵称" prop="newNickName">
<el-input
v-model="queryParams.newNickName"
placeholder="请输入下级用户昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上级电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入上级电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="下级电话" prop="newPhone">
<el-input
v-model="queryParams.newPhone"
placeholder="请输入下级电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:activities:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:activities:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:activities:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:activities:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="activitiesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<!-- <el-table-column label="上级id" align="center" prop="uid" />-->
<!-- <el-table-column label="下级id" align="center" prop="newUid" />-->
<!-- <el-table-column label="删除标记:1-删除,0-正常" align="center" prop="isDelete" />-->
<!-- <el-table-column label="备注" align="center" prop="remark" />-->
<!-- <el-table-column label="上级用户头像" align="center" prop="avatar" />-->
<!-- <el-table-column label="下级用户头像" align="center" prop="newAvatar" />-->
<el-table-column label="上级用户昵称" align="center" prop="nickName" />
<el-table-column label="下级用户昵称" align="center" prop="newNickName" />
<el-table-column label="上级电话" align="center" prop="phone" />
<el-table-column label="下级电话" align="center" prop="newPhone" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:activities:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:activities:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改分享活动绑定关系对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="上级用户头像" prop="avatar" v-show="false">
<el-input v-model="form.avatar" placeholder="请输入上级用户头像" />
</el-form-item>
<!-- <el-form-item label="下级用户头像" prop="newAvatar">-->
<!-- <el-input v-model="form.newAvatar" placeholder="请输入下级用户头像" />-->
<!-- </el-form-item>-->
<el-form-item label="上级用户id" prop="group">
<el-input @focus="openConsumer()" v-model="form.uid" placeholder="请输入上级用户id" />
</el-form-item>
<el-form-item label="上级用户昵称" prop="group">
<el-input v-model="form.nickName" placeholder="请输入上级用户昵称" />
</el-form-item>
<el-form-item label="下级用户昵称" prop="newNickName">
<el-input v-model="form.newNickName" placeholder="请输入下级用户昵称" />
</el-form-item>
<el-form-item label="上级电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入上级电话" />
</el-form-item>
<el-form-item label="下级电话" prop="newPhone">
<el-input v-model="form.newPhone" placeholder="请输入下级电话" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<selectConsumer ref="selectConsumerList" @selectConsumerList="selectConsumerId"/>
</div>
</template>
<script>
import { listActivities, getActivities, delActivities, addActivities, updateActivities } from "@/api/system/activities";
import selectPoi from '@/views/system/store/selectPoiId.vue'
import selectConsumer from "./selectConsumer.vue";
export default {
name: "Activities",
components: { selectConsumer },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 分享活动绑定关系表格数据
activitiesList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
activityType: null,
uid: null,
newUid: null,
isDelete: null,
avatar: null,
newAvatar: null,
nickName: null,
newNickName: null,
phone: null,
newPhone: null
},
// 表单参数
form: {},
// 表单校验
rules: {
activityType: [
{ required: true, message: "活动类型(0-新用户注册,1-权益金会员分享)不能为空", trigger: "change" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询分享活动绑定关系列表 */
getList() {
this.loading = true;
listActivities(this.queryParams).then(response => {
this.activitiesList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
activityType: null,
uid: null,
newUid: null,
isDelete: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
avatar: null,
newAvatar: null,
nickName: null,
newNickName: null,
phone: null,
newPhone: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
openConsumer() {
this.$refs.selectConsumerList.show();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加分享活动绑定关系";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getActivities(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改分享活动绑定关系";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateActivities(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addActivities(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除分享活动绑定关系编号为"' + ids + '"的数据项?').then(function() {
return delActivities(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/activities/export', {
...this.queryParams
}, `activities_${new Date().getTime()}.xlsx`)
},
selectConsumerId(id) {
this.form.uid = id;
},
}
};
</script>
<template>
<!-- 授权用户 -->
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="用户昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入用户昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row>
<el-table @row-click="clickRow" ref="table" :data="consumerList" height="450px">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="账号" align="center" prop="account" />
<el-table-column label="用户昵称" align="center" prop="nickName" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="角色类型" align="center" prop="roleType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.wechat_role_type" :value="scope.row.roleType"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-row>
</el-dialog>
</template>
<script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/store";
export default {
dicts: ['sys_user_sex', 'wechat_role_type'],
props: {
// 角色编号
storeId: {
type: [Number, String]
},
position: {
type: [Number, String]
}
},
data() {
return {
// 遮罩层
visible: false,
// 选中数组值
consumerIds: [],
// 总条数
total: 0,
// 未授权用户数据
consumerList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
storeId: undefined,
nickName: undefined,
phone: undefined,
position: undefined
}
};
},
methods: {
// 显示弹框
show() {
this.queryParams.storeId = this.storeId;
this.queryParams.position = this.position;
this.getList();
this.visible = true;
},
clickRow(row) {
this.$emit('selectConsumerList', row.id);
this.visible = false;
},
// 查询表数据
getList() {
unallocatedUserList(this.queryParams).then(res => {
this.consumerList = res.rows;
this.total = res.total;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment