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

Issue 504 505 n1 #587

Merged
merged 3 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
233 changes: 153 additions & 80 deletions client/src/components/SchemaView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ import finstanceModal from '@/api/finstance'
// import dataQuerymodel from '@/api/dataquery'
import saveemailTemplate from '@/api/emailtemplate'
import schemalist from '@/pages/user/SchemaList'
import config from '@/config'
const io = require('socket.io-client')
const socket = io(config.socketURI)
// import config from '@/config'
// const io = require('socket.io-client')
// const socket = io(config.socketURI)

export default {
name: 'SchemaView',
Expand Down Expand Up @@ -1373,85 +1373,77 @@ export default {
this.jumperLinks = objectArr
}
},
beforeDestroy () {
for (let item of socket.subs) {
item.destroy()
}
},
mounted () {
for (let item of socket.subs) {
item.destroy()
}
this.init()
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
console.log(data._currentStatus && data._state, this.$route.params.stateid)
if (data._currentStatus && data._state === this.$route.params.stateid) {
if (this.instanceEntries.length < this.entriesTotal) {
this.instanceEntries.push(data)
this.dataData = this.instanceEntries
} else {
console.log('..........')
this.dataTotal++
}
} else {
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data._previous })
this.instanceEntries.splice(inx, 1)
}
})
}
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
if (this.$store.state.role === 1) {
if (data._currentStatus && data._state === this.$route.params.stateid) {
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
this.instanceEntries.splice(inx, 1)
this.instanceEntries.push(data)
this.dataData = this.instanceEntries
}
}
console.log(this.$store.state.role === 2, data)
if (this.$store.state.role === 2 && data !== undefined) {
console.log('dataClaim', this.dataClaim)
console.log('dataClaim', data)
console.log('dataUnclaim', this.dataUnclaim)
if (data._claimUser === '') {
let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id })
this.dataUnclaim.splice(inx, 1)
this.dataClaim.push(data)
console.log(inx)
} else {
let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id })
this.dataClaim.splice(inx, 1)
this.dataUnclaim.push(data)
console.log(inx)
}
}
let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
if (finx !== -1 && !data._currentStatus && data._next === null) {
if (this.flowzList[finx].processList[data._state].count > 0) {
this.flowzList[finx].processList[data._state].count--
}
if (this.flowzList[finx].count > 0) {
this.flowzList[finx].count--
}
}
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
// this.instanceEntries.splice(inx, 1)
// this.dataData = this.instanceEntries
})
}
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
if (data._currentStatus) {
let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
if (finx !== -1) {
this.flowzList[finx].processList[data._state].count--
this.flowzList[finx].count--
}
}
})
}
// if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
// socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
// console.log(data._currentStatus && data._state, this.$route.params.stateid)
// if (data._currentStatus && data._state === this.$route.params.stateid) {
// if (this.instanceEntries.length < this.entriesTotal) {
// this.instanceEntries.push(data)
// this.dataData = this.instanceEntries
// } else {
// console.log('..........')
// this.dataTotal++
// }
// } else {
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data._previous })
// this.instanceEntries.splice(inx, 1)
// }
// })
// }
// if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
// socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
// if (this.$store.state.role === 1) {
// if (data._currentStatus && data._state === this.$route.params.stateid) {
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
// this.instanceEntries.splice(inx, 1)
// this.instanceEntries.push(data)
// this.dataData = this.instanceEntries
// }
// }
// console.log(this.$store.state.role === 2, data)
// if (this.$store.state.role === 2 && data !== undefined) {
// console.log('dataClaim', this.dataClaim)
// console.log('dataClaim', data)
// console.log('dataUnclaim', this.dataUnclaim)
// if (data._claimUser === '') {
// let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id })
// this.dataUnclaim.splice(inx, 1)
// this.dataClaim.push(data)
// console.log(inx)
// } else {
// let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id })
// this.dataClaim.splice(inx, 1)
// this.dataUnclaim.push(data)
// console.log(inx)
// }
// }
// let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
// if (finx !== -1 && !data._currentStatus && data._next === null) {
// if (this.flowzList[finx].processList[data._state].count > 0) {
// this.flowzList[finx].processList[data._state].count--
// }
// if (this.flowzList[finx].count > 0) {
// this.flowzList[finx].count--
// }
// }
// // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
// // this.instanceEntries.splice(inx, 1)
// // this.dataData = this.instanceEntries
// })
// }
// if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
// socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
// if (data._currentStatus) {
// let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
// if (finx !== -1) {
// this.flowzList[finx].processList[data._state].count--
// this.flowzList[finx].count--
// }
// }
// })
// }
},
computed: {
dataCount () {
Expand Down Expand Up @@ -1541,6 +1533,87 @@ export default {
},
removed (data) {
}
},
'dflowzdata': {
_created (data) {
// console.log('================created==============', data)
let keys = Object.keys(data)
for (let tName of keys) {
if (tName === this.$route.params.id.replace(/-/g, '_')) {
if (data[tName]._currentStatus && data[tName]._state === this.$route.params.stateid) {
if (this.instanceEntries.length < this.entriesTotal) {
this.instanceEntries.push(data[tName])
this.dataData = this.instanceEntries
} else {
this.dataTotal++
}
} else {
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data[tName]._previous })
this.instanceEntries.splice(inx, 1)
}
}
}
},
_updated (data) {
},
_patched (data) {
// console.log('==============patched============', data)
let keys = Object.keys(data)
for (let tName of keys) {
if (data[tName]._currentStatus) {
if (this.$store.state.role === 1) {
if (data[tName]._currentStatus && data[tName]._state === this.$route.params.stateid) {
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data[tName].id })
this.instanceEntries.splice(inx, 1)
this.instanceEntries.push(data[tName])
this.dataData = this.instanceEntries
}
}
// console.log(this.$store.state.role === 2, data)
if (this.$store.state.role === 2 && data[tName] !== undefined) {
// console.log('dataClaim', this.dataClaim)
// console.log('dataClaim', data[tName])
// console.log('dataUnclaim', this.dataUnclaim)
if (data[tName]._claimUser === '') {
let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data[tName].id })
this.dataUnclaim.splice(inx, 1)
this.dataClaim.push(data[tName])
// console.log(inx)
} else {
let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data[tName].id })
this.dataClaim.splice(inx, 1)
this.dataUnclaim.push(data[tName])
// console.log(inx)
}
}
let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
if (finx !== -1 && !data[tName]._currentStatus && data[tName]._next === null) {
if (this.flowzList[finx].processList[data[tName]._state].count > 0) {
this.flowzList[finx].processList[data[tName]._state].count--
}
if (this.flowzList[finx].count > 0) {
this.flowzList[finx].count--
}
}
}
}
},
_removed (data) {
// let keys = Object.keys(data)
// for (let tName of keys) {
// if (data[tName]._currentStatus) {
// let finx = _.findIndex(this.flowzList, {id: tName.replace(/_/g, '-')})
// if (finx !== -1) {
// if (this.flowzList[finx].processList[data[tName]._state].count > 0) {
// this.flowzList[finx].processList[data[tName]._state].count--
// }
// if (this.flowzList[finx].count > 0) {
// this.flowzList[finx].count--
// }
// }
// }
// }
}
}
}
}
Expand Down
Loading