diff --git a/src/components/CreatePersonDialog.vue b/src/components/CreatePersonDialog.vue index e45cf39..3a3df78 100644 --- a/src/components/CreatePersonDialog.vue +++ b/src/components/CreatePersonDialog.vue @@ -84,6 +84,7 @@ export default { }, }; }, + emits: ['onCancel','createdPerson'], props: { dialogFormVisible: Boolean, }, diff --git a/src/components/CreateProjectDialog.vue b/src/components/CreateProjectDialog.vue index fcaac68..a7e55e0 100644 --- a/src/components/CreateProjectDialog.vue +++ b/src/components/CreateProjectDialog.vue @@ -343,6 +343,7 @@ export default { projectClasses: Array, projectSubClasses: Array }, + emits: ['created'], methods: { onProjectClassChange(val) { this.ruleForm.projectSubclassId = '' diff --git a/src/components/EditJobDialog.vue b/src/components/EditJobDialog.vue index 94f132b..58aecb6 100644 --- a/src/components/EditJobDialog.vue +++ b/src/components/EditJobDialog.vue @@ -56,6 +56,7 @@ export default { inputValue: "", }; }, + emits: ['onCancel', 'edited'], props: { dialogFormVisible: Boolean, staffId: Number, diff --git a/src/components/TransferDialog.vue b/src/components/TransferDialog.vue index d7c5e31..da76a18 100644 --- a/src/components/TransferDialog.vue +++ b/src/components/TransferDialog.vue @@ -5,10 +5,10 @@ width="500px" > -

交接会将该项目成员的所有带进行和进行中的工作项移交给交接人员,交接人员继承该项目成员所有岗位

- - + + +
+ diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 333cfc0..d7ae579 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,5 +2,5 @@ //const baseUrl = "http://36.5.61.1:8081/" //const baseUrl = "http://101.34.228.45:8080/api/" const baseUrl = "https://www.hammer-hfut.tk/api/" -//const baseUrl = "http://192.168.209.129:8081/" +//const baseUrl = "http://192.168.251.129:8081/" export default baseUrl; \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 4246121..dad5102 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -22,12 +22,17 @@ request.interceptors.request.use( request.interceptors.response.use( function (response) { // 2xx 范围内的状态码都会触发该函数。 - console.log("SUCCESS") - //let staff = store.state.staff - //staff.Token = response.config.headers.Token - //console.log(response) - store.commit('updateToken', response.config.headers.token) - return response + if(response.data.code === 200) + { + console.log("SUCCESS") + store.commit('updateToken', response.config.headers.token) + return response + } + else + { + return Promise.reject(response) + } + }, function (error) { console.log("ERROR") console.log(error.response) @@ -39,6 +44,20 @@ request.interceptors.response.use( }) store.commit('clearStaff') router.push({path: '/login'}) + return + } + if(error.response.data.msg) + { + ElMessage({ + message: error.response.data.msg, + type: 'error', + }) + } + else { + ElMessage({ + message: '未知错误', + type: 'error', + }) } return Promise.reject(error) }); diff --git a/src/views/Login.vue b/src/views/Login.vue index bfb49f6..9000abd 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -18,7 +18,7 @@ - 登录 @@ -46,6 +46,9 @@ const loginForm = reactive({ username: '', password: '' }) + +const tip = ref("用户名或密码错误") + console.log(localStorage.getItem('token')) const onSubmit = () => { @@ -59,10 +62,13 @@ const onSubmit = () => { store.commit('setStaff', response.data.data) router.push({path: '/'}) } else { - console.log(response.data) - showAlert.value = true + return Promise.reject(response) } }).catch(function (error) { + if(error.response.data.msg) + tip.value=error.response.data.msg + else + tip.value="登录失败,未知错误" console.log('error:') console.log(error); showAlert.value = true diff --git a/src/views/OngoingProject.vue b/src/views/OngoingProject.vue index 37ae3f0..9a985e0 100644 --- a/src/views/OngoingProject.vue +++ b/src/views/OngoingProject.vue @@ -28,7 +28,7 @@ :percentage="scope.row.totalNum===0?0:Math.round(scope.row.completeNum*100/scope.row.totalNum)"> - + @@ -148,6 +145,7 @@ export default { }; }, + emits: ['groupChanged'], props: { projectAccessLevel: Number, projectGroup: Array @@ -159,6 +157,17 @@ export default { EchartsPie }, methods: { + getOperationsVisible(row) { + switch (this.projectAccessLevel) { + case 1: + return row.projectStaffPosition !== '项目经理' + case 2: + return row.projectStaffPosition !== '项目经理' && !row.projectStaffPosition.includes('项目主管') + default: + return false + } + + }, getStationList() { let projectId = this.$route.params.projectId; request({ @@ -192,11 +201,28 @@ export default { this.editStaffId = row.staffId this.editStaffPosition = '' const that = this - this.$nextTick(()=> { + this.$nextTick(() => { that.editStaffPosition = row.projectStaffPosition }) this.editJobDialogVisible = true }, + onTransferClick(row) { + this.transferStaffId = row.staffId + this.transferDialogVisible = true + }, + onRemoveClick(row) { + const that = this + request({ + url: `/project/${this.$route.params.projectId}/group/${row.staffId}`, + method: "delete", + }).then((res) => { + that.$message.success("已离队"); + that.refreshGroupTable() + that.$emit("groupChanged"); + }).catch(function (error) { + console.log(error); + }); + }, // 选择一页显示多少条数据 handleSizeChange(val) { this.pageSize = val; @@ -208,9 +234,10 @@ export default { }; this.getTableData(data); }, - rehushTableData() { + refreshGroupTable() { this.dialogFormVisible = false; this.editJobDialogVisible = false + this.transferDialogVisible = false const data = { pageCurrent: this.currentPage, pageSize: this.pageSize, @@ -219,6 +246,7 @@ export default { }; this.getTableData(data); this.getStationList(); + this.$emit('groupChanged') }, getTableData(param) { let projectId = this.$route.params.projectId; @@ -257,7 +285,7 @@ export default { this.getTableData(data); }, jobFormatter(row, column) { - return row[column.property].replace(',',','); + return row[column.property].replace(',', ','); }, }, mounted() { diff --git a/src/views/ProjectWorkitem.vue b/src/views/ProjectWorkitem.vue index 367f787..4ba7efc 100644 --- a/src/views/ProjectWorkitem.vue +++ b/src/views/ProjectWorkitem.vue @@ -462,7 +462,8 @@ export default { taskClosedTime: row.taskClosedTime, taskStartTime: new Date(row.taskStartTime * 1000), taskEndTime: new Date(row.taskEndTime * 1000), - taskDescription: row.taskDescription + taskDescription: row.taskDescription, + childrenCount: row.childrenCount } if (row.attachedInfo) switch (this.form.taskType) { @@ -496,7 +497,8 @@ export default { taskId: row.taskId, taskStatus: row.taskStatus, taskCreatedTime: row.taskCreatedTime, - taskClosedTime: row.taskClosedTime + taskClosedTime: row.taskClosedTime, + childrenCount: row.childrenCount } console.log(submitForm) const that = this @@ -530,20 +532,6 @@ export default { else Promise.reject(response) }).catch(function (error) { - console.log(error.response.data) - let msg = '修改失败,' - if(error.response.data&&error.response.data.msg) - { - msg+=error.response.data.msg - } - else - msg+='未知错误' - ElMessage({ - message: msg, - type: 'error', - }) - - if (submitForm.taskFatherId === 0) { that.getWorkitems() } else { @@ -631,7 +619,7 @@ export default { submitForm['taskStatus'] = this.form.taskStatus submitForm['taskCreatedTime'] = this.form.taskCreatedTime submitForm['taskClosedTime'] = this.form.taskClosedTime - + submitForm['childrenCount'] = this.form.childrenCount request({ url: 'project/' + this.$route.params.projectId + '/task/' + this.form.taskId, method: 'put', @@ -679,7 +667,8 @@ export default { taskClosedTime: row.taskClosedTime, taskStartTime: new Date(row.taskStartTime * 1000), taskEndTime: new Date(row.taskEndTime * 1000), - taskDescription: row.taskDescription + taskDescription: row.taskDescription, + childrenCount: row.childrenCount } if (row.attachedInfo) switch (this.form.taskType) { @@ -701,6 +690,7 @@ export default { this.dialogVisible = true }, onAddClick(row, taskType) { + console.log(this.projectGroup) this.form = { row: row, operation: 'add',