@@ -225,6 +225,9 @@ import finstanceModal from '@/api/finstance'
225
225
// import dataQuerymodel from '@/api/dataquery'
226
226
import saveemailTemplate from ' @/api/emailtemplate'
227
227
import schemalist from ' @/pages/user/SchemaList'
228
+ import config from ' @/config'
229
+ const io = require (' socket.io-client' )
230
+ const socket = io (config .socketURI )
228
231
229
232
export default {
230
233
name: ' SchemaView' ,
@@ -1198,6 +1201,7 @@ export default {
1198
1201
' _state' : this .$route .params .stateid
1199
1202
}, heads)
1200
1203
.then (res => {
1204
+ console .log (' res.data.total' , res .data .total )
1201
1205
this .isFlowzLoaded = true
1202
1206
this .dataTotal = res .data .total
1203
1207
if (res .data .data .length > 0 ) {
@@ -1285,6 +1289,54 @@ export default {
1285
1289
},
1286
1290
mounted () {
1287
1291
this .init ()
1292
+ if (socket ._callbacks [' $' + this .$route .params .id .replace (/ -/ g , ' _' ) + ' _created' ] === undefined ) {
1293
+ socket .on (this .$route .params .id .replace (/ -/ g , ' _' ) + ' _created' , (data ) => {
1294
+ console .log (' ===created==' , data)
1295
+ if (data ._currentStatus && data ._state === this .$store .state .stateid ) {
1296
+ if (this .instanceEntries .length < this .entriesTotal ) {
1297
+ this .instanceEntries .push (data)
1298
+ this .dataData = this .instanceEntries
1299
+ } else {
1300
+ console .log (' ..........' )
1301
+ this .dataTotal ++
1302
+ }
1303
+ }
1304
+ })
1305
+ }
1306
+ if (socket ._callbacks [' $' + this .$route .params .id .replace (/ -/ g , ' _' ) + ' _patched' ] === undefined ) {
1307
+ socket .on (this .$route .params .id .replace (/ -/ g , ' _' ) + ' _patched' , (data ) => {
1308
+ console .log (' ===patched==' , data)
1309
+ if (! data ._currentStatus && data ._state === this .$store .state .stateid ) {
1310
+ let inx = _ .findIndex (this .instanceEntries , (o ) => { return o .id === data .id })
1311
+ this .instanceEntries .splice (inx, 1 )
1312
+ this .dataData = this .instanceEntries
1313
+ }
1314
+ // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1315
+ // if (finx !== -1 && !data._currentStatus && data._next === null) {
1316
+ // if (this.flowzList[finx].processList[data._state].count > 0) {
1317
+ // this.flowzList[finx].processList[data._state].count--
1318
+ // }
1319
+ // if (this.flowzList[finx].count > 0) {
1320
+ // this.flowzList[finx].count--
1321
+ // }
1322
+ // }
1323
+ // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1324
+ // this.instanceEntries.splice(inx, 1)
1325
+ // this.dataData = this.instanceEntries
1326
+ })
1327
+ }
1328
+ // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
1329
+ // socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
1330
+ // console.log('===removed==', data)
1331
+ // // if (data._currentStatus) {
1332
+ // // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1333
+ // // if (finx !== -1) {
1334
+ // // this.flowzList[finx].processList[data._state].count--
1335
+ // // this.flowzList[finx].count--
1336
+ // // }
1337
+ // // }
1338
+ // })
1339
+ // }
1288
1340
},
1289
1341
computed: {
1290
1342
dataCount () {
0 commit comments