diff --git a/client/src/components/SchemaView.vue b/client/src/components/SchemaView.vue index 46c4629..69e3a15 100644 --- a/client/src/components/SchemaView.vue +++ b/client/src/components/SchemaView.vue @@ -304,21 +304,36 @@ export default { 'schemasubformview': (resolve) => { require(['./SchemaSubFormView'], resolve) } }, methods: { - searchData (query) { + searchData (query, sort) { + console.log('query', query, sort) this.dataLoading = true // New Custom Dynamic FLowz Data call let heads = { ftablename: this.currentFlowzId } - dflowzdata.get(null, { + if (query === null) { + query = { + text: '', + filter: '' + } + } + let params = { $skip: this.skip, $limit: this.limit, '_currentStatus': true, '_state': this.$route.params.stateid, // 'id[$search]': '^' + query.text '$search': query.text - }, heads) + } + if (sort !== undefined) { + if (sort.order === 'asc') { + params['$sort[' + sort.key + ']'] = 1 + } else if (sort.order === 'desc') { + params['$sort[' + sort.key + ']'] = -1 + } + } + dflowzdata.get(null, params, heads) .then(res => { this.isFlowzLoaded = true this.dataTotal = res.data.total @@ -379,7 +394,8 @@ export default { // }) }, sortData (object) { - // console.log('object') + // console.log('object', object, query) + this.searchData(null, object) }, emailService (item) { this.isEmailDone = true diff --git a/client/src/masterLayout/SideBar.vue b/client/src/masterLayout/SideBar.vue index 462cf81..46522f3 100644 --- a/client/src/masterLayout/SideBar.vue +++ b/client/src/masterLayout/SideBar.vue @@ -118,7 +118,10 @@ export default { }, beforeDestroy () { // alert('beforeDestroy') - // console.log(socket, socket.disconnected) + // console.log(socket) + for (let item of socket.subs) { + item.destroy() + } }, methods: { getByOrder (array) { @@ -195,7 +198,7 @@ export default { }) if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_created'] === undefined) { socket.on(m.id.replace(/-/g, '_') + '_created', (data) => { - console.log('===created==', data) + // console.log('===created==', data) if (data._currentStatus) { let finx = _.findIndex(this.flowzList, {id: m.id}) if (finx !== -1) { @@ -207,7 +210,7 @@ export default { } if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_patched'] === undefined) { socket.on(m.id.replace(/-/g, '_') + '_patched', (data) => { - console.log('===patched==', data) + // console.log('===patched==', data) let finx = _.findIndex(this.flowzList, {id: m.id}) if (finx !== -1 && !data._currentStatus && data._next === null) { if (this.flowzList[finx].processList[data._state].count > 0) { @@ -221,7 +224,7 @@ export default { } if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_removed'] === undefined) { socket.on(m.id.replace(/-/g, '_') + '_removed', (data) => { - console.log('===removed==', data) + // console.log('===removed==', data) if (data._currentStatus) { let finx = _.findIndex(this.flowzList, {id: m.id}) if (finx !== -1) { @@ -447,8 +450,15 @@ export default { }, mounted () { // this.activeFlow(this.$store.state.activeFlow) - // console.log('this.$feathers', this.$feathers) + for (let item of socket.subs) { + item.destroy() + } this.init() + // console.log('socket', socket) + // console.log('this.$feathers', this.$feathers) + // this.$feathers.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_created', (data) => { + // console.log('this.$feathers', data) + // }) }, feathers: { 'flowz': { diff --git a/client/src/pages/user/SchemaList.vue b/client/src/pages/user/SchemaList.vue index 24352f5..bce43c6 100644 --- a/client/src/pages/user/SchemaList.vue +++ b/client/src/pages/user/SchemaList.vue @@ -338,7 +338,7 @@ id: this.flowzData.schema, item: params.row, formName: params.row.name, - currentState: params.row._currentStatus, + currentState: params.row._state, flowzData: this.flowzData, formData: params.row } diff --git a/service/src/services/dflowzdata/dflowzdata.hooks.js b/service/src/services/dflowzdata/dflowzdata.hooks.js index adbf994..4e39007 100644 --- a/service/src/services/dflowzdata/dflowzdata.hooks.js +++ b/service/src/services/dflowzdata/dflowzdata.hooks.js @@ -84,7 +84,7 @@ function beforeCreate (hook) { return hook.app.service('flowz').get(tName).then(res => { hook.data._currentStatus = true if (res.processList[hook.data._state].type === 'endevent') { - console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') + // console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') hook.data._currentStatus = false } hook.data._createdAt = new Date().toISOString()