提交先锋

This commit is contained in:
case committed 2022-07-06 23:48:56 +08:00
1 parent 571ba2a8a1
commit b7bbcca9dc
19 files changed
+19786

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
'use strict';
module.exports = {
tableEnum: {
// ========================江湖表============================
_cache: '_cache',
_constant: '_constant',
_file: '_file',
_group: '_group',
_log: '_log',
_page: '_page',
_resource: '_resource',
_record_history: '_record_history',
_resource_request_log: '_resource_request_log',
_role: '_role',
_test_case: '_test_case',
_user: '_user',
_user_group_role: '_user_group_role',
_user_group_role_page: '_user_group_role_page',
_user_group_role_resource: '_user_group_role_resource',
_user_group_role_ui_level: '_user_group_role_ui_level',
_user_session: '_user_session',
// ========================应用表============================
app: 'student',
article: 'article',
assignment: 'assignment',
category: 'category',
workflow: 'workflow',
task: 'task',
task_history: 'task_history',
// ========================基础 View============================
_view01_resource: '_view01_resource',
_view01_user: '_view01_user',
// ========================高级 View============================
_view02_user_app: '_view02_user_app',
_view02_user_group_role: '_view02_user_group_role',
},
};
+24
View File
@@ -0,0 +1,24 @@
'use strict';
class BizError extends Error {
constructor({ errorCode, errorReason, errorReasonSupplement }) {
super(JSON.stringify({ errorCode, errorReason, errorReasonSupplement }));
this.name = 'BizError';
this.errorCode = errorCode;
this.errorReason = errorReason;
this.errorReasonSupplement = errorReasonSupplement;
}
}
const errorInfoEnum = {
data_exception: { errorCode: 'data_exception', errorReason: '数据异常' },
workflow_not_found: { errorCode: 'work_flow_not_found', errorReason: '流程不存在' },
task_not_found: { errorCode: 'task_not_found', errorReason: '任务不存在' },
node_not_found: { errorCode: 'node_not_found', errorReason: '节点不存在' },
line_not_found: { errorCode: 'line_not_found', errorReason: '线路不存在' },
};
module.exports = {
BizError,
errorInfoEnum,
};
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
(function(){function a(a,b){return[-a[0][b]+3*a[1][b]+-3*a[2][b]+a[3][b],3*a[0][b]-6*a[1][b]+3*a[2][b],-3*a[0][b]+3*a[1][b],a[0][b]]}function b(b){return[a(b,"x"),a(b,"y")]}function c(a){return 0>a?-1:a>0?1:0}function d(a,b,d,e){var f,g,h=b/a,i=d/a,j=e/a,k=(3*i-Math.pow(h,2))/9,l=(9*h*i-27*j-2*Math.pow(h,3))/54,m=Math.pow(k,3)+Math.pow(l,2),n=[];if(m>=0)f=c(l+Math.sqrt(m))*Math.pow(Math.abs(l+Math.sqrt(m)),1/3),g=c(l-Math.sqrt(m))*Math.pow(Math.abs(l-Math.sqrt(m)),1/3),n[0]=-h/3+(f+g),n[1]=-h/3-(f+g)/2,n[2]=-h/3-(f+g)/2,0!==Math.abs(Math.sqrt(3)*(f-g)/2)&&(n[1]=-1,n[2]=-1);else{var o=Math.acos(l/Math.sqrt(-Math.pow(k,3)));n[0]=2*Math.sqrt(-k)*Math.cos(o/3)-h/3,n[1]=2*Math.sqrt(-k)*Math.cos((o+2*Math.PI)/3)-h/3,n[2]=2*Math.sqrt(-k)*Math.cos((o+4*Math.PI)/3)-h/3}for(var p=0;3>p;p++)(n[p]<0||n[p]>1)&&(n[p]=-1);return n}"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:a>0?1:-1});var e={subtract:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},dotProduct:function(a,b){return a.x*b.x+a.y*b.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,b){return{x:a.x*b,y:a.y*b}}},f=64,g=Math.pow(2,-f-1),h=function(a,b){for(var c=[],d=j(a,b),f=b.length-1,g=2*f-1,h=k(d,g,c,0),i=e.subtract(a,b[0]),l=e.square(i),m=0,n=0;h>n;n++){i=e.subtract(a,o(b,f,c[n],null,null));var p=e.square(i);l>p&&(l=p,m=c[n])}return i=e.subtract(a,b[f]),p=e.square(i),l>p&&(l=p,m=1),{location:m,distance:l}},i=function(a,b){var c=h(a,b);return{point:o(b,b.length-1,c.location,null,null),location:c.location}},j=function(a,b){for(var c=b.length-1,d=2*c-1,f=[],g=[],h=[],i=[],j=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],k=0;c>=k;k++)f[k]=e.subtract(b[k],a);for(var k=0;c-1>=k;k++)g[k]=e.subtract(b[k+1],b[k]),g[k]=e.scale(g[k],3);for(var l=0;c-1>=l;l++)for(var m=0;c>=m;m++)h[l]||(h[l]=[]),h[l][m]=e.dotProduct(g[l],f[m]);for(k=0;d>=k;k++)i[k]||(i[k]=[]),i[k].y=0,i[k].x=parseFloat(k)/d;for(var n=c,o=c-1,p=0;n+o>=p;p++){var q=Math.max(0,p-o),r=Math.min(p,n);for(k=q;r>=k;k++){var s=p-k;i[k+s].y+=h[s][k]*j[s][k]}}return i},k=function(a,b,c,d){var e,g,h=[],i=[],j=[],p=[];switch(l(a,b)){case 0:return 0;case 1:if(d>=f)return c[0]=(a[0].x+a[b].x)/2,1;if(m(a,b))return c[0]=n(a,b),1}o(a,b,.5,h,i),e=k(h,b,j,d+1),g=k(i,b,p,d+1);for(var q=0;e>q;q++)c[q]=j[q];for(var q=0;g>q;q++)c[q+e]=p[q];return e+g},l=function(a,b){var c,d,e=0;c=d=Math.sgn(a[0].y);for(var f=1;b>=f;f++)c=Math.sgn(a[f].y),c!=d&&e++,d=c;return e},m=function(a,b){var c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s;i=a[0].y-a[b].y,j=a[b].x-a[0].x,k=a[0].x*a[b].y-a[b].x*a[0].y;var t,u;t=u=0;for(var v=1;b>v;v++){var w=i*a[v].x+j*a[v].y+k;w>t?t=w:u>w&&(u=w)}return n=0,o=1,p=0,q=i,r=j,s=k-t,l=n*r-q*o,m=1/l,d=(o*s-r*p)*m,q=i,r=j,s=k-u,l=n*r-q*o,m=1/l,e=(o*s-r*p)*m,f=Math.min(d,e),h=Math.max(d,e),c=h-f,g>c?1:0},n=function(a,b){var c=1,d=0,e=a[b].x-a[0].x,f=a[b].y-a[0].y,g=a[0].x-0,h=a[0].y-0,i=e*d-f*c,j=1/i,k=(e*h-f*g)*j;return 0+c*k},o=function(a,b,c,d,e){for(var f=[[]],g=0;b>=g;g++)f[0][g]=a[g];for(var h=1;b>=h;h++)for(var g=0;b-h>=g;g++)f[h]||(f[h]=[]),f[h][g]||(f[h][g]={}),f[h][g].x=(1-c)*f[h-1][g].x+c*f[h-1][g+1].x,f[h][g].y=(1-c)*f[h-1][g].y+c*f[h-1][g+1].y;if(null!=d)for(g=0;b>=g;g++)d[g]=f[g][0];if(null!=e)for(g=0;b>=g;g++)e[g]=f[b-g][g];return f[b][0]},p={},q=function(a){var b=p[a];if(!b){b=[];var c=function(){return function(b){return Math.pow(b,a)}},d=function(){return function(b){return Math.pow(1-b,a)}},e=function(a){return function(b){return a}},f=function(){return function(a){return a}},g=function(){return function(a){return 1-a}},h=function(a){return function(b){for(var c=1,d=0;d<a.length;d++)c*=a[d](b);return c}};b.push(new c);for(var i=1;a>i;i++){for(var j=[new e(a)],k=0;a-i>k;k++)j.push(new f);for(var k=0;i>k;k++)j.push(new g);b.push(new h(j))}b.push(new d),p[a]=b}return b},r=function(a,b){for(var c=q(a.length-1),d=0,e=0,f=0;f<a.length;f++)d+=a[f].x*c[f](b),e+=a[f].y*c[f](b);return{x:d,y:e}},s=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))},t=function(a){return a[0].x===a[1].x&&a[0].y===a[1].y},u=function(a,b,c){if(t(a))return{point:a[0],location:b};for(var d=r(a,b),e=0,f=b,g=c>0?1:-1,h=null;e<Math.abs(c);)f+=.005*g,h=r(a,f),e+=s(h,d),d=h;return{point:h,location:f}},v=function(a){if(t(a))return 0;for(var b=r(a,0),c=0,d=0,e=1,f=null;1>d;)d+=.005*e,f=r(a,d),c+=s(f,b),b=f;return c},w=function(a,b,c){return u(a,b,c).point},x=function(a,b,c){return u(a,b,c).location},y=function(a,b){var c=r(a,b),d=r(a.slice(0,a.length-1),b),e=d.y-c.y,f=d.x-c.x;return 0===e?1/0:Math.atan(e/f)},z=function(a,b,c){var d=u(a,b,c);return d.location>1&&(d.location=1),d.location<0&&(d.location=0),y(a,d.location)},A=function(a,b,c,d){d=null==d?0:d;var e=u(a,b,d),f=y(a,e.location),g=Math.atan(-1/f),h=c/2*Math.sin(g),i=c/2*Math.cos(g);return[{x:e.point.x+i,y:e.point.y+h},{x:e.point.x-i,y:e.point.y-h}]},B=function(a,c,e,f,g){var h=f-c,i=a-e,j=a*(c-f)+c*(e-a),k=b(g),l=[h*k[0][0]+i*k[1][0],h*k[0][1]+i*k[1][1],h*k[0][2]+i*k[1][2],h*k[0][3]+i*k[1][3]+j],m=d.apply(null,l),n=[];if(null!=m)for(varLine truncated
this[a+"Scope"]=function(b,c){x(b._katavorioDrag,c,this._dragsByScope,a+"Scope"),x(b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this),this[a+"DragScope"]=function(b,c){x(b.constructor===F?b:b._katavorioDrag,c,this._dragsByScope,a+"Scope")}.bind(this),this[a+"DropScope"]=function(b,c){x(b.constructor===G?b:b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this)}.bind(this)),this.snapToGrid=function(a,b){for(var c in this._dragsByScope)w(this._dragsByScope[c],function(c){c.snap(a,b)})},this.getDragsForScope=function(a){return this._dragsByScope[a]},this.getDropsForScope=function(a){return this._dropsByScope[a]};var z=function(a,b,c){if(a=J(a),a[b]){var d=f.indexOf(a[b]);d>=0&&f.splice(d,1),j(a[b],c)&&y(a[b],function(a){a.destroy()}),delete a[b]}},B=function(a,b,c,d){a=J(a),a[b]&&a[b].off(c,d)};this.elementRemoved=function(a){this.destroyDraggable(a),this.destroyDroppable(a)},this.destroyDraggable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrag",this._dragsByScope):B(a,"_katavorioDrag",b,c)},this.destroyDroppable=function(a,b,c){1===arguments.length?z(a,"_katavorioDrop",this._dropsByScope):B(a,"_katavorioDrop",b,c)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},f=[],g={},C={}};var C={},D=function(a,c,d){var f=e(c)?c:c.id,g=e(c)?!0:c.active!==!1,h=C[f]||function(){var a={name:f,members:[]};return C[f]=a,a}();return y(a,function(a){if(a._katavorioDrag){if(d&&null!=a._katavorioDrag.posseRoles[h.name])return;b(h.members,a._katavorioDrag),b(a._katavorioDrag.posses,h.name),a._katavorioDrag.posseRoles[h.name]=g}}),h};this.addToPosse=function(a,b){for(var c=[],d=1;d<arguments.length;d++)c.push(D(a,arguments[d]));return 1===c.length?c[0]:c},this.setPosse=function(a,b){for(var c=[],e=1;e<arguments.length;e++)c.push(D(a,arguments[e],!0).name);return y(a,function(a){if(a._katavorioDrag){var b=d(a._katavorioDrag.posses,c),e=[];Array.prototype.push.apply(e,a._katavorioDrag.posses);for(var f=0;f<b.length;f++)this.removeFromPosse(a,b[f])}}.bind(this)),1===c.length?c[0]:c},this.removeFromPosse=function(a,b){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var d=1;d<arguments.length;d++)b=arguments[d],y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var d=a._katavorioDrag;y(b,function(a){c(C[a].members,d),c(d.posses,a),delete d.posseRoles[a]})}})},this.removeFromAllPosses=function(a){y(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var b=a._katavorioDrag;y(b.posses,function(a){c(C[a].members,b)}),b.posses.length=0,b.posseRoles={}}})},this.setPosseState=function(a,b,c){var d=C[b];d&&y(a,function(a){a._katavorioDrag&&a._katavorioDrag.posses&&(a._katavorioDrag.posseRoles[d.name]=c)})}},a.Katavorio.version="1.0.0","undefined"!=typeof exports&&(exports.Katavorio=a.Katavorio)}.call("undefined"!=typeof window?window:this),function(){function a(a){return"[object Array]"===Object.prototype.toString.call(a)}function b(a){return"[object Number]"===Object.prototype.toString.call(a)}function c(a){return"string"==typeof a}function d(a){return"boolean"==typeof a}function e(a){return null==a}function f(a){return null==a?!1:"[object Object]"===Object.prototype.toString.call(a)}function g(a){return"[object Date]"===Object.prototype.toString.call(a)}function h(a){return"[object Function]"===Object.prototype.toString.call(a)}function i(a){return h(a)&&null!=a.name&&a.name.length>0}function j(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function k(b){if(c(b))return""+b;if(d(b))return!!b;if(g(b))return new Date(b.getTime());if(h(b))return b;if(a(b)){for(var e=[],i=0;i<b.length;i++)e.push(k(b[i]));return e}if(f(b)){var j={};for(var l in b)j[l]=k(b[l]);return j}return b}function l(b,e,g,h){var i,j,l={},m={};for(g=g||[],h=h||[],j=0;j<g.length;j++)l[g[j]]=!0;for(j=0;j<h.length;j++)m[h[j]]=!0;var n=k(b);for(j in e)if(null==n[j]||m[j])n[j]=e[j];else if(c(e[j])||d(e[j]))l[j]?(i=[],i.push.apply(i,a(n[j])?n[j]:[n[j]]),i.push.apply(i,d(e[j])?e[j]:[e[j]]),n[j]=i):n[j]=e[j];else if(a(e[j]))i=[],a(n[j])&&i.push.apply(i,n[j]),i.push.apply(i,e[j]),n[j]=i;else if(f(e[j])){f(n[j])||(n[j]={});for(var o in e[j])n[j][o]=e[j][o]}return n}function m(a,b,c){if(null!=a){var d=a,e=d;return b.replace(/([^\.])+/g,function(a,b,d,f){var g=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),h=d+a.length>=f.length,i=function(){return e[g[1]]||function(){return e[g[1]]=[],e[g[1]]}()};if(h)g?i()[g[3]]=c:e[a]=c;else if(g){var j=i();e=j[g[3]]||function(){return j[g[3]]={},j[g[3]]}()}else e=e[a]||function(){return e[a]={},e[a]}();return""}),a}}function n(a,b,c){for(var d=0;d<c.length;d++){var e=c[d][0][c[d][1]].apply(c[d][0],c[d][2]);if(e===b)return e}return a}function o(b,d,e,g){var i=function(a){var b=a.match(/(\${.*?})/g);if(null!=b)for(var c=0;c<b.length;c++){var e=d[b[c].substring(2,b[c].length-1)]||"";null!=e&&(a=a.replace(b[c],e))}return a},j=function(b){if(null!=b){if(c(b))return i(b);if(!h(b)||g||null!=e&&0!==(b.name||"").indexOf(e)){if(a(b)){for(var k=[],l=0;l<b.lLine truncated
f};var W=function(a,b,c){var d=f.Defaults.ConnectionType||f.getDefaultConnectionType(),e=a.constructor===d,g=e?{connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]}:a;b&&f.fire("connectionDetached",g,c),f.fire("internal.connectionDetached",g,c),f.anchorManager.connectionDetached(g)},X=f.fireMoveEvent=function(a,b){f.fire("connectionMoved",a,b)};this.unregisterEndpoint=function(a){a._jsPlumb.uuid&&(v[a._jsPlumb.uuid]=null),f.anchorManager.deleteEndpoint(a);for(var b in u){var c=u[b];if(c){for(var d=[],e=0,g=c.length;g>e;e++)c[e]!==a&&d.push(c[e]);u[b]=d}u[b].length<1&&delete u[b]}};var Y="isDetachAllowed",Z="beforeDetach",$="checkCondition";this.deleteConnection=function(a,c){return null!=a&&(c=c||{},c.force||b.functionChain(!0,!1,[[a.endpoints[0],Y,[a]],[a.endpoints[1],Y,[a]],[a,Y,[a]],[f,$,[Z,a]]]))?(a.setHover(!1),W(a,!a.pending&&c.fireEvent!==!1,c.originalEvent),a.endpoints[0].detachFromConnection(a),a.endpoints[1].detachFromConnection(a),b.removeWithFunction(t,function(b){return a.id===b.id}),a.cleanup(),a.destroy(),!0):!1},this.deleteEveryConnection=function(a){a=a||{};var b=t.length,c=0;return f.batch(function(){for(var d=0;b>d;d++)c+=f.deleteConnection(t[0],a)?1:0}),c},this.deleteConnectionsForElement=function(a,b){b=b||{},a=f.getElement(a);var c=T(a),d=u[c];if(d&&d.length)for(var e=0,g=d.length;g>e;e++)d[e].deleteEveryConnection(b);return f},this.deleteObject=function(a){var c={endpoints:{},connections:{},endpointCount:0,connectionCount:0},d=a.deleteAttachedObjects!==!1,e=function(b){null!=b&&null==c.connections[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.connections[b.id]=b,c.connectionCount++)},g=function(b){if(null!=b&&null==c.endpoints[b.id]&&(a.dontUpdateHover||null==b._jsPlumb||b.setHover(!1),c.endpoints[b.id]=b,c.endpointCount++,d))for(var f=0;f<b.connections.length;f++){var g=b.connections[f];e(g)}};a.connection?e(a.connection):g(a.endpoint);for(var h in c.connections){var i=c.connections[h];if(i._jsPlumb){b.removeWithFunction(t,function(a){return i.id===a.id}),W(i,a.fireEvent===!1?!1:!i.pending,a.originalEvent);var j=null==a.deleteAttachedObjects?null:!a.deleteAttachedObjects;i.endpoints[0].detachFromConnection(i,null,j),i.endpoints[1].detachFromConnection(i,null,j),i.cleanup(!0),i.destroy(!0)}}for(var k in c.endpoints){var l=c.endpoints[k];l._jsPlumb&&(f.unregisterEndpoint(l),l.cleanup(!0),l.destroy(!0))}return c};var _=function(a,b,c,d){for(var e=0,f=a.length;f>e;e++)a[e][b].apply(a[e],c);return d(a)},aa=function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e++)d.push([a[e][b].apply(a[e],c),a[e]]);return d},ba=function(a,b,c){return function(){return _(a,b,arguments,c)}},ca=function(a,b){return function(){return aa(a,b,arguments)}},da=function(a,b){var c=[];if(a)if("string"==typeof a){if("*"===a)return a;c.push(a)}else if(b)c=a;else if(a.length)for(var d=0,e=a.length;e>d;d++)c.push(l(a[d]).id);else c.push(l(a).id);return c},ea=function(a,b,c){return"*"===a?!0:a.length>0?-1!==a.indexOf(b):!c};this.getConnections=function(a,b){a?a.constructor===String&&(a={scope:a}):a={};for(var c=a.scope||f.getDefaultScope(),d=da(c,!0),e=da(a.source),g=da(a.target),h=!b&&d.length>1?{}:[],i=function(a,c){if(!b&&d.length>1){var e=h[a];null==e&&(e=h[a]=[]),e.push(c)}else h.push(c)},j=0,k=t.length;k>j;j++){var l=t[j],m=l.proxies&&l.proxies[0]?l.proxies[0].originalEp.elementId:l.sourceId,n=l.proxies&&l.proxies[1]?l.proxies[1].originalEp.elementId:l.targetId;ea(d,l.scope)&&ea(e,m)&&ea(g,n)&&i(l.scope,l)}return h};var fa=function(a,b){return function(c){for(var d=0,e=a.length;e>d;d++)c(a[d]);return b(a)}},ga=function(a){return function(b){return a[b]}},ha=function(a,b){var c,d,e={length:a.length,each:fa(a,b),get:ga(a)},f=["setHover","removeAllOverlays","setLabel","addClass","addOverlay","removeOverlay","removeOverlays","showOverlay","hideOverlay","showOverlays","hideOverlays","setPaintStyle","setHoverPaintStyle","setSuspendEvents","setParameter","setParameters","setVisible","repaint","addType","toggleType","removeType","removeClass","setType","bind","unbind"],g=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(c=0,d=f.length;d>c;c++)e[f[c]]=ba(a,f[c],b);for(c=0,d=g.length;d>c;c++)e[g[c]]=ca(a,g[c]);return e},ia=function(a){var b=ha(a,ia);return o.extend(b,{setDetachable:ba(a,"setDetachable",ia),setReattach:ba(a,"setReattach",ia),setConnector:ba(a,"setConnector",ia),"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteConnection(a[b])},isDetachable:ca(a,"isDetachable"),isReattach:ca(a,"isReattach")})},ja=function(a){var b=ha(a,ja);return o.extend(b,{setEnabled:ba(a,"setEnabled",ja),setAnchor:ba(a,"setAnchor",ja),isEnabled:ca(a,"isEnabled"),deleteEveryConnection:function(){for(var b=0,c=a.length;c>b;b++)a[b].deleteEveryConnection()},"delete":function(){for(var b=0,c=a.length;c>b;b++)f.deleteEndpointLine truncated
}.bind(this);this.prepareAnchor=function(a){var b=this._jsPlumb.instance.makeAnchor(a,this.elementId,i);return b.bind("anchorChanged",function(a){this.fire("anchorChanged",{endpoint:this,anchor:a}),n()}.bind(this)),b},this.setPreparedAnchor=function(a,b){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=a,n(),b||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(a,b){var c=this.prepareAnchor(a);return this.setPreparedAnchor(c,b),this};var o=function(a){if(this.connections.length>0)for(var b=0;b<this.connections.length;b++)this.connections[b].setHover(a,!1);else this.setHover(a)}.bind(this);this.bind("mouseover",function(){o(!0)}),this.bind("mouseout",function(){o(!1)}),a._transient||this._jsPlumb.instance.anchorManager.add(this,this.elementId),this.prepareEndpoint=function(d,e){var f,g=function(a,c){var d=i.getRenderMode();if(b.Endpoints[d][a])return new b.Endpoints[d][a](c);if(!i.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+a+"'"}},h={_jsPlumb:this._jsPlumb.instance,cssClass:a.cssClass,container:a.container,tooltip:a.tooltip,connectorTooltip:a.connectorTooltip,endpoint:this};return c.isString(d)?f=g(d,h):c.isArray(d)?(h=c.merge(d[1],h),f=g(d[0],h)):f=d.clone(),f.clone=function(){return c.isString(d)?g(d,h):c.isArray(d)?(h=c.merge(d[1],h),g(d[0],h)):void 0}.bind(this),f.typeId=e,f},this.setEndpoint=function(a,b){var c=this.prepareEndpoint(a);this.setPreparedEndpoint(c,!0)},this.setPreparedEndpoint=function(a,b){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=a,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},b.extend(this,a,g),this.isSource=a.isSource||!1,this.isTemporarySource=a.isTemporarySource||!1,this.isTarget=a.isTarget||!1,this.connections=a.connections||[],this.connectorPointerEvents=a["connector-pointer-events"],this.scope=a.scope||i.getDefaultScope(),this.timestamp=null,this.reattachConnections=a.reattach||i.Defaults.ReattachConnections,this.connectionsDetachable=i.Defaults.ConnectionsDetachable,(a.connectionsDetachable===!1||a.detachable===!1)&&(this.connectionsDetachable=!1),this.dragAllowedWhenFull=a.dragAllowedWhenFull!==!1,a.onMaxConnections&&this.bind("maxConnections",a.onMaxConnections),this.addConnection=function(a){this.connections.push(a),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)},this.detachFromConnection=function(a,b,c){b=null==b?this.connections.indexOf(a):b,b>=0&&(this.connections.splice(b,1),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)),!c&&m&&0===this.connections.length&&i.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:c!==!0})},this.deleteEveryConnection=function(a){for(var b=this.connections.length,c=0;b>c;c++)i.deleteConnection(this.connections[0],a)},this.detachFrom=function(a,b,c){for(var d=[],e=0;e<this.connections.length;e++)(this.connections[e].endpoints[1]===a||this.connections[e].endpoints[0]===a)&&d.push(this.connections[e]);for(var f=0,g=d.length;g>f;f++)i.deleteConnection(d[0]);return this},this.getElement=function(){return this.element},this.setElement=function(d){var e=this._jsPlumb.instance.getId(d),f=this.elementId;return c.removeWithFunction(a.endpointsByElement[this.elementId],function(a){return a.id===this.id}.bind(this)),this.element=b.getElement(d),this.elementId=i.getId(this.element),i.anchorManager.rehomeEndpoint(this,f,this.element),i.dragManager.endpointAdded(this.element),c.addToList(a.endpointsByElement,e,this),this},this.makeInPlaceCopy=function(){var b=this.anchor.getCurrentLocation({element:this}),c=this.anchor.getOrientation(this),d=this.anchor.getCssClass(),e={bind:function(){},compute:function(){return[b[0],b[1]]},getCurrentLocation:function(){return[b[0],b[1]]},getOrientation:function(){return c},getCssClass:function(){return d}};return k({dropOptions:a.dropOptions,anchor:e,source:this.element,paintStyle:this.getPaintStyle(),endpoint:a.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){return this.connections[0]},this.setStyle=this.setPaintStyle,this.paint=function(a){a=a||{};var b=a.timestamp,c=!(a.recalc===!1);if(!b||this.timestamp!==b){var d=i.updateOffset({elId:this.elementId,timestamp:b}),e=a.offset?a.offset.o:d.o;if(null!=e){var f=a.anchorPoint,g=a.connectorPaintStyle;if(null==f){var j=a.dimensions||d.s,k={xy:[e.left,e.top],wh:j,element:this,timestamp:b};if(c&&this.anchor.isDynamic&&this.connections.length>0){var l=h(this,a.elementWithPrecedence),m=l.endpoints[0]===this?1:0,n=0===m?l.sourceId:l.targetId,o=i.getCachedData(n),p=o.o,q=o.s;k.index=0===m?1:0,k.connection=l,k.txy=[p.left,p.top],k.twh=q,k.tElement=l.endpoints[m]}else this.connections.length>0&&(k.connection=this.connections[0]);f=this.anchor.compute(k)}thiLine truncated
endpoint:c,deleteAttachedObjects:!1}),this._jsPlumb.instance.fire("endpointReplaced",{previous:c,current:g}),this._jsPlumb.instance.anchorManager.updateOtherEndpoint(this.endpoints[0].elementId,this.endpoints[1].elementId,this.endpoints[1].elementId,this)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumb;c.AnchorManager=function(a){var d={},e={},f={},g={},h=this,i={},j=a.jsPlumbInstance,k={},l=function(a,b,c,d,e,f,g){for(var h=[],i=b[e?0:1]/(d.length+1),j=0;j<d.length;j++){var k=(j+1)*i,l=f*b[e?1:0];g&&(k=b[e?0:1]-k);var m=e?k:l,n=c[0]+m,o=m/b[0],p=e?l:k,q=c[1]+p,r=p/b[1];h.push([n,q,o,r,d[j][1],d[j][2]])}return h},m=function(a){return function(b,c){var d=!0;return d=a?b[0][0]<c[0][0]:b[0][0]>c[0][0],d===!1?-1:1}},n=function(a,b){var c=a[0][0]<0?-Math.PI-a[0][0]:Math.PI-a[0][0],d=b[0][0]<0?-Math.PI-b[0][0]:Math.PI-b[0][0];return c>d?1:-1},o={top:function(a,b){return a[0]>b[0]?1:-1},right:m(!0),bottom:m(!0),left:n},p=function(a,b){return a.sort(b)},q=function(a,b){var c=j.getCachedData(a),d=c.s,g=c.o,h=function(b,c,d,g,h,i,j){if(g.length>0)for(var k=p(g,o[b]),m="right"===b||"top"===b,n=l(b,c,d,k,h,i,m),q=function(a,b){e[a.id]=[b[0],b[1],b[2],b[3]],f[a.id]=j},r=0;r<n.length;r++){var s=n[r][4],t=s.endpoints[0].elementId===a,u=s.endpoints[1].elementId===a;t&&q(s.endpoints[0],n[r]),u&&q(s.endpoints[1],n[r])}};h("bottom",d,[g.left,g.top],b.bottom,!0,1,[0,1]),h("top",d,[g.left,g.top],b.top,!0,0,[0,-1]),h("left",d,[g.left,g.top],b.left,!1,0,[-1,0]),h("right",d,[g.left,g.top],b.right,!1,1,[1,0])};this.reset=function(){d={},g={},i={}},this.addFloatingConnection=function(a,b){k[a]=b},this.removeFloatingConnection=function(a){delete k[a]},this.newConnection=function(a){var d=a.sourceId,e=a.targetId,f=a.endpoints,h=!0,i=function(i,j,k,l,m){d===e&&k.isContinuous&&(a._jsPlumb.instance.removeElement(f[1].canvas),h=!1),b.addToList(g,l,[m,j,k.constructor===c.DynamicAnchor])};i(0,f[0],f[0].anchor,e,a),h&&i(1,f[1],f[1].anchor,d,a)};var r=function(a){!function(a,c){if(a){var d=function(a){return a[4]===c};b.removeWithFunction(a.top,d),b.removeWithFunction(a.left,d),b.removeWithFunction(a.bottom,d),b.removeWithFunction(a.right,d)}}(i[a.elementId],a.id)};this.connectionDetached=function(a,c){var d=a.connection||a,e=a.sourceId,f=a.targetId,i=d.endpoints,j=function(a,c,d,e,f){b.removeWithFunction(g[e],function(a){return a[0].id===f.id})};j(1,i[1],i[1].anchor,e,d),j(0,i[0],i[0].anchor,f,d),d.floatingId&&(j(d.floatingIndex,d.floatingEndpoint,d.floatingEndpoint.anchor,d.floatingId,d),r(d.floatingEndpoint)),r(d.endpoints[0]),r(d.endpoints[1]),c||(h.redraw(d.sourceId),d.targetId!==d.sourceId&&h.redraw(d.targetId))},this.add=function(a,c){b.addToList(d,c,a)},this.changeId=function(a,b){g[b]=g[a],d[b]=d[a],delete g[a],delete d[a]},this.getConnectionsFor=function(a){return g[a]||[]},this.getEndpointsFor=function(a){return d[a]||[]},this.deleteEndpoint=function(a){b.removeWithFunction(d[a.elementId],function(b){return b.id===a.id}),r(a)},this.clearFor=function(a){delete d[a],d[a]=[]};var s=function(c,d,e,f,g,h,i,j,k,l,m,n){var o,p,q=-1,r=-1,s=f.endpoints[i],t=s.id,u=[1,0][i],v=[[d,e],f,g,h,t],w=c[k],x=s._continuousAnchorEdge?c[s._continuousAnchorEdge]:null;if(x){var y=b.findWithFunction(x,function(a){return a[4]===t});if(-1!==y)for(x.splice(y,1),o=0;o<x.length;o++)p=x[o][1],b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,x[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,x[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id})}for(o=0;o<w.length;o++)p=w[o][1],1===a.idx&&w[o][3]===h&&-1===r&&(r=o),b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,w[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,w[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id});if(-1!==q)w[q]=v;else{var z=j?-1!==r?r:0:w.length;w.splice(z,0,v)}s._continuousAnchorEdge=k};this.updateOtherEndpoint=function(a,d,e,f){var h=b.findWithFunction(g[a],function(a){return a[0].id===f.id}),i=b.findWithFunction(g[d],function(a){return a[0].id===f.id});-1!==h&&(g[a][h][0]=f,g[a][h][1]=f.endpoints[1],g[a][h][2]=f.endpoints[1].anchor.constructor===c.DynamicAnchor),i>-1&&(g[d].splice(i,1),b.addToList(g,e,[f,f.endpoints[0],f.endpoints[0].anchor.constructor===c.DynamicAnchor])),f.updateConnectedClass()},this.sourceChanged=function(a,d,e,f){if(a!==d){e.sourceId=d,e.source=f,b.removeWithFunction(g[a],function(a){return a[0].id===e.id});var h=b.findWithFunction(g[e.targetId],function(a){return a[0].id===e.id});h>-1&&(g[e.targetId][h][0]=e,g[e.targetId][h][1]=e.endpoints[0],g[e.targetId][h][2]=e.endpoints[0].anchor.constructor===c.DynamicAnchor),b.addToList(g,d,[e,e.endpoints[1],e.endpoints[1].anchor.constructor===c.DynamicAnchor]),e.endpoints[1].anchor.isContinuous&&(e.source===e.target?e._jsPlumb.instance.removeElement(e.endpoints[1].canvas):null==e.endpoints[1].canvas.parentNode&&e._jsLine truncated
display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+d),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(a,b){c.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},c.extend(b.Endpoints.Blank,[b.Endpoints.AbstractEndpoint,f],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),b.Endpoints.Triangle=function(a){this.type="Triangle",b.Endpoints.AbstractEndpoint.apply(this,arguments);var c=this;a=a||{},a.width=a.width||55,a.height=a.height||55,this.width=a.width,this.height=a.height,this._compute=function(a,b,d,e){var f=d.width||c.width,g=d.height||c.height,h=a[0]-f/2,i=a[1]-g/2;return[h,i,f,g]}};var g=b.Overlays.AbstractOverlay=function(a){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=a.component,this.loc=null==a.location?.5:a.location,this.endpointLoc=null==a.endpointLocation?[.5,.5]:a.endpointLocation,this.visible=a.visible!==!1};g.prototype={cleanup:function(a){a&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(a,b){},setVisible:function(a){this.visible=a,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(a){this.loc+=a,this.component.repaint()},setLocation:function(a){this.loc=a,this.component.repaint()},getLocation:function(){return this.loc},updateFrom:function(){}},b.Overlays.Arrow=function(a){this.type="Arrow",g.apply(this,arguments),this.isAppendedAtTopLevel=!1,a=a||{};var e=this;this.length=a.length||20,this.width=a.width||20,this.id=a.id,this.direction=(a.direction||1)<0?-1:1;var f=a.paintStyle||{"stroke-width":1},h=a.foldback||.623;this.computeMaxSize=function(){return 1.5*e.width},this.elementCreated=function(c,d){if(this.path=c,a.events)for(var e in a.events)b.on(c,e,a.events[e])},this.draw=function(a,b){var e,g,i,j,k;if(a.pointAlongPathFrom){if(c.isString(this.loc)||this.loc>1||this.loc<0){var l=parseInt(this.loc,10),m=this.loc<0?1:0;e=a.pointAlongPathFrom(m,l,!1),g=a.pointAlongPathFrom(m,l-this.direction*this.length/2,!1),i=d.pointOnLine(e,g,this.length)}else if(1===this.loc){if(e=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,-this.length),i=d.pointOnLine(e,g,this.length),-1===this.direction){var n=i;i=e,e=n}}else if(0===this.loc){if(i=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,this.length),e=d.pointOnLine(i,g,this.length),-1===this.direction){var o=i;i=e,e=o}}else e=a.pointAlongPathFrom(this.loc,this.direction*this.length/2),g=a.pointOnPath(this.loc),i=d.pointOnLine(e,g,this.length);j=d.perpendicularLineTo(e,i,this.width),k=d.pointOnLine(e,i,h*this.length);var p={hxy:e,tail:j,cxy:k},q=f.stroke||b.stroke,r=f.fill||b.stroke,s=f.strokeWidth||b.strokeWidth;return{component:a,d:p,"stroke-width":s,stroke:q,fill:r,minX:Math.min(e.x,j[0].x,j[1].x),maxX:Math.max(e.x,j[0].x,j[1].x),minY:Math.min(e.y,j[0].y,j[1].y),maxY:Math.max(e.y,j[0].y,j[1].y)}}return{component:a,minX:0,maxX:0,minY:0,maxY:0}}},c.extend(b.Overlays.Arrow,g,{updateFrom:function(a){this.length=a.length||this.length,this.width=a.width||this.width,this.direction=null!=a.direction?a.direction:this.direction,this.foldback=a.foldback||this.foldback},cleanup:function(){this.path&&this.canvas&&this.canvas.removeChild(this.path)}}),b.Overlays.PlainArrow=function(a){a=a||{};var c=b.extend(a,{foldback:1});b.Overlays.Arrow.call(this,c),this.type="PlainArrow"},c.extend(b.Overlays.PlainArrow,b.Overlays.Arrow),b.Overlays.Diamond=function(a){a=a||{};var c=a.length||40,d=b.extend(a,{length:c/2,foldback:2});b.Overlays.Arrow.call(this,d),this.type="Diamond"},c.extend(b.Overlays.Diamond,b.Overlays.Arrow);var h=function(a,b){return(null==a._jsPlumb.cachedDimensions||b)&&(a._jsPlumb.cachedDimensions=a.getDimensions()),a._jsPlumb.cachedDimensions},i=function(a){b.jsPlumbUIComponent.apply(this,arguments),g.apply(this,arguments);var d=this.fire;this.fire=function(){d.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,this.id=a.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=a.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=a.create,this._jsPlumb.initiallyInvisible=a.visible===!1,this.getElement=function(){if(null==this._jsPlumb.div){var c=this._jsPlumb.div=b.getElement(this._jsPlumb.create(this._jsPlumb.component));c.style.position="absolute",jsPlumb.addClass(c,this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:a.cssClass?a.cssClass:"")),this._jsPlumb.instance.appendElement(c),this._jsPlumb.instance.getId(c),this.canvas=c;var d="translate(-50%, -50%)";c.style.webkitTransform=d,c.style.mozTransform=d,c.style.msTransform=d,c.style.oTransform=d,c.style.transform=d,c._jsPlumb=this,a.visible===!1&&(c.style.display="none")}return this._jsPlumb.div},this.draw=function(a,b,d){var e=h(this);if(null!=e&&2===e.length){Line truncated
return t("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(a){s(a,{cx:this.w/2,cy:this.h/2,r:this.radius})}},c.extend(b.Endpoints.svg.Dot,[b.Endpoints.Dot,A]),b.Endpoints.svg.Rectangle=function(){b.Endpoints.Rectangle.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(a){return t("rect",{width:this.w,height:this.h})},this.updateNode=function(a){s(a,{width:this.w,height:this.h})}},c.extend(b.Endpoints.svg.Rectangle,[b.Endpoints.Rectangle,A]),b.Endpoints.svg.Image=b.Endpoints.Image,b.Endpoints.svg.Blank=b.Endpoints.Blank,b.Overlays.svg.Label=b.Overlays.Label,b.Overlays.svg.Custom=b.Overlays.Custom;var B=function(a,c){a.apply(this,c),b.jsPlumbUIComponent.apply(this,c),this.isAppendedAtTopLevel=!1;this.path=null,this.paint=function(a,b){if(a.component.svg&&b){null==this.path&&(this.path=t("path",{"pointer-events":"all"}),a.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,a.component),this.canvas=a.component.svg);var e=c&&1===c.length?c[0].cssClass||"":"",f=[0,0];b.xmin<0&&(f[0]=-b.xmin),b.ymin<0&&(f[1]=-b.ymin),s(this.path,{d:d(a.d),"class":e,stroke:a.stroke?a.stroke:null,fill:a.fill?a.fill:null,transform:"translate("+f[0]+","+f[1]+")"})}};var d=function(a){return isNaN(a.cxy.x)||isNaN(a.cxy.y)?"":"M"+a.hxy.x+","+a.hxy.y+" L"+a.tail[0].x+","+a.tail[0].y+" L"+a.cxy.x+","+a.cxy.y+" L"+a.tail[1].x+","+a.tail[1].y+" L"+a.hxy.x+","+a.hxy.y};this.transfer=function(a){a.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),a.canvas.appendChild(this.path))}};c.extend(B,[b.jsPlumbUIComponent,b.Overlays.AbstractOverlay],{cleanup:function(a){null!=this.path&&(a?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(a,b){this.path&&b.canvas&&b.canvas.appendChild(this.path)},setVisible:function(a){null!=this.path&&(this.path.style.display=a?"block":"none")}}),b.Overlays.svg.Arrow=function(){B.apply(this,[b.Overlays.Arrow,arguments])},c.extend(b.Overlays.svg.Arrow,[b.Overlays.Arrow,B]),b.Overlays.svg.PlainArrow=function(){B.apply(this,[b.Overlays.PlainArrow,arguments])},c.extend(b.Overlays.svg.PlainArrow,[b.Overlays.PlainArrow,B]),b.Overlays.svg.Diamond=function(){B.apply(this,[b.Overlays.Diamond,arguments])},c.extend(b.Overlays.svg.Diamond,[b.Overlays.Diamond,B]),b.Overlays.svg.GuideLines=function(){var a,c,d=null,e=this;b.Overlays.GuideLines.apply(this,arguments),this.paint=function(b,g){null==d&&(d=t("path"),b.connector.svg.appendChild(d),e.attachListeners(d,b.connector),e.attachListeners(d,e),a=t("path"),b.connector.svg.appendChild(a),e.attachListeners(a,b.connector),e.attachListeners(a,e),c=t("path"),b.connector.svg.appendChild(c),e.attachListeners(c,b.connector),e.attachListeners(c,e));var h=[0,0];g.xmin<0&&(h[0]=-g.xmin),g.ymin<0&&(h[1]=-g.ymin),s(d,{d:f(b.head,b.tail),stroke:"red",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(a,{d:f(b.tailLine[0],b.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(c,{d:f(b.headLine[0],b.headLine[1]),stroke:"green",fill:null,transform:"translate("+h[0]+","+h[1]+")"})};var f=function(a,b){return"M "+a.x+","+a.y+" L"+b.x+","+b.y}},c.extend(b.Overlays.svg.GuideLines,b.Overlays.GuideLines)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Katavorio,e=a.Biltong,f=function(b){var c=b._mottle;return c||(c=b._mottle=new a.Mottle),c},g=function(a,c){c=c||"main";var f="_katavorio_"+c,g=a[f],h=a.getEventManager();return g||(g=new d({bind:h.on,unbind:h.off,getSize:b.getSize,getConstrainingRectangle:function(a){return[a.parentNode.scrollWidth,a.parentNode.scrollHeight]},getPosition:function(b,c){var d=a.getOffset(b,c,b._katavorioDrag?b.offsetParent:null);return[d.left,d.top]},setPosition:function(a,b){a.style.left=b[0]+"px",a.style.top=b[1]+"px"},addClass:b.addClass,removeClass:b.removeClass,intersects:e.intersects,indexOf:function(a,b){return a.indexOf(b)},scope:a.getDefaultScope(),css:{noSelect:a.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}}),g.setZoom(a.getZoom()),a[f]=g,a.bind("zoom",g.setZoom)),g},h=function(a){var b=a.el._jsPlumbDragOptions,c=!0;return b.canDrag&&(c=b.canDrag()),c&&(this.setHoverSuspended(!0),this.select({source:a.el}).addClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:a.el}).addClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.setConnectionBeingDragged(!0)),c},i=function(a){var b=this.getUIPosition(arguments,this.getZoom());if(null!=b){var c=a.el._jsPlumbDragOptions;this.draw(a.el,b,null,!0),c._dragging&&this.addClass(a.el,"jtk-dragged"),c._dragging=!0}},j=function(a){for(var b,c=a.selection,d=function(a){null!=a[1]&&(b=this.getUIPosition([{el:a[2].el,pos:[a[1].left,aLine truncated
@@ -0,0 +1,602 @@
/*
Default styles for jsPlumb Toolkit
Copyright 2018 https://jsplumbtoolkit.com
*/
/* --------------------------------------------------------------------------------------------- */
/* --- SURFACE WIDGET -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*
Assigned to every Node managed by an instance of the Toolkit. They are required to be positioned absolute, to
enable dragging to work properly.
*/
.jtk-node {
position: absolute;
}
/*
Assigned to every Group managed by an instance of the Toolkit. They are required to be positioned absolute, to
enable dragging to work properly. We set overflow:visible on Group elements too, as a drag outside of the bounds
is automatically reverted anyway, and without overflow:visible you cannot drag a node to some other element. You can
also drag a node out of the element's viewport and if you drop it you can never get it back.
*/
.jtk-group {
position: absolute;
overflow: visible;
}
/*
This is the attribute used to mark which part of a Group DOM element should contain the child Nodes. We mark it
as having `position:relative` so that the absolute positioned Nodes are drawn correctly.
*/
[jtk-group-content] {
position:relative;
}
/*
This style was created in response to this Chrome bug:
http://stackoverflow.com/questions/13758215/artifacts-when-css-scaled-in-chrome
Basically it's about how sometimes there can be artefacts left on screen when the user drags an element. It seems
the issue has been fixed in more recent versions of Chrome, but the style is left here in case you come across
the problem.
*/
.jtk-node.jtk-drag {
/*-webkit-backface-visibility: hidden;*/
}
/*
Suppresses the pointer events on an element that was created by Katavorio in response to a drag in which the element
should first be cloned. Having this clone ignore pointer events means there is less chance that any other
mouse activity (such as click) on the original element will not be consumed by katavorio.
*/
.katavorio-clone-drag {
pointer-events:none;
}
/*
Assigned to an element that is the `Container` in a `render` call.
Elements that are acting as Surface widgets should have overflow:hidden set to prevent libs from
scrolling them during drag (we don't want scrollbars; we have an infinite canvas). Position is set to
`relative` as this is the parent for nodes, which are positioned absolute (and for absolute positioning
to work, you need to ensure the parent node has `position:relative`). This style also sets some default
values for the cursor - using a `grab` cursor where supported.
*/
.jtk-surface {
overflow: hidden !important;
position: relative;
cursor: move;
cursor: -moz-grab;
cursor: -webkit-grab;
/*
For IE10+. As discussed on this page:
https://msdn.microsoft.com/en-us/library/ie/jj583807(v=vs.85).aspx
Microsoft have very helpfully implemented default behaviours for a bunch of touch events and
then consumed the events so you don't have to be bothered by them. They've "done a lot of research"
about this stuff and put together a really great default experience for everyone in the entire world.
*/
touch-action:none;
/*
Another Chrome issue that appears to have been fixed in later versions
http://stackoverflow.com/questions/15464055/css-transition-effect-makes-image-blurry-moves-image-1px-in-chrome
*/
/*
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
*/
}
/*
Assigned to the surface when it is being panned. The default is to change the cursor (in browsers that support
a `grabbing` cursor), and to disable text selection.
*/
.jtk-surface-panning {
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*
The work area in a surface renderer.
*/
.jtk-surface-canvas {
overflow: visible !important;
}
/*
For IE10+. Discussed above in the .jtk-surface styles. This one is specific to elements that are configured
to be droppable on a Surface via its `registerDroppableNodes` method.
*/
.jtk-surface-droppable-node {
touch-action:none;
}
/*
Assigned to a Surface widget when panning is disabled (and therefore the app is relying on scrollbars when the content overflows).
*/
.jtk-surface-nopan {
overflow: scroll !important;
cursor:default;
}
/*
Assigned to tile images in a tiled background
*/
.jtk-surface-tile {
border:none;
outline:none;
margin:0;
-webkit-transition: opacity .3s ease .15s;
-moz-transition: opacity .3s ease .15s;
-o-transition: opacity .3s ease .15s;
-ms-transition: opacity .3s ease .15s;
transition: opacity .3s ease .15s;
}
/*
Assigned to the element used for node select with the mouse ("lasso").
*/
.jtk-lasso {
border: 2px solid rgb(49, 119, 184);
background-color: WhiteSmoke;
opacity: 0.5;
display: none;
z-index: 20000;
position: absolute;
}
/*
This class is added to the document body on lasso drag start and removed at the end of lasso dragging. Its purpose
is to switch off text selection on all elements while the user is dragging the lasso.
*/
.jtk-lasso-select-defeat * {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/**
Added to the lasso mask when it is operating in 'inverted' mode, ie. the excluded parts of the UI are covered, rather
than the normal mode in which the selected parts of the UI are covered.
*/
.jtk-lasso-mask {
position:fixed;
z-index:20000;
display:none;
opacity:0.5;
background-color: #07234E;
top:0;
bottom:0;
left:0;
right:0;
}
/*
Assigned to some element that has been selected (either via lasso or programmatically).
*/
.jtk-surface-selected-element {
border: 2px dashed #f76258 !important;
}
/*
Assigned to all pan buttons in a surface widget.
*/
.jtk-surface-pan {
background-color: Azure;
opacity: 0.4;
text-align: center;
cursor: pointer;
z-index: 2;
-webkit-transition: background-color 0.15s ease-in;
-moz-transition: background-color 0.15s ease-in;
-o-transition: background-color 0.15s ease-in;
transition: background-color 0.15s ease-in;
}
/*
Specific styles for the top and bottom pan buttons.
Top/bottom are 100% width and 20px high by default
*/
.jtk-surface-pan-top, .jtk-surface-pan-bottom {
width: 100%;
height: 20px;
}
/*
Hover styles for all pan buttons.
On hover, change color, background color, font weight and opacity.
*/
.jtk-surface-pan-top:hover, .jtk-surface-pan-bottom:hover, .jtk-surface-pan-left:hover, .jtk-surface-pan-right:hover {
opacity: 0.6;
background-color: rgb(49, 119, 184);
color: white;
font-weight: bold;
}
/*
Specific styles for the left and right pan buttons.
Left/right pan buttons are 100% height and 20px wide
*/
.jtk-surface-pan-left, .jtk-surface-pan-right {
width: 20px;
height: 100%;
line-height: 40;
}
/*
Assigned to a pan button when the user is pressing it.
*/
.jtk-surface-pan-active, .jtk-surface-pan-active:hover {
background-color: #f76258;
}
/* --------------------------------------------------------------------------------------------- */
/* --- MINIVIEW WIDGET ------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*
Assigned to an element that is acting as a Miniview.
As with Surface, Miniview elements should have overflow:hidden set to prevent
libs from scrolling them during drag. This style also provides a default width/height for a miniview,
which you may wish to override.
*/
.jtk-miniview {
overflow: hidden !important;
width: 125px;
height: 125px;
position: relative;
background-color: #B2C9CD;
border: 1px solid #E2E6CD;
border-radius: 4px;
opacity: 0.8;
}
/*
Assigned to the element that shows the size of the related viewport in a Miniview widget, and which can be dragged to
move the surface.
*/
.jtk-miniview-panner {
border: 5px dotted WhiteSmoke;
opacity: 0.4;
background-color: rgb(79, 111, 126);
cursor: move;
cursor: -moz-grab;
cursor: -webkit-grab;
}
/*
Assigned to the miniview's panner when it is being dragged.
*/
.jtk-miniview-panning {
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
/*
Added to all elements displayed in a miniview.
*/
.jtk-miniview-element {
background-color: rgb(96, 122, 134);
position: absolute;
}
/*
Added to Group elements displayed in a miniview
*/
.jtk-miniview-group-element {
background: transparent;
border: 2px solid rgb(96,122,134);
}
/*
Assigned to the collapse/expand miniview button
*/
.jtk-miniview-collapse {
color: whiteSmoke;
position: absolute;
font-size: 18px;
top: -1px;
right: 3px;
cursor: pointer;
font-weight: bold;
}
/*
The '-' symbol when the miniview is expanded
*/
.jtk-miniview-collapse:before {
content: "\2012";
}
/*
Assigned to the miniview element when it is collapsed.
*/
.jtk-miniview-collapsed {
background-color: #449ea6;
border-radius: 4px;
height: 22px;
margin-right: 0;
padding: 4px;
width: 21px;
}
/*
Hide all children of the miniview (except the expand button) when it is collapsed so you don't see anything
poking through under the + icon.
*/
.jtk-miniview-collapsed .jtk-miniview-element, .jtk-miniview-collapsed .jtk-miniview-panner {
visibility: hidden;
}
/*
The '+' symbol when the miniview is collapsed.
*/
.jtk-miniview-collapsed .jtk-miniview-collapse:before {
content: "+";
}
/*
Hover state for the collapse/expand icon.
*/
.jtk-miniview-collapse:hover {
color: #E4F013;
}
/* ------------------------------------------------------------------------------------------- */
/* --- DIALOGS --------------------------------------------------------------------------------*/
/* ------------------------------------------------------------------------------------------- */
/*
This is the element that acts as the dialog underlay - the modal "mask". Note the high z-index default
set here (and note also the overlay style below has a z-index with a value higher by one).
*/
.jtk-dialog-underlay {
left: 0;
right: 0;
top: 0;
bottom: 0;
position: fixed;
z-index: 100000;
opacity: 0.8;
background-color: #CCC;
display: none;
}
/*
This is the element that acts as the parent for dialog content.
*/
.jtk-dialog-overlay {
position: fixed;
z-index: 100001;
display: none;
background-color: white;
font-family: "Open Sans", sans-serif;
padding: 7px;
box-shadow: 0 0 5px gray;
overflow: hidden;
}
.jtk-dialog-overlay-x {
max-height:0;
transition: max-height 0.5s ease-in;
-moz-transition: max-height 0.5s ease-in;
-ms-transition: max-height 0.5s ease-in;
-o-transition: max-height 0.5s ease-in;
-webkit-transition: max-height 0.5s ease-in;
}
.jtk-dialog-overlay-y {
max-width:0;
transition: max-width 0.5s ease-in;
-moz-transition: max-width 0.5s ease-in;
-ms-transition: max-width 0.5s ease-in;
-o-transition: max-width 0.5s ease-in;
-webkit-transition: max-width 0.5s ease-in;
}
.jtk-dialog-overlay-top {
top:20px;
}
.jtk-dialog-overlay-bottom {
bottom:20px;
}
.jtk-dialog-overlay-left {
left:20px;
}
.jtk-dialog-overlay-right {
right:20px;
}
.jtk-dialog-overlay-x.jtk-dialog-overlay-visible {
max-height:1000px;
}
.jtk-dialog-overlay-y.jtk-dialog-overlay-visible {
max-width:1000px;
}
/*
The element containing buttons in a dialog.
*/
.jtk-dialog-buttons {
text-align: right;
margin-top: 5px;
}
/*
An individual button in a dialog.
*/
.jtk-dialog-button {
border: none;
cursor: pointer;
margin-right: 5px;
min-width: 56px;
background-color: white;
outline: 1px solid #ccc;
}
/*
Hover style for an individual button in a dialog.
*/
.jtk-dialog-button:hover {
color: white;
background-color: #234b5e;
}
/*
The titlebar of a dialog.
*/
.jtk-dialog-title {
text-align: left;
font-size: 14px;
margin-bottom: 9px;
}
.jtk-dialog-content {
font-size:12px;
text-align:left;
min-width:250px;
margin: 0 14px;
}
.jtk-dialog-content ul {
width:100%;
padding-left:0;
}
.jtk-dialog-content label {
cursor: pointer;
font-weight: inherit;
}
.jtk-dialog-overlay input, .jtk-dialog-overlay textarea {
background-color: #FFF;
border: 1px solid #CCC;
color: #333;
font-size: 14px;
font-style: normal;
outline: none;
padding: 6px 4px;
margin-right: 6px;
}
.jtk-dialog-overlay input:focus, .jtk-dialog-overlay textarea:focus {
background-color: #cbeae1;
border: 1px solid #83b8a8;
color: #333;
font-size: 14px;
font-style: normal;
outline: none;
}
/* -------------------------------------------------------------------------------------------- */
/* --- DRAWING TOOLS -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------------------------- */
/*
Assigned to the element that is drawn around some other element when a drawing operation is taking place.
*/
.jtk-draw-skeleton {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
outline: 2px solid #84acb3;
opacity: 0.8;
}
/*
Assigned to every handle (top left, top right, bottom left, bottom right, center) in a draw skeleton.
*/
.jtk-draw-handle {
position: absolute;
width: 7px;
height: 7px;
background-color: #84acb3;
}
/*
Assigned to the top left handle in a draw skeleton
*/
.jtk-draw-handle-tl {
left: 0;
top: 0;
cursor: nw-resize;
}
/*
Assigned to the top right handle in a draw skeleton
*/
.jtk-draw-handle-tr {
right: 0;
top: 0;
cursor: ne-resize;
}
/*
Assigned to the bottom left handle in a draw skeleton
*/
.jtk-draw-handle-bl {
left: 0;
bottom: 0;
cursor: sw-resize;
}
/*
Assigned to the bottom right handle in a draw skeleton
*/
.jtk-draw-handle-br {
bottom: 0;
right: 0;
cursor: se-resize;
}
/*
Assigned to the center handle in a draw skeleton (the handle by which the element may be dragged). This is
not visible by defaut; enable if you need it.
*/
.jtk-draw-drag {
display:none;
position: absolute;
left: 50%;
top: 50%;
margin-left: -10px;
margin-top: -10px;
width: 20px;
height: 20px;
background-color: #84acb3;
cursor: move;
}
/*
This class is added to the document body on drag resize start and removed at the end of resizing. Its purpose
is to switch off text selection on all elements while the user is resizing an element.
*/
.jtk-drag-select-defeat * {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
+271
View File
@@ -0,0 +1,271 @@
'use strict';
const Service = require('egg').Service;
const { tableEnum, articlePublishStatusEnum } = require("../constant/constant");
const _ = require("lodash");
const path = require("path");
// TODO: 封装一下
const dayjs = require("dayjs");
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone') // dependent on utc plugin
dayjs.extend(utc)
dayjs.extend(timezone)
const idGenerateUtil = require("egg-jianghu/app/common/idGenerateUtil");
const validateUtil = require("egg-jianghu/app/common/validateUtil");
const { BizError, errorInfoEnum } = require("../constant/error");
const fs = require("fs"),
fsPromises = require("fs").promises,
unlink = fsPromises.unlink,
rename = fsPromises.rename,
util = require("util"),
exists = util.promisify(fs.exists);
const actionDataScheme = Object.freeze({
deletedArticle: {
type: "object",
additionalProperties: true,
required: ["articleId"],
properties: {
articleId: { anyOf: [{ type: "string" }, { type: "number" }] },
},
},
});
class TaskService extends Service {
async whereToUserId() {
const { where } = this.ctx.request.body.appData;
const { userId, username } = this.ctx.userInfo;
where.createByUser = userId;
}
async createTaskId() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
// const { workflowId, taskTitle, taskFormStructure, taskFormData } = actionData;
const { workflowId, taskTitle, workflowForm, workflowFormData } = actionData;
const { userId, username } = this.ctx.userInfo;
actionData.taskId = await idGenerateUtil.idPlus({
knex: jianghuKnex,
startValue: 1000,
tableName: tableEnum.task,
columnName: "taskId"
});
const workflow = await jianghuKnex(tableEnum.workflow).where({workflowId}).first();
if (!workflow) {
throw new BizError(errorInfoEnum.workflow_not_found)
return
}
const { workflowConfig } = workflow;
const {nodeList = [], lineList = []} = JSON.parse(workflowConfig || '{}');
actionData.workflowConfig = workflowConfig;
// start 节点进入历史
const start = nodeList.find(e => e.id.includes('start-'));
const line = lineList.find(e => e.from === start.id);
if (line) {
// 寻找start开始线路 task存储第二个节点
const nextNode = nodeList.find(e => e.id === line.to);
const userNode = nodeList.filter(e => e.id.includes('userTask') || e.id.includes('receiveTask') );
const allUser = await this.getProcessUserList(userNode);
const taskProcessorList = await this.getProcessUserList([nextNode]);
const nextLine = lineList.filter(e => e.from === nextNode.id);
// 组建默认knex data
actionData.taskStatus = 'running';
actionData.taskConfigId = nextNode.id;
actionData.taskNextConfigList = JSON.stringify(nextLine);
actionData.taskEditUserList = taskProcessorList;
actionData.taskViewUserList = allUser;
actionData.createByUser = userId;
actionData.taskInitUser = userId;
// workflowFormInput 1. 上表单数据 2. 待输入 3. 总表单
// 起始节点 无上一个
actionData.taskFormInput = JSON.stringify({
input: workflowFormData,
formList: workflowForm
});
delete actionData.workflowForm;
delete actionData.workflowFormData;
delete actionData.workflowId;
const history = {
...actionData,
taskExplain: start.label,
taskHandleDesc: '流转',
taskLineFrom: line.from,
taskLineTo: line.to,
taskLineLabel: line.type + '-' + line.label,
taskCostDuration: 0
}
const insert = await jianghuKnex(tableEnum.task_history).insert(history);
} else {
throw new BizError(errorInfoEnum.article_not_found);
}
}
async getGroupUserList(groupId) {
const { jianghuKnex, config } = this.app;
const userList = await jianghuKnex(tableEnum._user_group_role).where({groupId}).select('userId');
return userList.map(e => {
return e.userId
});
}
async getProcessUserList(nodeList) {
let userIds = []
for(const item of nodeList) {
const {assignValue, assignType} = item;
if (assignType === 'person') {
userIds = [...userIds, ...assignValue];
} else if (assignType === 'group') {
userIds = [...userIds, ...await this.getGroupUserList(assignValue)];
}
}
return _.uniq(userIds).join(',');
}
async taskCareUser() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
const { userId: careUser, taskId } = actionData;
const { userId } = this.ctx.userInfo;
const taskInfo = await jianghuKnex(tableEnum.task).where({taskId}).first();
// 转交写入历史
const history = {
taskId: taskId,
taskNode: '转交',
historyForm: line.from,
historyTo: line.to,
historyChooseName: line.label,
historyCostDuration: 0
}
await jianghuKnex(tableEnum.task_history).insert(history);
// 修改task处理人
const taskProcessorList = taskInfo.taskProcessorList.replace(userId, careUser);
await jianghuKnex(tableEnum.task).where({taskId}).update({taskProcessorList});
}
/**
* 工单历史信息
* @returns
*/
async getTaskHistoryInfo() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
const { taskId } = actionData;
const { userId } = this.ctx.userInfo;
const taskInfo = await jianghuKnex(tableEnum.task).where({taskId}).first();
// 获取process 流程、根据节点线路组建步骤条
if (!taskInfo) {
throw new BizError(errorInfoEnum.task_not_found);
}
const taskStepperList = this.makeStepper(taskInfo.workflowConfig);
taskInfo.workflowConfig = JSON.parse(taskInfo.workflowConfig);
// 查找task 任务历史列表
const taskHistoryList = await jianghuKnex(tableEnum.task_history).where({taskId}).orderBy('id', 'asc').select();
const isAccess = taskInfo.taskEditUserList.includes(userId);
const nextLineList = taskInfo.taskStatus === 'running' ? JSON.parse(taskInfo.taskNextConfigList) : [];
const taskTpl = JSON.parse(taskInfo.taskFormInput || '{"prev": {}, "input": {}, "formList": []}');
const currentNode = taskInfo.workflowConfig.nodeList.find(e => e.id === taskInfo.taskConfigId);
return {taskStepperList, taskHistoryList, isAccess, nextLineList, taskTpl, step: taskStepperList.find(e => currentNode.id === e.id).value, currentNode: taskInfo.workflowConfig.nodeList.find(e => e.id === taskInfo.taskConfigId)};
}
/**
* 制作节点步骤list
* @param {*} processInfo
* @returns
*/
makeStepper(workflowStructure) {
const {nodeList = [], lineList = []} = JSON.parse(workflowStructure || '{}');
const start = nodeList.find(e => e.id.includes('start-'));
const nodeSortList = [];
nodeSortList.push(start);
for(let i = 0; i < nodeList.length; i++) {
const nodeCache = this.getNextNodeSetup(nodeList, lineList, nodeSortList);
nodeSortList.push(nodeCache)
if (nodeSortList.length >= nodeList.length) break;
}
const stepperList = []
let i = 1;
for (const item of nodeSortList) {
stepperList.push({value: i, text: item.label, id: item.id});
i++;
}
return stepperList;
}
/**
* 获取下一个步骤节点
* @param {*} nodeAllList
* @param {*} lineAllList
* @param {*} nodeSortList
* @returns
*/
getNextNodeSetup(nodeAllList, lineAllList, nodeSortList) {
const lastNode = nodeSortList[nodeSortList.length - 1];
const lineList = lineAllList.filter(e => e.from === lastNode.id);
if (!lineList) {
// 线路不存在
}
const lineIds = lineList.map(e => { return e.to });
return nodeAllList.find(e => lineIds.includes(e.id) && !(nodeSortList.find(s => s.id === e.id)));
}
async submitNode() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
const { type, taskId, taskRemark, taskTpl, taskComment } = actionData;
const { userId, username } = this.ctx.userInfo;
const taskInfo = await jianghuKnex(tableEnum.task).where({taskId}).first();
delete taskInfo.id;
const {nodeList = [], lineList = []} = JSON.parse(taskInfo.workflowConfig || '{}');
const nLineList = JSON.parse(taskInfo.taskNextConfigList);
const line = nLineList.find(e => e.type === type);
const currentNode = nodeList.find(e => e.id === taskInfo.taskConfigId);
// 写入exec历史
const prevHistory = await jianghuKnex(tableEnum.task_history).where({taskId}).orderBy('operationAt', 'desc').first();
let taskFormInput = JSON.parse(taskInfo.taskFormInput);
taskFormInput.prev = taskFormInput.input;
taskFormInput.input = taskTpl.input;
taskFormInput = JSON.stringify(taskFormInput);
const history = {
...taskInfo,
taskExplain: currentNode.label,
taskConfigId: currentNode.id,
taskHandleDesc: line.label + '-' + line.type,
taskLineFrom: line.from,
taskLineTo: line.to,
taskLineLabel: line.type + '-' + line.label,
taskCostDuration: parseInt((new Date().getTime() - new Date(prevHistory.operationAt).getTime()) / 1000)
}
await jianghuKnex(tableEnum.task_history).insert(history);
// 修改任务步骤node 处理人\
const nextLineList = lineList.filter(e => e.from === line.to);
if (line.to.includes('end-')) {
const endHistory = {
...history,
taskExplain: '结束',
taskConfigId: currentNode.id,
taskHandleDesc: '流程结束',
taskLineFrom: line.from,
taskLineTo: line.to,
taskLineLabel: line.type + '-' + line.label,
taskCostDuration: 0,
operationByUser: username,
operationByUserId: userId,
}
await jianghuKnex(tableEnum.task_history).insert(endHistory);
}
const taskEditUserList = await this.getProcessUserList([currentNode]);
const nextNode = nodeList.find(e => e.id === line.to);
await jianghuKnex(tableEnum.task).where({taskId}).update({
taskFormInput,
taskRemark,
taskNextConfigList: JSON.stringify(nextLineList),
taskEditUserList,
taskConfigId: nextNode.id,
taskStatus: (nextLineList.length === 0 || currentNode.id.includes('end-')) ? 'end' : type === 'deny' ? 'deny' : 'running',
taskComment
});
}
}
module.exports = TaskService;
+85
View File
@@ -0,0 +1,85 @@
'use strict';
const Service = require('egg').Service;
const { tableEnum, articlePublishStatusEnum } = require("../constant/constant");
const _ = require("lodash");
const path = require("path");
// TODO: 封装一下
const dayjs = require("dayjs");
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone') // dependent on utc plugin
dayjs.extend(utc)
dayjs.extend(timezone)
const idGenerateUtil = require("egg-jianghu/app/common/idGenerateUtil");
const validateUtil = require("egg-jianghu/app/common/validateUtil");
const { BizError, errorInfoEnum } = require("../constant/error");
const fs = require("fs"),
fsPromises = require("fs").promises,
unlink = fsPromises.unlink,
rename = fsPromises.rename,
util = require("util"),
exists = util.promisify(fs.exists);
const actionDataScheme = Object.freeze({
deletedArticle: {
type: "object",
additionalProperties: true,
required: ["articleId"],
properties: {
articleId: { anyOf: [{ type: "string" }, { type: "number" }] },
},
},
});
class WorkflowService extends Service {
async createTplId() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
actionData.formId = await idGenerateUtil.idPlus({
knex: jianghuKnex,
startValue: 1000,
tableName: tableEnum.form,
columnName: "formId"
});
}
async createWorkflowId() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
actionData.workflowId = await idGenerateUtil.idPlus({
knex: jianghuKnex,
startValue: 1000,
tableName: tableEnum.workflow,
columnName: "workflowId"
});
}
async assignTplData() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
let { tplId } = actionData;
const tplIds = tplId ? tplId.split(',') : [];
if (tplIds.length) {
const tplList = await jianghuKnex(tableEnum.form).whereIn('formId', tplIds).select();
let formList = [];
const formData = {};
for( const item of tplList) {
const cache = JSON.parse(item.formStructure);
for(const i of cache) {
i.tplId = item.tplId
}
formList = [...formList, ...cache];
for(const it of cache) {
formData[it.id] = '';
}
}
actionData.tplFormStructure = JSON.stringify(formList);
} else {
actionData.tplFormStructure = '[]';
}
console.log(actionData);
}
}
module.exports = WorkflowService;
+47
View File
@@ -0,0 +1,47 @@
<template id="edit-flow">
<!-- <el-form :model="flowData" ref="dataForm" label-width="100px" class="flowEditForm margin13" size="mini">
<el-form-item label="GUID">
<el-input disabled v-model="flowData.Id"></el-input>
</el-form-item>
<el-form-item label="流程名称">
<el-input v-model="flowData.Name"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="flowData.Remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
</el-form-item>
</el-form> -->
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="GUID" v-model="flowData.Id"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="流程名称" v-model="flowData.Name"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="flowData.Remark"></v-text-field>
</v-col>
</v-row>
</v-form>
</template>
<script>
Vue.component("edit-flow", {
template: '#edit-flow',
vuetify: new Vuetify(),
name: 'editFlow',
data() {
return {
flowData: {},
isFormValid: true
}
},
methods: {
init(data) {
this.flowData = data;
},
}
})
</script>
+88
View File
@@ -0,0 +1,88 @@
<template id="edit-line">
<!-- <el-form :model="line" ref="dataForm" label-width="100px" class="flowEditForm margin13" size="mini">
<el-form-item label="GUID">
<el-input disabled v-model="line.id"></el-input>
</el-form-item>
<el-form-item label="源活动">
<el-input disabled v-model="line.from"></el-input>
</el-form-item>
<el-form-item label="目标活动">
<el-input disabled v-model="line.to"></el-input>
</el-form-item>
<el-form-item label="名称">
<el-input v-model="line.label"></el-input>
</el-form-item>
<el-form-item label="备注说明">
<el-input v-model="line.Remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
</el-form-item>
</el-form> -->
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="GUID" v-model="line.id"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined disabled label="源活动" v-model="line.from"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined disabled label="目标活动" v-model="line.to"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="名称" v-model="line.label"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-select
:items="lineTypeList"
dense outlined
class="cus-v-input mr-2"
label="操作类型"
outlined
v-model="line.type"
></v-select>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务Resource" v-model="line.hook"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注说明" v-model="line.Remark"></v-text-field>
</v-col>
</v-row>
</v-form>
</template>
<script>
Vue.component("edit-line", {
template: '#edit-line',
vuetify: new Vuetify(),
name: 'editLine',
data() {
return {
line: { label: '' },
isUpdate: false,
isFormValid: true,
lineTypeList: []
}
},
watch: {
line: {
handler(val) {
if (this.isUpdate) {
this.$emit('line-save', this.line);
}
},
deep: true
}
},
methods: {
init(item, lineTypeList) {
this.isUpdate = false;
this.line = item;
this.lineTypeList = lineTypeList;
this.$nextTick(function () {
this.isUpdate = true;
});
},
}
})
</script>
+185
View File
@@ -0,0 +1,185 @@
<template id="edit-node">
<!-- <el-form :model="node" ref="dataForm" label-width="100px" class="flowEditForm margin13" size="mini">
<el-form-item label="GUID">
<el-input disabled v-model="node.id"></el-input>
</el-form-item>
<el-form-item label="名称">
<el-input v-model="node.label"></el-input>
</el-form-item>
<el-form-item label="活动类型">
<el-select v-model="node.Type" placeholder="请选择">
<el-option v-for="item in TypeList" :key="item.Value" :label="item.Text" :value="item.Value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="node.Remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
</el-form-item>
</el-form> -->
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input" dense outlined label="GUID" v-model="node.id"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input" dense outlined label="名称" v-model="node.label"></v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input" dense outlined label="备注说明" v-model="node.Remark"></v-text-field>
</v-col>
<v-col cols="12" v-if="showTask" class="pa-xs-0 pb-xs-4 pb-3">
<v-select
:items="assignTypeList"
dense outlined
item-text="text"
item-value="value"
class="cus-v-input"
label="指派类型"
outlined
v-model="node.assignType"
></v-select>
</v-col>
<v-col cols="12" v-if="showTask" class="pa-xs-0 pb-xs-4 pb-3">
<v-select
:items="optionList"
dense outlined
item-text="text"
item-value="value"
class="cus-v-input"
:label="assignType"
:multiple="node.assignType === 'person'"
v-model="node.assignValue"
:disabled="!node.assignType"
></v-select>
</v-col>
<v-col cols="12" v-if="showTask" class="pa-xs-0 pb-xs-4 pb-3">
<!-- <v-textarea
outlined
name="input-7-4"
label="允许的操作"
value=""
rows="3"
hide-details
></v-textarea> -->
<v-text-field class="cus-v-input" dense outlined label="允许的操作(英文逗号分隔)" v-model="node.lineTypeList"></v-text-field>
</v-col>
<v-col cols="12" v-if="showTask" class="pa-xs-0 pb-xs-4 pb-3">
<v-select
:items="tpl"
dense outlined
item-text="text"
item-value="value"
class="cus-v-input"
label="可写模板"
multiple
v-model="node.formId"
></v-select>
</v-col>
<v-col cols="12" v-if="showTask" class="pa-xs-0 pb-xs-4 pb-3">
<v-select
:items="tpl"
dense outlined
item-text="text"
item-value="value"
class="cus-v-input"
label="隐藏模板"
multiple
v-model="node.formIdHidden"
></v-select>
</v-col>
</v-row>
</template>
<script>
Vue.component("edit-node", {
template: '#edit-node',
vuetify: new Vuetify(),
name: 'editNode',
props: {
user: {
type: Array,
default: () => {
return []
}
},
group: {
type: Array,
default: () => {
return []
}
},
tpl: {
type: Array,
default: () => {
return []
}
},
},
data() {
return {
isFormValid: true,
node: {},
typeList: [
{ Value: 'start', Text: '起点' },
{ Value: 'end', Text: '终点' },
{ Value: 'userTask', Text: '审核节点' },
{ Value: 'receiveTask', Text: '处理节点' }
],
assignTypeList: [{value: 'person', text: '用户'}, {value: 'group', text: '组'}]
}
},
watch: {
},
created() {},
computed: {
showTask() {
return ['userTask', 'receiveTask'].includes(this.node.type);
},
assignType() {
if (!this.node.assignType) return '请选择指派类型';
return this.assignTypeList.find(e => e.value === this.node.assignType).text;
},
optionList() {
if (!this.node.assignType) {
return []
}
if (this.node.assignType === 'person') {
return this.user
}
if (this.node.assignType === 'group') {
return this.group
}
}
},
methods: {
init(data, node) {
this.node = node;
// data.nodeList.filter((node) => {
// if (node.id === id) {
// this.node = node;
// }
// })
},
getOptionList() {
if (!this.node.assignType) {
return []
}
if (!this.node.assignType === 'person') {
return this.user
}
if (!this.node.assignType === 'group') {
return this.group
}
}
}
})
</script>
<style>
.v-textarea textarea {
line-height: 1.2rem;
}
</style>
+143
View File
@@ -0,0 +1,143 @@
<template id="flow-node">
<div class="node-item" ref="node" :style="flowNodeContainer" @mouseenter="showDelete" @mouseleave="hideDelete"
@mouseup="changeNodeSite" @click.stop="editNode">
<!-- <div class="node-titel">
<div class="node-icon" v-show="mouseEnter">
<i class="el-icon-delete" @@click.stop="deleteNode"></i>
</div>
</div> -->
<div class="node-con"><i :class="iconClass" class="type-icon"></i><span>{{node.label}}</span></div>
<div class="node-del" v-show="mouseEnter" @click.stop="deleteNode">
×
</div>
<!--连线用--//触发连线的区域-->
<div class="flow-node-drag" v-show="isconnect"></div>
</div>
</template>
<script>
Vue.component("flow-node", {
template: '#flow-node',
vuetify: new Vuetify(),
name: 'flow-node',
props: {
node: Object,
isconnect: Boolean,
},
data() {
return {
mouseEnter: false
}
},
computed: {
// 节点容器样式
flowNodeContainer: {
get() {
return {
position: 'absolute',
minWidth: '80px',
top: this.node.top,
left: this.node.left,
boxShadow: this.mouseEnter ? '#66a6e0 0px 0px 12px 0px' : '',
}
}
},
iconClass() {
const type = this.node.type;
if (type == 'start') {
return 'el-icon-help';
} else if (type == 'end') {
return 'el-icon-s-help';
} else if (type == 'userTask') {
return 'el-icon-user';
} else if (type == 'receiveTask') {
return 'el-icon-s-tools';
}
}
},
methods: {
// 删除节点
deleteNode() {
this.$emit('delete-node', this.node.id)
},
// 编辑节点
editNode() {
this.$emit('edit-node', this.node)
},
// 鼠标进入
showDelete() {
this.mouseEnter = true
},
// 鼠标离开
hideDelete() {
this.mouseEnter = false
},
// 鼠标移动后抬起
changeNodeSite() {
this.$emit('change-node-site', {
nodeId: this.node.id,
left: this.$refs.node.style.left,
top: this.$refs.node.style.top,
})
}
}
})
</script>
<style>
.node-item {
border-radius: 4px;
box-shadow: 0 0 2px #696969;
cursor: move;
overflow: initial;
background: #fbf4dc;
padding: 0 10px;
}
.node-titel {
height: 20px;
background: #ffc400;
}
.node-icon {
position: absolute;
top: 0px;
right: 0px;
line-height: 20px
}
.node-icon i {
cursor: pointer;
}
.node-con {
text-align: center;
line-height: 30px;
}
.node-del {
position: absolute;
color: white;
background-color: red;
width: 15px;
height: 15px;
border-radius: 100%;
text-align: center;
line-height: 15px;
font-size: 20px;
cursor: pointer;
top: -5px;
right: -5px;
}
.flow-node-drag {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
cursor: crosshair;
}
</style>
+653
View File
@@ -0,0 +1,653 @@
<template id="process-flow">
<div class="process-flow-container">
<div class="flow-menu">
<div class="menu-item" v-for="item in menuList" draggable="true" @dragstart="drag(item)">
<i :class="item.icon"></i>
<div>{{item.name}}</div>
</div>
<hr>
<div class="menu-item" @click="isConnect=true">
<i class="el-icon-bottom-right"></i>
<div>连线</div>
</div>
<div class="menu-item" @click="isConnect=false">
<i class="el-icon-rank"></i>
<div>选择</div>
</div>
</div>
<div class="flow-detail">
<div id="flowContent" ref="flowContent" @drop="drop($event)" @dragover="allowDrop($event)" @click="editFlow()"
@dblclick="isConnect=false">
<flow-node v-for="node in data.nodeList" :key="node.id" :node="node" :id="node.id" :isconnect="isConnect"
@delete-node="deleteNode" @change-node-site="changeNodeSite" @edit-node="editNode">
</flow-node>
</div>
</div>
<div class="flow-edit" v-if="editType">
<div class="flow-edit-content">
<edit-node ref="nodeForm" v-show="editType=='node'" :user="user" :group="group" :tpl="tpl"></edit-node>
<edit-line ref="lineForm" v-show="editType=='line'" @line-save="lineLabelSave"></edit-line>
</div>
</div>
</div>
</template>
<link href="/<$ ctx.app.config.appId $>/public/jsplumb/jsplumbtoolkit-defaults.css" rel="stylesheet">
<script src="/<$ ctx.app.config.appId $>/public/jsplumb/jsplumb.min.js"></script>
<script type="module">
Vue.component("process-flow", {
template: '#process-flow',
vuetify: new Vuetify(),
name: 'process-flow',
props: {
data: {
type: Object,
default: () => {
return {
flowInfo: {
Name: '我的流程',
Remark: '',
},
nodeList: [],
lineList: []
}
}
},
user: {
type: Array,
default: () => {
return []
}
},
group: {
type: Array,
default: () => {
return []
}
},
tpl: {
type: Array,
default: () => {
return []
}
},
},
data: () => {
const connectorPaintStyle = {
lineWidth: 4,
strokeStyle: "#61B7CF",
joinstyle: "round",
outlineColor: "white",
outlineWidth: 2
};
// 鼠标悬浮在连接线上的样式
const connectorHoverStyle = {
lineWidth: 4,
strokeStyle: "#216477",
outlineWidth: 2,
outlineColor: "white"
};
return {
menuList: [{
type: 'start',
name: '起点',
icon: 'el-icon-help'
},
{
name: '终点',
type: 'end',
icon: 'el-icon-s-help'
},
{
name: '审批节点',
type: 'userTask',
icon: 'el-icon-user'
},
{
name: '处理节点',
type: 'receiveTask',
icon: 'el-icon-s-tools'
},
],
jsPlumb: null, // jsPlumb 实例
index: 1,
// 默认设置参数
jsplumbSetting: {
// 动态锚点、位置自适应
Anchors: ['Top', 'TopCenter', 'TopRight', 'TopLeft', 'Right', 'RightMiddle', 'Bottom', 'BottomCenter',
'BottomRight', 'BottomLeft', 'Left', 'LeftMiddle'
],
Container: 'flowContent',
// 连线的样式 StateMachine、Flowchart,有四种默认类型:Bezier(贝塞尔曲线),Straight(直线),Flowchart(流程图),State machine(状态机)
Connector: 'Straight',
//这个是鼠标拉出来的线的属性
ConnectionOverlays: [
["Label", {
label: "同意-连线文本",
id: "label-1",
cssClass: "csslabel"
}]
],
// 鼠标不能拖动删除线
ConnectionsDetachable: false,
// 删除线的时候节点不删除
DeleteEndpointsOnDetach: false,
// 连线的端点
// Endpoint: ["Dot", {radius: 5}],
Endpoint: ["Rectangle", {
height: 10,
width: 10
}],
// 线端点的样式
EndpointStyle: {
fill: 'rgba(255,255,255,0)',
outlineWidth: 1
},
LogEnabled: true, //是否打开jsPlumb的内部日志记录
// 绘制线
PaintStyle: {
stroke: '#409eff',
strokeWidth: 2
},
// 绘制箭头
Overlays: [
['Arrow', {
width: 8,
length: 8,
location: 1
}],
],
RenderMode: "svg"
},
// jsplumb连接参数
jsplumbConnectOptions: {
isSource: true,
isTarget: true,
// 动态锚点、提供了4个方向 Continuous、AutoDefault
anchor: "Continuous",
},
jsplumbSourceOptions: {
filter: ".flow-node-drag", //触发连线的区域
/*"span"表示标签,".className"表示类,"#id"表示元素id*/
filterExclude: false,
anchor: "Continuous",
allowLoopback: false
},
jsplumbTargetOptions: {
filter: ".flow-node-drag",
/*"span"表示标签,".className"表示类,"#id"表示元素id*/
filterExclude: false,
anchor: "Continuous",
allowLoopback: false
},
// 是否加载完毕
loadEasyFlowFinish: false,
// 数据
currentItem: '', //临时存添加的元素
isConnect: false, //判断是否连接
timer: null, //定时器,判断单双击,
currentConnect: '', //当前的连接线
currentLine: '', //当前连接线数据
editType: '', //编辑的类型
connectorPaintStyle,
// 鼠标悬浮在连接线上的样式
connectorHoverStyle,
hollowCircle: {
endpoint: ["Dot", { radius: 8 }], //端点的形状
connectorStyle: connectorPaintStyle,//连接线的颜色,大小样式
connectorHoverStyle: connectorHoverStyle,
paintStyle: {
strokeStyle: "#1e8151",
fillStyle: "transparent",
radius: 2,
lineWidth: 2
}, //端点的颜色样式
//anchor: "AutoDefault",
isSource: true, //是否可以拖动(作为连线起点)
connector: ["Flowchart", { stub: [40, 60], gap: 10, cornerRadius: 5, alwaysRespectStubs: true }], //连接线的样式种类有[Bezier],[Flowchart],[StateMachine ],[Straight ]
isTarget: true, //是否可以放置(连线终点)
maxConnections: -1, // 设置连接点最多可以连接几条线
connectorOverlays: [["Arrow", { width: 10, length: 10, location: 1 }]]
},
lineTypeList: [
{text: '同意', value: 'agree'},
{text: '拒绝', value: 'deny'},
]
};
},
watch: {
data: {
// 每个属性值发生变化就会调用这个函数
handler(newVal, oldVal) {
this.saveData(newVal)
},
// 深度监听 属性的变化
deep: true
}
},
created() { },
mounted() {
console.log('data', this.data)
this.jsPlumb = jsPlumb.getInstance();
this.$nextTick(() => {
this.init();
});
this.editFlow()
},
methods: {
init() {
const _this = this
if (this.jsPlumb) {
_this.jsPlumb.setSuspendDrawing(false, true);
}
this.jsPlumb.ready(function () {
// 导入默认配置
_this.jsPlumb.importDefaults(_this.jsplumbSetting)
// 会使整个jsPlumb立即重绘。
_this.jsPlumb.setSuspendDrawing(false, true);
// 初始化节点
_this.loadEasyFlow()
// 单点连接线(编辑label),
_this.jsPlumb.bind('click', function (conn, originalEvent) {
//clearTimeout(this.timer);
//this.timer = setTimeout(function () { // 这里采用执行自定义事件的方式
// console.log("click", conn);
// _this.editLine(conn);
//}, 300); // 延迟300ms执行单击事件,区分双击事件
console.log("click", conn);
_this.editLine(conn);
console.log(conn.getOverlay("label-1"));
//conn.getOverlay("label-1").setLabel('大肥肚'); //初始化label
})
// 双击连接线(删除),
_this.jsPlumb.bind('dblclick', function (conn, originalEvent) {
clearTimeout(this.timer);
console.log("dblclick", conn)
_this.jsPlumb.deleteConnection(conn)
})
// 连线
_this.jsPlumb.bind("connection", function (evt) {
console.log('connection', evt)
let from = evt.source.id
let to = evt.target.id
if (_this.loadEasyFlowFinish) {
_this.data.lineList.push({
from: from,
to: to,
label: '连线名称',
type: 'agree',
id: _this.getUUID('line'),
Remark: '',
endpoint: 'Dot' // 线的类型
})
};
setTimeout(function () {
_this.editLine(evt.connection, true);
}, 100);
})
// 删除连线
_this.jsPlumb.bind("connectionDetached", function (evt) {
console.log('connectionDetached', evt)
_this.deleteLine(evt.sourceId, evt.targetId)
})
// 改变线的连接节点
_this.jsPlumb.bind("connectionMoved", function (evt) {
console.log('connectionMoved', evt)
_this.changeLine(evt.originalSourceId, evt.originalTargetId)
})
// 单击endpoint
// jsPlumb.bind("endpointClick", function (evt) {
// console.log('endpointClick', evt)
// })
//
// // 双击endpoint
// jsPlumb.bind("endpointDblClick", function (evt) {
// console.log('endpointDblClick', evt)
// })
// contextmenu 右键
_this.jsPlumb.bind("contextmenu", function (evt) {
console.log('contextmenu', evt)
})
// beforeDrop
_this.jsPlumb.bind("beforeDrop", function (evt) {
console.log('beforeDrop', evt)
let from = evt.sourceId
let to = evt.targetId
if (from === to) {
window.vtoast.fail('不能连接自己');
return false
}
if (_this.hasLine(from, to)) {
window.vtoast.fail({ message: '不能重复连线' });
return false
}
// if (_this.hashOppositeLine(from, to)) {
// window.vtoast.fail('不能回环哦');
// return false
// }
return true
})
// beforeDetach
_this.jsPlumb.bind("beforeDetach", function (evt) {
console.log('beforeDetach', evt)
})
})
},
// 加载流程图
loadEasyFlow() {
// 初始化节点
for (var i = 0; i < this.data.nodeList.length; i++) {
let node = this.data.nodeList[i]
// 设置源点,可以拖出线连接其他节点
this.jsPlumb.makeSource(node.id, this.jsplumbSourceOptions)
// // 设置目标点,其他源点拖出的线可以连接该节点
this.jsPlumb.makeTarget(node.id, this.jsplumbTargetOptions)
// 设置可拖拽
// jsPlumb.draggable(node.id, {
// containment: 'parent',
// grid: [10, 10]
// })
this.jsPlumb.draggable(node.id, {
containment: 'parent'
})
// this.jsPlumb.addEndpoint(node.id, { anchors: "TopCenter" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "RightMiddle" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "BottomCenter" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "LeftMiddle" }, this.hollowCircle);
// jsPlumb.draggable(node.id)
}
// 初始化连线
for (var i = 0; i < this.data.lineList.length; i++) {
let line = this.data.lineList[i]
let connection = this.jsPlumb.connect({
source: line.from,
target: line.to,
endpoint: 'Dot' // 线的类型
}, this.jsplumbConnectOptions);
connection.getOverlay("label-1").setLabel(line.type + '-' +line.label); //初始化label
}
this.$nextTick(function () {
this.loadEasyFlowFinish = true
})
},
// 添加新的节点
addNode(temp) {
console.log('添加节点', temp)
this.data.nodeList.push(temp);
this.$nextTick(function () {
this.jsPlumb.makeSource(temp.id, this.jsplumbSourceOptions)
this.jsPlumb.makeTarget(temp.id, this.jsplumbTargetOptions)
this.jsPlumb.draggable(temp.id, {
containment: 'parent'
})
// this.jsPlumb.addEndpoint(node.id, { anchors: "TopCenter" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "RightMiddle" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "BottomCenter" }, this.hollowCircle);
// this.jsPlumb.addEndpoint(node.id, { anchors: "LeftMiddle" }, this.hollowCircle);
})
},
// 删除线
deleteLine(from, to) {
this.data.lineList = this.data.lineList.filter(function (line) {
return line.from !== from && line.to !== to
})
},
// 改变连线
changeLine(oldFrom, oldTo) {
this.deleteLine(oldFrom, oldTo)
},
// 改变节点的位置
changeNodeSite(data) {
for (var i = 0; i < this.data.nodeList.length; i++) {
let node = this.data.nodeList[i]
if (node.id === data.nodeId) {
this.data.nodeList[i].left = data.left
this.data.nodeList[i].top = data.top
}
}
},
//删除节点
async deleteNode(nodeId) {
// this.data.nodeList = this.data.nodeList.filter(function(node) {
// if (node.id === nodeId) {
// node.show = false
// }
// return true
// })
this.data.nodeList.forEach((item, index) => {
if (item.id === nodeId) {
this.data.nodeList.splice(index, 1);
}
})
this.$nextTick(function () {
console.log('删除' + nodeId)
this.jsPlumb.removeAllEndpoints(nodeId);
})
return true
},
//编辑节点
editNode(node) {
//console.log('编辑节点', nodeId)
this.editType = 'node';
this.$nextTick(function () {
this.$refs.nodeForm.init(this.data, node)
})
},
editLine(conn, add = false) {
const _this = this;
_this.currentConnect = conn;
_this.data.lineList.forEach(function (item, index) {
if (item.from == conn.sourceId && item.to == conn.targetId) {
// 获取上一个节点
const preNode = _this.data.nodeList.find(e => e.id === item.from);
const lineTypeList = preNode.lineTypeList ? preNode.lineTypeList.split(',') : []
// 如果不是开始节点 并且类型不在允许的操作内
if (!lineTypeList.includes(item.type) ) {
// 1 - 删除画布连线 | 2 - 清空line的操作属性
// _this.jsPlumb.deleteConnection(conn)
// 从 lineList 数组移除
// _this.data.lineList.splice(index,1);
// 不渲染表单
// return
// 默认修改类型为第一个
if (!preNode.id.includes('start-')) {
if (add) {
item.type = lineTypeList[0] || '';
} else {
item.type = '';
}
} else {
item.type = lineTypeList[0] || '';
}
// item.type = lineTypeList[0] || '';
}
_this.currentLine = item;
_this.editType = 'line';
_this.$nextTick(function () {
_this.$refs.lineForm.init(item, lineTypeList)
})
return;
}
});
},
//删除线
delLine(conn) {
this.jsPlumb.deleteConnection(conn)
},
// 是否具有该线
hasLine(from, to) {
return !!this.data.lineList.find(line => line.from === from && line.to === to)
},
// 是否含有相反的线
hashOppositeLine(from, to) {
return this.hasLine(to, from)
},
lineLabelSave(line) {
this.currentConnect.getOverlay("label-1").setLabel(line.type + '-' +line.label);
//this.$set(this.currentLine, 'label', line.label);
},
drag(item) {
this.currentItem = item;
},
drop(event) {
//event.preventDefault();
var _obj = this.$refs.flowContent;
var temp = {
id: this.getUUID(this.currentItem.type),
label: this.currentItem.name,
top: event.offsetY + 'px',
left: event.offsetX + 'px',
type: this.currentItem.type,
lineTypeList: this.currentItem.type === 'start' ? '同意' : this.currentItem.type === 'end' ? '' : '同意,拒绝',
}
this.addNode(temp);
this.editNode(temp);
},
allowDrop(event) {
event.preventDefault()
},
getUUID(prefix) {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 10; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
var uuid = s.join("");
return prefix + '-' + uuid;
},
saveData() {
//console.log(this.jsPlumb)
//console.log(this.jsPlumb.Defaults)
//console.log('线', this.jsPlumb.getConnections())
console.log(this.data);
this.$emit('change-structure', this.data)
},
editFlow() {
this.editType = 'flow';
// this.$nextTick(function () {
// this.$refs.flowEdit.init(this.data.flowInfo);
// })
}
}
})
</script>
<style>
.process-flow-container {
display: flex;
width: 100%;
height: calc(100vh - 260px);
color: #606266;
}
.flow-detail {
flex: 1;
border: 1px solid #EBEEF5;
padding: 12px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
word-break: break-all;
border-radius: 4px;
position: relative;
}
#flowContent {
width: 100%;
height: 100%;
position: relative;
}
.item {
position: absolute;
width: 60px;
height: 90px;
border: 1px solid #007AFF;
}
.flow-menu {
width: 100px;
padding: 10px;
margin: 0 10px;
border: 1px solid #EBEEF5;
padding: 12px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
word-break: break-all;
border-radius: 4px;
}
.menu-item {
text-align: center;
box-shadow: 0 0 4px #696969;
margin-bottom: 8px;
cursor: pointer;
font-size: 14px;
color: #606266;
padding: 5px 0;
border-radius: 5px;
}
.menu-item>i {
font-size: 30px;
}
.flow-edit {
width: 300px;
padding: 0 10px;
max-height: 100%;
min-height: 100%;
overflow-x: hidden;
overflow-y: auto;
}
.flow-edit-content {
min-height: 100%;
background: #FFF;
color: #606266;
line-height: 1.4;
text-align: justify;
font-size: 14px;
border: 1px solid #EBEEF5;
padding: 12px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
word-break: break-all;
border-radius: 4px;
}
.csslabel {
color: #434343;
font-weight: 400;
z-index: 10;
font-size: 12px;
color: #409eff;
background: #fff;
}
.csslabel .label-text {
background-color: white;
}
</style>
@@ -0,0 +1,335 @@
<template id="form-item-list-generator">
<div class="d-flex form-item-list-generator-content">
<div class="componentList">
<div class="left-component-item-title">
<v-icon>mdi-puzzle-outline</v-icon>
组件
</div>
<draggable
:group="{ name: 'componentGroup', pull: 'clone', put: false }"
:list="componentList"
draggable=".left-component-item"
:clone="cloneComponent"
@end="leftComponentDraggableOnEnd">
<div class="left-component-item"
v-for="(component, index) in componentList" :key="index"
@click="addFormItem(component)">
<div class="left-component-item-body">
<v-icon small class="mr-1">{{ component.icon }}</v-icon>
{{ component.title }}
</div>
</div>
</draggable>
</div>
<v-card class="formItemList">
<v-toolbar dense flat>
<v-btn icon @click.stop="emptyCanva">
<v-icon color="grey lighten-1" dark>mdi-delete-empty</v-icon>
</v-btn>
</v-toolbar>
<draggable
v-if="formItemList.length > 0"
:list="formItemList"
:animation="300"
group="componentGroup">
<v-hover v-for="(formItem, index) in formItemList" :key="index" v-slot:default="{ hover }">
<v-card
@click.native="formItemSelect(formItem.id)"
:elevation="hover ? 12 : 2"
:class="['ma-2', selectedFormItemId === formItem.id && !hover ? 'formItem-selected' : 'formItem-body']"
style="cursor: move"
dense>
<v-list-item>
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-radio-group :disabled="true" :label="(index+1) + formItem.component.outline">
<v-radio hide-details v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
:key="optionIndex" :label="option.value" :value="option.value"></v-radio>
</v-radio-group>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}. {{ formItem.component.outline }}</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox hide-details style="margin-top: 0px;" :disabled="true" :label="option.value" hide-details color="red"></v-checkbox>
</div>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'textarea'">
<v-textarea dense outlined placeholder="请输入答案" hide-details :disabled="true" :rows="4" :label="(index+1) + '. ' + formItem.component.outline"/>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'input'">
<v-text-field class="cus-v-input" dense outlined :label="(index+1) + '. ' + formItem.component.outline" :disabled="true">
</v-list-item-content>
<v-list-item-action v-if="selectedFormItemId === formItem.id" class="justify-start">
<v-btn x-small icon @click.stop="formItemCopy(index, formItem)">
<v-icon color="primary">mdi-content-duplicate</v-icon>
</v-btn>
<v-btn x-small icon @click.stop="formItemDelete(formItem.id)">
<v-icon color="error">mdi-close-box</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-card>
</v-hover>
</draggable>
<v-row v-else align="center" justify="center" style="width: 100%;">
<v-card height="100" class="ma-12" width="100%">
<draggable :list="[]" :animation="300" group="componentGroup">
<v-card-text class="text-center title">
从左侧拖入或点选组件进行表单设计
</v-card-text>
</draggable>
</v-card>
</v-row>
</v-row>
</v-card>
<div class="property">
<div class="property-title">
<v-icon>mdi-application-edit-outline</v-icon>组件属性
</div>
<div v-if="selectCanvaIndex >= 0 && formItemList[selectCanvaIndex]">
<v-card flat v-if="formItemList[selectCanvaIndex].component.type === 'singleSelect' || formItemList[selectCanvaIndex].component.type === 'multipleSelect'">
<v-row no-gutters>
<v-col cols="12">
<v-text-field class="cus-v-input mr-2" dense outlined label="标题" v-model="formItemList[selectCanvaIndex].component.outline"></v-text-field>
<div style="display: flex; flex-direction: row;justify-content: space-between; align-items: center;">
<v-subheader>选项列表</v-subheader>
<v-btn icon @click.stop="propertyAddOption(formItemList[selectCanvaIndex].component.property.selectOptionList.length)">
<v-icon dark color="grey lighten-1">mdi-plus-box</v-icon>
</v-btn>
</div>
<v-list dense>
<v-list-item v-for="(option, index) in formItemList[selectCanvaIndex].component.property.selectOptionList" :key="index">
<v-list-item-content>
<v-text-field
v-model="option.value"
label="选项"
outlined
dense
hide-details
clearable
placeholder="请输入选项"/>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click.stop="propertyDeleteOption(index)">
<v-icon color="grey lighten-1" dark>mdi-delete</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
</v-col>
</v-row>
</v-card>
<v-card flat v-if="formItemList[selectCanvaIndex].component.type === 'textarea'">
<v-text-field class="cus-v-input mr-2" dense outlined label="多行文本" v-model="formItemList[selectCanvaIndex].component.outline"></v-text-field>
</v-card>
<v-card flat v-if="formItemList[selectCanvaIndex].component.type === 'input'">
<v-text-field class="cus-v-input mr-2" dense outlined label="单行文本" v-model="formItemList[selectCanvaIndex].component.outline"></v-text-field>
</v-card>
</div>
</div>
</div>
</template>
<script src="//cdn.jsdelivr.net/npm/sortablejs@1.8.4/Sortable.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js"></script>
<script>
// 1. v-main 滚动条
// 2. v-navigation-drawer 小屏幕 不要关闭
Vue.component("form-item-list-generator", {
template: '#form-item-list-generator',
vuetify: new Vuetify(),
name: 'form-item-list-generator',
props: {
formItemList: {
type: Array,
default: [],
required: true,
},
},
data: () => ({
componentList: [
{ title: '单行文本', type: 'input', outline: '单行文本', property: {}, icon: 'mdi-form-textarea' },
{ title: '多行文本', type: 'textarea', outline: '多行文本', property: {}, icon: 'mdi-form-textarea' },
{ title: '单选', type: 'singleSelect', outline: '单选', property: { selectOptionList: [] }, icon: 'mdi-checkbox-marked-circle' },
{ title: '多选', type: 'multipleSelect', outline: '多选', property: { selectOptionList: [] }, icon: 'mdi-checkbox-marked' },
],
tempComponent: null,
// 当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
// 对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与 C 语言的 strstr() 以及 Java 的 indexOf() 定义相符。
// 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
// `,
// property: {}, icon: 'mdi-checkbox-marked-circle'
// },
// formItemData: {}
// }
// ],
selectedFormItemId: null,
rightPanels: [0,1,2,3,4],
}),
computed: {
selectCanvaIndex () {
const index = this.formItemList.findIndex(item => item.id === this.selectedFormItemId);
return index;
},
},
mounted() {
},
destroyed() {},
watch: {
},
async created() {},
methods: {
cloneComponent (component) {
this.tempComponent = component;
},
leftComponentDraggableOnEnd (event) {
if (event.from !== event.to) {
const newIndex = event.newIndex;
this.addFormItem(this.tempComponent, newIndex);
}
this.tempComponent = null;
},
addFormItem(component, targetIndex) {
const { type } = component;
const formItem = {
id: `${type}_${this.uuid(8)}`,
component: _.cloneDeep(component)
};
if (!this.formItemList) {
this.formItemList = [];
}
if (targetIndex > -1) {
this.formItemList.splice(targetIndex, 0, formItem);
} else {
this.formItemList.push(formItem);
}
},
formItemSelect (id) {
this.selectedFormItemId = id;
},
formItemCopy (index, formItem) {
const newFormItem = _.cloneDeep(formItem);
newFormItem.id = `${newFormItem.component.type}_${this.uuid(8)}`,
this.formItemList.splice(index+1, 0, newFormItem);
},
emptyCanva () {
this.formItemList.splice(0, this.formItemList.length);
},
formItemDelete (id) {
const index = this.formItemList.findIndex((item) => item.id === id);
if (index > -1) {
this.formItemList.splice(index, 1);
}
},
propertyAddOption (index) {
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 0, { value: "" });
},
propertyDeleteOption (index) {
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 1);
},
uuid (t=21) {
let e="",r=crypto.getRandomValues(new Uint8Array(t));
for(;t--;){let n=63&r[t];e+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"};
return e
},
getFormItemList () {
return this.formItemList;
},
},
})
</script>
<style scoped>
.form-item-list-generator-content {
align-items: stretch;
height: 100%;
}
.componentList {
padding: 8px;
box-sizing: border-box;
width: 256px;
overflow-y: auto;
height: 100%;
max-height: 100%;
}
.left-component-item {
width: 100%;
margin: 1%;
transition: transform 0ms !important;
}
.left-component-item-title {
font-size: 14px;
color: #222;
margin: 6px 2px;
}
.left-component-item-body {
padding: 8px 10px;
background: #e0e0e0;
font-size: 12px;
cursor: move;
border: 1px dashed #e0e0e0;
border-radius: 3px;
}
.left-component-item-body:hover {
border: 1px dashed #1565c0;
background: #e3f2fd;
color: #1565c0;
}
.left-component-item-body:hover .v-icon {
color: #1565c0;
}
.formItemList {
flex: 1;
overflow-y: auto;
height: 100%;
max-height: 100%;
background-color: #e0e0e0 !important;
border-radius: 0 !important;
border: 1px dashed #999 !important;
}
.formItemList .formItem-selected {
border: 1px dashed #1565c0 !important;
background: #e3f2fd;
}
.formItem-title {
white-space: normal;
}
.property {
width: 360px;
overflow-y: auto;
max-height: calc(100vh - 105px);
padding: 10px;
}
.property .property-title {
margin-bottom: 10px;
}
.property .v-expansion-panel .v-expansion-panel-header {
min-height: auto;
}
.property .v-expansion-panel-content__wrap {
padding: 0px;
}
.property .v-expansion-panel .v-list-item__action, .v-list-item__avatar, .v-list-item__icon {
display: inline-block;
min-width: 24px;
}
</style>
@@ -0,0 +1,99 @@
<template id="form-item-list-render">
<div>
<v-card v-for="(formItem, index) in formItemList" :key="index" class="ma-2 formItem-item-body" :elevation="hover ? 12 : 2" dense>
<v-list-item>
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-radio-group v-model="formItem.answerData.selected">
<v-radio :disabled="isCorrecting" v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex" :label="option.value" :value="option.value"></v-radio>
</v-radio-group>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox :disabled="isCorrecting" style="margin-top: 0px;" v-model="formItem.answerData[option.value]" :label="option.value" hide-details color="red"></v-checkbox>
</div>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'textarea'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-row>
<v-col cols="12">
<v-textarea :disabled="isCorrecting" outlined placeholder="" v-model="formItem.answerData.answer" :rows="4"/>
</v-col>
</v-row>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
</v-list-item>
</v-card>
</div>
</template>
<script>
Vue.component("form-item-list-render", {
template: '#form-item-list-render',
mixins: [ window.jianghuUiActionMixins ],
vuetify: new Vuetify(),
vueComponent: "formItemListRender",
name: 'form-item-list-render',
props: {
formItemList: {
type: Array,
default: () => {
return []
},
required: true,
},
action: {
type: String,
default: '',
},
},
data: () => ({
}),
computed: {
isCorrecting() {
return this.action === 'correcting'
}
},
watch: {
form: {
deep: true,
}
},
destroyed() {},
watch: {},
async created() {},
methods: {},
})
</script>
<style scoped>
.formItem-title {
white-space: normal;
}
.correct {
border-top: 1px solid #999;
padding-top: 10px;
}
.correct-title-box .successText {
color: rgb(1, 166, 46);
font-weight: bold;
}
.correct-title-box .failText {
color: darkred;
font-weight: bold;
}
.correct-title-box {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
</style>
+84
View File
@@ -0,0 +1,84 @@
<template id="tpl-form-design">
<div class="tpl-form-design-container">
<form-item-list-generator
:form-item-list="form"
ref="formItemListGenerator"/>
<!-- <v-navigation-drawer v-model="formItemListPreviewDrawer" fixed temporary hide-overlay bottom width="90%">
<v-toolbar dark class="blue darken-3" dense>
<v-toolbar-title>表单预览</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn dark text @click="formItemListPreviewDrawer = false">关闭</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-card class="mt-3">
<v-row>
<v-col cols="12" md="6" class="pa-0">
<codemirror v-model="JSON.stringify(formItemList, null, 4)" :options="codemirrorOptions"/>
</v-col>
<v-col cols="12" md="6">
<form-item-list-render :form-item-list="formItemList"></form-item-list-render>
</v-col>
</v-row>
</v-card>
</v-navigation-drawer> -->
</div>
</template>
<script type="module">
Vue.component("tpl-form-design", {
template: "#tpl-form-design",
props: {
form: {
type: Array,
default: () => {
return []
}
}
},
data: () => ({
}),
computed: {
versionList () {
const list = this.articleAssignmentListWithAnswer.map(item => {
return { text: item.version, value: item.version }
})
return list;
},
formItemList () {
let list = []
if (this.articleAssignmentListWithAnswer[this.selectedVersionIndex]) {
list = this.articleAssignmentListWithAnswer[this.selectedVersionIndex].formItemList;
}
return list;
}
},
watch: {
// 每个属性值发生变化就会调用这个函数
form(newVal, oldVal) {
this.saveData(newVal)
},
// 深度监听 属性的变化
deep: true
},
async created() {
},
mounted() {},
methods: {
saveData(newVal) {
// this.$emit('change-structure', this.form);
}
}
})
</script>
<style scoped>
.tpl-form-design-container {
width: 100%;
height: 500px;
max-height: 500px;
overflow-y: auto;
border: 2px solid rgb(226, 226, 226);
}
</style>
+311
View File
@@ -0,0 +1,311 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-card>
<v-list three-line subheader>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field v-model="serverSearchInput.processName" label="流程名称" class="cus-v-input "
:class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-btn class="elevation-0" color="success" dark @click="doUiAction('refreshTableData')">
查询
</v-btn>
</v-col>
</v-row>
</v-list>
<v-divider></v-divider>
<v-list three-line subheader>
<v-subheader>流程列表</v-subheader>
<v-list-item v-for="(item, index) in tableDataFromBackend" :key="index">
<v-subheader>{{getConstantCollectionItemText('categoryList', index)}}</v-subheader>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="6" xl="6" class="pa-xs-0 pb-xs-4 pb-3" v-for="(it, index) in item">
<v-btn class="elevation-0 mr-10" color="success" dark @click="doUiAction('startCreateItem', {item: it})">
{{it.workflowName}}
</v-btn>
</v-col>
</v-row>
</v-list-item>
</v-list>
</v-card>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务标题" v-model="editItem['taskTitle']">
</v-text-field>
</v-col>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3" v-for="(formItem, index) in editItem.workflowForm" :key="index">
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-radio-group :rules="requireRules" v-model="editItem.workflowFormData[formItem.id]" hide-details>
<v-radio v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
:key="optionIndex" :label="option.value"></v-radio>
</v-radio-group>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox :rules="requireRules" style="margin-top: 0px;" :label="option.value" v-model="editItem.workflowFormData[formItem.id]" hide-details color="red"></v-checkbox>
</div>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'textarea'">
<v-textarea hide-details dense outlined placeholder="请输入" :rules="requireRules" :label="(index+1) + '. ' + formItem.component.outline" v-model="editItem.workflowFormData[formItem.id]" :rows="4"/>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'input'">
<v-text-field class="cus-v-input mr-2" dense outlined placeholder="请输入" :rules="requireRules" :label="(index+1) + '. ' + formItem.component.outline" v-model="editItem.workflowFormData[formItem.id]" ></v-text-field>
</v-list-item-content>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)"
:style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存
</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false"
:style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
categoryList: [],
},
serverSearchInput: {
processName: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{ text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: "任务ID", value: "taskId", width: 120 },
{ text: "流程节点版本ID", value: "processVersionId", width: 120 },
{ text: "任务名称", value: "taskTitle", width: 120 },
{ text: "任务状态:running 执行中;deny 拒绝;end 结束", value: "taskStatus", width: 120 },
{ text: "当前执行中节点", value: "taskCurrentNode", width: 120 },
{ text: "申请人", value: "taskApplier", width: 120 },
{ text: "当前执行的处理人员,用逗号分隔", value: "taskProcessorList", width: 120 },
{ text: "所有相关人员,用逗号分隔", value: "taskRelatedPersonList", width: 120 },
{ text: "催单次数", value: "taskUrgeCount", width: 120 },
{ text: "最后催单时间", value: "taskUrgeLastTime", width: 120 },
{ text: "操作者", value: "operationByUser", width: 120 },
{ text: "操作时间", value: "operationAt", width: 250 },
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed' },
],
currentClickButton: { title: '新增', action: 'add' },
editItem: {},
tplItem: {},
tableButtonList: [
{ text: '修改', buttonType: 'edit', color: 'success', action: 'startUpdateItem' },
{ text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem' },
],
dialogSaveInfoAction: ''
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({ gender }) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
await this.doUiAction('refreshTableData');
},
mounted() { },
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value => !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskCreateManagement',
actionId: 'selectWorkflowList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
for(const item of rows) {
item.workflowForm = JSON.parse(item.workflowForm || '[]');
}
this.tableDataFromBackend = _.groupBy(rows, 'workflowCategory');
this.isTableLoading = false;
},
// startCreateItem
async clearItemData({item: { workflowForm, workflowConfig, workflowId }}) {
this.editItem = {workflowForm, workflowFormData: {}, workflowId};
},
async openCreateItemDialog() {
this.currentClickButton = { action: 'add', title: '新增' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
// createItem
async confirmCreateItemDialog() {
return window.confirmDialog({ title: '新增', content: '确定新增吗?' })
},
/**
* 新增数据
*/
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskCreateManagement',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增数据成功");
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
// startUpdateItem
async prepareItemData({ item }) {
this.editItem = { ...item };
},
async openUpdateDialog() {
this.currentClickButton = { action: 'edit', title: '修改' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
// updateItem
async confirmUpdateItemDialog() {
return window.confirmDialog({ title: '修改', content: '确定修改吗?' });
},
/**
* 保存数据
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: { id: id }
}
}
})
await window.vtoast.success("修改数据成功");
},
// updateItem
async confirmDeleteItemDialog() {
return window.confirmDialog({ title: '删除', content: '确定删除吗?' });
},
/**
* 删除数据
*/
async doDeleteItem({ item }) {
const { id } = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除数据成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].length ? this.constantCollection[key].find(e => e && e.value+'' === _value+'') : '';
if (constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value || '';
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+365
View File
@@ -0,0 +1,365 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-4" style="background-color: rgb(236, 236, 236);">
<v-stepper v-model="step" class="mb-4">
<v-stepper-header>
<template v-for="(item, index) in taskStepperList">
<v-divider v-if="index > 0"></v-divider>
<v-stepper-step :complete="step > item.value" :step="item.value">
{{item.text}}
</v-stepper-step>
</template>
</v-stepper-header>
</v-stepper>
<v-card class="mb-4">
<v-subheader>表单信息</v-subheader>
<v-divider></v-divider>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col :cols="taskTpl.prev ? 6 : 12" v-for="(key, i) in ['prev', 'input']" :key="i"
v-if="isAccess && taskTpl[key]">
<v-row>
<v-col cols="12" class="pa-xs-0 pb-xs-4 pb-3" v-for="(formItem, index) in taskTpl.formList" :key="index"
v-if="taskTpl[key] && !(currentNode.formIdHidden || []).includes(formItem.id)">
<!-- <v-subheader inset > {{ key === 'prev' ? '历史表单' : '当前' }} </v-subheader> -->
<template v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{formTitlePrefix(formItem.component.outline, key)}}
</v-list-item-title>
<v-radio-group v-model="taskTpl[key][formItem.id]">
<v-radio hide-details v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
:disabled="key === 'prev' || !(currentNode.formId || []).includes(formItem.id)" :key="optionIndex"
:label="option.value" v-model="taskTpl[key][formItem.id]"></v-radio>
</v-radio-group>
</template>
<template v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{formTitlePrefix(formItem.component.outline, key)}}
</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox style="margin-top: 0px;"
:disabled="key === 'prev' || !(currentNode.formId || []).includes(formItem.id)"
:label="option.value" v-model="taskTpl[key][formItem.id]" hide-details color="red"></v-checkbox>
</div>
</template>
<template v-if="formItem.component.type === 'textarea'">
<v-textarea hide-details dense outlined placeholder="请输入"
:label="formTitlePrefix(formItem.component.outline, key)"
:disabled="key === 'prev' || !(currentNode.formId || []).includes(formItem.id)"
v-model="taskTpl[key][formItem.id]" :rows="4" />
</template>
<template v-if="formItem.component.type === 'input'">
<v-text-field class="cus-v-input" placeholder="请输入" dense outlined
:label="formTitlePrefix(formItem.component.outline, key)"
:disabled="key === 'prev' || !(currentNode.formId || []).includes(formItem.id)"
v-model="taskTpl[key][formItem.id]"></v-text-field>
</template>
</v-col>
</v-row>
</v-col>
</v-row>
<v-divider></v-divider>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none" v-if="isAccess">
<v-col cols="12">
<v-textarea dense outlined placeholder="请输入备注信息" hide-details v-model="editItem.taskComment" :disabled="currentNode && currentNode.id && currentNode.id.includes('end-')" :rows="4" />
</v-col>
<v-col cols="12" style="text-align: center;" class="mb-3">
<v-btn color="primary" v-for="item in nextLineList" @click="submitNode(item.type)">
{{item.type}}-{{item.label}}</v-btn>
</v-col>
</v-row>
</v-card>
<v-card>
<v-list three-line subheader>
<v-subheader>任务流转历史</v-subheader>
<v-divider></v-divider>
<div class="pa-2">
<v-simple-table dense>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">
节点
</th>
<th class="text-left">
流转
</th>
<th class="text-left">
处理人
</th>
<th class="text-left">
时长
</th>
</tr>
</thead>
<tbody>
<tr v-for="item in taskHistoryList" :key="item.name">
<td>{{ item.taskExplain }}</td>
<td>{{ item.taskHandleDesc }}</td>
<td>{{ item.operationByUser}}</td>
<td>{{ item.taskCostDuration }}秒</td>
</tr>
</tbody>
</template>
</v-simple-table>
</div>
</v-list>
</v-card>
</v-container>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
step: 1,
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
categoryList: [],
},
serverSearchInput: {
processName: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{ text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed' },
{ text: "任务ID", value: "taskId", width: 120 },
{ text: "流程节点版本ID", value: "processVersionId", width: 120 },
{ text: "任务名称", value: "taskTitle", width: 120 },
{ text: "任务状态:running 执行中;deny 拒绝;end 结束", value: "taskStatus", width: 120 },
{ text: "当前执行中节点", value: "taskCurrentNode", width: 120 },
{ text: "申请人", value: "taskApplier", width: 120 },
{ text: "当前执行的处理人员,用逗号分隔", value: "taskProcessorList", width: 120 },
{ text: "所有相关人员,用逗号分隔", value: "taskRelatedPersonList", width: 120 },
{ text: "催单次数", value: "taskUrgeCount", width: 120 },
{ text: "最后催单时间", value: "taskUrgeLastTime", width: 120 },
{ text: "操作者", value: "operationByUser", width: 120 },
{ text: "操作时间", value: "operationAt", width: 250 },
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed' },
],
currentClickButton: { title: '新增', action: 'add' },
editItem: {},
tableButtonList: [
{ text: '修改', buttonType: 'edit', color: 'success', action: 'startUpdateItem' },
{ text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem' },
],
dialogSaveInfoAction: '',
taskId: '',
isAccess: [],
nextLineList: [],
taskHistoryList: [],
taskTpl: [],
taskStepperList: [],
currentNode: {}
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({ gender }) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
const searchParams = new URLSearchParams(location.search.substring(1));
this.taskId = searchParams.get('taskId');
await this.getTaskHistoryList()
},
mounted() { },
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value => !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskCreateManagement',
actionId: 'selectProcessList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{ column: 'operationAt', order: 'desc' }]
}
}
});
this.tableDataFromBackend = _.groupBy(rows, 'categoryId');
this.isTableLoading = false;
},
/**
* 获取表格数据
*/
async getTaskHistoryList() {
const { data: { appData: { taskHistoryList, taskStepperList, taskTpl, isAccess, nextLineList, step, currentNode } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskHistoryManagement',
actionId: 'getTaskHistoryInfo',
actionData: { taskId: this.taskId },
}
}
});
this.taskHistoryList = taskHistoryList;
this.taskTpl = taskTpl;
this.taskStepperList = taskStepperList;
this.currentNode = currentNode;
this.isAccess = isAccess;
this.nextLineList = nextLineList;
this.step = step;
},
// startCreateItem
async clearItemData({ processVersionId }) {
this.editItem = { processVersionId };
},
async openCreateItemDialog() {
this.currentClickButton = { action: 'add', title: '新增' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
// createItem
async confirmCreateItemDialog() {
return window.confirmDialog({ title: '新增', content: '确定新增吗?' })
},
/**
* 新增数据
*/
async submitNode(type) {
await window.vtoast.loading("提交数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskHistoryManagement',
actionId: 'submitNode',
actionData: { type, taskId: this.taskId, taskComment: this.editItem.taskComment, taskTpl: this.taskTpl }
}
}
})
await window.vtoast.success("提交数据成功");
this.getTaskHistoryList();
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
// startUpdateItem
async prepareItemData({ item }) {
this.editItem = { ...item };
},
async openUpdateDialog() {
this.currentClickButton = { action: 'edit', title: '修改' };
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
// updateItem
async confirmUpdateItemDialog() {
return window.confirmDialog({ title: '修改', content: '确定修改吗?' });
},
/**
* 保存数据
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: { id: id }
}
}
})
await window.vtoast.success("修改数据成功");
},
// updateItem
async confirmDeleteItemDialog() {
return window.confirmDialog({ title: '删除', content: '确定删除吗?' });
},
/**
* 删除数据
*/
async doDeleteItem({ item }) {
const { id } = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除数据成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(e => e.value + '' === _value + '');
if (constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
},
formTitlePrefix(title, type) {
if (type === 'prev') {
return '历史-' + title;
}
return title;
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+367
View File
@@ -0,0 +1,367 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
SQL END!-->
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" sm="12" md="3" xl="2" class="pa-xs-0 pb-3" :class="{'pb-xs-4': !isMobile}">
<v-text-field v-model="serverSearchInput.studentId" label="学生ID" class="cus-v-input " :class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="2" class="pa-xs-0 pb-3" :class="{'pb-xs-4': !isMobile, 'mt-2': isMobile}">
<v-text-field v-model="serverSearchInput.classId" label="班级ID" class="cus-v-input" :class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-col :class="{'pb-xs-4': !isMobile, 'pt-2': isMobile, 'pl-0': isMobile}" cols="12" md="2" sm="12" xl="3">
<v-btn
class="elevation-0"
color="success"
dark
@click="doUiAction('refreshTableData')"
>
查询
</v-btn>
</v-col>
</v-row>
<v-divider></v-divider>
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem')">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<!-- <template v-slot:item.level="{ item }">-->
<!-- {{ getConstantCollectionItemText('level', item.level) }}-->
<!-- </template>-->
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" @click="doUiAction('toTaskHistory', {item})">
查看
</v-btn>
<v-btn small class="mr-2" :class="tableButton.color" v-for="tableButton of tableButtonList" @click="doUiAction(tableButton.action, {item})">
{{ tableButton.text }}
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务ID" v-model="editItem['taskId']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务名称" v-model="editItem['taskTitle']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务状态:running 执行中;deny 拒绝;end 结束" v-model="editItem['taskStatus']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="表单" v-model="editItem['taskFormInput']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="当前执行中节点ID" v-model="editItem['taskConfigId']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="执行线路id list: 逗号分隔" v-model="editItem['taskNextConfigList']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="申请人" v-model="editItem['taskInitUser']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="当前执行的处理人员,用逗号分隔" v-model="editItem['taskEditUserList']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="所有相关人员,用逗号分隔" v-model="editItem['taskViewUserList']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem['taskComment']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="work flow流程JSON" v-model="editItem['workflowConfig']"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="任务创建人" v-model="editItem['createByUser']"></v-text-field>
</v-col>
<!-- <v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">-->
<!-- &lt;!&ndash; 必填字段样式 demo :rules="requireRules" &ndash;&gt;-->
<!-- <v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>-->
<!-- </v-col>-->
<!-- &lt;!&ndash; select 字段 demo &ndash;&gt;-->
<!-- <v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">-->
<!-- <v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>-->
<!-- </v-col>-->
<!-- &lt;!&ndash; 日期选择 demo &ndash;&gt;-->
<!-- <v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">-->
<!-- <v-menu class="cus-v-input mr-2" offset-y max-width="290">-->
<!-- <template v-slot:activator="{ on, attrs }">-->
<!-- <v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>-->
<!-- </template>-->
<!-- <v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>-->
<!-- </v-menu>-->
<!-- </v-col>-->
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
},
serverSearchInput: {
studentId: null,
classId: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "任务ID", value: "taskId", width: 120},
{text: "任务名称", value: "taskTitle", width: 120},
{text: "任务状态:running 执行中;deny 拒绝;end 结束", value: "taskStatus", width: 120},
{text: "当前执行中节点ID", value: "taskConfigId", width: 120},
{text: "申请人", value: "taskInitUser", width: 120},
{text: "当前执行的处理人员,用逗号分隔", value: "taskEditUserList", width: 120},
{text: "所有相关人员,用逗号分隔", value: "taskViewUserList", width: 120},
{text: "备注", value: "taskComment", width: 120},
{text: "任务创建人", value: "createByUser", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
tableButtonList: [
{text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem'},
],
dialogSaveInfoAction: ''
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
await this.doUiAction('refreshTableData');
},
mounted() {},
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value=> !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'selectItemList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = rows;
this.isTableLoading = false;
},
// startCreateItem
async clearItemData() {
this.editItem = {};
},
async openCreateItemDialog() {
this.currentClickButton = {action: 'add', title: '新增'};
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
// createItem
async confirmCreateItemDialog() {
return window.confirmDialog({title: '新增', content: '确定新增吗?'})
},
/**
* 新增数据
*/
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增数据成功");
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
// startUpdateItem
async prepareItemData({item}) {
this.editItem = {...item};
},
async openUpdateDialog() {
this.currentClickButton = {action: 'edit', title: '修改'};
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
// updateItem
async confirmUpdateItemDialog() {
return window.confirmDialog({title: '修改', content: '确定修改吗?'});
},
/**
* 保存数据
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: {id: id}
}
}
})
await window.vtoast.success("修改数据成功");
},
// updateItem
async confirmDeleteItemDialog() {
return window.confirmDialog({title: '删除', content: '确定删除吗?'});
},
/**
* 删除数据
*/
async doDeleteItem({item}) {
const { id } = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'taskManagement',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除数据成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
},
toTaskHistory({item}) {
window.open(`/${window.appInfo.appId}/page/taskHistoryManagement?taskId=${item.taskId}`);
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+419
View File
@@ -0,0 +1,419 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem')">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="serverSearchInput.classId" label="班级ID" class="cus-v-input" :class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-btn
class="elevation-0"
color="success"
dark
@click="doUiAction('refreshTableData')"
>
查询
</v-btn>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<!-- <template v-slot:item.level="{ item }">-->
<!-- {{ getConstantCollectionItemText('level', item.level) }}-->
<!-- </template>-->
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" :class="tableButton.color" v-for="tableButton of tableButtonList" @click="doUiAction(tableButton.action, {item})">
{{ tableButton.text }}
</v-btn>
</template>
</v-data-table>
</v-container>
<v-dialog v-model="dialog" fullscreen hide-overlay persistent transition="dialog-bottom-transition">
<v-card>
<v-toolbar dark color="primary">
<v-btn icon dark @click="dialog = false">
<v-icon>mdi-close</v-icon>
</v-btn>
<v-toolbar-title>流程编辑</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn dark text @click="doUiAction(dialogSaveInfoAction)">
保存
</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-list three-line subheader>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="3" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="流程名" v-model="editItem['workflowName']">
</v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="分类" v-model="editItem['workflowCategory']">
</v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem['workflowRemark']">
</v-text-field>
</v-col>
</v-row>
</v-list>
<v-divider></v-divider>
<v-list three-line subheader>
<v-subheader>模板设置</v-subheader>
<v-list-item>
<tpl-form-design v-if="dialog" :form="editItem.workflowForm">
</tpl-form-design>
</v-list-item>
</v-list>
<v-list three-line subheader>
<v-subheader>流程设置</v-subheader>
<v-list-item>
<process-flow v-if="dialog" :data="editItem.workflowConfig" :user="constantCollection.userList" :group="constantCollection.groupList" :tpl="constantCollection.workflowFormList">
</process-flow>
</v-list-item>
</v-list>
</v-card>
</v-dialog>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
{% include 'component/flow/processFlow.html' %}
{% include 'component/flow/editFlow.html' %}
{% include 'component/flow/editLine.html' %}
{% include 'component/flow/editNode.html' %}
{% include 'component/flow/flowNode.html' %}
{% include 'component/tpl/tplFormDesign.html' %}
{% include 'component/tpl/formItemListGenerator.html' %}
{% include 'component/tpl/formItemListRender.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
userList: [],
groupList: [],
workflowFormList: []
},
serverSearchInput: {
studentId: null,
classId: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "流程ID", value: "workflowId", width: 120},
{text: "流程名", value: "workflowName", width: 120},
{text: "分类ID", value: "workflowCategory", width: 120},
{text: "备注", value: "workFlowRemark", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
tableButtonList: [
{text: '修改', buttonType: 'edit', color: 'success', action: 'startUpdateItem'},
{text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem'},
],
dialogSaveInfoAction: '',
dialog: false,
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {
'editItem.workflowForm': {
handler(val) {
if (!val) return
this.constantCollection.workflowFormList = [];
for(const item of val) {
this.constantCollection.workflowFormList.push({
text: item.component.outline,
value: item.id
})
}
if (!this.editItem.workflowConfig) return;
for (const config of this.editItem.workflowConfig.nodeList) {
if (!config.formId) return;
const formId = []
for(const item of config.formId) {
if (!this.constantCollection.workflowFormList.find(e => e.value === item)) {
formId.push(item)
}
}
config.formId = formId
console.log(config.outline, config.formId)
}
},
deep: true,
immediate: true
}
},
async created() {
await this.doUiAction('refreshTableData');
this.getUserList();
this.getGroupList();
},
mounted() {},
methods: {
buildEditItem() {
const item = {
workflowId: this.editItem.workflowId || null,
workflowName: this.editItem.workflowName,
workflowRemark: this.editItem.workflowRemark,
workflowCategory: this.editItem.workflowCategory,
workflowConfig: this.editItem.workflowConfig ? JSON.stringify(this.editItem.workflowConfig) : null,
workflowForm: this.editItem.workflowForm ? JSON.stringify(this.editItem.workflowForm) : null,
}
if (this.editItem.id) {
item.id = this.editItem.id;
}
return item;
},
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value=> !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectItemList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
for(const item of rows) {
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
}
this.tableDataFromBackend = rows;
this.isTableLoading = false;
},
/**
* 获取表格数据
*/
async getUserList() {
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectUserList',
actionData: {},
where: {},
}
}
});
this.constantCollection.userList = rows.map(e => {
return {text: e.username, value: e.userId}
})
},
/**
* 获取表格数据
*/
async getGroupList() {
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectGroupList',
actionData: {},
where: {},
}
}
});
this.constantCollection.groupList = rows.map(e => {
return {text: e.groupName, value: e.groupId}
});
},
// startCreateItem
async clearItemData() {
this.editItem = { workflowForm: [], workflowConfig: {lineList: [], nodeList:[]} };
},
async openCreateItemDialog() {
this.currentClickButton = {action: 'add', title: '新增'};
// this.isEditDrawerShow = true;
this.dialog = true;
this.dialogSaveInfoAction = 'createItem';
},
// createItem
async confirmCreateItemDialog() {
return window.confirmDialog({title: '新增', content: '确定新增吗?'})
},
/**
* 新增数据
*/
async doCreateItem() {
delete this.computedEditItem.id;
const item = this.buildEditItem();
await window.vtoast.loading("新增数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'insertItem',
actionData: item
}
}
})
await window.vtoast.success("新增数据成功");
},
async closeDrawerShow() {
// this.isEditDrawerShow = false;
this.dialog = false;
},
// startUpdateItem
async prepareItemData({item}) {
this.editItem = item;
},
async openUpdateDialog() {
this.currentClickButton = {action: 'edit', title: '修改'};
// this.isEditDrawerShow = true;
this.dialog = true;
this.dialogSaveInfoAction = 'updateItem';
},
// updateItem
async confirmUpdateItemDialog() {
return window.confirmDialog({title: '修改', content: '确定修改吗?'});
},
/**
* 保存数据
*/
async doUpdateItem() {
const {id, ...item} = this.buildEditItem();
await window.vtoast.loading("修改数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'updateItem',
actionData: item,
where: {id: id}
}
}
})
await window.vtoast.success("修改数据成功");
},
// updateItem
async confirmDeleteItemDialog() {
return window.confirmDialog({title: '删除', content: '确定删除吗?'});
},
/**
* 删除数据
*/
async doDeleteItem({item}) {
const { id } = item;
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除数据成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return value;
}
}
})
</script>
<style scoped>
.v-dialog--fullscreen .v-sheet {
height: unset;
top: unset;
position: unset;
background: white;
}
</style>
{% endblock %}