-
+
{{ $t('commons.adv_search.search') }}
@@ -145,38 +153,53 @@ import {getUrl, LOG_MODULE_MAP, LOG_TYPE, LOG_TYPE_MAP, SYSLIST, WORKSYSLIST} fr
import MsLogDetail from "./LogDetail";
export default {
- name: "OperatingLog",
- components: {
- MsTablePagination, MsTableOperator, MsLogDetail
- },
- data() {
- return {
- props: {
- multiple: false,
- },
- result: {},
- form: {},
- currentPage: 0,
- pageSize: 10,
- total: 0,
- items: [],
- workspaceList: [],
- isSystem: false,
- condition: {
- times: [new Date().getTime() - 3600 * 1000 * 24 * 7, new Date().getTime()],
- },
- tableData: [],
- userList: [],
- screenHeight: 'calc(100vh - 270px)',
- LOG_TYPE: new LOG_TYPE(this),
- LOG_TYPE_MAP: new LOG_TYPE_MAP(this),
- LOG_MODULE_MAP: new LOG_MODULE_MAP(this),
- sysList: new SYSLIST(),
- loading: false,
- }
- },
- mounted() {
- switch (this.$route.name) {
+ name: "OperatingLog",
+ components: {
+ MsTablePagination, MsTableOperator, MsLogDetail
+ },
+ data() {
+ return {
+ props: {
+ multiple: false,
+ },
+ result: {},
+ form: {},
+ currentPage: 0,
+ pageSize: 10,
+ total: 0,
+ items: [],
+ workspaceList: [],
+ isSystem: false,
+ condition: {
+ times: [new Date().getTime() - 3600 * 1000 * 24 * 7, new Date().getTime()],
+ },
+ tableData: [],
+ userList: [],
+ screenHeight: 'calc(100vh - 270px)',
+ LOG_TYPE: new LOG_TYPE(this),
+ LOG_TYPE_MAP: new LOG_TYPE_MAP(this),
+ LOG_MODULE_MAP: new LOG_MODULE_MAP(this),
+ sysList: new SYSLIST(),
+ loading: false,
+ options: [],
+ selectLoading: false
+ }
+ },
+ mounted() {
+ switch (this.$route.name) {
+ case "system":
+ this.getWorkSpaceList();
+ this.getMember();
+ break;
+ case "workspace":
+ this.initProject("/project/listAll/" + getCurrentWorkspaceId());
+ this.getMember('/user/ws/current/member/list');
+ break;
+ }
+ },
+ watch: {
+ '$route'(to) {
+ switch (to.name) {
case "system":
this.getWorkSpaceList();
this.getMember();
@@ -187,35 +210,22 @@ export default {
break;
}
},
- watch: {
- '$route'(to) {
- switch (to.name) {
- case "system":
- this.getWorkSpaceList();
- this.getMember();
- break;
- case "workspace":
- this.initProject("/project/listAll/" + getCurrentWorkspaceId());
- this.getMember('/user/ws/current/member/list');
- break;
+ '$route.path': {
+ handler(toPath) {
+ if (toPath === '/setting/operatingLog/workspace') {
+ this.isSystem = false;
+ this.sysList = new WORKSYSLIST();
+ this.condition.workspaceId = getCurrentWorkspaceId();
+ } else {
+ this.isSystem = true;
+ this.sysList = new SYSLIST();
+ this.condition.workspaceId = '';
}
},
- '$route.path': {
- handler(toPath) {
- if (toPath === '/setting/operatingLog/workspace') {
- this.isSystem = false;
- this.sysList = new WORKSYSLIST();
- this.condition.workspaceId = getCurrentWorkspaceId();
- } else {
- this.isSystem = true;
- this.sysList = new SYSLIST();
- this.condition.workspaceId = '';
- }
- },
- deep: true,
- immediate: true
- },
+ deep: true,
+ immediate: true
},
+ },
methods: {
isLink(row) {
let uri = getUrl(row, this);
@@ -227,88 +237,103 @@ export default {
clickResource(resource) {
let uri = getUrl(resource, this);
if (!resource.sourceId) {
- this.toPage(uri);
+ this.toPage(uri);
+ }
+ let operModule = resource.operModule;
+ let module = this.getLogModule(operModule);
+ if (module === "系统-系统参数设置" || module === "系统-系統參數設置" || module === "System parameter setting") {
+ this.toPage(uri);
+ } else {
+ let resourceId = resource.sourceId;
+ if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
+ resourceId = JSON.parse(resource.sourceId);
}
- let operModule = resource.operModule;
- let module = this.getLogModule(operModule);
- if (module === "系统-系统参数设置" || module === "系统-系統參數設置" || module === "System parameter setting") {
+ if (resourceId instanceof Array) {
+ resourceId = resourceId[0];
+ }
+ if (!this.isSystem) {
+ let user = getCurrentUser();
+ let permission = user.userGroups.filter(ug => ug.sourceId === resource.projectId);
+ if (!permission || (Array.isArray(permission) && permission.length === 0)) {
+ this.$warning(this.$t("commons.no_operation_permission"));
+ return;
+ }
+ }
+ this.$get('/user/update/currentByResourceId/' + resourceId, () => {
this.toPage(uri);
- } else {
- let resourceId = resource.sourceId;
- if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
- resourceId = JSON.parse(resource.sourceId);
- }
- if (resourceId instanceof Array) {
- resourceId = resourceId[0];
- }
- if (!this.isSystem) {
- let user = getCurrentUser();
- let permission = user.userGroups.filter(ug => ug.sourceId === resource.projectId);
- if (!permission || (Array.isArray(permission) && permission.length === 0)) {
- this.$warning(this.$t("commons.no_operation_permission"));
- return;
- }
- }
- this.$get('/user/update/currentByResourceId/' + resourceId, () => {
- this.toPage(uri);
- });
- }
- },
- toPage(uri) {
- let id = "new_a";
- let a = document.createElement("a");
- a.setAttribute("href", uri);
- a.setAttribute("target", "_blank");
- a.setAttribute("id", id);
- document.body.appendChild(a);
- a.click();
-
- let element = document.getElementById(id);
- element.parentNode.removeChild(element);
- },
- handleSelect(item) {
- this.$set(this.condition, "operUser", item.id);
- },
- getMember(url) {
- if (!url) {
- url = '/user/list';
- }
- this.result = this.$get(url, response => {
- this.userList = response.data;
});
- },
- createFilter(queryString) {
- return (user) => {
- return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
- };
- },
- querySearch(queryString, cb) {
- let userList = this.userList;
- let results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
- // 调用 callback 返回建议列表的数据
- cb(results);
- },
- initTableData() {
- if (this.condition.operModules && this.condition.operModules.length > 0) {
- this.condition.operModule = this.condition.operModules[1];
- }
- if (this.isSystem) {
- this.condition.projectIds = [];
- } else {
- this.condition.workspaceIds = [];
- }
- let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize;
- this.loading = true;
- this.$post(url, this.condition, response => {
- this.tableData = response.data.listObject;
- this.total = response.data.itemCount;
- this.loading = false;
- })
+ }
+ },
+ toPage(uri) {
+ let id = "new_a";
+ let a = document.createElement("a");
+ a.setAttribute("href", uri);
+ a.setAttribute("target", "_blank");
+ a.setAttribute("id", id);
+ document.body.appendChild(a);
+ a.click();
- },
+ let element = document.getElementById(id);
+ element.parentNode.removeChild(element);
+ },
+ handleSelect(item) {
+ this.$set(this.condition, "operUser", item.id);
+ },
+ getMember(url) {
+ if (!url) {
+ url = '/user/list';
+ }
+ this.result = this.$get(url, response => {
+ this.userList = response.data;
+ });
+ },
+ createFilter(queryString) {
+ return (user) => {
+ return (user.email.indexOf(queryString.toLowerCase()) === 0
+ || user.id.indexOf(queryString.toLowerCase()) === 0
+ || (user.name && user.name.indexOf(queryString) === 0));
+ };
+ },
+ querySearch(query) {
+ if (query !== '') {
+ this.selectLoading = true;
+ setTimeout(() => {
+ this.selectLoading = false;
+ this.options = this.userList.filter(this.createFilter(query));
+ }, 300);
+ } else {
+ this.options = [];
+ }
+ },
+ visibleChange(val) {
+ if (!val) {
+ this.querySearch('');
+ }
+ },
+ initTableData() {
+ if (this.condition.operModules && this.condition.operModules.length > 0) {
+ this.condition.operModule = this.condition.operModules[1];
+ }
+ if (this.isSystem) {
+ this.condition.projectIds = [];
+ } else {
+ this.condition.workspaceIds = [];
+ }
+ let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize;
+ this.loading = true;
+ this.$post(url, this.condition, response => {
+ this.tableData = response.data.listObject;
+ this.total = response.data.itemCount;
+ this.loading = false;
+ })
+
+ },
reset() {
let projectIds = this.condition.projectIds;
- this.condition = {projectIds: projectIds, times: [new Date().getTime() - 3600 * 1000 * 24 * 7, new Date().getTime()]};
+ this.condition = {
+ projectIds: projectIds,
+ times: [new Date().getTime() - 3600 * 1000 * 24 * 7, new Date().getTime()]
+ };
this.initTableData();
},
getWorkSpaceList() {
@@ -337,36 +362,36 @@ export default {
let data = {id: item.id, label: item.name};
this.items.push(data);
projectIds.push(item.id);
- })
- }
- this.condition.projectIds = projectIds;
- this.initTableData();
- })
- },
- getProject() {
- this.condition.projectIds = [];
- this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
- let project = response.data;
- this.items = [{id: project.id, label: project.name}];
- this.condition.projectIds = [project.id];
- this.condition.projectId = project.id;
- this.initTableData();
- });
- },
- getType(type) {
- return this.LOG_TYPE_MAP.get(type);
- },
- getLogModule(val) {
- return this.LOG_MODULE_MAP.get(val) ? this.LOG_MODULE_MAP.get(val) : val;
- },
- search() {
+ })
+ }
+ this.condition.projectIds = projectIds;
this.initTableData();
- },
- openDetail(row) {
- this.$refs.logDetail.open(row.id);
- },
- }
+ })
+ },
+ getProject() {
+ this.condition.projectIds = [];
+ this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
+ let project = response.data;
+ this.items = [{id: project.id, label: project.name}];
+ this.condition.projectIds = [project.id];
+ this.condition.projectId = project.id;
+ this.initTableData();
+ });
+ },
+ getType(type) {
+ return this.LOG_TYPE_MAP.get(type);
+ },
+ getLogModule(val) {
+ return this.LOG_MODULE_MAP.get(val) ? this.LOG_MODULE_MAP.get(val) : val;
+ },
+ search() {
+ this.initTableData();
+ },
+ openDetail(row) {
+ this.$refs.logDetail.open(row.id);
+ },
}
+}