提交先锋

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

+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 %}