@@ -225,9 +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
+ // import config from '@/config'
229
+ // const io = require('socket.io-client')
230
+ // const socket = io(config.socketURI)
231
231
232
232
export default {
233
233
name: ' SchemaView' ,
@@ -1373,85 +1373,77 @@ export default {
1373
1373
this .jumperLinks = objectArr
1374
1374
}
1375
1375
},
1376
- beforeDestroy () {
1377
- for (let item of socket .subs ) {
1378
- item .destroy ()
1379
- }
1380
- },
1381
1376
mounted () {
1382
- for (let item of socket .subs ) {
1383
- item .destroy ()
1384
- }
1385
1377
this .init ()
1386
- if (socket ._callbacks [' $' + this .$route .params .id .replace (/ -/ g , ' _' ) + ' _created' ] === undefined ) {
1387
- socket .on (this .$route .params .id .replace (/ -/ g , ' _' ) + ' _created' , (data ) => {
1388
- console .log (data ._currentStatus && data ._state , this .$route .params .stateid )
1389
- if (data ._currentStatus && data ._state === this .$route .params .stateid ) {
1390
- if (this .instanceEntries .length < this .entriesTotal ) {
1391
- this .instanceEntries .push (data)
1392
- this .dataData = this .instanceEntries
1393
- } else {
1394
- console .log (' ..........' )
1395
- this .dataTotal ++
1396
- }
1397
- } else {
1398
- let inx = _ .findIndex (this .instanceEntries , (o ) => { return o .id === data ._previous })
1399
- this .instanceEntries .splice (inx, 1 )
1400
- }
1401
- })
1402
- }
1403
- if (socket ._callbacks [' $' + this .$route .params .id .replace (/ -/ g , ' _' ) + ' _patched' ] === undefined ) {
1404
- socket .on (this .$route .params .id .replace (/ -/ g , ' _' ) + ' _patched' , (data ) => {
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
- }
1438
- }
1439
- // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1440
- // this.instanceEntries.splice(inx, 1)
1441
- // this.dataData = this.instanceEntries
1442
- })
1443
- }
1444
- if (socket ._callbacks [' $' + this .$route .params .id .replace (/ -/ g , ' _' ) + ' _removed' ] === undefined ) {
1445
- socket .on (this .$route .params .id .replace (/ -/ g , ' _' ) + ' _removed' , (data ) => {
1446
- if (data ._currentStatus ) {
1447
- let finx = _ .findIndex (this .flowzList , {id: this .$route .params .id })
1448
- if (finx !== - 1 ) {
1449
- this .flowzList [finx].processList [data ._state ].count --
1450
- this .flowzList [finx].count --
1451
- }
1452
- }
1453
- })
1454
- }
1378
+ // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
1379
+ // socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
1380
+ // console.log(data._currentStatus && data._state, this.$route.params.stateid)
1381
+ // if (data._currentStatus && data._state === this.$route.params.stateid) {
1382
+ // if (this.instanceEntries.length < this.entriesTotal) {
1383
+ // this.instanceEntries.push(data)
1384
+ // this.dataData = this.instanceEntries
1385
+ // } else {
1386
+ // console.log('..........')
1387
+ // this.dataTotal++
1388
+ // }
1389
+ // } else {
1390
+ // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data._previous })
1391
+ // this.instanceEntries.splice(inx, 1)
1392
+ // }
1393
+ // })
1394
+ // }
1395
+ // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
1396
+ // socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
1397
+ // if (this.$store.state.role === 1) {
1398
+ // if (data._currentStatus && data._state === this.$route.params.stateid) {
1399
+ // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1400
+ // this.instanceEntries.splice(inx, 1)
1401
+ // this.instanceEntries.push(data)
1402
+ // this.dataData = this.instanceEntries
1403
+ // }
1404
+ // }
1405
+ // console.log(this.$store.state.role === 2, data)
1406
+ // if (this.$store.state.role === 2 && data !== undefined) {
1407
+ // console.log('dataClaim', this.dataClaim)
1408
+ // console.log('dataClaim', data)
1409
+ // console.log('dataUnclaim', this.dataUnclaim)
1410
+ // if (data._claimUser === '') {
1411
+ // let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id })
1412
+ // this.dataUnclaim.splice(inx, 1)
1413
+ // this.dataClaim.push(data)
1414
+ // console.log(inx)
1415
+ // } else {
1416
+ // let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id })
1417
+ // this.dataClaim.splice(inx, 1)
1418
+ // this.dataUnclaim.push(data)
1419
+ // console.log(inx)
1420
+ // }
1421
+ // }
1422
+ // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1423
+ // if (finx !== -1 && !data._currentStatus && data._next === null) {
1424
+ // if (this.flowzList[finx].processList[data._state].count > 0) {
1425
+ // this.flowzList[finx].processList[data._state].count--
1426
+ // }
1427
+ // if (this.flowzList[finx].count > 0) {
1428
+ // this.flowzList[finx].count--
1429
+ // }
1430
+ // }
1431
+ // // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1432
+ // // this.instanceEntries.splice(inx, 1)
1433
+ // // this.dataData = this.instanceEntries
1434
+ // })
1435
+ // }
1436
+ // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
1437
+ // socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
1438
+ // if (data._currentStatus) {
1439
+ // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1440
+ // if (finx !== -1) {
1441
+ // this.flowzList[finx].processList[data._state].count--
1442
+ // this.flowzList[finx].count--
1443
+ // }
1444
+ // }
1445
+ // })
1446
+ // }
1455
1447
},
1456
1448
computed: {
1457
1449
dataCount () {
@@ -1541,6 +1533,87 @@ export default {
1541
1533
},
1542
1534
removed (data ) {
1543
1535
}
1536
+ },
1537
+ ' dflowzdata' : {
1538
+ _created (data ) {
1539
+ // console.log('================created==============', data)
1540
+ let keys = Object .keys (data)
1541
+ for (let tName of keys) {
1542
+ if (tName === this .$route .params .id .replace (/ -/ g , ' _' )) {
1543
+ if (data[tName]._currentStatus && data[tName]._state === this .$route .params .stateid ) {
1544
+ if (this .instanceEntries .length < this .entriesTotal ) {
1545
+ this .instanceEntries .push (data[tName])
1546
+ this .dataData = this .instanceEntries
1547
+ } else {
1548
+ this .dataTotal ++
1549
+ }
1550
+ } else {
1551
+ let inx = _ .findIndex (this .instanceEntries , (o ) => { return o .id === data[tName]._previous })
1552
+ this .instanceEntries .splice (inx, 1 )
1553
+ }
1554
+ }
1555
+ }
1556
+ },
1557
+ _updated (data ) {
1558
+ },
1559
+ _patched (data ) {
1560
+ // console.log('==============patched============', data)
1561
+ let keys = Object .keys (data)
1562
+ for (let tName of keys) {
1563
+ if (data[tName]._currentStatus ) {
1564
+ if (this .$store .state .role === 1 ) {
1565
+ if (data[tName]._currentStatus && data[tName]._state === this .$route .params .stateid ) {
1566
+ let inx = _ .findIndex (this .instanceEntries , (o ) => { return o .id === data[tName].id })
1567
+ this .instanceEntries .splice (inx, 1 )
1568
+ this .instanceEntries .push (data[tName])
1569
+ this .dataData = this .instanceEntries
1570
+ }
1571
+ }
1572
+ // console.log(this.$store.state.role === 2, data)
1573
+ if (this .$store .state .role === 2 && data[tName] !== undefined ) {
1574
+ // console.log('dataClaim', this.dataClaim)
1575
+ // console.log('dataClaim', data[tName])
1576
+ // console.log('dataUnclaim', this.dataUnclaim)
1577
+ if (data[tName]._claimUser === ' ' ) {
1578
+ let inx = _ .findIndex (this .dataUnclaim , (o ) => { return o .id === data[tName].id })
1579
+ this .dataUnclaim .splice (inx, 1 )
1580
+ this .dataClaim .push (data[tName])
1581
+ // console.log(inx)
1582
+ } else {
1583
+ let inx = _ .findIndex (this .dataClaim , (o ) => { return o .id === data[tName].id })
1584
+ this .dataClaim .splice (inx, 1 )
1585
+ this .dataUnclaim .push (data[tName])
1586
+ // console.log(inx)
1587
+ }
1588
+ }
1589
+ let finx = _ .findIndex (this .flowzList , {id: this .$route .params .id })
1590
+ if (finx !== - 1 && ! data[tName]._currentStatus && data[tName]._next === null ) {
1591
+ if (this .flowzList [finx].processList [data[tName]._state ].count > 0 ) {
1592
+ this .flowzList [finx].processList [data[tName]._state ].count --
1593
+ }
1594
+ if (this .flowzList [finx].count > 0 ) {
1595
+ this .flowzList [finx].count --
1596
+ }
1597
+ }
1598
+ }
1599
+ }
1600
+ },
1601
+ _removed (data ) {
1602
+ // let keys = Object.keys(data)
1603
+ // for (let tName of keys) {
1604
+ // if (data[tName]._currentStatus) {
1605
+ // let finx = _.findIndex(this.flowzList, {id: tName.replace(/_/g, '-')})
1606
+ // if (finx !== -1) {
1607
+ // if (this.flowzList[finx].processList[data[tName]._state].count > 0) {
1608
+ // this.flowzList[finx].processList[data[tName]._state].count--
1609
+ // }
1610
+ // if (this.flowzList[finx].count > 0) {
1611
+ // this.flowzList[finx].count--
1612
+ // }
1613
+ // }
1614
+ // }
1615
+ // }
1616
+ }
1544
1617
}
1545
1618
}
1546
1619
}
0 commit comments