diff --git a/client/src/components/SchemaView.vue b/client/src/components/SchemaView.vue index e266df1..c5c4d90 100644 --- a/client/src/components/SchemaView.vue +++ b/client/src/components/SchemaView.vue @@ -225,6 +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) export default { name: 'SchemaView', @@ -1198,6 +1201,7 @@ export default { '_state': this.$route.params.stateid }, heads) .then(res => { + console.log('res.data.total', res.data.total) this.isFlowzLoaded = true this.dataTotal = res.data.total if (res.data.data.length > 0) { @@ -1285,6 +1289,54 @@ export default { }, mounted () { 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('===created==', data) + if (data._currentStatus && data._state === this.$store.state.stateid) { + if (this.instanceEntries.length < this.entriesTotal) { + this.instanceEntries.push(data) + this.dataData = this.instanceEntries + } else { + console.log('..........') + this.dataTotal++ + } + } + }) + } + if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) { + socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => { + console.log('===patched==', data) + if (!data._currentStatus && data._state === this.$store.state.stateid) { + let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id }) + this.instanceEntries.splice(inx, 1) + this.dataData = this.instanceEntries + } + // 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) => { + // console.log('===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 () { diff --git a/client/src/pages/user/SchemaList.vue b/client/src/pages/user/SchemaList.vue index 404478a..24352f5 100644 --- a/client/src/pages/user/SchemaList.vue +++ b/client/src/pages/user/SchemaList.vue @@ -291,7 +291,7 @@ }) cols.push({ title: 'ID', - key: 'id', + key: '_uuid', fixed: 'left', width: 260, render: (h, params) => { @@ -304,13 +304,13 @@ click: () => { var $temp = $('') $('body').append($temp) - $temp.val(params.row.id).select() + $temp.val(params.row._uuid).select() document.execCommand('copy') this.$Message.info('Copied to Clipboard') $temp.remove() } } - }, params.row.id) + }, params.row._uuid) } }) } diff --git a/service/src/services/dflowzdata/dflowzdata.hooks.js b/service/src/services/dflowzdata/dflowzdata.hooks.js index 37e4d5f..534e12d 100644 --- a/service/src/services/dflowzdata/dflowzdata.hooks.js +++ b/service/src/services/dflowzdata/dflowzdata.hooks.js @@ -83,6 +83,10 @@ function beforeCreate (hook) { let tName = hook.params.headers.ftablename.replace(regex, '-') return hook.app.service('flowz').get(tName).then(res => { hook.data._currentStatus = true + if (res.processList[hook.data._state].type === 'endevent') { + console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') + hook.data._currentStatus = false + } hook.data._createdAt = new Date().toISOString() // hook.data._userId = '' // hook.data._claimUser = ''