Commit ec327f7b authored by 李鹏 's avatar 李鹏

authority

parent 9de794c5
...@@ -173,7 +173,7 @@ const headers = reactive([ ...@@ -173,7 +173,7 @@ const headers = reactive([
}, },
{ {
label: "手机号", label: "手机号",
prop: "contact_phone", prop: "phone",
minWidth: 150, minWidth: 150,
}, },
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="page_content apaas_scroll"> <div class="page_content apaas_scroll">
<div class="info_row"> <div class="info_row">
<div class="title"> <div class="title">
<div><span class="icon_box"></span> 账号信息</div> <div><span class="icon_box"></span> 基础信息</div>
<div class="dashed_line"></div> <div class="dashed_line"></div>
</div> </div>
<div class="info_content"> <div class="info_content">
...@@ -17,20 +17,14 @@ ...@@ -17,20 +17,14 @@
alt="" /> alt="" />
</div> </div>
<div class="info_box"> <div class="info_box">
<bg-info :data="accountInfo"></bg-info> <bg-detail-table2 class="detail_info" :list="accountInfo">
</div> <template #state="{ data }">
</div> <p class="detail-module">
</div> <span>{{ data.label }}</span>
<div> <span :class="data.value ? 'active' : 'disabled'">{{ data.value ? "启用" : "禁用" }}</span>
<div class="title"> </p>
<div><span class="icon_box"></span> 个人信息</div> </template>
<div class="dashed_line"></div> </bg-detail-table2>
</div>
<div class="info_content">
<div class="img_box"></div>
<div class="info_box">
<bg-info v-if="accountType === 2" :data="personInfo"></bg-info>
<bg-info v-if="accountType === 3" :data="personInfo2"></bg-info>
</div> </div>
</div> </div>
</div> </div>
...@@ -39,7 +33,7 @@ ...@@ -39,7 +33,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, toRefs, ref, computed, onBeforeMount } from "vue"; import { reactive, ref, onBeforeMount } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import axios from "@/request/http.js"; import axios from "@/request/http.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
...@@ -48,120 +42,64 @@ const route = useRoute(); ...@@ -48,120 +42,64 @@ const route = useRoute();
const accountInfo = reactive([ const accountInfo = reactive([
{ {
name: "手机号", key: "name",
value: "", label: "姓名",
nameWidth: 130,
},
{
name: "账号",
value: "",
nameWidth: 130,
},
{
name: "角色",
value: "",
nameWidth: 130,
},
{
name: "所属组织",
value: "",
nameWidth: 130,
},
{
name: "创建人",
value: "", value: "",
nameWidth: 130,
}, },
{ {
name: "创建账号", key: "organization",
label: "所属组织",
value: "", value: "",
nameWidth: 130,
}, },
{ {
name: "最后编辑时间", key: "system_account",
label: "账号",
value: "", value: "",
nameWidth: 130,
}, },
{ {
name: "创建时间", key: "phone",
label: "手机号",
value: "", value: "",
nameWidth: 130,
}, },
]);
const personInfo = reactive([
{
name: "姓名",
value: "",
nameWidth: 130,
},
{ {
name: "邮箱", key: "system_role",
label: "角色",
value: "", value: "",
nameWidth: 130,
}, },
{ {
name: "证据类型", key: "state",
label: "是否启用",
value: "", value: "",
nameWidth: 130, slot: "state",
}, },
{ {
name: "身份证号", key: "created_name",
label: "创建人",
value: "", value: "",
idCard: true,
nameWidth: 130,
}, },
{ {
name: "备注", key: "created_time",
label: "创建时间",
value: "", value: "",
full: true,
nameWidth: 130,
},
]);
const personInfo2 = reactive([
{
name: "姓名",
value: "",
nameWidth: 130,
},
{
name: "邮箱",
value: "",
nameWidth: 130,
},
{
name: "备注",
value: "",
full: true,
nameWidth: 130,
}, },
]); ]);
const logo = ref(""); const logo = ref("");
const accountType = ref(2); //1.业务系统账号 2.组织管理员账号 3.平台用户账号
const getDetail = () => { const getDetail = () => {
axios.get(`/apaas/system/v5/org/user/${route.query.id}`).then((res) => { axios.get(`/v1/api/user/${route.query.id}`).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
const detail = res.data.data; const detail = res.data.data;
accountInfo[0].value = detail.contact_phone; accountInfo[0].value = detail.name;
accountInfo[1].value = detail.system_account; accountInfo[1].value = detail.organization;
accountInfo[2].value = detail.system_role && detail.system_role.length > 0 ? detail.system_role.join("") : ""; accountInfo[2].value = detail.system_account;
accountInfo[3].value = detail.organization; accountInfo[3].value = detail.phone;
accountInfo[4].value = detail.created_by; accountInfo[4].value =
accountInfo[5].value = detail.created_by_account; detail.system_role_name && detail.system_role_name.length > 0 ? detail.system_role_name.join("") : "";
accountInfo[6].value = detail.updated_time; accountInfo[5].value = detail.state;
accountInfo[6].value = detail.created_name;
accountInfo[7].value = detail.created_time; accountInfo[7].value = detail.created_time;
personInfo[0].value = detail.contact_name;
personInfo[1].value = detail.contact_email;
personInfo[2].value = detail.document_type === 1 ? "身份证" : "";
personInfo[3].value = detail.document_number;
personInfo[4].value = detail.remark;
personInfo2[0].value = detail.contact_name;
personInfo2[1].value = detail.contact_email;
personInfo2[2].value = detail.remark;
logo.value = detail.logo; logo.value = detail.logo;
accountType.value = detail.is_admin;
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
} }
...@@ -175,7 +113,7 @@ onBeforeMount(() => { ...@@ -175,7 +113,7 @@ onBeforeMount(() => {
}); });
</script> </script>
<style scoped> <style scoped lang="scss">
.page_content { .page_content {
padding: 15px; padding: 15px;
overflow: auto; overflow: auto;
...@@ -216,4 +154,42 @@ onBeforeMount(() => { ...@@ -216,4 +154,42 @@ onBeforeMount(() => {
border-radius: 2px; border-radius: 2px;
margin-right: 5px; margin-right: 5px;
} }
.detail-module {
height: 100%;
display: flex;
span {
height: 100%;
display: inline-block;
padding-left: 15px;
box-sizing: border-box;
&:nth-of-type(1) {
background-color: #f7f7f9;
min-width: 114px;
border-right: solid 1px #dadee7;
}
&:nth-of-type(2) {
flex-grow: 1;
&::before {
display: inline-block;
content: "";
width: 8px;
height: 8px;
margin-right: 4px;
border-radius: 4px;
}
&.active {
color: #3759be;
&::before {
background-color: #3759be;
}
}
&.disabled {
color: #ff9f51;
&::before {
background-color: #ff9f51;
}
}
}
}
}
</style> </style>
...@@ -26,6 +26,7 @@ import { useRoute, useRouter } from "vue-router"; ...@@ -26,6 +26,7 @@ import { useRoute, useRouter } from "vue-router";
import systemForm from "./system-form.vue"; import systemForm from "./system-form.vue";
import { reactive, ref, onBeforeUnmount, onMounted } from "vue"; import { reactive, ref, onBeforeUnmount, onMounted } from "vue";
import axios from "@/request/http.js"; import axios from "@/request/http.js";
import CryptoJS from "crypto-js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue"; import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const route = useRoute(); const route = useRoute();
...@@ -57,10 +58,15 @@ const getSystemFormData = (data) => { ...@@ -57,10 +58,15 @@ const getSystemFormData = (data) => {
}; };
//提交表单 //提交表单
const submit = () => { const submit = () => {
systemFormRef.value.validateForm().then((res) => {
if (!res) return;
if (route.query.id) { if (route.query.id) {
let params = { let params = {
...formData, ...systemFormRef.value.systemForm,
logo: formData.logo && formData.logo.length > 0 ? formData.logo[0].url : "", logo:
systemFormRef.value.systemForm.logo && systemFormRef.value.systemForm.logo.length > 0
? systemFormRef.value.systemForm.logo[0].url
: "",
}; };
axios.put(`/v1/api/user/${route.query.id}`, params).then((res) => { axios.put(`/v1/api/user/${route.query.id}`, params).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -72,11 +78,15 @@ const submit = () => { ...@@ -72,11 +78,15 @@ const submit = () => {
}); });
} else { } else {
let params = { let params = {
...formData, ...systemFormRef.value.systemForm,
logo: formData.logo && formData.logo.length > 0 ? formData.logo[0].url : "", logo:
password: CryptoJS.AES.encrypt(formData.password, "swuE9cmCZQwrkYRV").toString(), systemFormRef.value.systemForm.logo && systemFormRef.value.systemForm.logo.length > 0
? systemFormRef.value.systemForm.logo[0].url
: "",
password: CryptoJS.AES.encrypt(systemFormRef.value.systemForm.password, "swuE9cmCZQwrkYRV").toString(),
}; };
axios.put(`/v1/api/user/add`, params).then((res) => { delete params.confirm_password;
axios.post(`/v1/api/user/add`, params).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
ElMessage.success(res.data.msg); ElMessage.success(res.data.msg);
cancel(); cancel();
...@@ -85,14 +95,14 @@ const submit = () => { ...@@ -85,14 +95,14 @@ const submit = () => {
} }
}); });
} }
});
}; };
//取消 //取消
const cancel = () => { const cancel = () => {
// router.go(-1);
router.push({ router.push({
path: "/authority/user", path: "/authority/user",
query: { query: {
id: formData.organization_id, organization_id: systemFormRef.value.systemForm.organization_id,
}, },
}); });
}; };
...@@ -103,18 +113,12 @@ const getDetail = () => { ...@@ -103,18 +113,12 @@ const getDetail = () => {
const form = res.data.data; const form = res.data.data;
systemFormRef.value.setForm({ systemFormRef.value.setForm({
organization_id: form.organization_id, organization_id: form.organization_id,
system_role_id: form.system_role_id, select_role: form.system_role,
logo: form.logo ? [{ url: form.logo }] : [], logo: form.logo ? [{ url: form.logo }] : [],
business_code: form.business_code, name: form.name,
business_name: form.business_name,
business_desc: form.business_desc,
system_account: form.system_account, system_account: form.system_account,
system_phone: form.system_phone, phone: form.phone,
access_address: form.access_address,
develop_id: form.develop_id,
state: form.state, state: form.state,
appid: form.app_id,
appsecret: form.app_secret,
}); });
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
......
...@@ -55,11 +55,6 @@ ...@@ -55,11 +55,6 @@
:stripe="true" :stripe="true"
:select="true" :select="true"
@selectAc="selectRows"> @selectAc="selectRows">
<template v-slot:business_name="{ row }">
<span @click="goDetail(row)" class="can_click_text">
{{ row.business_name }}
</span>
</template>
<template v-slot:state="{ row }"> <template v-slot:state="{ row }">
<bg-switch <bg-switch
@click="stateChange(row)" @click="stateChange(row)"
...@@ -106,7 +101,7 @@ ...@@ -106,7 +101,7 @@
<bg-icon <bg-icon
style="font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline" style="font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline"
icon="#bg-ic-circle-tips"></bg-icon> icon="#bg-ic-circle-tips"></bg-icon>
您正在对 <span class="danger_info">{{ selectedRow.business_name }}</span 您正在对 <span class="danger_info">{{ selectedRow.system_account }}</span
>做删除操作。 >做删除操作。
</div> </div>
<template #footer> <template #footer>
...@@ -137,7 +132,7 @@ ...@@ -137,7 +132,7 @@
<bg-icon <bg-icon
style="font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline" style="font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline"
icon="#bg-ic-circle-tips"></bg-icon> icon="#bg-ic-circle-tips"></bg-icon>
您正在对 <span class="danger_info">{{ selectedRow.business_name }}</span 您正在对 <span class="danger_info">{{ selectedRow.system_account }}</span
>做修改密码操作,修改后旧密码将无法登录。 >做修改密码操作,修改后旧密码将无法登录。
</div> </div>
<div> <div>
...@@ -192,13 +187,13 @@ import bgBreadcrumb from "@/components/bg-breadcrumb.vue"; ...@@ -192,13 +187,13 @@ import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const dataTable = ref(null); const dataTable = ref(null);
const headers = ref([ const headers = ref([
{ {
label: "业务系统编码", label: "姓名",
prop: "business_code", prop: "name",
minWidth: 160, minWidth: 160,
}, },
{ {
label: "业务系统名称", label: "手机号",
prop: "business_name", prop: "phone",
minWidth: 160, minWidth: 160,
}, },
{ {
...@@ -207,7 +202,7 @@ const headers = ref([ ...@@ -207,7 +202,7 @@ const headers = ref([
}, },
{ {
label: "所属组织", label: "所属组织",
prop: "organization_name", prop: "org_name",
minWidth: 180, minWidth: 180,
}, },
{ {
...@@ -227,7 +222,6 @@ const headers = ref([ ...@@ -227,7 +222,6 @@ const headers = ref([
}, },
]); ]);
const tableRows = ref([]); const tableRows = ref([]);
const search = ref("");
const filter = reactive({ const filter = reactive({
search: "", search: "",
page: 1, page: 1,
...@@ -281,22 +275,22 @@ const getTableRows = () => { ...@@ -281,22 +275,22 @@ const getTableRows = () => {
}) })
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
tableRows.value = res.data.data || []; tableRows.value = res.data.data?.org_users?.data || [];
tableTotal.value = res.data.total; tableTotal.value = res.data.data?.org_users?.total || 0;
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
} }
}); });
}; };
const addAccount = (params) => { const addAccount = () => {
router.push({ router.push({
path: "/authority/user/add", path: "/authority/user/add",
}); });
}; };
const handleNodeClick = (data) => { const handleNodeClick = (data) => {
if (data.data_type == 1) { if (data.data_type > 0) {
selectNode.value = data.organization_id; selectNode.value = data.organization_id;
changePage(1); changePage(1);
} else { } else {
...@@ -326,7 +320,6 @@ const getOrgTree = () => { ...@@ -326,7 +320,6 @@ const getOrgTree = () => {
orgData.value = res.data.data || []; orgData.value = res.data.data || [];
// orgData.value.shift(); // orgData.value.shift();
const orgList = searchOrg(orgData.value); const orgList = searchOrg(orgData.value);
console.log("orgList", orgList);
if (route.query.organization_id) { if (route.query.organization_id) {
searchItem(orgData.value, route.query.organization_id); searchItem(orgData.value, route.query.organization_id);
} else { } else {
...@@ -386,9 +379,10 @@ const filterNode = (value, data) => { ...@@ -386,9 +379,10 @@ const filterNode = (value, data) => {
}; };
const stateChange = (row) => { const stateChange = (row) => {
console.log("row", row);
const params = { const params = {
id: row.id, id: row.id,
state: row.state == 1 ? 0 : 1, state: row.state,
}; };
axios.post(`/v1/api/user/updateState`, params).then((res) => { axios.post(`/v1/api/user/updateState`, params).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -544,7 +538,7 @@ const editConfirm = () => { ...@@ -544,7 +538,7 @@ const editConfirm = () => {
const selectRows = (data) => { const selectRows = (data) => {
selected.value = data.selection; selected.value = data.selection;
selectedName.value = data.selection.map((item) => item.business_name); selectedName.value = data.selection.map((item) => item.system_account);
}; };
const clearSelected = () => { const clearSelected = () => {
......
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