加机构管理目录
This commit is contained in:
@@ -5,7 +5,7 @@ import request from '@/utils/request';
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageOrganizations(params) {
|
||||
const res = await request.get('/sylive/organization/page', {
|
||||
const res = await request.get('/institution/organization/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -19,7 +19,7 @@ export async function pageOrganizations(params) {
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listOrganizations(params) {
|
||||
const res = await request.get('/sylive/organization', {
|
||||
const res = await request.get('/institution/organization', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -33,7 +33,7 @@ export async function listOrganizations(params) {
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listOrganizationParent(params) {
|
||||
const res = await request.get('/sylive/organization/parent', {
|
||||
const res = await request.get('/institution/organization/parent', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -47,7 +47,7 @@ export async function listOrganizationParent(params) {
|
||||
* @param data 机构信息
|
||||
*/
|
||||
export async function addOrganization(data) {
|
||||
const res = await request.post('/sylive/organization', data);
|
||||
const res = await request.post('/institution/organization', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export async function addOrganization(data) {
|
||||
* @param data 机构信息
|
||||
*/
|
||||
export async function updateOrganization(data) {
|
||||
const res = await request.put('/sylive/organization', data);
|
||||
const res = await request.put('/institution/organization', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export async function updateOrganization(data) {
|
||||
* @param id 机构id
|
||||
*/
|
||||
export async function removeOrganization(id) {
|
||||
const res = await request.delete('/sylive/organization/' + id);
|
||||
const res = await request.delete('/institution/organization/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export async function removeOrganization(id) {
|
||||
* @param id 机构id
|
||||
*/
|
||||
export async function infoOrganization(id) {
|
||||
const res = await request.get('/sylive/organization/info/' + id);
|
||||
const res = await request.get('/institution/organization/info/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import request from '@/utils/request';
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageTeamUser(params) {
|
||||
const res = await request.get('/sylive/teamUser/page', {
|
||||
const res = await request.get('/institution/teamUser/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -19,7 +19,7 @@ export async function pageTeamUser(params) {
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listTeamUser(params) {
|
||||
const res = await request.post('/sylive/teamUser/list', params);
|
||||
const res = await request.post('/institution/teamUser/list', params);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export async function listTeamUser(params) {
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function getTeamUser(id) {
|
||||
const res = await request.get('/sylive/teamUser/' + id);
|
||||
const res = await request.get('/institution/teamUser/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export async function getTeamUser(id) {
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function addTeamUser(data) {
|
||||
const res = await request.post('/sylive/teamUser', data);
|
||||
const res = await request.post('/institution/teamUser', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export async function addTeamUser(data) {
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function updateTeamUser(data) {
|
||||
const res = await request.put('/sylive/teamUser', data);
|
||||
const res = await request.put('/institution/teamUser', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export async function updateTeamUser(data) {
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function removeTeamUser(id) {
|
||||
const res = await request.delete('/sylive/teamUser/' + id);
|
||||
const res = await request.delete('/institution/teamUser/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export async function removeTeamUser(id) {
|
||||
* @param data 用户id集合
|
||||
*/
|
||||
export async function removeTeamUsers(data) {
|
||||
const res = await request.delete('/sylive/teamUser/batch', {
|
||||
const res = await request.delete('/institution/teamUser/batch', {
|
||||
data
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -94,7 +94,7 @@ export async function removeTeamUsers(data) {
|
||||
* @param status 状态
|
||||
*/
|
||||
export async function updateTeamUserStatus(userId, status) {
|
||||
const res = await request.put('/sylive/teamUser/status', {
|
||||
const res = await request.put('/institution/teamUser/status', {
|
||||
userId,
|
||||
status
|
||||
});
|
||||
@@ -111,7 +111,7 @@ export async function updateTeamUserStatus(userId, status) {
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export async function updateTeamUserPassword(userId, password = '123456') {
|
||||
const res = await request.put('/sylive/teamUser/password', {
|
||||
const res = await request.put('/institution/teamUser/password', {
|
||||
userId,
|
||||
password
|
||||
});
|
||||
@@ -128,7 +128,7 @@ export async function updateTeamUserPassword(userId, password = '123456') {
|
||||
export async function importTeamUser(file) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const res = await request.post('/sylive/teamUser/import', formData);
|
||||
const res = await request.post('/institution/teamUser/import', formData);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ export async function importTeamUser(file) {
|
||||
* @param id 修改时的id
|
||||
*/
|
||||
export async function checkExistence(field, value, id) {
|
||||
const res = await request.get('/sylive/teamUser/existence', {
|
||||
const res = await request.get('/institution/teamUser/existence', {
|
||||
params: { field, value, id }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import request from '@/utils/request';
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageTeams(params) {
|
||||
const res = await request.get('/sylive/team/page', {
|
||||
const res = await request.get('/institution/team/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -19,7 +19,7 @@ export async function pageTeams(params) {
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listTeams(params) {
|
||||
const res = await request.get('/sylive/team', {
|
||||
const res = await request.get('/institution/team', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
@@ -33,7 +33,7 @@ export async function listTeams(params) {
|
||||
* @param data 团队信息
|
||||
*/
|
||||
export async function addTeam(data) {
|
||||
const res = await request.post('/sylive/team', data);
|
||||
const res = await request.post('/institution/team', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export async function addTeam(data) {
|
||||
* @param data 团队信息
|
||||
*/
|
||||
export async function updateTeam(data) {
|
||||
const res = await request.put('/sylive/team', data);
|
||||
const res = await request.put('/institution/team', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export async function updateTeam(data) {
|
||||
* @param id 团队id
|
||||
*/
|
||||
export async function removeTeam(id) {
|
||||
const res = await request.delete('/sylive/team/' + id);
|
||||
const res = await request.delete('/institution/team/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询机构
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageOrganizations(params) {
|
||||
const res = await request.get('/sylive/organization/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listOrganizations(params) {
|
||||
const res = await request.get('/sylive/organization', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询上级机构列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listOrganizationParent(params) {
|
||||
const res = await request.get('/sylive/organization/parent', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加机构
|
||||
* @param data 机构信息
|
||||
*/
|
||||
export async function addOrganization(data) {
|
||||
const res = await request.post('/sylive/organization', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机构
|
||||
* @param data 机构信息
|
||||
*/
|
||||
export async function updateOrganization(data) {
|
||||
const res = await request.put('/sylive/organization', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构
|
||||
* @param id 机构id
|
||||
*/
|
||||
export async function removeOrganization(id) {
|
||||
const res = await request.delete('/sylive/organization/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构详情
|
||||
* @param id 机构id
|
||||
*/
|
||||
export async function infoOrganization(id) {
|
||||
const res = await request.get('/sylive/organization/info/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询用户
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageTeamUser(params) {
|
||||
const res = await request.get('/sylive/teamUser/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listTeamUser(params) {
|
||||
const res = await request.post('/sylive/teamUser/list', params);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询用户
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function getTeamUser(id) {
|
||||
const res = await request.get('/sylive/teamUser/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function addTeamUser(data) {
|
||||
const res = await request.post('/sylive/teamUser', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function updateTeamUser(data) {
|
||||
const res = await request.put('/sylive/teamUser', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function removeTeamUser(id) {
|
||||
const res = await request.delete('/sylive/teamUser/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @param data 用户id集合
|
||||
*/
|
||||
export async function removeTeamUsers(data) {
|
||||
const res = await request.delete('/sylive/teamUser/batch', {
|
||||
data
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
* @param userId 用户id
|
||||
* @param status 状态
|
||||
*/
|
||||
export async function updateTeamUserStatus(userId, status) {
|
||||
const res = await request.put('/sylive/teamUser/status', {
|
||||
userId,
|
||||
status
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
* @param userId 用户id
|
||||
* @param password 密码
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export async function updateTeamUserPassword(userId, password = '123456') {
|
||||
const res = await request.put('/sylive/teamUser/password', {
|
||||
userId,
|
||||
password
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入用户
|
||||
* @param file excel文件
|
||||
*/
|
||||
export async function importTeamUser(file) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const res = await request.post('/sylive/teamUser/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('/sylive/teamUser/existence', {
|
||||
params: { field, value, id }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询团队
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageTeams(params) {
|
||||
const res = await request.get('/sylive/team/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询团队列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listTeams(params) {
|
||||
const res = await request.get('/sylive/team', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加团队
|
||||
* @param data 团队信息
|
||||
*/
|
||||
export async function addTeam(data) {
|
||||
const res = await request.post('/sylive/team', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团队
|
||||
* @param data 团队信息
|
||||
*/
|
||||
export async function updateTeam(data) {
|
||||
const res = await request.put('/sylive/team', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团队
|
||||
* @param id 团队id
|
||||
*/
|
||||
export async function removeTeam(id) {
|
||||
const res = await request.delete('/sylive/team/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询用户
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function pageUsers(params) {
|
||||
const res = await request.get('/sylive/user/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function listUsers(params) {
|
||||
const res = await request.post('/sylive/user/list', params);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询用户
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function getUser(id) {
|
||||
const res = await request.get('/sylive/user/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function addUser(data) {
|
||||
const res = await request.post('/sylive/user', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export async function updateUser(data) {
|
||||
const res = await request.put('/sylive/user', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function removeUser(id) {
|
||||
const res = await request.delete('/sylive/user/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @param data 用户id集合
|
||||
*/
|
||||
export async function removeUsers(data) {
|
||||
const res = await request.delete('/sylive/user/batch', {
|
||||
data
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
* @param userId 用户id
|
||||
* @param status 状态
|
||||
*/
|
||||
export async function updateUserStatus(userId, status) {
|
||||
const res = await request.put('/sylive/user/status', {
|
||||
userId,
|
||||
status
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
* @param userId 用户id
|
||||
* @param password 密码
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export async function updateUserPassword(userId, password = '123456') {
|
||||
const res = await request.put('/sylive/user/password', {
|
||||
userId,
|
||||
password
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
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('/sylive/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 organizationId 机构id
|
||||
*/
|
||||
export async function checkExistence(field, value, organizationId) {
|
||||
const res = await request.get('/sylive/user/existence', {
|
||||
params: { field, value, organizationId }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -97,7 +97,7 @@
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
import EleImageUpload from 'ele-admin/es/ele-image-upload';
|
||||
import request from '@/utils/request';
|
||||
import { addTeam, updateTeam } from '@/api/sylive/team';
|
||||
import { addTeam, updateTeam } from '@/api/institution/team';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -113,7 +113,7 @@
|
||||
// 修改回显的数据
|
||||
data: Object,
|
||||
// 上级id
|
||||
parentId: Number,
|
||||
parentId: null,
|
||||
// 团队数据
|
||||
teamList: Array
|
||||
},
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizationParent } from '@/api/sylive/organization';
|
||||
import { listOrganizationParent } from '@/api/institution/organization';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-modal)
|
||||
value: String,
|
||||
value: null,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-model)
|
||||
value: Number,
|
||||
value: null,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
addTeamUser,
|
||||
updateTeamUser,
|
||||
checkExistence
|
||||
} from '@/api/sylive/team-user';
|
||||
} from '@/api/institution/team-user';
|
||||
|
||||
export default {
|
||||
components: { TeamSelect },
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
pageTeamUser,
|
||||
removeTeamUser,
|
||||
updateTeamUserStatus
|
||||
} from '@/api/sylive/team-user';
|
||||
} from '@/api/institution/team-user';
|
||||
|
||||
export default {
|
||||
components: { TeamUserSearch, TeamUserEdit },
|
||||
|
||||
@@ -78,10 +78,10 @@
|
||||
<script>
|
||||
import TeamUserList from './components/team-user-list.vue';
|
||||
import TeamEdit from './components/team-edit.vue';
|
||||
import { listTeams, removeTeam } from '@/api/sylive/team';
|
||||
import { listTeams, removeTeam } from '@/api/institution/team';
|
||||
|
||||
export default {
|
||||
name: 'SyliveTeam',
|
||||
name: 'InstitutionTeam',
|
||||
components: { TeamUserList, TeamEdit },
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
copyActivity,
|
||||
updateActivityStatus
|
||||
} from '@/api/sylive/activity';
|
||||
import { listOrganizationParent } from '@/api/sylive/organization';
|
||||
import { listOrganizationParent } from '@/api/institution/organization';
|
||||
|
||||
export default {
|
||||
name: 'syliveActivity',
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<script>
|
||||
import GroSelect from './gro-select.vue';
|
||||
import { addGroups, updateGroups } from '@/api/sylive/groups';
|
||||
import { infoOrganization } from '@/api/sylive/organization';
|
||||
import { infoOrganization } from '@/api/institution/organization';
|
||||
|
||||
export default {
|
||||
components: { GroSelect },
|
||||
|
||||
@@ -127,8 +127,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUsers } from '@/api/sylive/user';
|
||||
import { listTeamUser } from '@/api/sylive/team-user';
|
||||
import { listUsers } from '@/api/institution/organization-user';
|
||||
import { listTeamUser } from '@/api/institution/team-user';
|
||||
import { addGroupsUser } from '@/api/sylive/groups-user';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -52,7 +52,11 @@
|
||||
<script>
|
||||
import { phoneReg } from 'ele-admin';
|
||||
import GroSelect from './gro-select.vue';
|
||||
import { addUser, updateUser, checkExistence } from '@/api/sylive/user';
|
||||
import {
|
||||
addUser,
|
||||
updateUser,
|
||||
checkExistence
|
||||
} from '@/api/institution/organization-user';
|
||||
|
||||
export default {
|
||||
components: { GroSelect },
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
import GroUserList from './components/gro-user-list.vue';
|
||||
import GroEdit from './components/gro-edit.vue';
|
||||
import { listGroups, removeGroups } from '@/api/sylive/groups';
|
||||
import { listOrganizations } from '@/api/sylive/organization';
|
||||
import { listTeams } from '@/api/sylive/team';
|
||||
import { listOrganizations } from '@/api/institution/organization';
|
||||
import { listTeams } from '@/api/institution/team';
|
||||
import { listDictionaries } from '@/api/system/dictionary';
|
||||
const ROUTE_PATH = '/sylive/groups';
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizationParent } from '@/api/sylive/organization';
|
||||
import { listOrganizationParent } from '@/api/institution/organization';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
import MembersSearch from './components/members-search.vue';
|
||||
import MembersEdit from './components/members-edit.vue';
|
||||
import MembersMajia from './components/members-majia.vue';
|
||||
import { listOrganizations } from '@/api/sylive/organization';
|
||||
import { listOrganizations } from '@/api/institution/organization';
|
||||
import {
|
||||
pageMembers,
|
||||
removeMembers,
|
||||
|
||||
@@ -127,8 +127,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizations } from '@/api/sylive/organization';
|
||||
import { listTeams } from '@/api/sylive/team';
|
||||
import { listOrganizations } from '@/api/institution/organization';
|
||||
import { listTeams } from '@/api/institution/team';
|
||||
import { listGoods } from '@/api/sylive/goods';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
<!-- 机构编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="680px"
|
||||
:visible="visible"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
:title="isUpdate ? '修改机构' : '添加机构'"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="上级机构:">
|
||||
<org-select
|
||||
v-model="form.parentId"
|
||||
:data="organizationList"
|
||||
placeholder="请选择上级机构"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构名称:" prop="organizationName">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="20"
|
||||
v-model="form.organizationName"
|
||||
placeholder="请输入机构名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构全称:">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="100"
|
||||
v-model="form.organizationFullName"
|
||||
placeholder="请输入机构全称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在地区:">
|
||||
<regions-select
|
||||
v-model="form.city"
|
||||
placeholder="请选择省市区"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="logo:"
|
||||
v-show="form.organizationType == 1 ? true : false"
|
||||
>
|
||||
<ele-image-upload
|
||||
v-model="form.logo"
|
||||
:limit="1"
|
||||
:drag="true"
|
||||
:multiple="false"
|
||||
:upload-handler="logoHandler"
|
||||
@upload="onUpload"
|
||||
/>
|
||||
<div class="ele-text-secondary">建议尺寸100X100</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="机构类型:" prop="organizationType">
|
||||
<org-type-select v-model="form.organizationType" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构id:" v-if="form.organizationId">
|
||||
<el-input v-model="form.organizationId" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号:">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
:max="99999"
|
||||
v-model="form.sortNumber"
|
||||
controls-position="right"
|
||||
placeholder="请输入排序号"
|
||||
class="ele-fluid ele-text-left"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:">
|
||||
<el-input
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
:maxlength="200"
|
||||
v-model="form.comments"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<el-button @click="updateVisible(false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="save">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import OrgSelect from './org-select.vue';
|
||||
import OrgTypeSelect from './org-type-select.vue';
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
import EleImageUpload from 'ele-admin/es/ele-image-upload';
|
||||
import request from '@/utils/request';
|
||||
import {
|
||||
addOrganization,
|
||||
updateOrganization
|
||||
} from '@/api/sylive/organization';
|
||||
|
||||
export default {
|
||||
components: { OrgSelect, OrgTypeSelect, RegionsSelect, EleImageUpload },
|
||||
props: {
|
||||
// 弹窗是否打开
|
||||
visible: Boolean,
|
||||
// 修改回显的数据
|
||||
data: Object,
|
||||
// 上级id
|
||||
parentId: Number,
|
||||
// 机构数据
|
||||
organizationList: Array
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
organizationId: null,
|
||||
parentId: null,
|
||||
organizationName: '',
|
||||
organizationFullName: '',
|
||||
organizationType: null,
|
||||
sortNumber: null,
|
||||
comments: '',
|
||||
logo: [],
|
||||
city: []
|
||||
};
|
||||
return {
|
||||
defaultForm,
|
||||
// 表单数据
|
||||
form: { ...defaultForm },
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
organizationName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入机构名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
organizationType: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择机构类型',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
// 提交状态
|
||||
loading: false,
|
||||
// 是否是修改
|
||||
isUpdate: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 保存编辑 */
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const data = {
|
||||
...this.form,
|
||||
parentId: this.form.parentId || 0
|
||||
};
|
||||
const saveOrUpdate = this.isUpdate
|
||||
? updateOrganization
|
||||
: addOrganization;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 上传事件 */
|
||||
logoHandler(file) {
|
||||
const item = {
|
||||
file,
|
||||
uid: file.uid,
|
||||
name: file.name,
|
||||
progress: 0,
|
||||
status: null
|
||||
};
|
||||
if (!file.type.startsWith('image')) {
|
||||
this.$message.error('只能选择图片');
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
this.$message.error('大小不能超过 2MB');
|
||||
return;
|
||||
}
|
||||
item.url = window.URL.createObjectURL(file);
|
||||
// 关键就是这里要自己 push 添加数据而不是靠 v-modal 自动更新
|
||||
this.form.logo.push(item);
|
||||
this.onUpload(item);
|
||||
},
|
||||
/* 上传 item */
|
||||
onUpload(item) {
|
||||
item.status = 'uploading';
|
||||
const formData = new FormData();
|
||||
formData.append('file', item.file);
|
||||
request({
|
||||
url: '/upload',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
onUploadProgress: (e) => {
|
||||
if (e.lengthComputable) {
|
||||
item.progress = (e.loaded / e.total) * 100;
|
||||
}
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
item.status = 'done';
|
||||
item.url = res.data.data.full_url;
|
||||
item.fileUrl = res.data.data.url;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
item.status = 'exception';
|
||||
});
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(visible) {
|
||||
if (visible) {
|
||||
if (this.data) {
|
||||
this.$util.assignObject(this.form, this.data);
|
||||
this.isUpdate = true;
|
||||
} else {
|
||||
this.form.parentId = this.parentId;
|
||||
this.isUpdate = false;
|
||||
}
|
||||
} else {
|
||||
this.$refs.form.clearValidate();
|
||||
this.form = { ...this.defaultForm };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- 机构选择下拉框 -->
|
||||
<template>
|
||||
<ele-tree-select
|
||||
clearable
|
||||
:value="value || ''"
|
||||
:data="data"
|
||||
label-key="organizationName"
|
||||
value-key="organizationId"
|
||||
:default-expand-all="true"
|
||||
:placeholder="placeholder"
|
||||
@input="updateValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-model)
|
||||
value: Number,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择机构'
|
||||
},
|
||||
// 机构数据
|
||||
data: Array
|
||||
},
|
||||
methods: {
|
||||
/* 更新选中数据 */
|
||||
updateValue(value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,57 +0,0 @@
|
||||
<!-- 机构类型选择下拉框 -->
|
||||
<template>
|
||||
<el-select
|
||||
clearable
|
||||
:value="value"
|
||||
class="ele-fluid"
|
||||
:placeholder="placeholder"
|
||||
@input="updateValue"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.dictDataId"
|
||||
:value="item.dictDataCode"
|
||||
:label="item.dictDataName"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDictionaryData } from '@/api/system/dictionary-data';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-modal)
|
||||
value: String,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择机构类型'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 机构类型数据
|
||||
data: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
/* 获取机构类型数据 */
|
||||
listDictionaryData({
|
||||
dictCode: 'organization_type'
|
||||
})
|
||||
.then((list) => {
|
||||
this.data = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/* 更新选中数据 */
|
||||
updateValue(value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,183 +0,0 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="680px"
|
||||
:visible="visible"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
:title="isUpdate ? '修改用户' : '添加用户'"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="所属机构:" prop="organizationId">
|
||||
<org-select
|
||||
:data="organizationList"
|
||||
placeholder="请选择所属机构"
|
||||
v-model="form.organizationId"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号:" prop="mobile">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="11"
|
||||
:disabled="isUpdate"
|
||||
v-model="form.mobile"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="姓名:" prop="uname">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="20"
|
||||
v-model="form.uname"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<el-button @click="updateVisible(false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="save">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { phoneReg } from 'ele-admin';
|
||||
import OrgSelect from './org-select.vue';
|
||||
import { addUser, updateUser, checkExistence } from '@/api/sylive/user';
|
||||
|
||||
export default {
|
||||
components: { OrgSelect },
|
||||
props: {
|
||||
// 弹窗是否打开
|
||||
visible: Boolean,
|
||||
// 修改回显的数据
|
||||
data: Object,
|
||||
// 全部机构
|
||||
organizationList: Array,
|
||||
// 机构id
|
||||
organizationId: Number
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
userId: null,
|
||||
organizationId: null,
|
||||
mobile: '',
|
||||
uname: ''
|
||||
};
|
||||
return {
|
||||
defaultForm,
|
||||
// 表单数据
|
||||
form: { ...defaultForm },
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
validator: (_rule, value, callback) => {
|
||||
if (this.data) {
|
||||
return callback();
|
||||
}
|
||||
if (!value) {
|
||||
return callback(new Error('请输入手机号'));
|
||||
}
|
||||
const st = new RegExp(phoneReg);
|
||||
if (!st.test(value)) {
|
||||
return callback(new Error('手机号格式不正确'));
|
||||
}
|
||||
checkExistence('mobile', value, this.form.organizationId)
|
||||
.then(() => {
|
||||
callback(new Error('手机号已经存在'));
|
||||
})
|
||||
.catch(() => {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
organizationId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属机构',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
uname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
// 提交状态
|
||||
loading: false,
|
||||
// 是否是修改
|
||||
isUpdate: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 保存编辑 */
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const data = {
|
||||
...this.form
|
||||
};
|
||||
const saveOrUpdate = this.isUpdate ? updateUser : addUser;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(visible) {
|
||||
if (visible) {
|
||||
if (this.data) {
|
||||
this.$util.assignObject(this.form, {
|
||||
...this.data
|
||||
});
|
||||
this.isUpdate = true;
|
||||
} else {
|
||||
this.form.organizationId = this.organizationId;
|
||||
this.isUpdate = false;
|
||||
}
|
||||
} else {
|
||||
this.$refs.form.clearValidate();
|
||||
this.form = { ...this.defaultForm };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,220 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 数据表格 -->
|
||||
<ele-pro-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
height="calc(100vh - 265px)"
|
||||
full-height="calc(100vh - 116px)"
|
||||
tool-class="ele-toolbar-form"
|
||||
cache-key="systemOrgUserTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
<template v-slot:toolbar>
|
||||
<org-user-search @search="reload">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
class="ele-btn-icon"
|
||||
@click="openEdit()"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
</org-user-search>
|
||||
</template>
|
||||
<!-- 角色列 -->
|
||||
<template v-slot:roleName="{ row }">
|
||||
<el-tag type="primary" size="mini">
|
||||
{{ row.roleName }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 状态列 -->
|
||||
<template v-slot:status="{ row }">
|
||||
<el-switch
|
||||
:active-value="0"
|
||||
:inactive-value="1"
|
||||
v-model="row.status"
|
||||
@change="editStatus(row)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
<template v-slot:action="{ row }">
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-edit"
|
||||
@click="openEdit(row)"
|
||||
>
|
||||
修改
|
||||
</el-link>
|
||||
<el-popconfirm
|
||||
class="ele-action"
|
||||
title="确定要删除此用户吗?"
|
||||
@confirm="remove(row)"
|
||||
>
|
||||
<template v-slot:reference>
|
||||
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
<!-- 编辑弹窗 -->
|
||||
<org-user-edit
|
||||
:data="current"
|
||||
:visible.sync="showEdit"
|
||||
:organization-list="organizationList"
|
||||
:organization-id="organizationId"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import OrgUserSearch from './org-user-search.vue';
|
||||
import OrgUserEdit from './org-user-edit.vue';
|
||||
import { pageUsers, removeUser, updateUserStatus } from '@/api/sylive/user';
|
||||
|
||||
export default {
|
||||
components: { OrgUserSearch, OrgUserEdit },
|
||||
props: {
|
||||
// 机构id
|
||||
organizationId: Number,
|
||||
// 全部机构
|
||||
organizationList: Array
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
prop: 'userId',
|
||||
label: 'ID',
|
||||
minWidth: 45,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'nickname',
|
||||
label: '微信昵称',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '手机号',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'roleName',
|
||||
label: '角色',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80,
|
||||
slot: 'roleName'
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
sortable: 'custom',
|
||||
width: 100,
|
||||
resizable: false,
|
||||
slot: 'status'
|
||||
},
|
||||
{
|
||||
columnKey: 'action',
|
||||
label: '操作',
|
||||
width: 160,
|
||||
align: 'center',
|
||||
resizable: false,
|
||||
slot: 'action',
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
],
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
// 是否显示编辑弹窗
|
||||
showEdit: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
return pageUsers({
|
||||
...where,
|
||||
...order,
|
||||
page,
|
||||
limit,
|
||||
organizationId: this.organizationId
|
||||
});
|
||||
},
|
||||
/* 刷新表格 */
|
||||
reload(where) {
|
||||
this.$refs.table.reload({ page: 1, where: where });
|
||||
},
|
||||
/* 显示编辑 */
|
||||
openEdit(row) {
|
||||
this.current = row;
|
||||
this.showEdit = true;
|
||||
},
|
||||
/* 删除 */
|
||||
remove(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
removeUser(row.userId)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
this.reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 更改状态 */
|
||||
editStatus(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
updateUserStatus(row.userId, row.status)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
row.status = !row.status ? 1 : 0;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听机构id变化
|
||||
organizationId() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,79 +0,0 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<el-form
|
||||
size="small"
|
||||
class="ele-form-search"
|
||||
@keyup.enter.native="search"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="10">
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
v-model="where.uname"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
v-model="where.nickname"
|
||||
placeholder="请输入微信昵称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
class="ele-btn-icon"
|
||||
@click="search"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<slot></slot>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
uname: '',
|
||||
nickname: ''
|
||||
};
|
||||
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>
|
||||
@@ -1,184 +0,0 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never" v-loading="loading">
|
||||
<ele-split-layout
|
||||
width="266px"
|
||||
allow-collapse
|
||||
:right-style="{ overflow: 'hidden' }"
|
||||
>
|
||||
<div>
|
||||
<!-- 操作按钮 -->
|
||||
<ele-toolbar class="ele-toolbar-actions">
|
||||
<div style="margin: 5px 0">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
class="ele-btn-icon"
|
||||
@click="openEdit()"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="warning"
|
||||
icon="el-icon-edit"
|
||||
class="ele-btn-icon"
|
||||
:disabled="!current"
|
||||
@click="openEdit(current)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
class="ele-btn-icon"
|
||||
:disabled="!current"
|
||||
@click="remove"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</ele-toolbar>
|
||||
<div class="ele-border-lighter sys-organization-list">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="data"
|
||||
highlight-current
|
||||
node-key="organizationId"
|
||||
:props="{ label: 'organizationName' }"
|
||||
:expand-on-click-node="false"
|
||||
:default-expand-all="true"
|
||||
@node-click="onNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-slot:content>
|
||||
<org-user-list
|
||||
v-if="current"
|
||||
:organization-list="data"
|
||||
:organization-id="current.organizationId"
|
||||
/>
|
||||
</template>
|
||||
</ele-split-layout>
|
||||
</el-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
<org-edit
|
||||
:visible.sync="showEdit"
|
||||
:data="editData"
|
||||
:parent-id="parentId"
|
||||
:organization-list="data"
|
||||
@done="query"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import OrgUserList from './components/org-user-list.vue';
|
||||
import OrgEdit from './components/org-edit.vue';
|
||||
import {
|
||||
listOrganizations,
|
||||
removeOrganization
|
||||
} from '@/api/sylive/organization';
|
||||
|
||||
export default {
|
||||
name: 'SyliveOrganization',
|
||||
components: { OrgUserList, OrgEdit },
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
loading: true,
|
||||
// 列表数据
|
||||
data: [],
|
||||
// 选中数据
|
||||
current: null,
|
||||
// 是否显示表单弹窗
|
||||
showEdit: false,
|
||||
// 编辑回显数据
|
||||
editData: null,
|
||||
// 上级id
|
||||
parentId: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.query();
|
||||
},
|
||||
methods: {
|
||||
/* 查询 */
|
||||
query() {
|
||||
this.loading = true;
|
||||
listOrganizations()
|
||||
.then((list) => {
|
||||
this.loading = false;
|
||||
this.data = this.$util.toTreeData({
|
||||
data: list,
|
||||
idField: 'organizationId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.onNodeClick(this.data[0]);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 选择数据 */
|
||||
onNodeClick(row) {
|
||||
if (row) {
|
||||
this.current = row;
|
||||
this.parentId = row.organizationId;
|
||||
this.$refs.tree.setCurrentKey(row.organizationId);
|
||||
} else {
|
||||
this.current = null;
|
||||
this.parentId = null;
|
||||
}
|
||||
},
|
||||
/* 显示编辑 */
|
||||
openEdit(item) {
|
||||
this.editData = item;
|
||||
this.showEdit = true;
|
||||
},
|
||||
/* 删除 */
|
||||
remove() {
|
||||
this.$confirm('确定要删除选中的机构吗?', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
const loading = this.$loading({ lock: true });
|
||||
removeOrganization(this.current.organizationId)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
this.query();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sys-organization-list {
|
||||
height: calc(100vh - 264px);
|
||||
box-sizing: border-box;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.sys-organization-list :deep(.el-tree-node__content) {
|
||||
height: 40px;
|
||||
|
||||
& > .el-tree-node__expand-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,261 +0,0 @@
|
||||
<!-- 团队编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="680px"
|
||||
:visible="visible"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
:title="isUpdate ? '修改团队' : '添加团队'"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="上级团队:">
|
||||
<team-select
|
||||
v-model="form.parentId"
|
||||
:data="teamList"
|
||||
placeholder="请选择上级团队"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="团队名称:" prop="teamName">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="20"
|
||||
v-model="form.teamName"
|
||||
placeholder="请输入团队名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属机构:" v-show="form.parentId ? false : true">
|
||||
<team-org-select v-model="form.organizationId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所在城市:">
|
||||
<regions-select
|
||||
v-model="form.city"
|
||||
placeholder="请选择省市"
|
||||
type="provinceCity"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="logo:"
|
||||
v-show="form.teamType == 1 ? true : false"
|
||||
>
|
||||
<ele-image-upload
|
||||
v-model="form.logo"
|
||||
:limit="1"
|
||||
:drag="true"
|
||||
:multiple="false"
|
||||
:upload-handler="logoHandler"
|
||||
@upload="onUpload"
|
||||
/>
|
||||
<div class="ele-text-secondary">建议尺寸100X100</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="团队类型:" prop="teamType">
|
||||
<team-type-select v-model="form.teamType" />
|
||||
</el-form-item>
|
||||
<el-form-item label="团队id:" v-if="form.teamId">
|
||||
<el-input v-model="form.teamId" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号:">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
:max="99999"
|
||||
v-model="form.sortNumber"
|
||||
controls-position="right"
|
||||
placeholder="请输入排序号"
|
||||
class="ele-fluid ele-text-left"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:">
|
||||
<el-input
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
:maxlength="200"
|
||||
v-model="form.comments"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<el-button @click="updateVisible(false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="save">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TeamSelect from './team-select.vue';
|
||||
import TeamTypeSelect from './team-type-select.vue';
|
||||
import TeamOrgSelect from './team-org-select.vue';
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
import EleImageUpload from 'ele-admin/es/ele-image-upload';
|
||||
import request from '@/utils/request';
|
||||
import { addTeam, updateTeam } from '@/api/sylive/team';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TeamSelect,
|
||||
TeamTypeSelect,
|
||||
TeamOrgSelect,
|
||||
RegionsSelect,
|
||||
EleImageUpload
|
||||
},
|
||||
props: {
|
||||
// 弹窗是否打开
|
||||
visible: Boolean,
|
||||
// 修改回显的数据
|
||||
data: Object,
|
||||
// 上级id
|
||||
parentId: Number,
|
||||
// 团队数据
|
||||
teamList: Array
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
teamId: null,
|
||||
parentId: null,
|
||||
teamName: '',
|
||||
teamType: null,
|
||||
sortNumber: null,
|
||||
comments: '',
|
||||
city: [],
|
||||
logo: [],
|
||||
organizationId: null
|
||||
};
|
||||
return {
|
||||
defaultForm,
|
||||
// 表单数据
|
||||
form: { ...defaultForm },
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
teamName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入团队名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
bizIds: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属机构',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
// 提交状态
|
||||
loading: false,
|
||||
// 是否是修改
|
||||
isUpdate: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 保存编辑 */
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const data = {
|
||||
...this.form,
|
||||
parentId: this.form.parentId || 0
|
||||
};
|
||||
const saveOrUpdate = this.isUpdate ? updateTeam : addTeam;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 上传事件 */
|
||||
logoHandler(file) {
|
||||
const item = {
|
||||
file,
|
||||
uid: file.uid,
|
||||
name: file.name,
|
||||
progress: 0,
|
||||
status: null
|
||||
};
|
||||
if (!file.type.startsWith('image')) {
|
||||
this.$message.error('只能选择图片');
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
this.$message.error('大小不能超过 2MB');
|
||||
return;
|
||||
}
|
||||
item.url = window.URL.createObjectURL(file);
|
||||
// 关键就是这里要自己 push 添加数据而不是靠 v-modal 自动更新
|
||||
this.form.logo.push(item);
|
||||
this.onUpload(item);
|
||||
},
|
||||
/* 上传 item */
|
||||
onUpload(item) {
|
||||
item.status = 'uploading';
|
||||
const formData = new FormData();
|
||||
formData.append('file', item.file);
|
||||
request({
|
||||
url: '/upload',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
onUploadProgress: (e) => {
|
||||
if (e.lengthComputable) {
|
||||
item.progress = (e.loaded / e.total) * 100;
|
||||
}
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
item.status = 'done';
|
||||
item.url = res.data.data.full_url;
|
||||
item.fileUrl = res.data.data.url;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
item.status = 'exception';
|
||||
});
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(visible) {
|
||||
if (visible) {
|
||||
if (this.data) {
|
||||
this.$util.assignObject(this.form, this.data);
|
||||
this.isUpdate = true;
|
||||
} else {
|
||||
this.form.parentId = this.parentId;
|
||||
this.isUpdate = false;
|
||||
}
|
||||
} else {
|
||||
this.$refs.form.clearValidate();
|
||||
this.form = { ...this.defaultForm };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,58 +0,0 @@
|
||||
<!-- 机构类型选择下拉框 -->
|
||||
<template>
|
||||
<el-select
|
||||
clearable
|
||||
:value="value"
|
||||
class="ele-fluid"
|
||||
:placeholder="placeholder"
|
||||
:default-expand-all="true"
|
||||
@input="updateValue"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.organizationId"
|
||||
:value="item.organizationId"
|
||||
:label="item.organizationName"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizationParent } from '@/api/sylive/organization';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-modal)
|
||||
value: String,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择机构'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 机构类型数据
|
||||
data: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
/* 获取机构类型数据 */
|
||||
listOrganizationParent({
|
||||
parentId: 0
|
||||
})
|
||||
.then((list) => {
|
||||
this.data = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/* 更新选中数据 */
|
||||
updateValue(value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- 机构选择下拉框 -->
|
||||
<template>
|
||||
<ele-tree-select
|
||||
clearable
|
||||
:value="value || ''"
|
||||
:data="data"
|
||||
label-key="teamName"
|
||||
value-key="teamId"
|
||||
default-expand-all
|
||||
:placeholder="placeholder"
|
||||
@input="updateValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-model)
|
||||
value: Number,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择团队'
|
||||
},
|
||||
// 机构数据
|
||||
data: Array
|
||||
},
|
||||
methods: {
|
||||
/* 更新选中数据 */
|
||||
updateValue(value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,57 +0,0 @@
|
||||
<!-- 机构类型选择下拉框 -->
|
||||
<template>
|
||||
<el-select
|
||||
clearable
|
||||
:value="value"
|
||||
class="ele-fluid"
|
||||
:placeholder="placeholder"
|
||||
@input="updateValue"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.dictDataId"
|
||||
:value="item.dictDataCode"
|
||||
:label="item.dictDataName"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDictionaryData } from '@/api/system/dictionary-data';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 选中的数据(v-modal)
|
||||
value: String,
|
||||
// 提示信息
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择团队类型'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 机构类型数据
|
||||
data: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
/* 获取机构类型数据 */
|
||||
listDictionaryData({
|
||||
dictCode: 'team_type'
|
||||
})
|
||||
.then((list) => {
|
||||
this.data = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/* 更新选中数据 */
|
||||
updateValue(value) {
|
||||
this.$emit('input', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,184 +0,0 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="680px"
|
||||
:visible="visible"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
:title="isUpdate ? '修改用户' : '添加用户'"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="所属团队:" prop="teamId">
|
||||
<team-select
|
||||
:data="teamList"
|
||||
placeholder="请选择所属团队"
|
||||
v-model="form.teamId"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号:" prop="mobile">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="11"
|
||||
:disabled="isUpdate"
|
||||
v-model="form.mobile"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
|
||||
<el-form-item label="姓名:" prop="uname">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="20"
|
||||
v-model="form.uname"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<el-button @click="updateVisible(false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="save">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { phoneReg } from 'ele-admin';
|
||||
import TeamSelect from './team-select.vue';
|
||||
import {
|
||||
addTeamUser,
|
||||
updateTeamUser,
|
||||
checkExistence
|
||||
} from '@/api/sylive/team-user';
|
||||
|
||||
export default {
|
||||
components: { TeamSelect },
|
||||
props: {
|
||||
// 弹窗是否打开
|
||||
visible: Boolean,
|
||||
// 修改回显的数据
|
||||
data: Object,
|
||||
// 全部团队
|
||||
teamList: Array,
|
||||
// 团队id
|
||||
teamId: Number
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
userId: null,
|
||||
teamId: null,
|
||||
mobile: '',
|
||||
uname: ''
|
||||
};
|
||||
return {
|
||||
defaultForm,
|
||||
// 表单数据
|
||||
form: { ...defaultForm },
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
validator: (_rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('请输入手机号'));
|
||||
}
|
||||
const st = new RegExp(phoneReg);
|
||||
if (!st.test(value)) {
|
||||
return callback(new Error('手机号格式不正确'));
|
||||
}
|
||||
checkExistence('mobile', value, this.data?.mobile)
|
||||
.then(() => {
|
||||
callback(new Error('手机号已经存在'));
|
||||
})
|
||||
.catch(() => {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
teamId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属团队',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
uname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
// 提交状态
|
||||
loading: false,
|
||||
// 是否是修改
|
||||
isUpdate: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 保存编辑 */
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const data = {
|
||||
...this.form
|
||||
};
|
||||
const saveOrUpdate = this.isUpdate ? updateTeamUser : addTeamUser;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(visible) {
|
||||
if (visible) {
|
||||
if (this.data) {
|
||||
this.$util.assignObject(this.form, {
|
||||
...this.data
|
||||
});
|
||||
this.isUpdate = true;
|
||||
} else {
|
||||
this.form.teamId = this.teamId;
|
||||
this.isUpdate = false;
|
||||
}
|
||||
} else {
|
||||
this.$refs.form.clearValidate();
|
||||
this.form = { ...this.defaultForm };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,216 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 数据表格 -->
|
||||
<ele-pro-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
height="calc(100vh - 265px)"
|
||||
full-height="calc(100vh - 116px)"
|
||||
tool-class="ele-toolbar-form"
|
||||
cache-key="systemTeamUserTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
<template v-slot:toolbar>
|
||||
<team-user-search @search="reload">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
class="ele-btn-icon"
|
||||
@click="openEdit()"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
</team-user-search>
|
||||
</template>
|
||||
<!-- 角色列 -->
|
||||
<template v-slot:roleName="{ row }">
|
||||
<el-tag type="primary" size="mini">
|
||||
{{ row.roleName }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 状态列 -->
|
||||
<template v-slot:status="{ row }">
|
||||
<el-switch
|
||||
:active-value="0"
|
||||
:inactive-value="1"
|
||||
v-model="row.status"
|
||||
@change="editStatus(row)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
<template v-slot:action="{ row }">
|
||||
<el-link
|
||||
type="primary"
|
||||
:underline="false"
|
||||
icon="el-icon-edit"
|
||||
@click="openEdit(row)"
|
||||
>
|
||||
修改
|
||||
</el-link>
|
||||
<el-popconfirm
|
||||
class="ele-action"
|
||||
title="确定要删除此用户吗?"
|
||||
@confirm="remove(row)"
|
||||
>
|
||||
<template v-slot:reference>
|
||||
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
<!-- 编辑弹窗 -->
|
||||
<team-user-edit
|
||||
:data="current"
|
||||
:visible.sync="showEdit"
|
||||
:team-list="teamList"
|
||||
:team-id="teamId"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TeamUserSearch from './team-user-search.vue';
|
||||
import TeamUserEdit from './team-user-edit.vue';
|
||||
import {
|
||||
pageTeamUser,
|
||||
removeTeamUser,
|
||||
updateTeamUserStatus
|
||||
} from '@/api/sylive/team-user';
|
||||
|
||||
export default {
|
||||
components: { TeamUserSearch, TeamUserEdit },
|
||||
props: {
|
||||
// 机构id
|
||||
teamId: Number,
|
||||
// 全部机构
|
||||
teamList: Array
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
prop: 'userId',
|
||||
label: 'ID',
|
||||
minWidth: 45,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'uname',
|
||||
label: '姓名',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'nickname',
|
||||
label: '微信昵称',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '手机号',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue);
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
sortable: 'custom',
|
||||
width: 100,
|
||||
resizable: false,
|
||||
slot: 'status'
|
||||
},
|
||||
{
|
||||
columnKey: 'action',
|
||||
label: '操作',
|
||||
width: 160,
|
||||
align: 'center',
|
||||
resizable: false,
|
||||
slot: 'action',
|
||||
showOverflowTooltip: true
|
||||
}
|
||||
],
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
// 是否显示编辑弹窗
|
||||
showEdit: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
return pageTeamUser({
|
||||
...where,
|
||||
...order,
|
||||
page,
|
||||
limit,
|
||||
teamId: this.teamId
|
||||
});
|
||||
},
|
||||
/* 刷新表格 */
|
||||
reload(where) {
|
||||
this.$refs.table.reload({ page: 1, where: where });
|
||||
},
|
||||
/* 显示编辑 */
|
||||
openEdit(row) {
|
||||
this.current = row;
|
||||
this.showEdit = true;
|
||||
},
|
||||
/* 删除 */
|
||||
remove(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
removeTeamUser(row.userId)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
this.reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 更改状态 */
|
||||
editStatus(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
updateTeamUserStatus(row.userId, row.status)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
row.status = !row.status ? 1 : 0;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听团队id变化
|
||||
teamId() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,79 +0,0 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<el-form
|
||||
size="small"
|
||||
class="ele-form-search"
|
||||
@keyup.enter.native="search"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="10">
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
v-model="where.uname"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
v-model="where.nickname"
|
||||
placeholder="请输入微信昵称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
class="ele-btn-icon"
|
||||
@click="search"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<slot></slot>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
uname: '',
|
||||
nickname: ''
|
||||
};
|
||||
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>
|
||||
@@ -1,184 +0,0 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never" v-loading="loading">
|
||||
<ele-split-layout
|
||||
width="266px"
|
||||
allow-collapse
|
||||
:right-style="{ overflow: 'hidden' }"
|
||||
>
|
||||
<div>
|
||||
<!-- 操作按钮 -->
|
||||
<ele-toolbar class="ele-toolbar-actions">
|
||||
<div style="margin: 5px 0">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
class="ele-btn-icon"
|
||||
@click="openEdit()"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="warning"
|
||||
icon="el-icon-edit"
|
||||
class="ele-btn-icon"
|
||||
:disabled="!current"
|
||||
@click="openEdit(current)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
class="ele-btn-icon"
|
||||
:disabled="!current"
|
||||
@click="remove"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</ele-toolbar>
|
||||
<div class="ele-border-lighter sys-team-list">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="data"
|
||||
highlight-current
|
||||
node-key="teamId"
|
||||
:props="{ label: 'teamName' }"
|
||||
:expand-on-click-node="false"
|
||||
:default-expand-all="true"
|
||||
@node-click="onNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-slot:content>
|
||||
<team-user-list
|
||||
v-if="current"
|
||||
:team-list="data"
|
||||
:team-id="current.teamId"
|
||||
/>
|
||||
</template>
|
||||
</ele-split-layout>
|
||||
</el-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
<team-edit
|
||||
:visible.sync="showEdit"
|
||||
:data="editData"
|
||||
:parent-id="parentId"
|
||||
:team-list="data"
|
||||
:organization-list="organizationList"
|
||||
@done="query"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TeamUserList from './components/team-user-list.vue';
|
||||
import TeamEdit from './components/team-edit.vue';
|
||||
import { listTeams, removeTeam } from '@/api/sylive/team';
|
||||
|
||||
export default {
|
||||
name: 'SyliveTeam',
|
||||
components: { TeamUserList, TeamEdit },
|
||||
data() {
|
||||
return {
|
||||
// 加载状态
|
||||
loading: true,
|
||||
// 列表数据
|
||||
data: [],
|
||||
// 选中数据
|
||||
current: null,
|
||||
// 是否显示表单弹窗
|
||||
showEdit: false,
|
||||
// 编辑回显数据
|
||||
editData: null,
|
||||
// 门店数据
|
||||
organizationList: [],
|
||||
// 上级id
|
||||
parentId: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.query();
|
||||
},
|
||||
methods: {
|
||||
/* 查询 */
|
||||
query() {
|
||||
this.loading = true;
|
||||
listTeams()
|
||||
.then((list) => {
|
||||
this.loading = false;
|
||||
this.data = this.$util.toTreeData({
|
||||
data: list,
|
||||
idField: 'teamId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.onNodeClick(this.data[0]);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 选择数据 */
|
||||
onNodeClick(row) {
|
||||
if (row) {
|
||||
this.current = row;
|
||||
this.parentId = row.teamId;
|
||||
this.$refs.tree.setCurrentKey(row.teamId);
|
||||
} else {
|
||||
this.current = null;
|
||||
this.parentId = null;
|
||||
}
|
||||
},
|
||||
/* 显示编辑 */
|
||||
openEdit(item) {
|
||||
this.editData = item;
|
||||
this.showEdit = true;
|
||||
},
|
||||
/* 删除 */
|
||||
remove() {
|
||||
this.$confirm('确定要删除选中的团队吗?', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
const loading = this.$loading({ lock: true });
|
||||
removeTeam(this.current.teamId)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
this.query();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sys-team-list {
|
||||
height: calc(100vh - 264px);
|
||||
box-sizing: border-box;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.sys-team-list :deep(.el-tree-node__content) {
|
||||
height: 40px;
|
||||
|
||||
& > .el-tree-node__expand-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user