完成我的工作项

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"); this.$emit("onCancel");
}, },
handleInputConfirm() { handleInputConfirm() {
this.inputValue = this.inputValue.trim()
this.inputValue.trim()
let inputValue = this.inputValue; let inputValue = this.inputValue;
if (inputValue) { if (inputValue) {
const isCF = !!this.dynamicTags.find((item) => { const isCF = !!this.dynamicTags.find((item) => {

View File

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

View File

@ -109,7 +109,7 @@ export default {
method: 'get', method: 'get',
}).then(response => { }).then(response => {
if (response.data.code === 200) { 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 that.projectAccessLevel = response.data.data.projectAccessLevel
} }
}).catch(function (error) { }).catch(function (error) {

View File

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

View File

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