|
|
@@ -0,0 +1,235 @@
|
|
|
+<template>
|
|
|
+ <div class="full-container-p24">
|
|
|
+ <div style="display: flex; justify-content: space-between">
|
|
|
+ <div style="display: flex">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入姓名/手机号"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ v-model="term"
|
|
|
+ clearable
|
|
|
+ style="height: 32px; width: 330px; line-height: 32px"
|
|
|
+ ></el-input>
|
|
|
+ <div class="seach-btn" @click="getSubAccountList">查询</div>
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" @click="visable = true">添加账号</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-dialog v-model="visable" title="添加账号" width="550px">
|
|
|
+ <template v-slot:default>
|
|
|
+ <div class="df jcc">
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="rules"
|
|
|
+ ref="form"
|
|
|
+ label-width="110px"
|
|
|
+ label-position="left"
|
|
|
+ >
|
|
|
+ <el-form-item prop="name" label="姓名">
|
|
|
+ <el-input style="width: 280px" v-model="ruleForm.name"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="phone" label="手机号">
|
|
|
+ <el-input
|
|
|
+ style="width: 280px"
|
|
|
+ v-model="ruleForm.phone"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="resetForm">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="addSubAccount(ruleForm)">
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <div style="margin-top: 24px">
|
|
|
+ <el-table :data="tableData" stripe style="width: 100%">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="序号"
|
|
|
+ min-width="80"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="userName"
|
|
|
+ label="姓名"
|
|
|
+ min-width="100"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="contactName"
|
|
|
+ label="手机号"
|
|
|
+ min-width="100"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="phone"
|
|
|
+ label="密码"
|
|
|
+ min-width="80"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ label="角色权限"
|
|
|
+ min-width="160"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column label="操作" min-width="120" align="center">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <div class="df aic">
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.accountStatus"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ active-text="启用"
|
|
|
+ inactive-text="禁用"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ color: red;
|
|
|
+ margin-left: 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ text-decoration: underline;
|
|
|
+ cursor: pointer;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ color: blue;
|
|
|
+ margin-left: 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ text-decoration: underline;
|
|
|
+ cursor: pointer;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 修改角色权限
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="width: 100%; text-align: right; margin-top: 43px">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ @current-change="pageChange"
|
|
|
+ ></el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import api from "../../apis/fetch";
|
|
|
+import { ref, onMounted, reactive } from "vue";
|
|
|
+import { ElNotification, ElMessageBox } from "element-plus";
|
|
|
+
|
|
|
+let tableData = ref([]);
|
|
|
+let currentPage = ref(1);
|
|
|
+let total = ref(0);
|
|
|
+let term = ref("");
|
|
|
+let loginAccountId = ref(0);
|
|
|
+let ruleForm = ref({
|
|
|
+ name: "",
|
|
|
+ phone: "",
|
|
|
+});
|
|
|
+const rules = reactive({
|
|
|
+ name: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请填写名称",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ phone: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请填联手机号",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+async function getSubAccountList() {
|
|
|
+ let res = await api.getSubAccountList({
|
|
|
+ term: term.value,
|
|
|
+ currentPage: currentPage.value,
|
|
|
+ size: 10,
|
|
|
+ loginAccountId: loginAccountId.value,
|
|
|
+ });
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ tableData.value = res.data.result;
|
|
|
+ total.value = res.data.total;
|
|
|
+ } else {
|
|
|
+ tableData.value = [];
|
|
|
+ total.value = 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function pageChange(e) {
|
|
|
+ currentPage.value = e;
|
|
|
+ getSubAccountList();
|
|
|
+}
|
|
|
+let visable = ref(false);
|
|
|
+let form = ref(null);
|
|
|
+async function addSubAccount() {
|
|
|
+ console.log(ruleForm.value);
|
|
|
+ let res = await api.addSubAccount({
|
|
|
+ ...ruleForm.value,
|
|
|
+ loginAccountId: loginAccountId.value,
|
|
|
+ });
|
|
|
+ console.log(res);
|
|
|
+ let status = res.data.status == 0;
|
|
|
+ ElNotification({
|
|
|
+ title: status ? "成功" : "失败",
|
|
|
+ duration: 1500,
|
|
|
+ message: res.data.msg,
|
|
|
+ type: status ? "success" : "error",
|
|
|
+ });
|
|
|
+ resetForm();
|
|
|
+ getSubAccountList();
|
|
|
+}
|
|
|
+function resetForm() {
|
|
|
+ visable.value = false;
|
|
|
+ form.value.resetFields();
|
|
|
+}
|
|
|
+
|
|
|
+function closeModal() {
|
|
|
+ proxyName.value = "";
|
|
|
+ contactPhone.value = "";
|
|
|
+ contactName.value = "";
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ loginAccountId.value = localStorage.loginAccountId;
|
|
|
+ getSubAccountList();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.seach-btn {
|
|
|
+ display: inline-block;
|
|
|
+ width: 60px;
|
|
|
+ height: 38px;
|
|
|
+ background: #0094fe;
|
|
|
+ border-radius: 2px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #ffffff;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 38px;
|
|
|
+ margin-left: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+</style>
|