完成离队、交接功能

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: {
dialogFormVisible: Boolean,
},

View File

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

View File

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

View File

@ -5,10 +5,10 @@
width="500px"
>
<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
v-for="member in projectGroup"
:key="member.staffId"
@ -24,10 +24,18 @@
</el-select>
</el-form-item>
</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>
</template>
<script>
import request from "../utils/request";
export default {
name: "TransferDialog",
props: {
@ -35,6 +43,29 @@ export default {
staffId: Number,
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>

View File

@ -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;

View File

@ -22,12 +22,17 @@ request.interceptors.request.use(
request.interceptors.response.use(
function (response) {
// 2xx 范围内的状态码都会触发该函数。
if(response.data.code === 200)
{
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
}
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)
});

View File

@ -18,7 +18,7 @@
<el-input v-model="loginForm.password" placeholder="密码" :prefix-icon="Key"
type="password" show-password></el-input>
</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>
<el-button style="width: 100%;" type="primary" native-type="submit" @click="onSubmit"></el-button>
</el-form>
@ -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

View File

@ -28,7 +28,7 @@
:percentage="scope.row.totalNum===0?0:Math.round(scope.row.completeNum*100/scope.row.totalNum)"></el-progress>
</template>
</el-table-column>
<el-table-column min-width="10%" align="right">
<el-table-column prop="operation" min-width="10%" align="right">
<template #default="scope">
<div style="height: 32px;">
<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)
},
onRowClick(row, column, event) {
if (column.property === "operation")
return
router.push({path: '/project/'+row.projectId})
},
onCreateProject() {

View File

@ -62,6 +62,7 @@
<router-view
:projectAccessLevel="projectAccessLevel"
:projectGroup="projectGroup"
@groupChanged="groupChanged"
></router-view>
</el-main>
</el-container>
@ -152,6 +153,10 @@ export default {
console.log(error)
})
},
groupChanged() {
console.log('groupChanged')
this.getProjectGroup()
}
}
}
</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="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>
<el-button type="primary" @click="onCreatePerson"></el-button>
</div>
@ -17,14 +18,20 @@
<el-table-column prop="projectStaffPosition" label="职位" min-width="40%" :formatter="jobFormatter"/>
<el-table-column align="right" min-width="35%">
<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
@click.native="onEditClick(scope.row)"
type="primary" link>修改</el-button>
type="primary" link>修改
</el-button>
<el-button
type="primary" link>交接</el-button>
@click.native="onTransferClick(scope.row)"
type="primary" link>交接
</el-button>
<el-button
type="primary" link>离队</el-button>
@click.native="onRemoveClick(scope.row)"
type="primary" link>离队
</el-button>
</div>
</template>
</el-table-column>
@ -70,20 +77,20 @@
</div>
<CreatePersonDialog
v-model:dialogFormVisible="dialogFormVisible"
@createdPerson="rehushTableData"
@onCancel="dialogFormVisible = false"
></CreatePersonDialog>
@createdPerson="refreshGroupTable"
@onCancel="dialogFormVisible = false"/>
<EditJobDialog
v-model:dialogFormVisible="editJobDialogVisible"
:staffId="editStaffId"
:projectStaffPosition="editStaffPosition"
@edited="rehushTableData"
@onCancel="editJobDialogVisible = false"
></EditJobDialog>
<TransferDialog>
@edited="refreshGroupTable"
@onCancel="editJobDialogVisible = false"/>
<TransferDialog
v-model:dialogVisible="transferDialogVisible"
:projectGroup="projectGroup"
</TransferDialog>
@onCancel="transferDialogVisible = false"
@transferred="refreshGroupTable"
:staffId="transferStaffId"
:projectGroup="projectGroup"/>
</template>
<script setup>
@ -105,16 +112,6 @@ onMounted(() => {
window.onresize = () => {
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>
@ -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() {

View File

@ -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',