Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangjiahao 2022-09-13 18:20:05 +08:00
commit d2e0057424
14 changed files with 354 additions and 226 deletions

View File

@ -68,6 +68,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/**/*.json", ANON);
filterChainDefinitionMap.put("/system/ui/**", ANON);
filterChainDefinitionMap.put("/system/file/**", ANON);
filterChainDefinitionMap.put("/**/*.js", ANON);
filterChainDefinitionMap.put("/**/*.css", ANON);
filterChainDefinitionMap.put("/**/*.map", ANON);

View File

@ -1,5 +1,6 @@
package io.dataease.controller.sys;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.controller.sys.response.BasicInfo;
@ -13,16 +14,15 @@ import io.dataease.service.system.EmailService;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -108,6 +108,23 @@ public class SystemParameterController {
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
}
@GetMapping("/file/down/{fileId}/{fileName}")
public ResponseEntity<ByteArrayResource> down(@PathVariable("fileId") String fileId, @PathVariable("fileName") String fileName) throws Exception{
FileMetadata fileMetadata = fileService.getFileMetadataById(fileId);
String type = fileMetadata.getType();
if (!StringUtils.endsWith(fileName.toUpperCase(), type.toUpperCase())) {
fileName += ("." + type);
}
byte[] bytes = fileService.loadFileAsBytes(fileId);
ByteArrayResource bar = new ByteArrayResource(bytes);
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
ContentDisposition contentDisposition = ContentDisposition.parse("attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
headers.setContentDisposition(contentDisposition);
return new ResponseEntity<>(bar, headers, HttpStatus.OK);
}
@PostMapping(value = "/save/ui", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String, List<SystemParameterDTO>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws IOException {
systemParameterService.saveUIInfo(systemParameterMap, bodyFiles);

View File

@ -0,0 +1,32 @@
package io.dataease.service.message.service.strategy;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.service.AuthUserService;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.dingtalk.service.DingtalkXpackService;
import io.dataease.service.message.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("sendDingtalk")
public class SendDingtalk implements SendService {
@Autowired
private AuthUserService authUserService;
@Override
public void sendMsg(Long userId, Long typeId, String content, String param) {
SysUserEntity userEntity = authUserService.getUserById(userId);
if (userEntity.getFrom() == 5 && authUserService.supportDingtalk()) {
String username = userEntity.getUsername();
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
List<String> userIds = new ArrayList<>();
userIds.add(username);
dingtalkXpackService.pushMsg(userIds, content);
}
}
}

View File

@ -0,0 +1,32 @@
package io.dataease.service.message.service.strategy;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.service.AuthUserService;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.lark.service.LarkXpackService;
import io.dataease.service.message.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("sendLark")
public class SendLark implements SendService {
@Autowired
private AuthUserService authUserService;
@Override
public void sendMsg(Long userId, Long typeId, String content, String param) {
SysUserEntity userEntity = authUserService.getUserById(userId);
if (userEntity.getFrom() == 6 && authUserService.supportLark()) {
String username = userEntity.getUsername();
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
List<String> userIds = new ArrayList<>();
userIds.add(username);
larkXpackService.pushMsg(userIds, content);
}
}
}

View File

@ -0,0 +1,31 @@
package io.dataease.service.message.service.strategy;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.service.AuthUserService;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.wecom.service.WecomXpackService;
import io.dataease.service.message.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("sendWecom")
public class SendWecom implements SendService {
@Autowired
private AuthUserService authUserService;
@Override
public void sendMsg(Long userId, Long typeId, String content, String param) {
SysUserEntity userEntity = authUserService.getUserById(userId);
if (userEntity.getFrom() == 4 && authUserService.supportWecom()) {
String username = userEntity.getUsername();
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
List<String> userIds = new ArrayList<>();
userIds.add(username);
wecomXpackService.pushMsg(userIds, content);
}
}
}

View File

@ -36,3 +36,7 @@ CREATE TABLE `panel_app_template` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `sys_menu` VALUES (800, 0, 0, 1, '数据集表单', 'dataset-form', 'dataset/form', 999, NULL, '/dataset-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_msg_channel` VALUES (3, 'webmsg.channel_wecom_msg', 'sendWecom');
INSERT INTO `sys_msg_channel` VALUES (4, 'webmsg.channel_dingtalk_msg', 'sendDingtalk');
INSERT INTO `sys_msg_channel` VALUES (5, 'webmsg.channel_lark_msg', 'sendLark');

View File

@ -84,7 +84,7 @@ i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field ch
i18n_no_all_delete_privilege_folder=This folder have sources which have no manage or view privilege,Can Not Be Deleted.
i18n_excel_field_repeat=Duplicate fields exist, please modify and try again.
i18n_schema_is_empty=Database schema is empty
\u7AD9\u5185\u6D88\u606F=Internal Messages
\u7AD9\u5185\u6D88\u606F=Messages Center
\u6240\u6709\u6D88\u606F=All Messages
\u672A\u8BFB\u6D88\u606F=Unread Messages
\u5DF2\u8BFB\u6D88\u606F==Read Messages

View File

@ -84,7 +84,7 @@ i18n_cst_ds_tb_or_field_deleted=\u81EA\u5B9A\u4E49\u6570\u636E\u96C6\u6240\u5173
i18n_no_all_delete_privilege_folder=\u8BE5\u76EE\u5F55\u4E0B\u5B58\u5728\u6CA1\u6709\u7BA1\u7406\u6743\u9650\u6216\u67E5\u770B\u6743\u9650\u7684\u8D44\u6E90\uFF0C\u65E0\u6CD5\u5220\u9664
i18n_excel_field_repeat=\u5B58\u5728\u91CD\u590D\u5B57\u6BB5\uFF0C\u8BF7\u4FEE\u6539\u540E\u91CD\u8BD5
i18n_schema_is_empty=\u6570\u636E\u5E93 Schema \u4E3A\u7A7A
\u7AD9\u5185\u6D88\u606F=\u7AD9\u5185\u6D88\u606F
\u7AD9\u5185\u6D88\u606F=\u6D88\u606F\u4E2D\u5FC3
\u6240\u6709\u6D88\u606F=\u6240\u6709\u6D88\u606F
\u672A\u8BFB\u6D88\u606F=\u672A\u8BFB\u6D88\u606F
\u5DF2\u8BFB\u6D88\u606F=\u5DF2\u8BFB\u6D88\u606F
@ -219,5 +219,5 @@ I18N_USER_DONOT_EXIST=\u7528\u6237\u4E0D\u5B58\u5728
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u7801\u9519\u8BEF
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u7801\u683C\u5F0F\u9519\u8BEF
I18N_DS_INVALID=数据源无效.
I18N_DS_INVALID_TABLE=数据源中有无效的表
I18N_DS_INVALID=\u6570\u636E\u6E90\u65E0\u6548.
I18N_DS_INVALID_TABLE=\u6570\u636E\u6E90\u4E2D\u6709\u65E0\u6548\u7684\u8868

View File

@ -84,7 +84,7 @@ i18n_cst_ds_tb_or_field_deleted=\u81EA\u5B9A\u7FA9\u6578\u64DA\u96C6\u6240\u95DC
i18n_no_all_delete_privilege_folder=\u8A72\u76EE\u9304\u4E0B\u5B58\u5728\u6C92\u6709\u7BA1\u7406\u6B0A\u9650\u6216\u67E5\u770B\u6B0A\u9650\u7684\u8CC7\u6E90\uFF0C\u7121\u6CD5\u522A\u9664
i18n_excel_field_repeat=\u5B58\u5728\u91CD\u5FA9\u5B57\u6BB5\uFF0C\u8ACB\u4FEE\u6539\u5F8C\u91CD\u8BD5
i18n_schema_is_empty=\u6578\u64DA\u5EAB Schema \u70BA\u7A7A
\u7AD9\u5185\u6D88\u606F=\u7AD9\u5167\u6D88\u606F
\u7AD9\u5185\u6D88\u606F=\u6D88\u606F\u4E2D\u5FC3
\u6240\u6709\u6D88\u606F=\u6240\u6709\u6D88\u606F
\u672A\u8BFB\u6D88\u606F=\u672A\u8B80\u6D88\u606F
\u5DF2\u8BFB\u6D88\u606F=\u5DF2\u8B80\u6D88\u606F
@ -215,5 +215,5 @@ I18N_USER_DONOT_EXIST=\u7528\u6236\u4E0D\u5B58\u5728
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u78BC\u932F\u8AA4
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u78BC\u683C\u5F0F\u932F\u8AA4
I18N_DS_INVALID=數據源無效.
I18N_DS_INVALID_TABLE=數據源中有無效的表
I18N_DS_INVALID=\u6578\u64DA\u6E90\u7121\u6548.
I18N_DS_INVALID_TABLE=\u6578\u64DA\u6E90\u4E2D\u6709\u7121\u6548\u7684\u8868

View File

@ -2222,8 +2222,11 @@ export default {
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type',
i18n_msg_type_ds_invalid: 'Datasource invalid',
channel_inner_msg: 'On site news',
channel_email_msg: 'Mail notification'
channel_inner_msg: 'On site',
channel_email_msg: 'Email',
channel_wecom_msg: 'Wecom',
channel_dingtalk_msg: 'Dingtalk',
channel_lark_msg: 'Lark'
},
denumberrange: {
label: 'Number range',

View File

@ -2224,7 +2224,10 @@ export default {
i18n_msg_type_ds_invalid: '數據源失效',
i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息',
channel_email_msg: '郵件提醒'
channel_email_msg: '郵件提醒',
channel_wecom_msg: '企業微信',
channel_dingtalk_msg: '釘釘提醒',
channel_lark_msg: '飛書提醒'
},
denumberrange: {
label: '數值區間',

View File

@ -2224,7 +2224,10 @@ export default {
i18n_msg_type_ds_invalid: '数据源失效',
i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息',
channel_email_msg: '邮件提醒'
channel_email_msg: '邮件提醒',
channel_wecom_msg: '企业微信',
channel_dingtalk_msg: '钉钉提醒',
channel_lark_msg: '飞书提醒'
},
denumberrange: {
label: '数值区间',

View File

@ -259,6 +259,10 @@ export default {
resultFormat() {
if (!this.chart.data) return
const value = this.chart.data.series[0].data[0]
if (value === null || value === undefined) {
this.result = '-'
return
}
let yAxis = []
try {
yAxis = JSON.parse(this.chart.yaxis)

View File

@ -3,96 +3,92 @@
<el-row class="top-operate">
<el-col :span="12">
<el-button
v-permission="['user:add']"
class="btn"
type="primary"
v-permission="['user:add']"
icon="el-icon-plus"
@click="create"
>{{ $t("user.create") }}</el-button
>
>{{ $t("user.create") }}</el-button>
<plugin-com v-if="isPluginLoaded" ref="ImportUserCom" component-name="ImportUser" />
</el-col>
<el-col :span="12" class="right-user">
<el-input
ref="search"
v-model="nikeName"
:placeholder="$t('role.search_by_name_email')"
prefix-icon="el-icon-search"
class="name-email-search"
size="small"
clearable
ref="search"
v-model="nikeName"
@blur="initSearch"
@clear="initSearch"
>
</el-input>
/>
<el-button
class="normal btn"
v-btnPress="filterColor"
class="normal btn"
:class="[filterTexts.length ? 'active-btn filter-not-null' : 'filter-zero']"
icon="iconfont icon-icon-filter"
@click="filterShow"
>{{ $t('user.filter') }}<template v-if="filterTexts.length">
({{ filterTexts.length }})
</template>
>{{ $t('user.filter') }}<template v-if="filterTexts.length">
({{ filterTexts.length }})
</template>
</el-button>
<el-dropdown trigger="click" :hide-on-click="false">
<el-button v-btnPress class="normal btn filter-zero" icon="el-icon-setting"
>{{ $t('user.list') }}</el-button
>
<el-dropdown-menu class="list-colums-slect" slot="dropdown">
<el-button
v-btnPress
class="normal btn filter-zero"
icon="el-icon-setting"
>{{ $t('user.list') }}</el-button>
<el-dropdown-menu slot="dropdown" class="list-colums-slect">
<p class="title">{{ $t('user.list_info') }}</p>
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
:indeterminate="isIndeterminate"
@change="handleCheckAllChange"
>{{ $t('dataset.check_all')}}</el-checkbox
>
>{{ $t('dataset.check_all') }}</el-checkbox>
<el-checkbox-group
v-model="checkedColumnNames"
@change="handleCheckedColumnNamesChange"
>
<el-checkbox
v-for="column in columnNames"
:label="column.props"
:key="column.props"
>{{ $t(column.label) }}</el-checkbox
>
:label="column.props"
>{{ $t(column.label) }}</el-checkbox>
</el-checkbox-group>
</el-dropdown-menu>
</el-dropdown>
</el-col>
</el-row>
<div class="filter-texts" v-if="filterTexts.length">
<div v-if="filterTexts.length" class="filter-texts">
<span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{$t('user.result_one')}}</span>
<el-divider direction="vertical"></el-divider>
<i @click="scrollPre" v-if="showScroll" class="el-icon-arrow-left arrow-filter"></i>
<span class="title">{{ $t('user.result_one') }}</span>
<el-divider direction="vertical" />
<i v-if="showScroll" class="el-icon-arrow-left arrow-filter" @click="scrollPre" />
<div class="filter-texts-container">
<p class="text" v-for="(ele, index) in filterTexts" :key="ele">
{{ ele }} <i @click="clearOneFilter(index)" class="el-icon-close"></i>
<p v-for="(ele, index) in filterTexts" :key="ele" class="text">
{{ ele }} <i class="el-icon-close" @click="clearOneFilter(index)" />
</p>
</div>
<i @click="scrollNext" v-if="showScroll" class="el-icon-arrow-right arrow-filter"></i>
<i v-if="showScroll" class="el-icon-arrow-right arrow-filter" @click="scrollNext" />
<el-button
type="text"
class="clear-btn"
icon="el-icon-delete"
@click="clearFilter"
>{{$t('user.clear_filter')}}</el-button
>
>{{ $t('user.clear_filter') }}</el-button>
</div>
<div
class="table-container"
id="resize-for-filter"
class="table-container"
:class="[filterTexts.length ? 'table-container-filter' : '']"
>
<grid-table
v-if="canLoadDom"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:tableData="data"
:table-data="data"
:columns="checkedColumnNames"
:pagination="paginationConfig"
@sort-change="sortChange"
@ -101,8 +97,8 @@
>
<el-table-column prop="username" label="ID" />
<el-table-column
show-overflow-tooltip
key="nickName"
show-overflow-tooltip
prop="nickName"
sortable="custom"
:label="$t('commons.nick_name')"
@ -115,23 +111,32 @@
scope.row.from === 0
? "LOCAL"
: scope.row.from === 1
? "LDAP"
: "OIDC"
? "LDAP"
: scope.row.from === 2
? "OIDC"
: scope.row.from === 3
? "CAS"
: scope.row.from === 4
? "Wecom"
: scope.row.from === 5
? "Dingtalk"
: scope.row.from === 6
? "Lark" : '-'
}}
</div>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
key="email"
show-overflow-tooltip
prop="email"
:label="$t('commons.email')"
/>
<el-table-column
v-if="isPluginLoaded"
show-overflow-tooltip
key="dept"
show-overflow-tooltip
prop="dept"
sortable="custom"
:label="$t('commons.organization')"
@ -142,13 +147,12 @@
</el-table-column>
<el-table-column
v-if="isPluginLoaded"
key="roles"
prop="roles"
:formatter="filterRoles"
key="roles"
show-overflow-tooltip
:label="$t('commons.role')"
>
</el-table-column>
/>
<el-table-column
key="status"
prop="status"
@ -168,9 +172,9 @@
</template>
</el-table-column>
<el-table-column
key="createTime"
show-overflow-tooltip
prop="createTime"
key="createTime"
sortable="custom"
:label="$t('commons.create_time')"
width="180"
@ -189,20 +193,19 @@
<template slot-scope="scope">
<el-button
v-permission="['user:edit']"
@click="edit(scope.row)"
class="text-btn mr2"
type="text"
>{{ $t("commons.edit") }}</el-button
>
@click="edit(scope.row)"
>{{ $t("commons.edit") }}</el-button>
<el-popover
:ref="'initPwd' + scope.row.userId"
placement="left"
width="321"
:ref="'initPwd' + scope.row.userId"
popper-class="reset-pwd"
trigger="click"
>
<i class="el-icon-warning"></i>
<div class="tips">{{$t('user.recover_pwd')}}</div>
<i class="el-icon-warning" />
<div class="tips">{{ $t('user.recover_pwd') }}</div>
<div class="editer-form-title">
<span class="pwd" type="text">{{
$t("commons.default_pwd") + "" + defaultPWD
@ -222,11 +225,10 @@
$t("fu.search_bar.cancel")
}}</el-button> -->
<el-button
@click="resetPwd(scope.row.userId)"
type="primary"
class="btn"
>{{ $t("fu.search_bar.ok") }}</el-button
>
@click="resetPwd(scope.row.userId)"
>{{ $t("fu.search_bar.ok") }}</el-button>
</div>
<el-button
@ -234,67 +236,65 @@
v-permission="['user:editPwd']"
class="text-btn mar16"
type="text"
>{{ $t("member.edit_password") }}</el-button
>
>{{ $t("member.edit_password") }}</el-button>
</el-popover>
<el-button
v-permission="['user:del']"
@click="del(scope.row)"
v-if="scope.row.id !== 1"
v-permission="['user:del']"
class="text-btn"
type="text"
>{{ $t("commons.delete") }}</el-button
>
@click="del(scope.row)"
>{{ $t("commons.delete") }}</el-button>
</template>
</el-table-column>
</grid-table>
</div>
<keep-alive>
<filterUser ref="filterUser" @search="filterDraw"></filterUser>
<filterUser ref="filterUser" @search="filterDraw" />
</keep-alive>
<user-editer @saved="search" ref="userEditer"></user-editer>
<user-editer ref="userEditer" @saved="search" />
</de-layout-content>
</template>
<script>
import userEditer from "./userEditer.vue";
import userEditer from './userEditer.vue'
const columnOptions = [
{
label: "ID",
props: "username",
label: 'ID',
props: 'username'
},
{
label: "commons.nick_name",
props: "nickName",
label: 'commons.nick_name',
props: 'nickName'
},
{
label: "user.source",
props: "from",
label: 'user.source',
props: 'from'
},
{
label: "commons.email",
props: "email",
label: 'commons.email',
props: 'email'
},
{
label: "commons.organization",
props: "dept",
label: 'commons.organization',
props: 'dept'
},
{
label: "commons.role",
props: "roles",
label: 'commons.role',
props: 'roles'
},
{
label: "commons.status",
props: "status",
label: 'commons.status',
props: 'status'
},
{
label: "commons.create_time",
props: "createTime",
},
];
import DeLayoutContent from "@/components/business/DeLayoutContent";
import { addOrder, formatOrders } from "@/utils/index";
import { pluginLoaded, defaultPwd } from "@/api/user";
label: 'commons.create_time',
props: 'createTime'
}
]
import DeLayoutContent from '@/components/business/DeLayoutContent'
import { addOrder, formatOrders } from '@/utils/index'
import { pluginLoaded, defaultPwd } from '@/api/user'
import bus from '@/utils/bus'
/* import { ldapStatus, pluginLoaded } from '@/api/user' */
import {
@ -302,13 +302,13 @@ import {
delUser,
editPassword,
editStatus,
allRoles,
} from "@/api/system/user";
import { mapGetters } from "vuex";
import filterUser from "./filterUser.vue";
import GridTable from "@/components/gridTable/index.vue";
import PluginCom from '@/views/system/plugin/PluginCom';
import _ from 'lodash';
allRoles
} from '@/api/system/user'
import { mapGetters } from 'vuex'
import filterUser from './filterUser.vue'
import GridTable from '@/components/gridTable/index.vue'
import PluginCom from '@/views/system/plugin/PluginCom'
import _ from 'lodash'
export default {
components: { DeLayoutContent, GridTable, filterUser, userEditer, PluginCom },
data() {
@ -320,7 +320,7 @@ export default {
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0,
total: 0
},
data: [],
filterTexts: [],
@ -328,41 +328,41 @@ export default {
form: {
roles: [
{
id: "",
},
],
id: ''
}
]
},
ruleForm: {},
rule: {
newPassword: [
{
required: true,
message: this.$t("user.input_password"),
trigger: "blur",
message: this.$t('user.input_password'),
trigger: 'blur'
},
{
required: true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
message: this.$t("member.password_format_is_incorrect"),
trigger: "blur",
},
],
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
]
},
cacheCondition: [],
depts: null,
roles: [],
nikeName: "",
nikeName: '',
userRoles: [],
orderConditions: [],
isPluginLoaded: false,
defaultPWD: "DataEase123..",
defaultPWD: 'DataEase123..',
canLoadDom: false,
showScroll: false,
resizeForFilter: null,
};
resizeForFilter: null
}
},
computed: {
...mapGetters(["user"]),
...mapGetters(['user']),
filterColor() {
return this.filterTexts.length ? 'rgba(51, 112, 255, 0.15)' : '#EFF0F1'
}
@ -370,61 +370,61 @@ export default {
watch: {
filterTexts: {
handler() {
this.getScrollStatus();
this.getScrollStatus()
},
deep: true,
},
deep: true
}
},
mounted() {
bus.$on('reload-user-grid', this.search)
this.allRoles();
this.search();
document.addEventListener("keypress", this.entryKey);
this.resizeObserver();
this.allRoles()
this.search()
document.addEventListener('keypress', this.entryKey)
this.resizeObserver()
},
beforeCreate() {
pluginLoaded()
.then((res) => {
this.isPluginLoaded = res.success && res.data;
this.isPluginLoaded = res.success && res.data
if (!this.isPluginLoaded) {
this.checkedColumnNames = this.checkedColumnNames.filter(ele => !['dept', 'roles'].includes(ele))
this.columnNames = this.columnNames.filter(ele => !['dept', 'roles'].includes(ele.props))
}
this.canLoadDom = true;
this.canLoadDom = true
})
.catch((e) => {
this.canLoadDom = true;
});
this.canLoadDom = true
})
defaultPwd().then((res) => {
if (res && res.data) {
this.defaultPWD = res.data;
this.defaultPWD = res.data
}
});
})
},
destroyed() {
document.removeEventListener("keypress", this.entryKey);
document.removeEventListener('keypress', this.entryKey)
bus.$off('reload-user-grid', this.search)
},
methods: {
resizeObserver() {
this.resizeForFilter = new ResizeObserver(entries => {
if (!this.filterTexts.length) return;
this.layoutResize();
});
this.resizeForFilter.observe(document.querySelector('#resize-for-filter'));
if (!this.filterTexts.length) return
this.layoutResize()
})
this.resizeForFilter.observe(document.querySelector('#resize-for-filter'))
},
layoutResize: _.debounce(function () {
layoutResize: _.debounce(function() {
this.getScrollStatus()
}, 200),
scrollPre() {
const dom = document.querySelector('.filter-texts-container');
const dom = document.querySelector('.filter-texts-container')
dom.scrollLeft -= 10
if (dom.scrollLeft <= 0) {
dom.scrollLeft = 0
}
},
scrollNext() {
const dom = document.querySelector('.filter-texts-container');
const dom = document.querySelector('.filter-texts-container')
dom.scrollLeft += 10
const width = dom.scrollWidth - dom.offsetWidth
if (dom.scrollLeft > width) {
@ -432,168 +432,168 @@ export default {
}
},
clearFilter() {
this.$refs.filterUser.clearFilter();
this.$refs.filterUser.clearFilter()
},
clearOneFilter(index) {
this.$refs.filterUser.clearOneFilter(index);
this.$refs.filterUser.search();
this.$refs.filterUser.clearOneFilter(index)
this.$refs.filterUser.search()
},
entryKey(event) {
const keyCode = event.keyCode;
const keyCode = event.keyCode
if (keyCode === 13) {
this.$refs.search.blur();
this.$refs.search.blur()
}
},
filterRoles(row, column, cellValue) {
const roleNames = cellValue.map((ele) => ele.roleName);
return roleNames.length ? roleNames.join() : "-";
const roleNames = cellValue.map((ele) => ele.roleName)
return roleNames.length ? roleNames.join() : '-'
},
initSearch() {
this.handleCurrentChange(1);
this.handleCurrentChange(1)
},
filterShow() {
this.$refs.filterUser.init();
this.$refs.filterUser.init()
},
handleCheckAllChange(val) {
this.checkedColumnNames = val
? columnOptions.map((ele) => ele.props)
: [];
: []
if (!this.isPluginLoaded) {
this.checkedColumnNames = this.checkedColumnNames.filter(ele => !['dept', 'roles'].includes(ele))
}
this.isIndeterminate = false;
this.checkedColumnNames = this.checkedColumnNames.filter(ele => !['dept', 'roles'].includes(ele))
}
this.isIndeterminate = false
},
handleCheckedColumnNamesChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.columnNames.length;
const checkedCount = value.length
this.checkAll = checkedCount === this.columnNames.length
this.isIndeterminate =
checkedCount > 0 && checkedCount < this.columnNames.length;
checkedCount > 0 && checkedCount < this.columnNames.length
},
resetPwd(userId) {
editPassword({ userId, newPassword: this.defaultPWD })
.then((res) => {
this.$success(this.$t("commons.modify_success"));
this.initSearch();
this.$success(this.$t('commons.modify_success'))
this.initSearch()
})
.finally(() => {
this.$refs["initPwd" + userId].doClose();
});
this.$refs['initPwd' + userId].doClose()
})
},
sortChange({ column, prop, order }) {
this.orderConditions = [];
this.orderConditions = []
if (!order) {
this.initSearch();
return;
this.initSearch()
return
}
if (prop === "dept") {
prop = "u.deptId";
if (prop === 'dept') {
prop = 'u.deptId'
}
if (prop === "status") {
prop = "u.enabled";
if (prop === 'status') {
prop = 'u.enabled'
}
this.orderConditions = [];
addOrder({ field: prop, value: order }, this.orderConditions);
this.initSearch();
this.orderConditions = []
addOrder({ field: prop, value: order }, this.orderConditions)
this.initSearch()
},
onCopy(e) {
this.openMessageSuccess("commons.copy_success");
this.openMessageSuccess('commons.copy_success')
},
onError(e) {},
handleSizeChange(pageSize) {
this.paginationConfig.currentPage = 1;
this.paginationConfig.pageSize = pageSize;
this.search();
this.paginationConfig.currentPage = 1
this.paginationConfig.pageSize = pageSize
this.search()
},
handleCurrentChange(currentPage) {
this.paginationConfig.currentPage = currentPage;
this.search();
this.paginationConfig.currentPage = currentPage
this.search()
},
filterDraw(condition, filterTexts = []) {
this.cacheCondition = condition;
this.filterTexts = filterTexts;
this.initSearch();
this.cacheCondition = condition
this.filterTexts = filterTexts
this.initSearch()
},
getScrollStatus() {
this.$nextTick(() => {
const dom = document.querySelector(".filter-texts-container");
this.showScroll = dom && dom.scrollWidth > dom.offsetWidth;
});
const dom = document.querySelector('.filter-texts-container')
this.showScroll = dom && dom.scrollWidth > dom.offsetWidth
})
},
search() {
const param = {
orders: formatOrders(this.orderConditions),
conditions: [...this.cacheCondition],
};
conditions: [...this.cacheCondition]
}
if (this.nikeName) {
param.conditions.push({
field: `concat(nick_name, ',' , email)`,
operator: "like",
value: this.nikeName,
});
operator: 'like',
value: this.nikeName
})
}
const { currentPage, pageSize } = this.paginationConfig;
const { currentPage, pageSize } = this.paginationConfig
userLists(currentPage, pageSize, param).then((response) => {
this.data = response.data.listObject;
this.paginationConfig.total = response.data.itemCount;
});
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
})
},
create() {
this.$refs.userEditer.init();
this.$refs.userEditer.init()
},
edit(row) {
this.$refs.userEditer.init(row);
this.$refs.userEditer.init(row)
},
del(row) {
this.$confirm(this.$t("user.sure_delete"), "", {
confirmButtonText: this.$t("commons.delete"),
cancelButtonText: this.$t("commons.cancel"),
cancelButtonClass: "de-confirm-fail-btn de-confirm-fail-cancel",
confirmButtonClass: "de-confirm-fail-btn de-confirm-fail-confirm",
customClass: "de-confirm de-confirm-fail",
iconClass: "el-icon-warning",
this.$confirm(this.$t('user.sure_delete'), '', {
confirmButtonText: this.$t('commons.delete'),
cancelButtonText: this.$t('commons.cancel'),
cancelButtonClass: 'de-confirm-fail-btn de-confirm-fail-cancel',
confirmButtonClass: 'de-confirm-fail-btn de-confirm-fail-confirm',
customClass: 'de-confirm de-confirm-fail',
iconClass: 'el-icon-warning'
})
.then(() => {
delUser(encodeURIComponent(row.userId)).then((res) => {
this.openMessageSuccess("commons.delete_success");
this.initSearch();
});
this.openMessageSuccess('commons.delete_success')
this.initSearch()
})
})
.catch(() => {
this.$info(this.$t("commons.delete_cancel"));
});
this.$info(this.$t('commons.delete_cancel'))
})
},
openMessageSuccess(text) {
const h = this.$createElement;
const h = this.$createElement
this.$message({
message: h("p", null, [
h("span", null, this.$t(text)),
message: h('p', null, [
h('span', null, this.$t(text))
]),
iconClass: "el-icon-success",
customClass: "de-message-success de-message",
});
iconClass: 'el-icon-success',
customClass: 'de-message-success de-message'
})
},
handleClose() {
this.depts = null;
this.formType = "add";
this.form = {};
this.editPasswordVisible = false;
this.dialogVisible = false;
this.depts = null
this.formType = 'add'
this.form = {}
this.editPasswordVisible = false
this.dialogVisible = false
},
changeSwitch(row) {
const { userId, enabled } = row;
const param = { userId: userId, enabled: enabled };
const { userId, enabled } = row
const param = { userId: userId, enabled: enabled }
editStatus(param).then((res) => {
this.$success(this.$t("commons.modify_success"));
});
this.$success(this.$t('commons.modify_success'))
})
},
allRoles() {
allRoles().then((res) => {
this.roles = res.data;
});
},
},
};
this.roles = res.data
})
}
}
}
</script>
<style scoped lang="scss">
@ -754,8 +754,6 @@ export default {
background: #F5F6F7 !important;
}
.right-user {
text-align: right;
display: flex;