添加画图接口token,优化画图接口

This commit is contained in:
gssong 2023-06-04 14:12:45 +08:00
parent 86670c99e4
commit f0a304d6d7
5 changed files with 35 additions and 18 deletions

View File

@ -411,6 +411,11 @@ angular.module('flowableModeler').controller('SaveModelCtrl', [ '$rootScope', '$
url: FLOWABLE.URL.putModel(modelMetaData.modelId)}) url: FLOWABLE.URL.putModel(modelMetaData.modelId)})
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
if(data.code === 500){
alert(data.msg)
$scope.status.loading = false;
return false
}
editorManager.handleEvents({ editorManager.handleEvents({
type: ORYX.CONFIG.EVENT_SAVED type: ORYX.CONFIG.EVENT_SAVED
}); });

View File

@ -15,27 +15,27 @@ var FLOWABLE = FLOWABLE || {};
FLOWABLE.URL = { FLOWABLE.URL = {
getModel: function(modelId) { getModel: function(modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/editor/json?version=' + Date.now(); return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/editor/json?version=' + Date.now()+'&Authorization=Bearer '+window.parent.this.token;
}, },
getStencilSet: function() { getStencilSet: function() {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/editor?version=' + Date.now(); return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/editor?version=' + Date.now()+'&Authorization=Bearer '+window.parent.this.token;
}, },
getCmmnStencilSet: function() { getCmmnStencilSet: function() {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/cmmneditor?version=' + Date.now(); return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/cmmneditor?version=' + Date.now()+'&Authorization=Bearer '+window.parent.this.token;
}, },
getDmnStencilSet: function() { getDmnStencilSet: function() {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/dmneditor?version=' + Date.now(); return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/stencil-sets/dmneditor?version=' + Date.now()+'&Authorization=Bearer '+window.parent.this.token;
}, },
putModel: function(modelId) { putModel: function(modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/editor/json'; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/editor/json'+'?Authorization=Bearer '+window.parent.this.token;
}, },
validateModel: function(){ validateModel: function(){
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/model/validate'; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/model/validate'+'?Authorization=Bearer '+window.parent.this.token;
} }
}; };

View File

@ -16,13 +16,13 @@
'use strict'; 'use strict';
var FLOWABLE = FLOWABLE || {}; var FLOWABLE = FLOWABLE || {};
var pathname = window.location.pathname.replace(/^(\/[^\/]*)(\/.*)?modeler\/?$/, '$1').replace(/\/$/, ''); var pathname = window.location.pathname.replace(/^(\/[^\/]*)(\/.*)?modeler\/?$/, '$1').replace(/\/$/, '');
const baseURL = window.parent.this.apiUrl;
FLOWABLE.CONFIG = { FLOWABLE.CONFIG = {
'onPremise' : true, 'onPremise' : true,
'contextRoot' : 'http://127.0.0.1:8080/workflow/model', 'contextRoot' : baseURL+'/workflow/model',
'contextModelerRestRoot' : 'http://127.0.0.1:8080/workflow/model', 'contextModelerRestRoot' : baseURL+'/workflow/model',
'webContextRoot' : 'http://127.0.0.1:8080/workflow/model', 'webContextRoot' : baseURL+'/workflow/model',
'datesLocalization' : false 'datesLocalization' : false
}; };

View File

@ -21,7 +21,7 @@ FLOWABLE.APP_URL = {
/* ACCOUNT URLS */ /* ACCOUNT URLS */
getAccountUrl: function () { getAccountUrl: function () {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/account'; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/account?Authorization=Bearer '+window.parent.this.token;
}, },
getLogoutUrl: function () { getLogoutUrl: function () {
@ -35,19 +35,19 @@ FLOWABLE.APP_URL = {
}, },
getModelUrl: function (modelId) { getModelUrl: function (modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId+'?Authorization=Bearer '+window.parent.this.token;
}, },
getModelModelJsonUrl: function (modelId) { getModelModelJsonUrl: function (modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/model-json'; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/model-json?Authorization=Bearer '+window.parent.this.token;
}, },
getModelBpmn20ExportUrl: function (modelId) { getModelBpmn20ExportUrl: function (modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/bpmn20?version=' + Date.now(); return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/bpmn20?version=' + Date.now()+'&Authorization=Bearer '+window.parent.this.token;
}, },
getCloneModelsUrl: function (modelId) { getCloneModelsUrl: function (modelId) {
return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/clone'; return FLOWABLE.CONFIG.contextModelerRestRoot + '/rest/models/' + modelId + '/clone'+'?Authorization=Bearer '+window.parent.this.token;
}, },
getModelHistoriesUrl: function (modelId) { getModelHistoriesUrl: function (modelId) {

View File

@ -8,6 +8,8 @@
</template> </template>
<script> <script>
const baseURL = import.meta.env.VITE_APP_BASE_API;
import { getToken } from '@/utils/auth';
export default { export default {
props: { props: {
modelId: String modelId: String
@ -21,14 +23,24 @@ export default {
computed: { computed: {
src() { src() {
return `/static/flowable-modeler/index.html#/editor/${this.modelId}`; return `/static/flowable-modeler/index.html#/editor/${this.modelId}`;
},
apiUrl() {
return baseURL;
},
token() {
return getToken();
} }
}, },
mounted(){
//vue
window.this = this;
},
methods: { methods: {
handleClose() { handleClose() {
this.$modal this.$modal
.confirm('请记得点击左上角保存按钮,确定关闭设计窗口?', '确认关闭') .confirm('请记得点击左上角保存按钮,确定关闭设计窗口?', '确认关闭')
.then(() => { .then(() => {
this.visible = false this.visible = false;
// //
this.$parent.getList(); this.$parent.getList();
}) })