代码更新

This commit is contained in:
chenchen 2022-10-17 20:05:03 +08:00
parent 016e456857
commit 0a187ef9f4

View File

@ -1,143 +1,138 @@
<template> <template>
<!-- 授权用户 --> <!-- 授权用户 -->
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body> <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 :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称" placeholder="请输入用户名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input
v-model="queryParams.phonenumber" v-model="queryParams.phonenumber"
placeholder="请输入手机号码" placeholder="请输入手机号码"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row> <el-row>
<el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px"> <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<!-- <template slot-scope="scope"> --> <template slot-scope="scope">
<div slot="status" slot-scope="text, record"> <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
<a v-if="record.status == 1" style="color: #000000d9">待审核</a> </template>
<a v-if="record.status == 2" style="color: #000000d9">正常</a> </el-table-column>
<a v-if="record.status == 3" style="color: #f36e48">已驳回</a> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<a v-if="record.status == 4" style="color: #000000d9">已禁用</a> <template slot-scope="scope">
</div> <span>{{ parseTime(scope.row.createTime) }}</span>
<!-- </template> --> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> </el-table>
<template slot-scope="scope"> <pagination
<span>{{ parseTime(scope.row.createTime) }}</span> v-show="total>0"
</template> :total="total"
</el-table-column> :page.sync="queryParams.pageNum"
</el-table> :limit.sync="queryParams.pageSize"
<pagination @pagination="getList"
v-show="total>0" />
:total="total" </el-row>
:page.sync="queryParams.pageNum" <div slot="footer" class="dialog-footer">
:limit.sync="queryParams.pageSize" <el-button type="primary" @click="handleSelectUser"> </el-button>
@pagination="getList" <el-button @click="visible = false"> </el-button>
/> </div>
</el-row> </el-dialog>
<div slot="footer" class="dialog-footer"> </template>
<el-button type="primary" @click="handleSelectUser"> </el-button>
<el-button @click="visible = false"> </el-button> <script>
</div> import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
</el-dialog> export default {
</template> dicts: ['sys_normal_disable'],
props: {
<script> //
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; roleId: {
export default { type: [Number, String]
dicts: ['sys_normal_disable'], }
props: { },
// data() {
roleId: { return {
type: [Number, String] //
} visible: false,
}, //
data() { userIds: [],
return { //
// total: 0,
visible: false, //
// userList: [],
userIds: [], //
// queryParams: {
total: 0, pageNum: 1,
// pageSize: 10,
userList: [], roleId: undefined,
// userName: undefined,
queryParams: { phonenumber: undefined
pageNum: 1, }
pageSize: 10, };
roleId: undefined, },
userName: undefined, methods: {
phonenumber: undefined //
} show() {
}; this.queryParams.roleId = this.roleId;
}, this.getList();
methods: { this.visible = true;
// },
show() { clickRow(row) {
this.queryParams.roleId = this.roleId; this.$refs.table.toggleRowSelection(row);
this.getList(); },
this.visible = true; //
}, handleSelectionChange(selection) {
clickRow(row) { this.userIds = selection.map(item => item.userId);
this.$refs.table.toggleRowSelection(row); },
}, //
// getList() {
handleSelectionChange(selection) { unallocatedUserList(this.queryParams).then(res => {
this.userIds = selection.map(item => item.userId); this.userList = res.rows;
}, this.total = res.total;
// });
getList() { },
unallocatedUserList(this.queryParams).then(res => { /** 搜索按钮操作 */
this.userList = res.rows; handleQuery() {
this.total = res.total; this.queryParams.pageNum = 1;
}); this.getList();
}, },
/** 搜索按钮操作 */ /** 重置按钮操作 */
handleQuery() { resetQuery() {
this.queryParams.pageNum = 1; this.resetForm("queryForm");
this.getList(); this.handleQuery();
}, },
/** 重置按钮操作 */ /** 选择授权用户操作 */
resetQuery() { handleSelectUser() {
this.resetForm("queryForm"); const roleId = this.queryParams.roleId;
this.handleQuery(); const userIds = this.userIds.join(",");
}, if (userIds == "") {
/** 选择授权用户操作 */ this.$modal.msgError("请选择要分配的用户");
handleSelectUser() { return;
const roleId = this.queryParams.roleId; }
const userIds = this.userIds.join(","); authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
if (userIds == "") { this.$modal.msgSuccess(res.msg);
this.$modal.msgError("请选择要分配的用户"); if (res.code === 200) {
return; this.visible = false;
} this.$emit("ok");
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { }
this.$modal.msgSuccess(res.msg); });
if (res.code === 200) { }
this.visible = false; }
this.$emit("ok"); };
} </script>
});
}
}
};
</script>