调整接口目录&&用户列表

This commit is contained in:
lcc
2025-06-25 14:35:16 +08:00
parent c21e23a6fc
commit 67f4a52f4a
12 changed files with 210 additions and 133 deletions
@@ -1,7 +1,7 @@
import request from '@/utils/request';
export async function listOrganizations(params) {
const res = await request.get('/system/organization', {
const res = await request.get('organization/manage', {
params
});
if (res.data.code === 0) {
@@ -11,7 +11,7 @@ export async function listOrganizations(params) {
}
export async function addOrganization(data) {
const res = await request.post('/system/Organization', data);
const res = await request.post('/organization/manage', data);
if (res.data.code === 0) {
return res.data.message;
}
@@ -19,7 +19,7 @@ export async function addOrganization(data) {
}
export async function updateOrganization(data) {
const res = await request.put('/system/Organization', data);
const res = await request.put('/organization/manage', data);
if (res.data.code === 0) {
return res.data.message;
}
@@ -27,7 +27,7 @@ export async function updateOrganization(data) {
}
export async function removeOrganization(id) {
const res = await request.delete('/system/Organization', {
const res = await request.delete('/organization/manage', {
data: { id }
});
if (res.data.code === 0) {
@@ -5,7 +5,7 @@ import request from '@/utils/request';
* @param params 查询条件
*/
export async function pageUsers(params) {
const res = await request.get('/pinan/user/page', {
const res = await request.get('/organization/user/page', {
params
});
if (res.data.code === 0) {
@@ -19,7 +19,7 @@ export async function pageUsers(params) {
* @param data 用户信息
*/
export async function addUser(data) {
const res = await request.post('/pinan/user/user', data);
const res = await request.post('/organization/user/user', data);
if (res.data.code === 0) {
return res.data.message;
}
@@ -31,7 +31,7 @@ export async function addUser(data) {
* @param data 用户信息
*/
export async function updateUser(data) {
const res = await request.put('/pinan/user/user', data);
const res = await request.put('/organization/user/user', data);
if (res.data.code === 0) {
return res.data.message;
}
@@ -51,7 +51,7 @@ export async function removeUser(id) {
* @param data 用户id集合
*/
export async function removeUsers(ids) {
const res = await request.delete('/pinan/user/batch', {
const res = await request.delete('/organization/user/batch', {
data: { ids }
});
if (res.data.code === 0) {
@@ -66,7 +66,7 @@ export async function removeUsers(ids) {
* @param status 状态
*/
export async function updateUserStatus(id, status) {
const res = await request.put('/pinan/user/status', {
const res = await request.put('/organization/user/status', {
id,
status
});
@@ -76,32 +76,12 @@ export async function updateUserStatus(id, status) {
return Promise.reject(new Error(res.data.message));
}
/**
* 导入用户
* @param file excel文件
*/
export async function importUsers(file) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post('/system/user/import', formData);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 检查用户是否存在
* @param field 检查的字段
* @param value 字段的值
* @param id 修改时的id
*/
export async function checkExistence(field, value, id) {
const res = await request.get('/system/user/existence', {
params: { field, value, id }
export async function groupTypeUsers(params) {
const res = await request.get('/organization/user/groupType', {
params
});
if (res.data.code === 0) {
return res.data.message;
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+2 -2
View File
@@ -1,7 +1,7 @@
import request from '@/utils/request';
export async function getOrganizationsCmmssn(params) {
const res = await request.get('/system/organizationCmmssn', {
const res = await request.get('/organization/cmmssn', {
params
});
if (res.data.code === 0) {
@@ -11,7 +11,7 @@ export async function getOrganizationsCmmssn(params) {
}
export async function updateOrganizationCmmssn(data) {
const res = await request.put('/system/OrganizationCmmssn', data);
const res = await request.put('/organization/cmmssn', data);
if (res.data.code === 0) {
return res.data.message;
}
@@ -54,7 +54,7 @@
import {
addOrganization,
updateOrganization
} from '@/api/system/organization';
} from '@/api/organization/manage';
import UploadImg from '@/components/UploadImg/index.vue';
export default {
@@ -106,7 +106,7 @@
import {
listOrganizations,
removeOrganization
} from '@/api/system/organization';
} from '@/api/organization/manage';
export default {
name: 'SystemOrganization',
@@ -0,0 +1,155 @@
<!-- 搜索表单 -->
<template>
<el-form
label-width="77px"
class="ele-form-search"
@keyup.enter.native="search"
@submit.native.prevent
>
<el-row :gutter="15">
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="用户账号:">
<el-input clearable v-model="where.username" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="手机号:">
<el-input clearable v-model="where.mobile" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 12, md: 12 } : { span: 12 }">
<el-form-item label="机构团队:">
<el-row>
<el-col :span="12" style="padding-right: 5px">
<el-select
value=""
v-model="where.orgId"
clearable
@change="changeOrg"
>
<el-option
v-for="item in orgList"
:value="item.id"
:key="item.id"
:label="item.title"
/>
</el-select>
</el-col>
<el-col :span="12" style="padding-right: 5px">
<el-select value="" v-model="where.teamId" clearable>
<el-option
v-for="item in teamList"
:value="item.id"
:key="item.id"
:label="item.title"
/>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="用户类型">
<el-select v-model="where.groupType" clearable>
<el-option
v-for="(item, index) in groupList"
:value="index"
:key="index"
:label="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<div class="ele-form-actions">
<el-button
type="primary"
icon="el-icon-search"
class="ele-btn-icon"
@click="search"
>
查询
</el-button>
<el-button @click="reset">重置</el-button>
</div>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { listOrganizations } from '@/api/organization/manage';
import { groupTypeUsers } from '@/api/organization/user';
export default {
data() {
// 默认表单数据
const defaultWhere = {
username: '',
mobile: '',
orgId: '',
teamId: '',
groupType: ''
};
return {
// 表单数据
where: { ...defaultWhere },
orgList: [],
teamList: [],
groupList: []
};
},
computed: {
// 是否开启响应式布局
styleResponsive() {
return this.$store.state.theme.styleResponsive;
}
},
created() {
this.loadOrg(0);
this.getGroupTypeList();
},
methods: {
getGroupTypeList() {
groupTypeUsers()
.then((data) => {
this.groupList = data;
})
.catch((e) => {
this.$message.error(e.message);
});
},
loadOrg(pid) {
listOrganizations({ pid: pid })
.then((data) => {
this.orgList = data;
})
.catch((e) => {
this.$message.error(e.message);
});
},
/* 搜索 */
search() {
this.$emit('search', this.where);
},
/* 重置 */
reset() {
this.where = { ...this.defaultWhere };
this.search();
},
changeOrg() {
this.teamList = [];
this.where.teamId = '';
if (this.where.orgId) {
listOrganizations({ pid: this.where.orgId })
.then((data) => {
this.teamList = data;
})
.catch((e) => {
this.$message.error(e.message);
});
}
}
}
};
</script>
@@ -2,9 +2,7 @@
<div class="ele-body">
<el-card shadow="never">
<!-- 搜索表单 -->
<!--
<user-search @search="reload" />
-->
<!-- 数据表格 -->
<ele-pro-table
ref="table"
@@ -83,17 +81,19 @@
<script>
import UserImport from './components/user-import.vue';
import UserSearch from './components/user-search.vue';
import {
pageUsers,
removeUser,
removeUsers,
updateUserStatus
} from '@/api/pingan/user';
} from '@/api/organization/user';
export default {
name: 'SystemUser',
components: {
UserImport
UserImport,
UserSearch
},
data() {
return {
@@ -108,9 +108,9 @@
},
{
prop: 'id',
label: 'ID',
label: '用户ID',
sortable: 'id',
minWidth: 45,
minWidth: 50,
align: 'center',
showOverflowTooltip: true,
fixed: 'left'
@@ -128,14 +128,28 @@
minWidth: 110
},
{
prop: 'createTime',
label: '创建时间',
sortable: 'createTime',
showOverflowTooltip: true,
minWidth: 110,
formatter: (_row, _column, cellValue) => {
return this.$util.toDateString(cellValue);
}
prop: 'orgName',
label: '机构',
align: 'center',
width: 80,
resizable: false,
showOverflowTooltip: true
},
{
prop: 'orgTeamName',
label: '机构团队',
align: 'center',
width: 80,
resizable: false,
showOverflowTooltip: true
},
{
prop: 'typeCn',
label: '角色类型',
align: 'center',
width: 80,
resizable: false,
showOverflowTooltip: true
},
{
prop: 'status',
@@ -147,6 +161,16 @@
slot: 'status',
showOverflowTooltip: true
},
{
prop: 'createTime',
label: '创建时间',
sortable: 'createTime',
showOverflowTooltip: true,
minWidth: 100,
formatter: (_row, _column, cellValue) => {
return this.$util.toDateString(cellValue);
}
},
{
columnKey: 'action',
label: '操作',
@@ -1,82 +0,0 @@
<!-- 搜索表单 -->
<template>
<el-form
label-width="77px"
class="ele-form-search"
@keyup.enter.native="search"
@submit.native.prevent
>
<el-row :gutter="15">
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="用户账号:">
<el-input clearable v-model="where.username" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="用户名:">
<el-input clearable v-model="where.nickname" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<el-form-item label="性别:">
<el-select
clearable
v-model="where.sex"
placeholder="请选择"
class="ele-fluid"
>
<el-option label="男" :value="1" />
<el-option label="女" :value="2" />
</el-select>
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
<div class="ele-form-actions">
<el-button
type="primary"
icon="el-icon-search"
class="ele-btn-icon"
@click="search"
>
查询
</el-button>
<el-button @click="reset">重置</el-button>
</div>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
data() {
// 默认表单数据
const defaultWhere = {
username: '',
nickname: '',
sex: undefined
};
return {
// 表单数据
where: { ...defaultWhere }
};
},
computed: {
// 是否开启响应式布局
styleResponsive() {
return this.$store.state.theme.styleResponsive;
}
},
methods: {
/* 搜索 */
search() {
this.$emit('search', this.where);
},
/* 重置 */
reset() {
this.where = { ...this.defaultWhere };
this.search();
}
}
};
</script>