完成离队、交接功能

main
wuyize 2022-07-12 14:17:44 +08:00
parent 1a5df10545
commit ac646086f6
11 changed files with 143 additions and 59 deletions

View File

@ -84,6 +84,7 @@ export default {
}, },
}; };
}, },
emits: ['onCancel','createdPerson'],
props: { props: {
dialogFormVisible: Boolean, dialogFormVisible: Boolean,
}, },

View File

@ -343,6 +343,7 @@ export default {
projectClasses: Array, projectClasses: Array,
projectSubClasses: Array projectSubClasses: Array
}, },
emits: ['created'],
methods: { methods: {
onProjectClassChange(val) { onProjectClassChange(val) {
this.ruleForm.projectSubclassId = '' this.ruleForm.projectSubclassId = ''

View File

@ -56,6 +56,7 @@ export default {
inputValue: "", inputValue: "",
}; };
}, },
emits: ['onCancel', 'edited'],
props: { props: {
dialogFormVisible: Boolean, dialogFormVisible: Boolean,
staffId: Number, staffId: Number,

View File

@ -5,10 +5,10 @@
width="500px" width="500px"
> >
<el-form> <el-form>
<p>交接会将该项目成员的所有带进行和进行中的工作项移交给交接人员交接人员继承该项目成员所有岗位</p>
<el-form-item label="交接人员" prop="taskHolderId">
<el-select style="width: 100%" v-model="form.taskHolderId" filterable > <el-form-item label="交接给" prop="taskHolderId">
<el-select style="width: 100%" v-model="targetStaffId" filterable >
<el-option <el-option
v-for="member in projectGroup" v-for="member in projectGroup"
:key="member.staffId" :key="member.staffId"
@ -24,10 +24,18 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="submit"></el-button>
<el-button @click="onCancel()"></el-button>
</span>
</template>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import request from "../utils/request";
export default { export default {
name: "TransferDialog", name: "TransferDialog",
props: { props: {
@ -35,6 +43,29 @@ export default {
staffId: Number, staffId: Number,
projectGroup: Array projectGroup: Array
}, },
emits: ['onCancel', 'transferred'],
data() {
return {
targetStaffId: null
}
},
methods: {
onCancel() {
this.$emit("onCancel");
},
submit() {
const that = this
request({
url: `/project/${this.$route.params.projectId}/group/${this.staffId}/transfer/${this.targetStaffId}`,
method: "put",
}).then((res) => {
that.$message.success("交接成功");
that.$emit("transferred");
}).catch(function (error) {
console.log(error);
});
}
}
} }
</script> </script>

View File

@ -2,5 +2,5 @@
//const baseUrl = "http://36.5.61.1:8081/" //const baseUrl = "http://36.5.61.1:8081/"
//const baseUrl = "http://101.34.228.45:8080/api/" //const baseUrl = "http://101.34.228.45:8080/api/"
const baseUrl = "https://www.hammer-hfut.tk/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; export default baseUrl;

View File

@ -22,12 +22,17 @@ request.interceptors.request.use(
request.interceptors.response.use( request.interceptors.response.use(
function (response) { function (response) {
// 2xx 范围内的状态码都会触发该函数。 // 2xx 范围内的状态码都会触发该函数。
if(response.data.code === 200)
{
console.log("SUCCESS") console.log("SUCCESS")
//let staff = store.state.staff
//staff.Token = response.config.headers.Token
//console.log(response)
store.commit('updateToken', response.config.headers.token) store.commit('updateToken', response.config.headers.token)
return response return response
}
else
{
return Promise.reject(response)
}
}, function (error) { }, function (error) {
console.log("ERROR") console.log("ERROR")
console.log(error.response) console.log(error.response)
@ -39,6 +44,20 @@ request.interceptors.response.use(
}) })
store.commit('clearStaff') store.commit('clearStaff')
router.push({path: '/login'}) 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) return Promise.reject(error)
}); });

View File

@ -18,7 +18,7 @@
<el-input v-model="loginForm.password" placeholder="密码" :prefix-icon="Key" <el-input v-model="loginForm.password" placeholder="密码" :prefix-icon="Key"
type="password" show-password></el-input> type="password" show-password></el-input>
</el-form-item> </el-form-item>
<el-alert v-if="showAlert" title="用户名或密码错误" type="error" show-icon @close="showAlert=false" <el-alert v-if="showAlert" :title="tip" type="error" show-icon @close="showAlert=false"
style="margin-bottom: 16px"></el-alert> style="margin-bottom: 16px"></el-alert>
<el-button style="width: 100%;" type="primary" native-type="submit" @click="onSubmit"></el-button> <el-button style="width: 100%;" type="primary" native-type="submit" @click="onSubmit"></el-button>
</el-form> </el-form>
@ -46,6 +46,9 @@ const loginForm = reactive({
username: '', username: '',
password: '' password: ''
}) })
const tip = ref("用户名或密码错误")
console.log(localStorage.getItem('token')) console.log(localStorage.getItem('token'))
const onSubmit = () => { const onSubmit = () => {
@ -59,10 +62,13 @@ const onSubmit = () => {
store.commit('setStaff', response.data.data) store.commit('setStaff', response.data.data)
router.push({path: '/'}) router.push({path: '/'})
} else { } else {
console.log(response.data) return Promise.reject(response)
showAlert.value = true
} }
}).catch(function (error) { }).catch(function (error) {
if(error.response.data.msg)
tip.value=error.response.data.msg
else
tip.value="登录失败,未知错误"
console.log('error:') console.log('error:')
console.log(error); console.log(error);
showAlert.value = true showAlert.value = true

View File

@ -28,7 +28,7 @@
:percentage="scope.row.totalNum===0?0:Math.round(scope.row.completeNum*100/scope.row.totalNum)"></el-progress> :percentage="scope.row.totalNum===0?0:Math.round(scope.row.completeNum*100/scope.row.totalNum)"></el-progress>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column min-width="10%" align="right"> <el-table-column prop="operation" min-width="10%" align="right">
<template #default="scope"> <template #default="scope">
<div style="height: 32px;"> <div style="height: 32px;">
<el-button v-show="showCloseProjectButton(scope.row)" type="primary" plain <el-button v-show="showCloseProjectButton(scope.row)" type="primary" plain
@ -191,6 +191,8 @@ export default {
return this.$store.state.staff===null? false:(this.$store.state.staff.staffId===row.projectCreator) return this.$store.state.staff===null? false:(this.$store.state.staff.staffId===row.projectCreator)
}, },
onRowClick(row, column, event) { onRowClick(row, column, event) {
if (column.property === "operation")
return
router.push({path: '/project/'+row.projectId}) router.push({path: '/project/'+row.projectId})
}, },
onCreateProject() { onCreateProject() {

View File

@ -62,6 +62,7 @@
<router-view <router-view
:projectAccessLevel="projectAccessLevel" :projectAccessLevel="projectAccessLevel"
:projectGroup="projectGroup" :projectGroup="projectGroup"
@groupChanged="groupChanged"
></router-view> ></router-view>
</el-main> </el-main>
</el-container> </el-container>
@ -152,6 +153,10 @@ export default {
console.log(error) console.log(error)
}) })
}, },
groupChanged() {
console.log('groupChanged')
this.getProjectGroup()
}
} }
} }
</script> </script>

