完成我的工作项

main
wuyize 2022-07-12 15:45:15 +08:00
parent 55e0fdf078
commit d58f84d236
5 changed files with 54 additions and 71 deletions

View File

@ -108,6 +108,8 @@ export default {
this.$emit("onCancel");
},
handleInputConfirm() {
this.inputValue = this.inputValue.trim()
this.inputValue.trim()
let inputValue = this.inputValue;
if (inputValue) {
const isCF = !!this.dynamicTags.find((item) => {

View File

@ -86,6 +86,7 @@ export default {
this.$emit("onCancel");
},
handleInputConfirm() {
this.inputValue = this.inputValue.trim()
let inputValue = this.inputValue;
if (inputValue) {
const isCF = !!this.dynamicTags.find((item) => {

View File

@ -109,7 +109,7 @@ export default {
method: 'get',
}).then(response => {
if (response.data.code === 200) {
that.projectStaffPosition = response.data.data.projectStaffPosition.replace(',','')
that.projectStaffPosition = response.data.data.projectStaffPosition.replaceAll(',','')
that.projectAccessLevel = response.data.data.projectAccessLevel
}
}).catch(function (error) {

View File

@ -285,7 +285,7 @@ export default {
this.getTableData(data);
},
jobFormatter(row, column) {
return row[column.property].replace(',', '');
return row[column.property].replaceAll(',', '');
},
},
mounted() {

View File

@ -6,7 +6,7 @@
<!-- <p style="font-family: 'Segoe UI',sans-serif;font-size: 20px;font-weight: bold;color: #606266">工作项</p>-->
<el-dropdown @command="handleCommand">
<span style="font-family: 'Segoe UI',sans-serif;font-size: 20px;font-weight: bold;color: #606266">
工作项
{{ mine ? '我的工作项' : '工作项' }}
<el-icon class="el-icon--right">
<arrow-down/>
</el-icon>
@ -25,7 +25,7 @@
>
<div style="display: flex;flex-direction: column">
<el-button
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0}, '需求')">
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0, isRoot: true}, '需求')">
<div style="width: 24px;display: flex;justify-content: center">
<svg-icon style="width: 24px;height: 24px;"
icon-class="demand"></svg-icon>
@ -33,7 +33,7 @@
<span style="margin-left: 5px">需求</span>
</el-button>
<el-button
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0}, '任务')">
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0, isRoot: true}, '任务')">
<div style="width: 24px;display: flex;justify-content: center">
<svg-icon style="width: 20px;height: 20px;"
icon-class="assignment"></svg-icon>
@ -41,7 +41,7 @@
<span style="margin-left: 5px">任务</span>
</el-button>
<el-button
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0}, '缺陷')">
style="padding: 4px;margin-left: 5px" text @click.native="onAddClick({taskId: 0, isRoot: true}, '缺陷')">
<div style="width: 24px;display: flex;justify-content: center">
<svg-icon style="width: 20px;height: 20px;"
icon-class="defect"></svg-icon>
@ -52,7 +52,7 @@
<template #reference>
<el-button :style="{'visibility': ( projectAccessLevel < 3)?'unset':'hidden'}" type="primary">新增工作项
<el-button :style="{'visibility': ( projectAccessLevel < 3&&!mine)?'unset':'hidden'}" type="primary">新增工作项
</el-button>
</template>
</el-popover>
@ -111,7 +111,8 @@
<el-table-column prop="operations" min-width="10%">
<template #default="scope">
<div style="width: 100%;display: flex;justify-content: flex-end">
<el-button v-show="scope.row.taskStatus!=='已完成'&&scope.row.taskStatus!=='关闭'&&scope.row.editable" style="padding: 4px" text @click.native="onEditClick(scope.row)">
<el-button v-show="scope.row.taskStatus!==''&&scope.row.taskStatus!==''&&scope.row.editable"
style="padding: 4px" text @click.native="onEditClick(scope.row)">
<svg-icon style="width: 20px;height: 20px;" icon-class="edit"></svg-icon>
</el-button>
@ -389,47 +390,23 @@ export default {
},
watch: {
projectAccessLevel: function (val) {
this.getWorkitems() //
this.getWorkitems(this.mine) //
},
projectGroup: function (val) {
},
mine: function (val) {
if(val)
{
const that = this;
request({
url: 'project/' + this.$route.params.projectId + '/task/mine',
method: 'get',
}).then(response => {
if (response.data.code === 200) {
//console.log(response.data.records)
that.workitems = response.data.data.records
for (let workitem of that.workitems) {
workitem['editable'] = that.projectAccessLevel < 3
//console.log(workitem)
}
//console.log(that.workitems)
}
}).catch(function (error) {
console.log(error)
})
}
else
{
this.getWorkitems()
}
this.getWorkitems(val)
}
},
created() {
if (this.projectAccessLevel)
this.getWorkitems()
this.getWorkitems(this.mine)
},
methods: {
handleCommand(command) {
switch (command)
{
switch (command) {
case 'mine':
this.mine = true;
break;
@ -448,6 +425,7 @@ export default {
if (column.property === "operations")
return
this.form = {
isRoot: row.isRoot,
disabled: row.taskStatus === '已完成' || row.taskStatus === '关闭' || !row.editable,
statusDisabled: this.statusDisabled(row),
title: '修改' + row.taskType,
@ -509,8 +487,8 @@ export default {
}).then(response => {
console.log(response)
if (response.data.code === 200) {
if (submitForm.taskFatherId === 0) {
that.getWorkitems()
if (row.isRoot) {
that.getWorkitems(that.mine)
} else {
let rtr = that.maps.get(submitForm.taskFatherId);
if (rtr) {
@ -528,12 +506,11 @@ export default {
type: 'success',
})
that.dialogVisible = false
}
else
} else
Promise.reject(response)
}).catch(function (error) {
if (submitForm.taskFatherId === 0) {
that.getWorkitems()
if (row.isRoot) {
that.getWorkitems(that.mine)
} else {
let rtr = that.maps.get(submitForm.taskFatherId);
if (rtr) {
@ -544,15 +521,13 @@ export default {
})
},
onSubmit() {
if( !this.$refs['formRef'])
{
if (!this.$refs['formRef']) {
console.log('formRef error')
return
}
this.$refs['formRef'].validate((valid) => {
console.log(valid)
if(valid)
{
if (valid) {
let submitForm = {
taskType: this.form.taskType,
taskFatherId: this.form.taskFatherId,
@ -591,9 +566,9 @@ export default {
}).then(response => {
//console.log(response)
if (response.data.code === 200) {
if (submitForm.taskFatherId === 0) {
that.getWorkitems()
} else {
if (this.form.isRoot) {
that.getWorkitems(that.mine)
}
this.form.row.hasChildren = true
let rtr = that.maps.get(submitForm.taskFatherId);
console.log(rtr)
@ -601,7 +576,7 @@ export default {
rtr.row.hasChildren = true
rtr.treeNode.loading = true
that.loadChildren(rtr.row, rtr.treeNode, rtr.resolve)
}
}
ElMessage({
@ -627,8 +602,8 @@ export default {
}).then(response => {
console.log(response)
if (response.data.code === 200) {
if (submitForm.taskFatherId === 0) {
that.getWorkitems()
if (this.form.isRoot) {
that.getWorkitems(that.mine)
} else {
let rtr = that.maps.get(submitForm.taskFatherId);
if (rtr) {
@ -655,6 +630,7 @@ export default {
},
onEditClick(row) {
this.form = {
isRoot: row.isRoot,
title: '修改' + row.taskType,
taskId: row.taskId,
taskType: row.taskType,
@ -692,6 +668,7 @@ export default {
onAddClick(row, taskType) {
console.log(this.projectGroup)
this.form = {
isRoot: row.isRoot,
row: row,
operation: 'add',
title: '新增' + taskType,
@ -708,8 +685,8 @@ export default {
}).then(response => {
console.log(response)
if (response.data.code === 200) {
if (row.taskFatherId === 0) {
that.getWorkitems()
if (row.isRoot) {
that.getWorkitems(that.mine)
} else {
//console.log(that.$refs.tableRef.store.states.lazyTreeNodeMap)
if (that.$refs.tableRef.store.states.lazyTreeNodeMap.value[row.taskFatherId].length === 1) {
@ -734,10 +711,10 @@ export default {
})
},
getWorkitems() {
getWorkitems(isMine) {
const that = this;
request({
url: 'project/' + this.$route.params.projectId + '/task/0/subtask',
url: 'project/' + this.$route.params.projectId + '/task' + (isMine ? '/mine' : '/0/subtask'),
method: 'get',
}).then(response => {
if (response.data.code === 200) {
@ -746,6 +723,7 @@ export default {
for (let workitem of that.workitems) {
workitem['editable'] = that.projectAccessLevel < 3
workitem['hasChildren'] = workitem.childrenCount !== 0
workitem['isRoot'] = true
//console.log(workitem)
}
//console.log(that.workitems)
@ -771,6 +749,7 @@ export default {
for (let workitem of records) {
workitem['editable'] = editable
workitem['hasChildren'] = workitem.childrenCount !== 0
workitem['isRoot'] = false
//console.log(workitem)
}
resolve(records)
@ -794,11 +773,12 @@ export default {
const editable = row.editable || row.taskHolderId === this.$store.state.staff.staffId
for (let workitem of records) {
workitem['editable'] = editable
workitem['hasChildren'] = workitem.childrenCount !== 0
workitem['isRoot'] = false
//console.log(workitem)
}
resolve(records)
for(let workitem of records)
{
for (let workitem of records) {
let rtr = that.maps.get(workitem.taskId);
if (rtr) {
rtr.treeNode.loading = true