Commit 35254706 authored by 何小勇's avatar 何小勇

组织管理-平台用户

parent f5eafea0
...@@ -1540,3 +1540,15 @@ border-radius:8px; ...@@ -1540,3 +1540,15 @@ border-radius:8px;
cursor: pointer; cursor: pointer;
} }
.warning_info {
background-color: #f7f7f9;
font-size: 14px;
color: #404a62;
padding: 5px;
text-align: left;
margin: 20px 0;
}
.danger_info {
color: #d75138;
}
...@@ -41,7 +41,7 @@ const checkPhone = (rule, value, callback) => { ...@@ -41,7 +41,7 @@ const checkPhone = (rule, value, callback) => {
callback(); callback();
} }
}); });
}; };
const contactFormRules = reactive({ const contactFormRules = reactive({
contact_name: [ contact_name: [
......
...@@ -62,7 +62,14 @@ ...@@ -62,7 +62,14 @@
<el-input v-model="systemForm.access_address" /> <el-input v-model="systemForm.access_address" />
</el-form-item> </el-form-item>
<el-form-item label="开发厂商名称" prop="develop_id"> <el-form-item label="开发厂商名称" prop="develop_id">
<el-input v-model="systemForm.develop_id" /> <el-select v-model="systemForm.develop_id" placeholder="请选择开发厂商" style="width: 100%">
<el-option
v-for="item in firmList"
:key="item.dict_id"
:label="item.dict_name"
:value="item.dict_id"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否启用" prop="state"> <el-form-item label="是否启用" prop="state">
<bg-switch :labels="['否','是']" :values="[0,1]" v-model="systemForm.state"></bg-switch> <bg-switch :labels="['否','是']" :values="[0,1]" v-model="systemForm.state"></bg-switch>
...@@ -174,6 +181,7 @@ const formRules = reactive({ ...@@ -174,6 +181,7 @@ const formRules = reactive({
const systemRef = ref(null) const systemRef = ref(null)
const emit = defineEmits(['action']) const emit = defineEmits(['action'])
const roleList = ref([]) const roleList = ref([])
const firmList = ref([])
const submitForm = async () => { const submitForm = async () => {
if (!systemRef) return if (!systemRef) return
...@@ -235,9 +243,22 @@ const getRoleList = () => { ...@@ -235,9 +243,22 @@ const getRoleList = () => {
}) })
} }
const getFirmList = () => {
$axios.get(`/apaas/system/v5/dictionary/developer/list`)
.then((res) => {
if (res.data.code == 200) {
firmList.value = res.data.data;
}else {
}
})
}
onBeforeMount(() =>{ onBeforeMount(() =>{
getOrgTree() getOrgTree()
getRoleList() getRoleList()
getFirmList()
}) })
onMounted(() => { onMounted(() => {
......
...@@ -20,7 +20,14 @@ ...@@ -20,7 +20,14 @@
/> />
</div> </div>
<div class="tree"> <div class="tree">
<el-tree ref="treeRef" :data="orgData" :props="defaultProps" @node-click="handleNodeClick" :filter-node-method="filterNode" :default-expand-all="true"> <el-tree ref="treeRef"
:data="orgData"
:props="defaultProps"
@node-click="handleNodeClick"
node-key="id"
:highlight-current="true"
:filter-node-method="filterNode"
:default-expand-all="true">
<template #default="{ node, data }"> <template #default="{ node, data }">
<div class="custom_tree_node"> <div class="custom_tree_node">
<span <span
...@@ -36,7 +43,7 @@ ...@@ -36,7 +43,7 @@
</div> </div>
<div class="flex_right bgc_white"> <div class="flex_right bgc_white">
<div class="main_container"> <div class="main_container">
<bg-filter-group @search="getTableRows" v-model="filter.search" placeholder="请输入关键字"> <bg-filter-group @search="changeSearch" v-model="filter.search" placeholder="请输入关键字">
<template v-slot:left_action> <template v-slot:left_action>
<div class="apaas_button"> <div class="apaas_button">
<el-button class="register_btn" type="primary" @click="addAccount"> <el-button class="register_btn" type="primary" @click="addAccount">
...@@ -196,7 +203,7 @@ ...@@ -196,7 +203,7 @@
<script setup> <script setup>
import { Search } from '@element-plus/icons-vue' import { Search } from '@element-plus/icons-vue'
import { reactive, toRefs, ref, } from '@vue/reactivity' import { reactive, toRefs, ref, } from '@vue/reactivity'
import { getCurrentInstance, watch } from 'vue' import { getCurrentInstance, watch, nextTick } from 'vue'
import { computed, onBeforeMount } from '@vue/runtime-core' import { computed, onBeforeMount } from '@vue/runtime-core'
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { edit } from 'ace-builds'; import { edit } from 'ace-builds';
...@@ -280,6 +287,7 @@ import CryptoJS from "crypto-js"; ...@@ -280,6 +287,7 @@ import CryptoJS from "crypto-js";
const passwordFormRules = reactive({ const passwordFormRules = reactive({
password: [ password: [
{ required: true, message: '请输入密码', trigger: 'blur' }, { required: true, message: '请输入密码', trigger: 'blur' },
{min: 8,message: '密码长度不得低于8位',trigger: 'blur'}
], ],
confirm_password: [ confirm_password: [
{ required: true, message: '请确认密码', trigger: 'blur' }, { required: true, message: '请确认密码', trigger: 'blur' },
...@@ -317,8 +325,8 @@ import CryptoJS from "crypto-js"; ...@@ -317,8 +325,8 @@ import CryptoJS from "crypto-js";
console.log(data.data_type) console.log(data.data_type)
if(data.data_type == 1) { if(data.data_type == 1) {
selectNode.value = data.id; selectNode.value = data.id;
changePage(1)
} }
console.log(selectNode)
} }
const orgData = ref([]) const orgData = ref([])
...@@ -333,8 +341,14 @@ import CryptoJS from "crypto-js"; ...@@ -333,8 +341,14 @@ import CryptoJS from "crypto-js";
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
orgData.value = res.data.data || []; orgData.value = res.data.data || [];
const orgList = searchOrg(res.data.data); orgData.value.shift()
selectNode.value = orgList.length > 1 ? orgList[1].id : ''; const orgList = searchOrg(orgData.value);
selectNode.value = orgList.length > 0 ? orgList[0].id : '';
nextTick(() =>{
if(orgList.length > 0) {
treeRef.value.setCurrentNode(orgList[0])
}
})
getTableRows() getTableRows()
}else { }else {
$message.error(res.data.msg) $message.error(res.data.msg)
...@@ -385,7 +399,7 @@ import CryptoJS from "crypto-js"; ...@@ -385,7 +399,7 @@ import CryptoJS from "crypto-js";
const changeSize = (size) => { const changeSize = (size) => {
filter.limit = size; filter.limit = size;
filter.page = 1; filter.page = 1;
getTableRows() changePage(1)
} }
const changePage = (page) => { const changePage = (page) => {
...@@ -393,6 +407,11 @@ import CryptoJS from "crypto-js"; ...@@ -393,6 +407,11 @@ import CryptoJS from "crypto-js";
getTableRows() getTableRows()
} }
const changeSearch = (val) => {
filter.search = val
changePage(1)
} // 表格关键字筛选
const goDetail = (params) => { const goDetail = (params) => {
router.push({ router.push({
path: "/develop/account/detail", path: "/develop/account/detail",
...@@ -412,8 +431,12 @@ import CryptoJS from "crypto-js"; ...@@ -412,8 +431,12 @@ import CryptoJS from "crypto-js";
} }
const deleteAccount = (data) => { const deleteAccount = (data) => {
selectedRow.value = data; if(data.state === 0) {
deleteRowFlag.value = true; selectedRow.value = data;
deleteRowFlag.value = true;
}else {
$message.error('当前状态已启用,不可删除!')
}
} }
const handleCloseDelete = () => { const handleCloseDelete = () => {
...@@ -605,16 +628,6 @@ import CryptoJS from "crypto-js"; ...@@ -605,16 +628,6 @@ import CryptoJS from "crypto-js";
bottom: unset; bottom: unset;
margin-top: 0px margin-top: 0px
} }
.warning_info {
background-color: #f7f7f9;
font-size: 14px;
color: #404a62;
padding: 5px;
text-align: left;
margin: 20px 0;
}
.danger_info {
color: #d75138;
}
</style> </style>
\ No newline at end of file
...@@ -32,26 +32,50 @@ ...@@ -32,26 +32,50 @@
<bg-info v-if="selectTreeDataType === 2" :data="baseInfo2"></bg-info> <bg-info v-if="selectTreeDataType === 2" :data="baseInfo2"></bg-info>
</div> </div>
<div class="main_container bgc_white"> <div class="main_container bgc_white">
<bg-filter-group @search="getTableRows" v-model="filter.search" placeholder="请输入关键字"> <bg-filter-group @search="changeSearch" v-model="filter.key_word" placeholder="请输入关键字">
<template v-slot:left_action> <template v-slot:left_action>
<div class="apaas_button"> <div class="apaas_button">
<el-button class="register_btn" type="primary" @click="addAccount"> <el-button class="register_btn" type="primary" @click="addAccount">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-add"></bg-icon> <bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-add"></bg-icon>
{{selectTreeDataType === 1 ? '新增组织管理员' : '新增平台用户' }} {{selectTreeDataType === 1 ? '新增组织管理员' : '新增平台用户' }}
</el-button> </el-button>
<!-- <el-button class="register_btn" @click="deleteBatch"> <el-button class="register_btn" @click="deleteBatch">
批量删除 批量删除
</el-button> </el-button>
<el-button class="register_btn" @click="resetPsd"> <el-button class="register_btn" @click="resetPsd">
重置密码 重置密码
</el-button> </el-button>
<span class="header_info">已选择<span style="color: #202531;font-weight: bold">{{selected.length}}</span></span> <span class="header_info">已选择<span style="color: #202531;font-weight: bold">{{selected.length}}</span></span>
<span class="header_info name_btn" @click="clearSelected">清空</span> --> <span class="header_info name_btn" @click="clearSelected">清空</span>
</div> </div>
</template> </template>
<template v-slot:filter_group>
<div class="left-filter filter_list">
<div class="filter_item">
<span class="filter_title">启用状态</span>
<el-select
v-model="filter.state"
placeholder="请选择"
style="width: 300px"
>
<el-option
v-for="(item, index) in stateOptions"
:key="'pushOptions' + index"
:label="item.name"
:value="item.value"
>
</el-option>
</el-select>
</div>
</div>
<div class="right-action apaas_button">
<el-button type="primary" @click="filterAction"> 查询 </el-button>
<el-button type="default" @click="filterClear"> 重置 </el-button>
</div>
</template>
</bg-filter-group> </bg-filter-group>
<div class="table_container apaas_scroll"> <div class="table_container apaas_scroll">
<bg-table ref="bgTable" :headers="headers" :rows="tableRows" :isIndex="true" :stripe="true"> <bg-table ref="dataTable" :headers="headers" :rows="tableRows" :isIndex="true" :stripe="true" :select="true" @selectAc="selectRows">
<template v-slot:system_account="{ row }"> <template v-slot:system_account="{ row }">
<span @click="goDetail(row)" class="name_btn"> <span @click="goDetail(row)" class="name_btn">
{{ row.system_account }} {{ row.system_account }}
...@@ -64,10 +88,10 @@ ...@@ -64,10 +88,10 @@
<bg-table-btn @click="editAccount(row)" class="btn"> <bg-table-btn @click="editAccount(row)" class="btn">
编辑 编辑
</bg-table-btn> </bg-table-btn>
<bg-table-btn class="btn"> <bg-table-btn @click="editPsdAccount(row)" class="btn">
修改密码 修改密码
</bg-table-btn> </bg-table-btn>
<bg-table-btn class="btn"> <bg-table-btn @click="deleteAccount(row)" class="btn">
删除 删除
</bg-table-btn> </bg-table-btn>
</template> </template>
...@@ -121,18 +145,116 @@ ...@@ -121,18 +145,116 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
v-model="dialogDel" v-model="dialogDelNode"
title="删除" title="删除"
width="520px" width="520px"
:before-close="handleCloseDel" :before-close="handleCloseDelNode"
> >
<div class="dialog_form"> <div class="dialog_form">
确认删除吗? 确认删除吗?
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="handleCloseDel">取消</el-button> <el-button @click="handleCloseDelNode">取消</el-button>
<el-button type="primary" @click="confirmDel">确认</el-button> <el-button type="primary" @click="confirmDelNode">确认</el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="deleteRowFlag"
title="删除"
width="520px"
:before-close="handleCloseRowDelete"
>
<div class="warning_info">
<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.system_account}}</span>做删除操作。
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseRowDelete">取消</el-button>
<el-button type="primary" @click="deleteRowConfirm">确定</el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="editFlag"
title="修改密码"
width="520px"
:before-close="handleCloseEdit"
>
<div class="warning_info">
<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.system_account}}</span>做修改密码操作,修改后旧密码将无法登录。
</div>
<div>
<el-form
:label-position="'right'"
label-width="120px"
:model="passwordForm"
:rules="passwordFormRules"
ref="passwordRef"
style="max-width: 80%"
>
<el-form-item label="新密码" prop="password">
<el-input v-model="passwordForm.password" :type="password_eye ? 'text' : 'password'" placeholder="请输入密码">
<template #suffix>
<bg-icon @click="password_eye = !password_eye" class="icon_eye" icon="#bg-ic-eye"></bg-icon>
</template>
</el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="confirm_password">
<el-input v-model="passwordForm.confirm_password" :type="confirm_eye ? 'text' : 'password'" placeholder="请确认新密码">
<template #suffix>
<bg-icon @click="confirm_eye = !confirm_eye" class="icon_eye" icon="#bg-ic-eye"></bg-icon>
</template>
</el-input>
</el-form-item>
</el-form>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseEdit">取消</el-button>
<el-button type="primary" @click="editConfirm">确定</el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="deleteFlag"
title="删除"
width="520px"
:before-close="handleCloseDelete"
>
<div class="warning_info">
<bg-icon style="font-size: 12px; color: #a9b1c7; mdeleteConfirmargin-right: 8px;vertical-align: baseline;" icon="#bg-ic-circle-tips"></bg-icon>
您正在对 <span class="danger_info">{{selectedName.join('、')}}</span>做删除操作。
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseDelete">取消</el-button>
<el-button type="primary" @click="deleteConfirm">确定</el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="resetFlag"
title="重置密码"
width="520px"
:before-close="handleCloseReset"
>
<div class="warning_info">
<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">{{selectedName.join('、')}}</span>做重置密码操作。
</div>
<div>
重置密码为123456,是否继续?
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCloseReset">取消</el-button>
<el-button type="primary" @click="resetConfirm">确定</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
...@@ -148,10 +270,12 @@ import { useRouter } from 'vue-router'; ...@@ -148,10 +270,12 @@ import { useRouter } from 'vue-router';
import tree from './tree.vue'; import tree from './tree.vue';
import directoryForm from './directory-form.vue'; import directoryForm from './directory-form.vue';
import orgForm from './org-form.vue'; import orgForm from './org-form.vue';
import CryptoJS from "crypto-js";
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy const { $axios,$message } = proxy
const dataTable = ref(null);
const baseInfo = reactive( const baseInfo = reactive(
[ [
{ {
...@@ -236,23 +360,65 @@ import orgForm from './org-form.vue'; ...@@ -236,23 +360,65 @@ import orgForm from './org-form.vue';
fixed: "right", fixed: "right",
}, },
]); ]);
const stateOptions = ref([
{
name: "全部",
value: ""
},
{
name: "启用",
value: "1"
},
{
name: "禁用",
value: "0"
},
])
const tableRows = ref([]); const tableRows = ref([]);
const tableTotal = ref(0); const tableTotal = ref(0);
const search = ref("");
const orgTree = ref(null); const orgTree = ref(null);
const selectTreeData = ref(null) const selectTreeData = ref(null)
const selectTreeDataType = ref(2); const selectTreeDataType = ref(2);
const dialogDel = ref(false) const dialogDelNode = ref(false)
const router = useRouter(); const router = useRouter();
const filter = reactive({ const filter = reactive({
organization_id: '',
data_type: '',
state: '', state: '',
key_word: "", key_word: "",
page: 1, page: 1,
limit: 10, limit: 10,
}); });
const deleteFlag = ref(false)
const deleteRowFlag = ref(false)
const resetFlag = ref(false)
const selectedRow = ref({})
const selected = ref([])
const selectedName = ref([])
const editFlag = ref(false)
const password_eye = ref(false)
const confirm_eye = ref(false)
const passwordRef = ref(null)
const passwordForm = reactive({
password: '',
confirm_password: '',
})
const validatePass = (rule, value, callback) => {
if (value !== passwordForm.password) {
callback(new Error("密码输入不一致"))
} else {
callback()
}
}
const passwordFormRules = reactive({
password: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{min: 8,message: '密码长度不得低于8位',trigger: 'blur'}
],
confirm_password: [
{ required: true, message: '请确认密码', trigger: 'blur' },
{ validator: validatePass, trigger: 'blur' }
],
})
const addAccount = (params) => { const addAccount = (params) => {
if(selectTreeDataType.value === 1) { if(selectTreeDataType.value === 1) {
...@@ -276,12 +442,31 @@ import orgForm from './org-form.vue'; ...@@ -276,12 +442,31 @@ import orgForm from './org-form.vue';
const changeSize = (size) => { const changeSize = (size) => {
filter.limit = size;
changePage(1)
}
const changePage = (page) => {
filter.page = page;
getTableRows();
} }
const changePage = (size) => { const changeSearch = (val) => {
filter.key_word = val
changePage(1)
} // 表格关键字筛选
} const filterAction = () => {
changePage(1)
} // 查询按钮
const filterClear = () => {
filter.state = "";
filter.key_word = "";
filter.limit = 10
filter.page = 1
changePage(1)
} // 重置筛选项
const dialogDirectory = ref(false) const dialogDirectory = ref(false)
const directoryFormType = ref('create') const directoryFormType = ref('create')
...@@ -387,12 +572,12 @@ import orgForm from './org-form.vue'; ...@@ -387,12 +572,12 @@ import orgForm from './org-form.vue';
} }
const handleCloseDel = () => { const handleCloseDelNode = () => {
dialogDel.value = false; dialogDelNode.value = false;
} }
//删除目录/组织 //删除目录/组织
const confirmDel = () => { const confirmDelNode = () => {
$axios.delete(`/apaas/system/v5/org/${selectTreeData.value.id}`) $axios.delete(`/apaas/system/v5/org/${selectTreeData.value.id}`)
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -401,7 +586,7 @@ import orgForm from './org-form.vue'; ...@@ -401,7 +586,7 @@ import orgForm from './org-form.vue';
}else { }else {
$message.error(res.data.msg) $message.error(res.data.msg)
} }
handleCloseDel() handleCloseDelNode()
}) })
} }
...@@ -456,7 +641,7 @@ import orgForm from './org-form.vue'; ...@@ -456,7 +641,7 @@ import orgForm from './org-form.vue';
}) })
} }
}else if(data.action === 'delete'){ }else if(data.action === 'delete'){
dialogDel.value = true; dialogDelNode.value = true;
}else if(data.action === 'mvup' || data.action === 'mvdown') { }else if(data.action === 'mvup' || data.action === 'mvdown') {
moveOrg(data.data); moveOrg(data.data);
} }
...@@ -520,24 +705,168 @@ import orgForm from './org-form.vue'; ...@@ -520,24 +705,168 @@ import orgForm from './org-form.vue';
}) })
} }
const stateChange = (row) => {
const state = row.state.toString();
$axios.post(
`/apaas/system/v5/user/state/${row.id}/${state}`,
)
.then((res) => {
if (res.data.code == 200) {
getTableRows()
}else {
$message.error(res.data.msg)
}
})
}
const editPsdAccount = (data) => {
selectedRow.value = data;
editFlag.value = true;
}
const handleCloseEdit = () => {
if (!passwordRef) return
passwordRef.value.resetFields()
editFlag.value = false;
}
const editConfirm = () => {
if (!passwordRef) return
passwordRef.value.validate((valid, fields) => {
if (valid) {
$axios.post(
`/apaas/system/v5/user/editpwd`,
{
id: selectedRow.value.id,
password: CryptoJS.AES.encrypt(passwordForm.password,"swuE9cmCZQwrkYRV").toString()
}
)
.then((res) => {
if (res.data.code == 200) {
$message.success(res.data.msg)
}else {
$message.error(res.data.msg)
}
handleCloseEdit();
})
}
})
}
const deleteAccount = (data) => {
if(data.state === 0) {
selectedRow.value = data;
deleteRowFlag.value = true;
}else {
$message.error('当前状态已启用,不可删除!')
}
}
const handleCloseRowDelete = () => {
deleteRowFlag.value = false;
}
const deleteRowConfirm = () => {
$axios.delete(
`/apaas/system/v5/user/delete`,{data: {ids: [selectedRow.value.id]}}
)
.then((res) => {
if (res.data.code == 200) {
$message.success(res.data.msg)
getTableRows()
}else {
$message.error(res.data.msg)
}
handleCloseRowDelete();
})
}
const editAccount = (data) => { const editAccount = (data) => {
if(selectTreeDataType === 1) { if(selectTreeDataType === 1) {
router.push({ router.push({
path: "/system/organization/platform-user", path: "/system/organization/org-user",
query: { query: {
id: data.id id: data.id
} }
}) })
} else { } else { router.push({
router.push({ path: "/system/organization/platform-user",
path: "/system/organization/org-user",
query: { query: {
id: data.id id: data.id
} }
}) })
} }
} }
const handleCloseDelete = () => {
deleteFlag.value = false;
}
const deleteConfirm = () => {
const ids = selected.value.map(item => item.id)
$axios.delete(
`/apaas/system/v5/user/delete`,{data: {ids: ids}}
)
.then((res) => {
if (res.data.code == 200) {
$message.success(res.data.msg)
getTableRows()
}else {
$message.error(res.data.data)
}
handleCloseDelete();
})
}
const deleteBatch = () => {
if(selectedName.value.length > 0){
deleteFlag.value = true;
}else {
$message.error('请先选择需要操作的数据!')
}
}
const handleCloseReset = () => {
resetFlag.value = false;
}
const resetPsd = () => {
if(selectedName.value.length > 0){
resetFlag.value = true;
}else {
$message.error('请先选择需要操作的数据!')
}
}
const resetConfirm = () => {
const ids = selected.value.map(item => item.id)
$axios.post(
`/apaas/system/v5/user/resetpwd`,{ids: ids}
)
.then((res) => {
if (res.data.code == 200) {
$message.success(res.data.msg)
getTableRows()
}else {
$message.error(res.data.msg)
}
handleCloseReset();
})
}
const selectRows = (data) => {
selected.value = data.selection;
selectedName.value = data.selection.map(item => item.system_account)
}
const clearSelected = () => {
dataTable.value.clearSelection();
}
onBeforeMount(() => { onBeforeMount(() => {
}) })
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
<div class="content_main"> <div class="content_main">
<orgAccountForm v-show="step === 1" :form-type="route.query.id ? true : false" ref="orgAccountRef" @action="getOrgAccountFormData"></orgAccountForm> <orgAccountForm v-show="step === 1" :form-type="route.query.id ? true : false" :id="route.query.id" ref="orgAccountRef" @action="getOrgAccountFormData"></orgAccountForm>
<orgPersonForm v-show="step === 2" ref="orgPersonRef" @action="getOrgPersonFormData"></orgPersonForm> <orgPersonForm v-show="step === 2" ref="orgPersonRef" @action="getOrgPersonFormData"></orgPersonForm>
<div class="process_end" v-show="step === 3"> <div class="process_end" v-show="step === 3">
<div> <div>
......
...@@ -53,10 +53,10 @@ const props = defineProps({ ...@@ -53,10 +53,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, //false 新建 true 编辑 default: false, //false 新建 true 编辑
}, },
// id: { id: {
// type: String, type: String,
// default: '', default: '',
// } }
}); });
const orgAccountForm = reactive({ const orgAccountForm = reactive({
organization_id: '', organization_id: '',
...@@ -77,6 +77,53 @@ const validatePass = (rule, value, callback) => { ...@@ -77,6 +77,53 @@ const validatePass = (rule, value, callback) => {
} }
} }
const validateSystemAccount = (rule, value, callback) => {
let params = null;
if (props.id){
params = {id: parseInt(props.id),system_account: value,}
}else {
params = {system_account: value}
}
$axios.post(`/apaas/system/v5/user/check/account`,params)
.then((res) => {
if (res.data.code == 200) {
callback()
}else {
callback(new Error(res.data.data))
}
})
}
const checkPhone = (rule, value, callback) => {
var phone_ruler = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
setTimeout(() => {
if (!phone_ruler.test(value)&&value.length!==0) {
callback(new Error("请输入正确的手机号码"));
} else {
callback();
}
});
};
const checkPhoneRepet = (rule, value, callback) => {
let params = null;
if (props.id){
params = {id: parseInt(props.id),contact_phone: value,}
}else {
params = {id: 0,contact_phone: value}
}
$axios.post(`/apaas/system/v5/org/check`,params)
.then((res) => {
if (res.data.code == 200) {
callback()
}else {
callback(new Error(res.data.data))
}
})
}
const orgAccountFormRules = reactive({ const orgAccountFormRules = reactive({
organization_id: [ organization_id: [
{ required: true, message: '请选择组织', trigger: 'blur' }, { required: true, message: '请选择组织', trigger: 'blur' },
...@@ -86,13 +133,17 @@ const orgAccountFormRules = reactive({ ...@@ -86,13 +133,17 @@ const orgAccountFormRules = reactive({
], ],
system_account: [ system_account: [
{ required: true, message: '请输入账号', trigger: 'blur' }, { required: true, message: '请输入账号', trigger: 'blur' },
{ validator: validateSystemAccount, trigger: 'blur' },
], ],
contact_phone: [ contact_phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' }, { required: true, message: '请输入手机号', trigger: 'blur' },
{ validator: checkPhone, trigger: 'blur' },
{ validator: checkPhoneRepet, trigger: 'blur' }
], ],
password: [ password: [
{ required: true, message: '请输入密码', trigger: 'blur' }, { required: true, message: '请输入密码', trigger: 'blur' },
{min: 8,message: '密码长度不得低于8位',trigger: 'blur'}
], ],
confirm_password: [ confirm_password: [
{ required: true, message: '请确认密码', trigger: 'blur' }, { required: true, message: '请确认密码', trigger: 'blur' },
......
...@@ -49,6 +49,10 @@ const documentTypeList = ref([{ ...@@ -49,6 +49,10 @@ const documentTypeList = ref([{
}]) }])
const orgPersonFormRules = reactive({ const orgPersonFormRules = reactive({
contact_email: [
// { required: true, message: '请输入手机号', trigger: 'blur' },
{ type: 'email',message: '请输入正确的邮箱', trigger: 'blur' }
],
}) })
const orgPersonFormRef = ref(null) const orgPersonFormRef = ref(null)
const emit = defineEmits(['action']) const emit = defineEmits(['action'])
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</div> </div>
<div class="page_content flex_cloumn"> <div class="page_content flex_cloumn">
<div class="content_top apaas_scroll"> <div class="content_top apaas_scroll">
<div class="content_process"> <div class="content_process" v-if="!route.query.id">
<div> <div>
<el-steps :active="step" > <el-steps :active="step" >
<el-step title="" :class="{'process_complete': step > 1}"> <el-step title="" :class="{'process_complete': step > 1}">
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
<div class="content_main"> <div class="content_main">
<platformAccountForm v-show="step === 1" ref="platformAccountFormRef" @action="getPlatformAccountFormData"></platformAccountForm> <platformAccountForm v-show="step === 1" :form-type="route.query.id ? true : false" :id="route.query.id" ref="platformAccountFormRef" @action="getPlatformAccountFormData"></platformAccountForm>
<platformPersonForm v-show="step === 2" ref="plplatformPersonFormRef" @action="getPlatformPersonFormData"></platformPersonForm> <platformPersonForm v-show="step === 2" ref="plplatformPersonFormRef" @action="getPlatformPersonFormData"></platformPersonForm>
<div class="process_end" v-show="step === 3"> <div class="process_end" v-show="step === 3">
<div> <div>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<div class="content_bottom" v-if="step !== 3"> <div class="content_bottom" v-if="step !== 3">
<div v-show="step === 1"> <div v-show="!route.query.id && step === 1">
<el-button @click="cancel">取消</el-button> <el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="nextStep">下一步</el-button> <el-button type="primary" @click="nextStep">下一步</el-button>
</div> </div>
...@@ -70,7 +70,10 @@ ...@@ -70,7 +70,10 @@
<el-button type="primary" @click="previousStep">上一步</el-button> <el-button type="primary" @click="previousStep">上一步</el-button>
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit">提交</el-button>
</div> </div>
<div v-show="route.query.id">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="nextStep">保存</el-button>
</div>
</div> </div>
</div> </div>
...@@ -115,8 +118,26 @@ const nextStep = () => { ...@@ -115,8 +118,26 @@ const nextStep = () => {
//账号信息表单检验触发事件 data为null 校验失败 //账号信息表单检验触发事件 data为null 校验失败
const getPlatformAccountFormData = (data) => { const getPlatformAccountFormData = (data) => {
if(data) { if(data) {
Object.assign(formData,data); if(route.query.id) {
step.value = 2; Object.assign(formData,data);
let params = {
...formData,
logo: formData.logo && formData.logo.length > 0 ? formData.logo[0].url : '',
}
$axios.put(`/apaas/system/v5/org/update/user/${route.query.id}`,params)
.then((res) => {
if (res.data.code == 200) {
successFlag.value = true;
step.value = 3;
}else {
$message.error(res.data.msg)
}
})
}else {
Object.assign(formData,data);
step.value = 2;
}
}else { }else {
} }
...@@ -127,18 +148,18 @@ const getPlatformPersonFormData = (data) => { ...@@ -127,18 +148,18 @@ const getPlatformPersonFormData = (data) => {
Object.assign(formData,data); Object.assign(formData,data);
if(route.query.id) { if(route.query.id) {
console.log(formData) console.log(formData)
let params = { // let params = {
} // }
$axios.post(`/apaas/system/v5/org/update/user/:id`,params) // $axios.post(`/apaas/system/v5/org/update/user/${route.query.id}`,params)
.then((res) => { // .then((res) => {
if (res.data.code == 200) { // if (res.data.code == 200) {
successFlag.value = true; // successFlag.value = true;
step.value = 3; // step.value = 3;
}else { // }else {
$message.error(res.data.msg) // $message.error(res.data.msg)
} // }
}) // })
}else { }else {
const params = {...formData, const params = {...formData,
...@@ -190,10 +211,30 @@ const getOrgTree = () => { ...@@ -190,10 +211,30 @@ const getOrgTree = () => {
}) })
} }
const getDetail = () => {
$axios.get(`/apaas/system/v5/org/user/${route.query.id}`)
.then((res) => {
if (res.data.code == 200) {
const form = res.data.data;
platformAccountFormRef.value.setForm({
logo: [{url:form.logo}],
system_account: form.system_account,
contact_phone: form.contact_phone,
state: form.state,
contact_name: form.contact_name,
contact_email: form.contact_email,
remark: form.remark,
})
}else {
$message.error(res.data.msg)
}
})
}
onBeforeMount(() => { onBeforeMount(() => {
getOrgTree() getOrgTree()
if(route.query.id) { if(route.query.id) {
console.log(route.query.id) getDetail()
} }
}) })
onMounted(() => { onMounted(() => {
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<el-form-item label="手机号" prop="contact_phone"> <el-form-item label="手机号" prop="contact_phone">
<el-input v-model="platformAccountForm.contact_phone" /> <el-input v-model="platformAccountForm.contact_phone" />
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item v-if="!formType" label="密码" prop="password">
<el-input type="password" v-model="platformAccountForm.password" /> <el-input type="password" v-model="platformAccountForm.password" />
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirm_password"> <el-form-item v-if="!formType" label="确认密码" prop="confirm_password">
<el-input type="password" v-model="platformAccountForm.confirm_password" /> <el-input type="password" v-model="platformAccountForm.confirm_password" />
</el-form-item> </el-form-item>
<el-form-item label="角色授权" prop="select_role"> <el-form-item v-if="!formType" label="角色授权" prop="select_role">
<el-select v-model="platformAccountForm.select_role" multiple placeholder="请选择角色" style="width: 100%"> <el-select v-model="platformAccountForm.select_role" multiple placeholder="请选择角色" style="width: 100%">
<el-option <el-option
v-for="item in roleList" v-for="item in roleList"
...@@ -31,6 +31,15 @@ ...@@ -31,6 +31,15 @@
:value="item.role_id" :value="item.role_id"
/> />
</el-select> </el-select>
</el-form-item>
<el-form-item v-if="formType" label="姓名" prop="contact_name">
<el-input v-model="platformAccountForm.contact_name" />
</el-form-item>
<el-form-item v-if="formType" label="邮箱" prop="contact_email">
<el-input v-model="platformAccountForm.contact_email"/>
</el-form-item>
<el-form-item v-if="formType" label="备注" prop="remark">
<el-input type="textarea" :rows="3" v-model="platformAccountForm.remark" />
</el-form-item> </el-form-item>
<el-form-item label="是否启用" prop="state"> <el-form-item label="是否启用" prop="state">
<bg-switch :labels="['否','是']" :values="[0,1]" v-model="platformAccountForm.state"></bg-switch> <bg-switch :labels="['否','是']" :values="[0,1]" v-model="platformAccountForm.state"></bg-switch>
...@@ -43,6 +52,16 @@ ...@@ -43,6 +52,16 @@
import { reactive, ref, onMounted, onBeforeMount, getCurrentInstance } from 'vue' import { reactive, ref, onMounted, onBeforeMount, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy const { $axios,$message } = proxy
const props = defineProps({
formType: {
type: Boolean,
default: false, //false 新建 true 编辑
},
id: {
type: String,
default: '',
}
});
const platformAccountForm = reactive({ const platformAccountForm = reactive({
logo: [], logo: [],
system_account: '', system_account: '',
...@@ -51,6 +70,10 @@ const platformAccountForm = reactive({ ...@@ -51,6 +70,10 @@ const platformAccountForm = reactive({
confirm_password: '', confirm_password: '',
select_role: '', select_role: '',
state: 1, state: 1,
contact_name: '',
contact_email: '',
remark: '',
}) })
...@@ -70,26 +93,68 @@ const checkPhone = (rule, value, callback) => { ...@@ -70,26 +93,68 @@ const checkPhone = (rule, value, callback) => {
callback(); callback();
} }
}); });
}; };
const validateSystemAccount = (rule, value, callback) => {
let params = null;
if (props.id){
params = {id: parseInt(props.id),system_account: value,}
}else {
params = {system_account: value}
}
$axios.post(`/apaas/system/v5/user/check/account`,params)
.then((res) => {
if (res.data.code == 200) {
callback()
}else {
callback(new Error(res.data.data))
}
})
}
const checkPhoneRepet = (rule, value, callback) => {
let params = null;
if (props.id){
params = {id: parseInt(props.id),contact_phone: value,}
}else {
params = {id: 0,contact_phone: value}
}
$axios.post(`/apaas/system/v5/org/check`,params)
.then((res) => {
if (res.data.code == 200) {
callback()
}else {
callback(new Error(res.data.data))
}
})
}
const platformAccountFormRules = reactive({ const platformAccountFormRules = reactive({
system_account: [ system_account: [
{ required: true, message: '请输入账号', trigger: 'blur' }, { required: true, message: '请输入账号', trigger: 'blur' },
{ validator: validateSystemAccount, trigger: 'blur' },
], ],
contact_phone: [ contact_phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' }, { required: true, message: '请输入手机号', trigger: 'blur' },
// { validator: checkPhone, trigger: 'blur' } { validator: checkPhone, trigger: 'blur' },
{ validator: checkPhoneRepet, trigger: 'blur' }
], ],
select_role: [ select_role: [
{ required: true, message: '请选择角色', trigger: 'blur' }, { required: true, message: '请选择角色', trigger: 'blur' },
], ],
password: [ password: [
{ required: true, message: '请输入密码', trigger: 'blur' }, { required: true, message: '请输入密码', trigger: 'blur' },
{min: 8,message: '密码长度不得低于8位',trigger: 'blur'}
], ],
confirm_password: [ confirm_password: [
{ required: true, message: '请确认密码', trigger: 'blur' }, { required: true, message: '请确认密码', trigger: 'blur' },
{ validator: validatePass, trigger: 'blur' } { validator: validatePass, trigger: 'blur' }
], ],
contact_email: [
{ type: 'email',message: '请输入正确的邮箱', trigger: 'blur' }
],
}) })
const roleList = ref([]) const roleList = ref([])
......
...@@ -29,7 +29,9 @@ const platformPersonForm = reactive({ ...@@ -29,7 +29,9 @@ const platformPersonForm = reactive({
}) })
const platformPersonFormRules = reactive({ const platformPersonFormRules = reactive({
contact_email: [
{ type: 'email',message: '请输入正确的邮箱', trigger: 'blur' }
],
}) })
const platformPersonFormRef = ref(null) const platformPersonFormRef = ref(null)
const emit = defineEmits(['action']) const emit = defineEmits(['action'])
......
...@@ -10,29 +10,31 @@ ...@@ -10,29 +10,31 @@
<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 class="dashed_line">
</div> </div>
</div> </div>
<div class="info_content"> <div class="info_content">
<div class="img_box"> <div class="img_box">
<img src="/src/assets/imgs/home_ic_user.png" style="height: 96px;width: 96px;border-radius: 99px" alt=""> <img v-if="logo" :src="logo" style="height: 96px;width: 96px;border-radius: 99px" alt="">
<img v-else src="/src/assets/imgs/home_ic_user.png" style="height: 96px;width: 96px;border-radius: 99px" alt="">
</div> </div>
<div class="info_box"> <div class="info_box">
<bg-info :data="baseInfo"></bg-info> <bg-info :data="accountInfo"></bg-info>
</div> </div>
</div> </div>
</div> </div>
<div> <div>
<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 class="dashed_line">
</div> </div>
</div> </div>
<div class="info_content"> <div class="info_content">
<div class="img_box"></div> <div class="img_box"></div>
<div class="info_box"> <div class="info_box">
<bg-info :data="contactInfo"></bg-info> <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>
...@@ -44,103 +46,145 @@ ...@@ -44,103 +46,145 @@
import { reactive, toRefs, ref, } from '@vue/reactivity' import { reactive, toRefs, ref, } from '@vue/reactivity'
import { getCurrentInstance } from 'vue' import { getCurrentInstance } from 'vue'
import { computed, onBeforeMount } from '@vue/runtime-core' import { computed, onBeforeMount } from '@vue/runtime-core'
import { useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
const baseInfo = reactive( const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const route = useRoute();
const accountInfo = reactive(
[ [
{ {
name: "所属机构", name: "手机号",
value: "某某省/某某市/大数据局", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "业务系统编码", name: "账号",
value: "00000001", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "业务系统名称", name: "角色",
value: "大数据处理系统", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "账号", name: "所属组织",
value: "admin001", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "AppID", name: "创建人",
value: "dasjkjjk", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "AppSecret", name: "创建账号",
value: "asda*******************jhjh", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "创建人", name: "最后编辑时间",
value: "admin(机构管理员)", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "创建时间", name: "创建时间",
value: "2022-01-01 10:10:10", value: "",
nameWidth: 112 nameWidth: 130
},
]
)
const personInfo = reactive(
[{
name: "姓名",
value: "",
nameWidth: 130
}, },
{ {
name: "是否启用", name: "邮箱",
value: "", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "开发厂商名单", name: "证据类型",
value: "某某大数据开发商", value: "",
nameWidth: 112 nameWidth: 130
}, },
{ {
name: "访问地址", name: "身份证号",
value: "http://www.bigdata.com", value: "",
full: true, nameWidth: 130
nameWidth: 112
}, },
{ {
name: "业务系统描述", name: "备注",
value: "系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述", value: "",
full: true, full: true,
nameWidth: 112 nameWidth: 130
}, },
] ])
)
const contactInfo = reactive( const personInfo2 = reactive(
[{ [{
name: "联系人姓名", name: "姓名",
value: "xxx", value: "",
nameWidth: 112 nameWidth: 130
},
{
name: "联系人手机号",
value: "15627365265",
nameWidth: 112
}, },
{ {
name: "联系人邮箱", name: "邮箱",
value: "http://www.bigdata@163.com", value: "",
full: true, nameWidth: 130
nameWidth: 112
}, },
{ {
name: "备注", name: "备注",
value: "系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述系统描述", value: "",
full: true, full: true,
nameWidth: 112 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) => {
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[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 {
$message.error(res.data.msg)
}
})
}
onBeforeMount(() => { onBeforeMount(() => {
if(route.query.id) {
getDetail()
}
}) })
</script> </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