View File

@ -2,7 +2,8 @@
<div ref="divRef" style="display: flex;margin: 0 30px 0 30px;height: 100%;justify-content: space-around;"> <div ref="divRef" style="display: flex;margin: 0 30px 0 30px;height: 100%;justify-content: space-around;">
<div ref="leftRef" style="width: 50%;height: 100%;padding: 0 30px 0 0;display: flex;flex-direction: column"> <div ref="leftRef" style="width: 50%;height: 100%;padding: 0 30px 0 0;display: flex;flex-direction: column">
<div style="margin: 0 10px 0 10px;display: flex;flex-direction: row;justify-content: space-between" ref="left_title_Ref"> <div style="margin: 0 10px 0 10px;display: flex;flex-direction: row;justify-content: space-between"
ref="left_title_Ref">
<p style="text-align:center; 'Segoe UI',sans-serif;font-size: 20px;font-weight: bold;color: #606266">项目团队</p> <p style="text-align:center; 'Segoe UI',sans-serif;font-size: 20px;font-weight: bold;color: #606266">项目团队</p>
<el-button type="primary" @click="onCreatePerson"></el-button> <el-button type="primary" @click="onCreatePerson"></el-button>
</div> </div>
@ -17,14 +18,20 @@
<el-table-column prop="projectStaffPosition" label="职位" min-width="40%" :formatter="jobFormatter"/> <el-table-column prop="projectStaffPosition" label="职位" min-width="40%" :formatter="jobFormatter"/>
<el-table-column align="right" min-width="35%"> <el-table-column align="right" min-width="35%">
<template #default="scope"> <template #default="scope">
<div style="width: 100%;display: flex;flex-direction: row;justify-content: flex-end"> <div v-if="getOperationsVisible(scope.row)"
style="width: 100%;display: flex;flex-direction: row;justify-content: flex-end">
<el-button <el-button
@click.native="onEditClick(scope.row)" @click.native="onEditClick(scope.row)"
type="primary" link>修改</el-button> type="primary" link>修改
</el-button>
<el-button <el-button
type="primary" link>交接</el-button> @click.native="onTransferClick(scope.row)"
type="primary" link>交接
</el-button>
<el-button <el-button
type="primary" link>离队</el-button> @click.native="onRemoveClick(scope.row)"
type="primary" link>离队
</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -70,20 +77,20 @@
</div> </div>
<CreatePersonDialog <CreatePersonDialog
v-model:dialogFormVisible="dialogFormVisible" v-model:dialogFormVisible="dialogFormVisible"
@createdPerson="rehushTableData" @createdPerson="refreshGroupTable"
@onCancel="dialogFormVisible = false" @onCancel="dialogFormVisible = false"/>
></CreatePersonDialog>
<EditJobDialog <EditJobDialog
v-model:dialogFormVisible="editJobDialogVisible" v-model:dialogFormVisible="editJobDialogVisible"
:staffId="editStaffId" :staffId="editStaffId"
:projectStaffPosition="editStaffPosition" :projectStaffPosition="editStaffPosition"
@edited="rehushTableData" @edited="refreshGroupTable"
@onCancel="editJobDialogVisible = false" @onCancel="editJobDialogVisible = false"/>
></EditJobDialog> <TransferDialog
<TransferDialog>
v-model:dialogVisible="transferDialogVisible" v-model:dialogVisible="transferDialogVisible"
:projectGroup="projectGroup" @onCancel="transferDialogVisible = false"
</TransferDialog> @transferred="refreshGroupTable"
:staffId="transferStaffId"
:projectGroup="projectGroup"/>
</template> </template>
<script setup> <script setup>
@ -105,16 +112,6 @@ onMounted(() => {
window.onresize = () => { window.onresize = () => {
tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 110; tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 110;
}; };
// innerHeight-offsetTop-110
// nextTick(()=>{
// tableHeight.value = leftRef.value.clientHeight - left_title_Ref.value.clientHeight - 26 - left_bottom_Ref.value.clientHeight
// });
// // tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 100;
// window.onresize = () => {
// tableHeight.value = leftRef.value.clientHeight - left_title_Ref.value.clientHeight - 26 - left_bottom_Ref.value.clientHeight
// // tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 100;
// // echartsHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 100;
// };
}); });
</script> </script>
@ -148,6 +145,7 @@ export default {
}; };
}, },
emits: ['groupChanged'],
props: { props: {
projectAccessLevel: Number, projectAccessLevel: Number,
projectGroup: Array projectGroup: Array
@ -159,6 +157,17 @@ export default {
EchartsPie EchartsPie
}, },
methods: { methods: {
getOperationsVisible(row) {
switch (this.projectAccessLevel) {
case 1:
return row.projectStaffPosition !== '项目经理'
case 2:
return row.projectStaffPosition !== '项目经理' && !row.projectStaffPosition.includes('项目主管')
default:
return false
}
},
getStationList() { getStationList() {
let projectId = this.$route.params.projectId; let projectId = this.$route.params.projectId;
request({ request({
@ -197,6 +206,23 @@ export default {
}) })
this.editJobDialogVisible = true 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) { handleSizeChange(val) {
this.pageSize = val; this.pageSize = val;
@ -208,9 +234,10 @@ export default {
}; };
this.getTableData(data); this.getTableData(data);
}, },
rehushTableData() { refreshGroupTable() {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.editJobDialogVisible = false this.editJobDialogVisible = false
this.transferDialogVisible = false
const data = { const data = {
pageCurrent: this.currentPage, pageCurrent: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
@ -219,6 +246,7 @@ export default {
}; };
this.getTableData(data); this.getTableData(data);
this.getStationList(); this.getStationList();
this.$emit('groupChanged')
}, },
getTableData(param) { getTableData(param) {
let projectId = this.$route.params.projectId; let projectId = this.$route.params.projectId;

View File

@ -462,7 +462,8 @@ export default {
taskClosedTime: row.taskClosedTime, taskClosedTime: row.taskClosedTime,
taskStartTime: new Date(row.taskStartTime * 1000), taskStartTime: new Date(row.taskStartTime * 1000),
taskEndTime: new Date(row.taskEndTime * 1000), taskEndTime: new Date(row.taskEndTime * 1000),
taskDescription: row.taskDescription taskDescription: row.taskDescription,
childrenCount: row.childrenCount
} }
if (row.attachedInfo) if (row.attachedInfo)
switch (this.form.taskType) { switch (this.form.taskType) {
@ -496,7 +497,8 @@ export default {
taskId: row.taskId, taskId: row.taskId,
taskStatus: row.taskStatus, taskStatus: row.taskStatus,
taskCreatedTime: row.taskCreatedTime, taskCreatedTime: row.taskCreatedTime,
taskClosedTime: row.taskClosedTime taskClosedTime: row.taskClosedTime,
childrenCount: row.childrenCount
} }
console.log(submitForm) console.log(submitForm)
const that = this const that = this
@ -530,20 +532,6 @@ export default {
else else
Promise.reject(response) Promise.reject(response)
}).catch(function (error) { }).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) { if (submitForm.taskFatherId === 0) {
that.getWorkitems() that.getWorkitems()
} else { } else {
@ -631,7 +619,7 @@ export default {
submitForm['taskStatus'] = this.form.taskStatus submitForm['taskStatus'] = this.form.taskStatus
submitForm['taskCreatedTime'] = this.form.taskCreatedTime submitForm['taskCreatedTime'] = this.form.taskCreatedTime
submitForm['taskClosedTime'] = this.form.taskClosedTime submitForm['taskClosedTime'] = this.form.taskClosedTime
submitForm['childrenCount'] = this.form.childrenCount
request({ request({
url: 'project/' + this.$route.params.projectId + '/task/' + this.form.taskId, url: 'project/' + this.$route.params.projectId + '/task/' + this.form.taskId,
method: 'put', method: 'put',
@ -679,7 +667,8 @@ export default {
taskClosedTime: row.taskClosedTime, taskClosedTime: row.taskClosedTime,
taskStartTime: new Date(row.taskStartTime * 1000), taskStartTime: new Date(row.taskStartTime * 1000),
taskEndTime: new Date(row.taskEndTime * 1000), taskEndTime: new Date(row.taskEndTime * 1000),
taskDescription: row.taskDescription taskDescription: row.taskDescription,
childrenCount: row.childrenCount
} }
if (row.attachedInfo) if (row.attachedInfo)
switch (this.form.taskType) { switch (this.form.taskType) {
@ -701,6 +690,7 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
onAddClick(row, taskType) { onAddClick(row, taskType) {
console.log(this.projectGroup)
this.form = { this.form = {
row: row, row: row,
operation: 'add', operation: 'add',