236 lines
9.6 KiB
HTML
236 lines
9.6 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<style>
|
|
.design-dialog .el-dialog__body {
|
|
padding: 0;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava>
|
|
<el-card shadow="never">
|
|
<search @search="doSearch">
|
|
<search-item label="名称">
|
|
<el-input v-model="pageForm.displayName" placeholder="请输入名称" clearable></el-input>
|
|
</search-item>
|
|
<search-item label="编码">
|
|
<el-input v-model="pageForm.name" placeholder="请输入编码" clearable></el-input>
|
|
</search-item>
|
|
</search>
|
|
</el-card>
|
|
|
|
<el-card shadow="never">
|
|
<table-tool>
|
|
<el-button type="primary" @click="onAdd" size="small" icon="el-icon-plus">新增</el-button>
|
|
</table-tool>
|
|
<el-table :data="tableData" @sort-change="pageOrder" style="width: 100%">
|
|
<el-table-column type="index" width="50px" label="序号" :index="indexMethod"></el-table-column>
|
|
<el-table-column prop="displayName" label="流程定义名称"></el-table-column>
|
|
<el-table-column prop="name" label="流程定义编码"></el-table-column>
|
|
<el-table-column prop="categoryName" label="流程分类">
|
|
<template slot-scope="{row}">{{categoryOptions.find(item => item.id ===
|
|
row.category)?.categoryName}}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="version" label="版本号"></el-table-column>
|
|
<el-table-column prop="state" label="状态">
|
|
<template slot-scope="{row}">
|
|
<el-tag size="mini" v-if="row.state===1" type="success">启用</el-tag>
|
|
<el-tag size="mini" v-else-if="row.state===0" type="info">停用</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
|
<el-table-column label="操作" fixed="right" width="350px">
|
|
<template slot-scope="{row}">
|
|
<el-button size="mini" type="primary" @click="onDesign(row)">设计</el-button>
|
|
</el-button>
|
|
<el-button size="mini" type="primary" @click="onEdit(row)">编辑</el-button>
|
|
<!-- <el-button type="text" size="mini" @click="onView(row)">查看</el-button>-->
|
|
<el-button v-if="row.state===1" type="danger" size="mini" @click="onUndeploy(row)">停用
|
|
</el-button>
|
|
<el-button v-if="row.state===0" type="primary" size="mini" @click="onPublish(row)">发布
|
|
</el-button>
|
|
<el-button v-if="row.state===0" type="danger" size="mini" @click="onDelete(row)">删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
</guava>
|
|
|
|
<el-dialog :title="formData.id ? '编辑' : '新增'" :visible.sync="dialogVisible" width="800px">
|
|
<el-form :model="formData" ref="formRef" label-width="120px">
|
|
<el-form-item label="流程定义名称" prop="flowName" :rules="{ required: true, message: '请输入流程定义名称', trigger: 'blur' }">
|
|
<el-input v-model="formData.flowName" placeholder="请输入流程定义名称"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="流程定义编码" prop="flowCode" :rules="{ required: true, message: '请输入流程定义编码', trigger: 'blur' }">
|
|
<el-input v-model="formData.flowCode" placeholder="请输入流程定义编码"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="流程分类" prop="category" :rules="{ required: true, message: '请选择流程分类', trigger: 'change' }">
|
|
<el-select v-model="formData.category" placeholder="请选择流程分类" clearable>
|
|
<el-option v-for="item in categoryOptions" :key="item.id" :label="item.categoryName" :value="item.id"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="onSubmit">确定</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<el-dialog title="流程设计" :visible.sync="designVisible" fullscreen class="design-dialog">
|
|
<div style="height: calc(100vh - 55px); width: 100%">
|
|
<iframe v-if="designVisible" :src="designUrl" frameborder="0" height="100%"
|
|
style="height: 100%; width: inherit"></iframe>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog title="xml编辑" :visible.sync="xmlVisible" width="70%">
|
|
<el-input type="textarea" style="width: 100%;" autosize v-model="formData.model"></el-input>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="xmlVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="onSave">保存</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
<script nonce="${cspNonce!}">
|
|
new Vue({
|
|
el: "#app",
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
dialogVisible: false,
|
|
categoryOptions: [],
|
|
designVisible: false,
|
|
designUrl: null,
|
|
xmlVisible: false,
|
|
formData: {}
|
|
}
|
|
},
|
|
methods: {
|
|
onAdd(){
|
|
this.formData = {}
|
|
this.dialogVisible = true
|
|
},
|
|
onSubmit(){
|
|
$.post("/snakerflow/define/addProcess", this.formData)
|
|
},
|
|
|
|
|
|
onDesign(row = null) {
|
|
this.designVisible = true
|
|
this.iframeLoaded()
|
|
this.designUrl = "/flow/define/designer2?processId=" + row?.id
|
|
},
|
|
|
|
onEdit(row) {
|
|
this.xmlVisible = true
|
|
this.$axios.post("/snakerflow/define/getXml", { id: row.id }).then(res => {
|
|
if (res.code === 0) {
|
|
this.formData = {
|
|
id: row.id,
|
|
model: res.data
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
onSave() {
|
|
$.post("/snakerflow/define/saveProcessXml", { ...this.formData, xmlHeader: true }).then(res => {
|
|
if (res.code === 0) {
|
|
this.$message.success("保存成功")
|
|
this.pageData()
|
|
this.xmlVisible = false
|
|
} else {
|
|
this.$message.error("保存失败")
|
|
}
|
|
})
|
|
},
|
|
|
|
iframeLoaded() {
|
|
// iframe监听组件内设计器保存事件
|
|
window.onmessage = (event) => {
|
|
console.log(event)
|
|
if (event.data === "success") {
|
|
this.$message.success("保存成功")
|
|
this.designVisible = false
|
|
this.pageData()
|
|
} else if (event.data === "error") {
|
|
this.$message.error("保存失败")
|
|
}
|
|
}
|
|
},
|
|
|
|
onUndeploy(row) {
|
|
this.$confirm("您确定要停用吗", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
}).then(() => {
|
|
this.$axios.post("/snakerflow/define/undeploy", { id: row.id }).then((res) => {
|
|
if (res.code === 0) {
|
|
this.$message.success(res.msg)
|
|
this.pageData()
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
onPublish(row) {
|
|
this.$confirm("您确定要发布吗", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
}).then(() => {
|
|
this.$axios.post("/snakerflow/define/publish", { id: row.id }).then((res) => {
|
|
if (res.code === 0) {
|
|
this.$message.success(res.msg)
|
|
this.pageData()
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
onDelete(row) {
|
|
this.$confirm("您确定要删除吗", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
}).then(() => {
|
|
this.$axios.post("/snakerflow/define/delete", { id: row.id }).then((res) => {
|
|
if (res.code === 0) {
|
|
this.$message.success(res.msg)
|
|
this.pageData()
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
onView(row) {
|
|
},
|
|
|
|
listCategory() {
|
|
// this.$axios.get("/platform/warmFlow/category/list").then((res) => {
|
|
// if (res.code === 0) {
|
|
// this.categoryOptions = res.data
|
|
// }
|
|
// })
|
|
}
|
|
},
|
|
created() {
|
|
this.pageData()
|
|
this.listCategory()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#-->
|