Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit c9b391d

Browse files
authored
Merge pull request #586 from FlowzPlatform/ClaimAndUnclaimByUser-new-develop
Claim un claim table issue resolve
2 parents 72a34c2 + 0652811 commit c9b391d

File tree

3 files changed

+56
-28
lines changed

3 files changed

+56
-28
lines changed

client/src/components/SchemaView.vue

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,6 @@ export default {
12671267
} else {
12681268
this.instanceEntries = []
12691269
this.dataUnclaim = []
1270-
this.dataClaim = []
12711270
this.dataLoading = false
12721271
this.$Loading.finish()
12731272
}
@@ -1298,7 +1297,6 @@ export default {
12981297
} else {
12991298
this.instanceEntries = []
13001299
this.dataClaim = []
1301-
this.dataUnclaim = []
13021300
this.dataLoading = false
13031301
this.$Loading.finish()
13041302
}
@@ -1375,7 +1373,15 @@ export default {
13751373
this.jumperLinks = objectArr
13761374
}
13771375
},
1376+
beforeDestroy () {
1377+
for (let item of socket.subs) {
1378+
item.destroy()
1379+
}
1380+
},
13781381
mounted () {
1382+
for (let item of socket.subs) {
1383+
item.destroy()
1384+
}
13791385
this.init()
13801386
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
13811387
socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
@@ -1396,21 +1402,40 @@ export default {
13961402
}
13971403
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
13981404
socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
1399-
if (data._currentStatus && data._state === this.$route.params.stateid) {
1400-
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1401-
this.instanceEntries.splice(inx, 1)
1402-
this.instanceEntries.push(data)
1403-
this.dataData = this.instanceEntries
1405+
if (this.$store.state.role === 1) {
1406+
if (data._currentStatus && data._state === this.$route.params.stateid) {
1407+
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1408+
this.instanceEntries.splice(inx, 1)
1409+
this.instanceEntries.push(data)
1410+
this.dataData = this.instanceEntries
1411+
}
1412+
}
1413+
console.log(this.$store.state.role === 2, data)
1414+
if (this.$store.state.role === 2 && data !== undefined) {
1415+
console.log('dataClaim', this.dataClaim)
1416+
console.log('dataClaim', data)
1417+
console.log('dataUnclaim', this.dataUnclaim)
1418+
if (data._claimUser === '') {
1419+
let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id })
1420+
this.dataUnclaim.splice(inx, 1)
1421+
this.dataClaim.push(data)
1422+
console.log(inx)
1423+
} else {
1424+
let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id })
1425+
this.dataClaim.splice(inx, 1)
1426+
this.dataUnclaim.push(data)
1427+
console.log(inx)
1428+
}
1429+
}
1430+
let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1431+
if (finx !== -1 && !data._currentStatus && data._next === null) {
1432+
if (this.flowzList[finx].processList[data._state].count > 0) {
1433+
this.flowzList[finx].processList[data._state].count--
1434+
}
1435+
if (this.flowzList[finx].count > 0) {
1436+
this.flowzList[finx].count--
1437+
}
14041438
}
1405-
// let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1406-
// if (finx !== -1 && !data._currentStatus && data._next === null) {
1407-
// if (this.flowzList[finx].processList[data._state].count > 0) {
1408-
// this.flowzList[finx].processList[data._state].count--
1409-
// }
1410-
// if (this.flowzList[finx].count > 0) {
1411-
// this.flowzList[finx].count--
1412-
// }
1413-
// }
14141439
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
14151440
// this.instanceEntries.splice(inx, 1)
14161441
// this.dataData = this.instanceEntries

client/src/pages/user/SchemaList.vue

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,12 @@
427427
on: {
428428
'click': async () => {
429429
let fheaders = {
430-
// workflowid: 'workflow_' + this.$route.params.id,
430+
workflowid: 'workflow_' + this.$route.params.id,
431431
normalpatch: true,
432-
ftablename: this.currentFlowzId
432+
ftablename: this.currentFlowzId,
433+
stateid: this.$route.params.stateid
433434
}
434-
dflowzdata.patch(params.row.id, {_claimUser: '', _state: this.$route.params.stateid}, null, fheaders)
435+
dflowzdata.patch(params.row.id, {_claimUser: ''}, null, fheaders)
435436
.then((res) => {
436437
this.$Notice.success({title: 'Successfully Unclaim'})
437438
})
@@ -576,11 +577,12 @@
576577
on: {
577578
'click': async () => {
578579
let fheaders = {
579-
// workflowid: 'workflow_' + this.$route.params.id,
580+
workflowid: 'workflow_' + this.$route.params.id,
580581
normalpatch: true,
581-
ftablename: this.currentFlowzId
582+
ftablename: this.currentFlowzId,
583+
stateid: this.$route.params.stateid
582584
}
583-
dflowzdata.patch(params.row.id, {_claimUser: this.$store.state.user._id, _state: this.$route.params.stateid}, null, fheaders)
585+
dflowzdata.patch(params.row.id, {_claimUser: this.$store.state.user._id}, null, fheaders)
584586
.then((res) => {
585587
this.$Notice.success({title: 'Successfully Claim'})
586588
})
@@ -742,14 +744,15 @@
742744
} else {
743745
for (let i = 0; i < this.selectedRows.length; i++) {
744746
let fheaders = {
745-
// workflowid: 'workflow_' + this.$route.params.id,
747+
workflowid: 'workflow_' + this.$route.params.id,
746748
normalpatch: true,
747-
ftablename: this.currentFlowzId
749+
ftablename: this.currentFlowzId,
750+
stateid: this.$route.params.stateid
748751
}
749752
if (this.selectedAssignUser !== 'noValue') {
750-
dflowzdata.patch(this.selectedRows[i].id, {_claimUser: '', _state: this.$route.params.stateid}, null, fheaders)
753+
dflowzdata.patch(this.selectedRows[i].id, {_claimUser: this.selectedAssignUser, _state: this.$route.params.stateid}, null, fheaders)
751754
.then((res) => {
752-
this.$Notice.success({title: 'Successfully Assign'})
755+
this.$Notice.success({title: 'Successfully Un-Assign'})
753756
})
754757
.catch((err) => {
755758
if (err.response) {
@@ -759,7 +762,7 @@
759762
}
760763
})
761764
} else {
762-
dflowzdata.patch(this.selectedRows[i].id, {_claimUser: this.selectedAssignUser, _state: this.$route.params.stateid}, null, fheaders)
765+
dflowzdata.patch(this.selectedRows[i].id, {_claimUser: '', _state: this.$route.params.stateid}, null, fheaders)
763766
.then((res) => {
764767
this.$Notice.success({title: 'Successfully Assign'})
765768
})

service/src/services/dflowzdata/dflowzdata.hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function beforeCreate (hook) {
8989
}
9090
hook.data._createdAt = new Date().toISOString()
9191
// hook.data._userId = ''
92-
// hook.data._claimUser = ''
92+
hook.data._claimUser = ''
9393
if (hook.data._state === res.first) {
9494
if (hook.data._nextTarget === undefined || hook.data._nextTarget === '') {
9595
hook.data._nextTarget = res.processList[hook.data._state].target[0].id

0 commit comments

Comments
 (0)