diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index 6b3bcdfa..9ad98d2f 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -221,6 +221,10 @@ export default { // 项目 'All Tags': '全部标签', + 'Project Name': '项目名称', + 'Project Description': '项目描述', + 'Tags': '标签', + 'Enter Tags': '输入标签', // 定时任务 'Schedule Name': '定时任务名称', diff --git a/frontend/src/store/modules/project.js b/frontend/src/store/modules/project.js index bed02795..eafe9dbb 100644 --- a/frontend/src/store/modules/project.js +++ b/frontend/src/store/modules/project.js @@ -2,7 +2,8 @@ import request from '../../api/request' const state = { projectForm: {}, - projectList: [] + projectList: [], + projectTags: [] } const getters = {} @@ -13,12 +14,15 @@ const mutations = { }, SET_PROJECT_LIST: (state, value) => { state.projectList = value + }, + SET_PROJECT_TAGS: (state, value) => { + state.projectTags = value } } const actions = { - getProjectList ({ state, commit }) { - request.get('/projects') + getProjectList ({ state, commit }, payload) { + request.get('/projects', payload) .then(response => { if (response.data.data) { commit('SET_PROJECT_LIST', response.data.data.map(d => { @@ -28,6 +32,14 @@ const actions = { } }) }, + getProjectTags ({ state, commit }) { + request.get('/projects/tags') + .then(response => { + if (response.data.data) { + commit('SET_PROJECT_TAGS', response.data.data.map(d => d.tag)) + } + }) + }, addProject ({ state }) { request.put('/projects', state.projectForm) }, diff --git a/frontend/src/views/project/ProjectList.vue b/frontend/src/views/project/ProjectList.vue index e6a11af0..5d03de2c 100644 --- a/frontend/src/views/project/ProjectList.vue +++ b/frontend/src/views/project/ProjectList.vue @@ -11,7 +11,7 @@ :inline-message="true" ref="projectForm" label-position="right"> - + @@ -84,8 +84,8 @@ - - + +

{{ item.name }}

@@ -129,6 +129,7 @@ export default { return { defaultTags: [], dialogVisible: false, + isClickAction: false, filter: { tag: '' } @@ -185,12 +186,22 @@ export default { this.$st.sendEv('项目', '提交项目') }, onEdit (row) { + this.isClickAction = true + setTimeout(() => { + this.isClickAction = false + }, 100) + this.$store.commit('project/SET_PROJECT_FORM', row) this.dialogVisible = true this.isEdit = true this.$st.sendEv('项目', '修改项目') }, onRemove (row) { + this.isClickAction = true + setTimeout(() => { + this.isClickAction = false + }, 100) + this.$confirm(this.$t('Are you sure to delete the project?'), this.$t('Notification'), { confirmButtonText: this.$t('Confirm'), cancelButtonText: this.$t('Cancel'), @@ -208,12 +219,17 @@ export default { this.$st.sendEv('项目', '删除项目') }, onView (row) { + if (this.isClickAction) return + this.$router.push({ name: 'SpiderList', params: { project_id: row._id } }) + }, + isNoProject (row) { + return row._id === '000000000000000000000000' } }, async created () {