Commit a1ef092e authored by 张耀's avatar 张耀

Merge branch 'dev' into zy

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