mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-30 03:02:00 +08:00
改了很多
This commit is contained in:
26
admin/src/api/flow_apply.ts
Normal file
26
admin/src/api/flow_apply.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 申请流程列表
|
||||
export function flow_apply_lists(params?: Record<string, any>) {
|
||||
return request.get({ url: '/flow_apply/list', params })
|
||||
}
|
||||
|
||||
// 申请流程详情
|
||||
export function flow_apply_detail(params: Record<string, any>) {
|
||||
return request.get({ url: '/flow_apply/detail', params })
|
||||
}
|
||||
|
||||
// 申请流程新增
|
||||
export function flow_apply_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_apply/add', params })
|
||||
}
|
||||
|
||||
// 申请流程编辑
|
||||
export function flow_apply_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_apply/edit', params })
|
||||
}
|
||||
|
||||
// 申请流程删除
|
||||
export function flow_apply_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_apply/del', params })
|
||||
}
|
||||
30
admin/src/api/flow_history.ts
Normal file
30
admin/src/api/flow_history.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 流程历史列表
|
||||
export function flow_history_list(params?: Record<string, any>) {
|
||||
return request.get({ url: '/flow_history/list', params })
|
||||
}
|
||||
// 流程历史列表-所有
|
||||
export function flow_history_list_all(params?: Record<string, any>) {
|
||||
return request.get({ url: '/flow_history/listAll', params })
|
||||
}
|
||||
|
||||
// 流程历史详情
|
||||
export function flow_history_detail(params: Record<string, any>) {
|
||||
return request.get({ url: '/flow_history/detail', params })
|
||||
}
|
||||
|
||||
// 流程历史新增
|
||||
export function flow_history_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_history/add', params })
|
||||
}
|
||||
|
||||
// 流程历史编辑
|
||||
export function flow_history_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_history/edit', params })
|
||||
}
|
||||
|
||||
// 流程历史删除
|
||||
export function flow_history_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow_history/del', params })
|
||||
}
|
||||
@@ -5,6 +5,11 @@ export function flow_template_lists(params?: Record<string, any>) {
|
||||
return request.get({ url: '/flow_template/list', params })
|
||||
}
|
||||
|
||||
// 流程模板列表-所有
|
||||
export function flow_template_lists_all(params?: Record<string, any>) {
|
||||
return request.get({ url: '/flow_template/listAll', params })
|
||||
}
|
||||
|
||||
// 流程模板详情
|
||||
export function flow_template_detail(params: Record<string, any>) {
|
||||
return request.get({ url: '/flow_template/detail', params })
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-checkbox v-model="formData.myAuditAutoPass"
|
||||
>发起人审批时自动通过</el-checkbox
|
||||
>
|
||||
<el-checkbox v-model="formData.myAuditAutoPass">发起人审批时自动通过</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批意见">
|
||||
<el-checkbox v-model="formData.remarkRequired">必填</el-checkbox>
|
||||
@@ -49,48 +47,48 @@
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
props: ["conf"],
|
||||
props: ['conf'],
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
autoRepeat: false, //审批人去重
|
||||
myAuditAutoPass: false, //发起人审批时自动通过
|
||||
remarkTip: "", //审批意见填写提示
|
||||
remarkTip: '', //审批意见填写提示
|
||||
remarkRequired: false,
|
||||
notVisibleForSponsor: false,
|
||||
notVisibleForSponsor: false
|
||||
},
|
||||
rules: {
|
||||
autoRepeat: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择选择分组",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
message: '请选择选择分组',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
},
|
||||
autoRepeatOptions: [
|
||||
{
|
||||
label: "启用自动去重",
|
||||
value: true,
|
||||
label: '启用自动去重',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
label: "不启用自动去重",
|
||||
value: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
label: '不启用自动去重',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (typeof this.conf === "object" && this.conf !== null) {
|
||||
Object.assign(this.formData, this.conf);
|
||||
if (typeof this.conf === 'object' && this.conf !== null) {
|
||||
Object.assign(this.formData, this.conf)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
return this.formData;
|
||||
},
|
||||
},
|
||||
};
|
||||
return this.formData
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
style="height: 100vh"
|
||||
class="flow-config-dialog"
|
||||
>
|
||||
<template #header="{ close, titleId, titleClass }">
|
||||
<template #header="{ close }">
|
||||
<header class="page__header">
|
||||
<div class="page-actions">
|
||||
{{ title }}
|
||||
@@ -157,7 +157,6 @@ export default {
|
||||
},
|
||||
publish() {
|
||||
const getCmpData = (name) => {
|
||||
console.log(name)
|
||||
return this.$refs[name].getData()
|
||||
}
|
||||
// basicSetting formDesign processDesign 返回的是Promise 因为要做校验
|
||||
@@ -172,7 +171,8 @@ export default {
|
||||
id: this?.mockData?.id,
|
||||
basicSetting: res[0].formData,
|
||||
flowFormData: res[1].formData,
|
||||
flowProcessData: res[2].formData
|
||||
flowProcessData: res[2].formData,
|
||||
flowProcessTreeData: res[2].TreeNode
|
||||
|
||||
// advancedSetting: getCmpData("advancedSetting"),
|
||||
}
|
||||
@@ -185,6 +185,7 @@ export default {
|
||||
err.msg && this.$message.error(err.msg)
|
||||
})
|
||||
},
|
||||
|
||||
sendToServer(param) {
|
||||
this.$notify({
|
||||
title: '数据已整合完成',
|
||||
|
||||
81
admin/src/components/flow/XForm/view.vue
Normal file
81
admin/src/components/flow/XForm/view.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:show-close="false"
|
||||
:fullscreen="false"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:destroy-on-close="true"
|
||||
top="1px"
|
||||
class="flow-config-dialog"
|
||||
>
|
||||
<v-form-render
|
||||
:form-json="formJson"
|
||||
:form-data="formData"
|
||||
:option-data="optionData"
|
||||
ref="vFormRef"
|
||||
>
|
||||
</v-form-render>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="getData"> Confirm </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import 'vform3-builds/dist/designer.style.css' //引入VForm3样式
|
||||
|
||||
const formJson = ref({})
|
||||
const formData = ref({})
|
||||
const optionData = reactive({})
|
||||
const vFormRef = ref(null)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const rowId = ref(0)
|
||||
|
||||
const props = defineProps({
|
||||
save: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
function open(id, form_json, form_data) {
|
||||
rowId.value = id
|
||||
formData.value = form_data
|
||||
formJson.value = form_json
|
||||
console.log('open')
|
||||
dialogVisible.value = true
|
||||
}
|
||||
function closeFn() {
|
||||
dialogVisible.value = false
|
||||
rowId.value = 0
|
||||
formData.value = {}
|
||||
formJson.value = {}
|
||||
}
|
||||
function getData() {
|
||||
vFormRef.value.getFormData().then((formData) => {
|
||||
console.log('formData', formData)
|
||||
props
|
||||
.save(rowId.value, formData)
|
||||
.then(() => {
|
||||
closeFn()
|
||||
})
|
||||
.catch(() => {})
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
getData,
|
||||
open
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// body {
|
||||
// margin: 0; /* 如果页面出现垂直滚动条,则加入此行CSS以消除之 */
|
||||
// }
|
||||
</style>
|
||||
@@ -165,7 +165,7 @@ export default {
|
||||
*/
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = this.lf.getGraphData()
|
||||
console.log('data', data)
|
||||
|
||||
const nodes = data.nodes
|
||||
const edges = data.edges
|
||||
|
||||
@@ -178,7 +178,6 @@ export default {
|
||||
sourceNodeIdSum[edge.sourceNodeId].push(targetNode)
|
||||
|
||||
for (const n of sourceNodeIdSum[edge.sourceNodeId]) {
|
||||
console.log('n', n)
|
||||
if (n.type != 'bpmn:exclusiveGateway') {
|
||||
haveMoreChildNode = true
|
||||
break
|
||||
@@ -202,15 +201,36 @@ export default {
|
||||
// });
|
||||
// }
|
||||
// 检查开始节点和结束节点是否存在
|
||||
const findStartNode = nodes.find((item) => item.type == 'bpmn:startEvent')
|
||||
const findEndNode = nodes.find((item) => item.type == 'bpmn:endEvent')
|
||||
if (!findStartNode || !findEndNode) {
|
||||
const findStartNode = nodes.filter((item) => item.type == 'bpmn:startEvent')
|
||||
const findEndNode = nodes.filter((item) => item.type == 'bpmn:endEvent')
|
||||
if (findStartNode.length != 1 || findEndNode.length != 1) {
|
||||
return reject({
|
||||
msg: '流程设计-流程必须有开始节点和结束节点'
|
||||
msg: '流程设计-流程必须有且只有一个开始节点和结束节点'
|
||||
})
|
||||
}
|
||||
|
||||
function handel(arr, pid) {
|
||||
const newArr = []
|
||||
arr.forEach((node) => {
|
||||
// console.log('sourceNodeIdSum', sourceNodeIdSum, node.id)
|
||||
const newNode = {
|
||||
id: node.id,
|
||||
pid: pid,
|
||||
type: node.type,
|
||||
fieldAuth: node?.properties?.fieldAuth,
|
||||
user: node?.properties?.user || 0
|
||||
}
|
||||
if (sourceNodeIdSum[node.id]) {
|
||||
newNode.children = handel(sourceNodeIdSum[node.id], node.id)
|
||||
}
|
||||
newArr.push(newNode)
|
||||
})
|
||||
return newArr
|
||||
}
|
||||
const TreeNode = handel(findStartNode, 0)
|
||||
console.log('TreeNode', TreeNode)
|
||||
// 检查连线方向是否正确;
|
||||
resolve({ formData: data })
|
||||
resolve({ formData: data, TreeNode })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,17 @@
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="image-node"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:startEvent','开始')"
|
||||
>
|
||||
<div class="image-node" @mousedown.stop.prevent="dragInNode('bpmn:startEvent', '开始')">
|
||||
<div class="pattern-start"></div>
|
||||
<div>开始</div>
|
||||
</div>
|
||||
<div
|
||||
class="image-node"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:userTask','审批')"
|
||||
>
|
||||
<div class="image-node" @mousedown.stop.prevent="dragInNode('bpmn:userTask', '审批')">
|
||||
<div class="pattern-user"></div>
|
||||
<div>审批</div>
|
||||
</div>
|
||||
<div
|
||||
class="image-node"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:serviceTask','系统任务')"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:serviceTask', '系统任务')"
|
||||
>
|
||||
<div class="pattern-user"></div>
|
||||
<div>系统</div>
|
||||
@@ -35,49 +29,45 @@
|
||||
|
||||
<div
|
||||
class="image-node"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:exclusiveGateway','网关')"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:exclusiveGateway', '网关')"
|
||||
>
|
||||
<div class="pattern-condition"></div>
|
||||
<div>网关</div>
|
||||
</div>
|
||||
<div
|
||||
class="image-node"
|
||||
@mousedown.stop.prevent="dragInNode('bpmn:endEvent','结束')"
|
||||
>
|
||||
<div class="image-node" @mousedown.stop.prevent="dragInNode('bpmn:endEvent', '结束')">
|
||||
<div class="pattern-end"></div>
|
||||
<div>结束</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import IconCircle from './icon/Circle.vue'
|
||||
import { List } from "./node";
|
||||
import { List } from './node'
|
||||
|
||||
console.log("List", List);
|
||||
console.log('List', List)
|
||||
export default {
|
||||
name: "DiagramSidebar",
|
||||
name: 'DiagramSidebar',
|
||||
data() {
|
||||
return {
|
||||
list: List.map((item) => {
|
||||
return {
|
||||
type: item.type,
|
||||
...item.info,
|
||||
};
|
||||
}),
|
||||
};
|
||||
...item.info
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dragInNode(type,text) {
|
||||
console.log("dragInNode", type);
|
||||
this.$emit("dragInNode", type,text);
|
||||
},
|
||||
},
|
||||
dragInNode(type, text) {
|
||||
console.log('dragInNode', type)
|
||||
this.$emit('dragInNode', type, text)
|
||||
}
|
||||
}
|
||||
// components: {
|
||||
// // IconCircle,
|
||||
// }
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="toolbar-item" :class="{ 'selection-active': selectionOpened }" @click="$_selectionSelect()">
|
||||
<div
|
||||
class="toolbar-item"
|
||||
:class="{ 'selection-active': selectionOpened }"
|
||||
@click="$_selectionSelect()"
|
||||
>
|
||||
<area-select size="18" />
|
||||
</div>
|
||||
<div class="toolbar-item" @click="$_zoomIn()">
|
||||
@@ -20,7 +24,12 @@
|
||||
<div class="toolbar-item" @click="$_saveGraph">导出</div>
|
||||
<div>
|
||||
<el-select v-model="linetype" @change="$_changeLineType">
|
||||
<el-option v-for="item in lineOptions" :key="item.value" :value="item.value" :label="item.label"></el-option>
|
||||
<el-option
|
||||
v-for="item in lineOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,30 +42,30 @@
|
||||
// import IconFont from './icon/Font.vue'
|
||||
// import IconBlod from './icon/Blod.vue'
|
||||
// import IconLine from './icon/Line.vue'
|
||||
import ZoomIn from "./icon/ZoomIn.vue";
|
||||
import ZoomOut from "./icon/ZoomOut.vue";
|
||||
import StepBack from "./icon/StepBack.vue";
|
||||
import StepFoward from "./icon/StepFoward.vue";
|
||||
import AreaSelect from "./icon/AreaSelect.vue";
|
||||
import ZoomIn from './icon/ZoomIn.vue'
|
||||
import ZoomOut from './icon/ZoomOut.vue'
|
||||
import StepBack from './icon/StepBack.vue'
|
||||
import StepFoward from './icon/StepFoward.vue'
|
||||
import AreaSelect from './icon/AreaSelect.vue'
|
||||
|
||||
let fileHandle;
|
||||
let fileHandle
|
||||
|
||||
async function getFile() {
|
||||
[fileHandle] = await window.showOpenFilePicker();
|
||||
console.log("fileHandle", fileHandle);
|
||||
;[fileHandle] = await window.showOpenFilePicker()
|
||||
console.log('fileHandle', fileHandle)
|
||||
}
|
||||
|
||||
async function getText() {
|
||||
const file = await fileHandle.getFile();
|
||||
const text = await file.text();
|
||||
console.log(text);
|
||||
return text;
|
||||
const file = await fileHandle.getFile()
|
||||
const text = await file.text()
|
||||
console.log(text)
|
||||
return text
|
||||
}
|
||||
|
||||
async function writeFile() {
|
||||
const writable = await fileHandle.createWritable();
|
||||
await writable.write("测试一下");
|
||||
await writable.close();
|
||||
const writable = await fileHandle.createWritable()
|
||||
await writable.write('测试一下')
|
||||
await writable.close()
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -65,90 +74,90 @@ export default {
|
||||
activeEdges: Array,
|
||||
fillColor: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectionOpened: false,
|
||||
undoAble: false,
|
||||
redoAble: false,
|
||||
colors: "#345678",
|
||||
linetype: "pro-polyline",
|
||||
colors: '#345678',
|
||||
linetype: 'pro-polyline',
|
||||
lineOptions: [
|
||||
{
|
||||
value: "pro-polyline",
|
||||
label: "折线",
|
||||
value: 'pro-polyline',
|
||||
label: '折线'
|
||||
},
|
||||
{
|
||||
value: "pro-line",
|
||||
label: "直线",
|
||||
value: 'pro-line',
|
||||
label: '直线'
|
||||
},
|
||||
{
|
||||
value: "pro-bezier",
|
||||
label: "曲线",
|
||||
},
|
||||
],
|
||||
};
|
||||
value: 'pro-bezier',
|
||||
label: '曲线'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$props.lf.on("history:change", ({ data: { undoAble, redoAble } }) => {
|
||||
this.$data.redoAble = redoAble;
|
||||
this.$data.undoAble = undoAble;
|
||||
});
|
||||
this.$props.lf.on('history:change', ({ data: { undoAble, redoAble } }) => {
|
||||
this.$data.redoAble = redoAble
|
||||
this.$data.undoAble = undoAble
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
async $import() {
|
||||
try {
|
||||
await getFile();
|
||||
let text = await getText();
|
||||
if(JSON.parse(text)){
|
||||
this.$emit("importData",JSON.parse(text));
|
||||
await getFile()
|
||||
const text = await getText()
|
||||
if (JSON.parse(text)) {
|
||||
this.$emit('importData', JSON.parse(text))
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error("文件读取错误");
|
||||
this.$message.error('文件读取错误')
|
||||
}
|
||||
},
|
||||
$_changeFillColor(val) {
|
||||
this.$emit("changeNodeFillColor", val.hex);
|
||||
this.$emit('changeNodeFillColor', val.hex)
|
||||
},
|
||||
$_saveGraph() {
|
||||
this.$emit("saveGraph");
|
||||
this.$emit('saveGraph')
|
||||
},
|
||||
$_zoomIn() {
|
||||
this.$props.lf.zoom(true);
|
||||
this.$props.lf.zoom(true)
|
||||
},
|
||||
$_zoomOut() {
|
||||
this.$props.lf.zoom(false);
|
||||
this.$props.lf.zoom(false)
|
||||
},
|
||||
$_undo() {
|
||||
if (this.$data.undoAble) {
|
||||
this.$props.lf.undo();
|
||||
this.$props.lf.undo()
|
||||
}
|
||||
},
|
||||
$_redo() {
|
||||
if (this.$data.redoAble) {
|
||||
this.$props.lf.redo();
|
||||
this.$props.lf.redo()
|
||||
}
|
||||
},
|
||||
$_selectionSelect() {
|
||||
this.selectionOpened = !this.selectionOpened;
|
||||
this.selectionOpened = !this.selectionOpened
|
||||
if (this.selectionOpened) {
|
||||
this.lf.extension.selectionSelect.openSelectionSelect();
|
||||
this.lf.extension.selectionSelect.openSelectionSelect()
|
||||
} else {
|
||||
this.lf.extension.selectionSelect.closeSelectionSelect();
|
||||
this.lf.extension.selectionSelect.closeSelectionSelect()
|
||||
}
|
||||
},
|
||||
$_changeLineType(value) {
|
||||
const { lf, activeEdges } = this.$props;
|
||||
const { graphModel } = lf;
|
||||
lf.setDefaultEdgeType(value);
|
||||
const { lf, activeEdges } = this.$props
|
||||
const { graphModel } = lf
|
||||
lf.setDefaultEdgeType(value)
|
||||
if (activeEdges && activeEdges.length > 0) {
|
||||
activeEdges.forEach((edge) => {
|
||||
graphModel.changeEdgeType(edge.id, value);
|
||||
});
|
||||
graphModel.changeEdgeType(edge.id, value)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
// ColorFill,
|
||||
@@ -160,10 +169,10 @@ export default {
|
||||
ZoomOut,
|
||||
StepBack,
|
||||
StepFoward,
|
||||
AreaSelect,
|
||||
AreaSelect
|
||||
// SketchPicker: Sketch
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -176,6 +185,6 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
.selection-active {
|
||||
background: rgba(0 ,0,0,0.2);
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,22 +1,37 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="drawerVisible"
|
||||
size="500px"
|
||||
:title="node?.text?.value"
|
||||
@close="close"
|
||||
>
|
||||
<el-drawer v-model="drawerVisible" size="500px" :title="node?.text?.value" @close="close">
|
||||
<div class="setting-block">
|
||||
<!-- 开始节点 -->
|
||||
{{ node }}
|
||||
|
||||
<div v-if="node.type == 'bpmn:startEvent'">开始节点</div>
|
||||
<div v-if="node.type == 'bpmn:userTask'">
|
||||
审批节点 设置审批人(具体人员,角色,部门(负责人),岗位?)
|
||||
审批节点
|
||||
<div>设置审批人(具体人员,部门(负责人),岗位?)</div>
|
||||
<!-- {{ adminUserList }} -->
|
||||
<el-form>
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="properties.user" placeholder="请选择审批人">
|
||||
<el-option
|
||||
v-for="item in adminUserList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div v-if="node.type == 'bpmn:serviceTask'">系统任务</div>
|
||||
<div v-if="node.type == 'bpmn:serviceTask'">
|
||||
<div>系统任务</div>
|
||||
<div>抄送</div>
|
||||
<div>发送邮件</div>
|
||||
<div>发送短信</div>
|
||||
<div>发送站内消息</div>
|
||||
</div>
|
||||
<div v-if="node.type == 'bpmn:exclusiveGateway'">
|
||||
<div>网关</div>
|
||||
<div>网关,只能有一个网关通过</div>
|
||||
<div>从form取值判断</div>
|
||||
</div>
|
||||
|
||||
@@ -24,11 +39,7 @@
|
||||
|
||||
<!-- 网关和结束节点不需要表单权限设置 -->
|
||||
<el-table
|
||||
v-if="
|
||||
['bpmn:startEvent', 'bpmn:userTask', 'bpmn:serviceTask'].includes(
|
||||
node.type
|
||||
)
|
||||
"
|
||||
v-if="['bpmn:startEvent', 'bpmn:userTask', 'bpmn:serviceTask'].includes(node.type)"
|
||||
fit
|
||||
size="small"
|
||||
:data="fieldList"
|
||||
@@ -54,14 +65,21 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { adminLists } from '@/api/perms/admin'
|
||||
|
||||
export default {
|
||||
name: "PropertyPanel",
|
||||
name: 'PropertyPanel',
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
drawerVisible: false,
|
||||
adminUserList: [],
|
||||
|
||||
node: {},
|
||||
properties: {
|
||||
user: '', //审批人id
|
||||
fieldAuth: {} // 字段权限
|
||||
},
|
||||
/**
|
||||
* 表单列表
|
||||
* [{
|
||||
@@ -70,46 +88,61 @@ export default {
|
||||
* auth: 1,
|
||||
* }]
|
||||
*/
|
||||
fieldList: [],
|
||||
};
|
||||
fieldList: []
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
open(node, fieldList) {
|
||||
this.node = node;
|
||||
this.node = node
|
||||
|
||||
this.properties.user = node?.properties?.user || ''
|
||||
this.properties.fieldAuth = node?.properties?.fieldAuth || {}
|
||||
this.fieldList = fieldList.map((item) => {
|
||||
let auth = 1;
|
||||
let formId = item?.field?.id;
|
||||
let auth = 1
|
||||
const formId = item?.field?.id
|
||||
if (node?.properties?.fieldAuth?.[formId]) {
|
||||
auth = node.properties.fieldAuth[formId];
|
||||
auth = node.properties.fieldAuth[formId]
|
||||
}
|
||||
return {
|
||||
id: formId,
|
||||
label: item?.field?.options?.label,
|
||||
auth: auth,
|
||||
};
|
||||
});
|
||||
|
||||
this.drawerVisible = true;
|
||||
auth: auth
|
||||
}
|
||||
})
|
||||
this.getAdminList()
|
||||
this.drawerVisible = true
|
||||
},
|
||||
close() {
|
||||
var fieldAuth = {};
|
||||
const fieldAuth = {}
|
||||
this.fieldList.forEach((item) => {
|
||||
fieldAuth[item.id] = item.auth;
|
||||
});
|
||||
this.setProperties("fieldAuth", {
|
||||
...fieldAuth,
|
||||
});
|
||||
fieldAuth[item.id] = item.auth
|
||||
})
|
||||
|
||||
this.setProperties('fieldAuth', {
|
||||
...fieldAuth
|
||||
})
|
||||
this.setProperties('user', this.properties.user)
|
||||
},
|
||||
getAdminList() {
|
||||
adminLists().then((res) => {
|
||||
console.log('res', res)
|
||||
this.adminUserList = res.lists.map((item) => {
|
||||
return {
|
||||
value: item.id,
|
||||
label: item.nickname
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
setProperties(key, val) {
|
||||
this.$emit("setProperties", this.node, {
|
||||
[key]: val,
|
||||
});
|
||||
this.$emit('setProperties', this.node, {
|
||||
[key]: val
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {},
|
||||
};
|
||||
components: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// 元素属性右侧面板默认属性
|
||||
export const defatuleStyle = {
|
||||
backgroundColor: '', // 填充色
|
||||
gradientColor: '', // 渐变色
|
||||
borderType: 0, // 边框类型
|
||||
borderColor: '', // 填充颜色
|
||||
borderWidth: 1, // 边框宽度
|
||||
borderStyle: '', // 边框类型
|
||||
fontSize: 12, // 文本大小
|
||||
fontColor: '', // 文本颜色
|
||||
fontWeight: '' // 文本加粗
|
||||
}
|
||||
@@ -11,27 +11,27 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LogicFlow from "@logicflow/core";
|
||||
import { BpmnElement} from "@logicflow/extension";
|
||||
import LogicFlow from '@logicflow/core'
|
||||
import { BpmnElement } from '@logicflow/extension'
|
||||
// import { SelectionSelect, Menu } from "@logicflow/extension";
|
||||
import "@logicflow/core/dist/style/index.css";
|
||||
import "@logicflow/extension/lib/style/index.css";
|
||||
import '@logicflow/core/dist/style/index.css'
|
||||
import '@logicflow/extension/lib/style/index.css'
|
||||
|
||||
import { registerCustomElement } from "./node";
|
||||
import { registerCustomElement } from './node'
|
||||
|
||||
export default {
|
||||
name: "DiagramView",
|
||||
name: 'DiagramView',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
lf: "",
|
||||
lf: '',
|
||||
activeNodes: [],
|
||||
activeEdges: [],
|
||||
properties: {},
|
||||
|
||||
timer: null,
|
||||
time: 60000
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// appStore: {
|
||||
@@ -39,7 +39,6 @@ export default {
|
||||
// if (this.lf) {
|
||||
// // this.lf.graphModel.resize();
|
||||
// // this.lf.fitView();
|
||||
|
||||
// // 侧栏有动画,所以要加延时
|
||||
// setTimeout(() => {
|
||||
// this.lf.graphModel.resize();
|
||||
@@ -52,9 +51,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
// this.initLogicFlow(exportInfo);
|
||||
|
||||
},
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
}
|
||||
@@ -64,7 +62,7 @@ export default {
|
||||
// 引入框选插件
|
||||
// LogicFlow.use(SelectionSelect);
|
||||
// LogicFlow.use(Menu);
|
||||
LogicFlow.use(BpmnElement);
|
||||
LogicFlow.use(BpmnElement)
|
||||
const lf = new LogicFlow({
|
||||
container: this.$refs.diagram,
|
||||
overlapMode: 1,
|
||||
@@ -74,99 +72,123 @@ export default {
|
||||
stopMoveGraph: true,
|
||||
metaKeyMultipleSelected: true,
|
||||
keyboard: {
|
||||
enabled: false,
|
||||
enabled: false
|
||||
},
|
||||
isSilentMode: true,
|
||||
grid: {
|
||||
visible: false,
|
||||
size: 1,
|
||||
type: "mesh",
|
||||
type: 'mesh',
|
||||
config: {
|
||||
color: "rgba(255,255,255,0.1)",
|
||||
thickness: 1,
|
||||
},
|
||||
color: 'rgba(255,255,255,0.1)',
|
||||
thickness: 1
|
||||
}
|
||||
},
|
||||
background: {
|
||||
backgroundColor: "rgba(29, 32, 98, 1)",
|
||||
backgroundColor: 'rgba(29, 32, 98, 1)'
|
||||
// backgroundImage:
|
||||
// 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2QwZDBkMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDBkMGQwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=")',
|
||||
// backgroundRepeat: "repeat",
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
lf.setTheme({
|
||||
baseEdge: { strokeWidth: 1 },
|
||||
baseNode: { strokeWidth: 1 },
|
||||
nodeText: { overflowMode: "autoWrap", lineHeight: 1.5 },
|
||||
edgeText: { overflowMode: "autoWrap", lineHeight: 1.5 },
|
||||
});
|
||||
nodeText: { overflowMode: 'autoWrap', lineHeight: 1.5 },
|
||||
edgeText: { overflowMode: 'autoWrap', lineHeight: 1.5 }
|
||||
})
|
||||
// 注册自定义元素
|
||||
registerCustomElement(lf);
|
||||
lf.setDefaultEdgeType("pro-polyline");
|
||||
lf.render(data);
|
||||
lf.fitView();
|
||||
registerCustomElement(lf)
|
||||
lf.setDefaultEdgeType('pro-polyline')
|
||||
lf.render(data)
|
||||
lf.fitView()
|
||||
|
||||
this.lf = lf;
|
||||
this.lf = lf
|
||||
},
|
||||
setType(errorMap) {
|
||||
const gatwayStatus = {
|
||||
error: 0,
|
||||
success: 0
|
||||
}
|
||||
let all = this.lf.getGraphRawData();
|
||||
const all = this.lf.getGraphRawData()
|
||||
all.nodes.forEach((item) => {
|
||||
if (!item.type.includes('status')) {
|
||||
return
|
||||
}
|
||||
if (item.properties.deviceType == 1 && errorMap.T80ErrorArr.some(i => i == item.properties.equipmentId)) {
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
} else if (item.properties.deviceType == 2 && errorMap.ZLErrorArr.some(i => i == item.properties.equipmentId)) {
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
} else if (item.properties.deviceType == 3 && errorMap.TimeOutErrorArr.some(i => i == item.properties.equipmentId)) {
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
} else if (item.properties.deviceType == 3 || item.properties.deviceType == 2 || item.properties.deviceType == 1) {
|
||||
this.lf.changeNodeType(item.id, "status_success");
|
||||
if (
|
||||
item.properties.deviceType == 1 &&
|
||||
errorMap.T80ErrorArr.some((i) => i == item.properties.equipmentId)
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
} else if (
|
||||
item.properties.deviceType == 2 &&
|
||||
errorMap.ZLErrorArr.some((i) => i == item.properties.equipmentId)
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
} else if (
|
||||
item.properties.deviceType == 3 &&
|
||||
errorMap.TimeOutErrorArr.some((i) => i == item.properties.equipmentId)
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
} else if (
|
||||
item.properties.deviceType == 3 ||
|
||||
item.properties.deviceType == 2 ||
|
||||
item.properties.deviceType == 1
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_success')
|
||||
} else if (item.properties.deviceType == 4) {
|
||||
let equipments = item.properties.equipmentId.split(',')
|
||||
equipments = equipments.map(i => i.trim())
|
||||
if (equipments.every(equipmentId => errorMap.TimeOutErrorArr.includes(equipmentId))) {
|
||||
equipments = equipments.map((i) => i.trim())
|
||||
if (
|
||||
equipments.every((equipmentId) =>
|
||||
errorMap.TimeOutErrorArr.includes(equipmentId)
|
||||
)
|
||||
) {
|
||||
gatwayStatus.error++
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
} else {
|
||||
gatwayStatus.success++
|
||||
this.lf.changeNodeType(item.id, "status_success");
|
||||
this.lf.changeNodeType(item.id, 'status_success')
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
this.$emit('gatewayStatus', gatwayStatus)
|
||||
},
|
||||
setTypeByDeviceID(deviceID, itemID, status) {
|
||||
let all = this.lf.getGraphRawData();
|
||||
const all = this.lf.getGraphRawData()
|
||||
all.nodes.forEach((item) => {
|
||||
if (item.properties.deviceType) {
|
||||
return
|
||||
}
|
||||
if (item.properties.deviceID == deviceID && item.properties.itemID == itemID && status == 1) {
|
||||
this.lf.changeNodeType(item.id, "status_success");
|
||||
} else if (item.properties.deviceID == deviceID && item.properties.itemID == itemID && status == 0) {
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
if (
|
||||
item.properties.deviceID == deviceID &&
|
||||
item.properties.itemID == itemID &&
|
||||
status == 1
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_success')
|
||||
} else if (
|
||||
item.properties.deviceID == deviceID &&
|
||||
item.properties.itemID == itemID &&
|
||||
status == 0
|
||||
) {
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
networkError() {
|
||||
let all = this.lf.getGraphRawData();
|
||||
const all = this.lf.getGraphRawData()
|
||||
all.nodes.forEach((item) => {
|
||||
if (item.properties.deviceType) {
|
||||
return
|
||||
}
|
||||
if (item.properties.deviceID && item.properties.itemID) {
|
||||
this.lf.changeNodeType(item.id, "status_error");
|
||||
this.lf.changeNodeType(item.id, 'status_error')
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -83,14 +83,15 @@
|
||||
<el-option label="BigDecimal" value="BigDecimal" />
|
||||
<el-option label="Date" value="Date" />
|
||||
<el-option label="Boolean" value="Boolean" />
|
||||
<el-option label="TsTime" value="core.TsTime" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="go属性" min-width="100">
|
||||
<!-- <el-table-column label="go属性" min-width="100">
|
||||
<template v-slot="{ row }">
|
||||
<el-input v-model="row.goField" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="必填" width="80">
|
||||
<template v-slot="{ row }">
|
||||
<el-checkbox
|
||||
|
||||
253
admin/src/views/flow_apply/edit.vue
Normal file
253
admin/src/views/flow_apply/edit.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form-item label="模板" prop="templateId">
|
||||
<el-select
|
||||
class="flex-1"
|
||||
v-model="formData.templateId"
|
||||
placeholder="请输入模板"
|
||||
@change="handleTemplateChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in flow_template"
|
||||
:key="index"
|
||||
:label="item.flowName"
|
||||
:value="item.id"
|
||||
clearable
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="流程名称" prop="flowName">
|
||||
<el-input v-model="formData.flowName" placeholder="请输入流程名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程分类" prop="flowGroup">
|
||||
<el-input v-model="formData.flowGroup" placeholder="请输入流程分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程描述" prop="flowRemark">
|
||||
<el-input v-model="formData.flowRemark" placeholder="请输入流程描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="表单配置" prop="flowFormData">
|
||||
<el-input
|
||||
v-model="formData.flowFormData"
|
||||
placeholder="请输入表单配置"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="流程配置" prop="flowProcessData">
|
||||
<el-input
|
||||
v-model="formData.flowProcessData"
|
||||
placeholder="请输入流程配置"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="formValue" prop="formValue">
|
||||
<el-input
|
||||
v-model="formData.formValue"
|
||||
placeholder="请输入流程配置"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态:0待提交,1审批中,2审批完成,3审批失败" prop="status">
|
||||
<el-select
|
||||
class="flex-1"
|
||||
v-model.number="formData.status"
|
||||
placeholder="请选择状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in dictData.flow_apply_status"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
clearable
|
||||
:disabled="!item.status"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { flow_apply_edit, flow_apply_add, flow_apply_detail } from '@/api/flow_apply'
|
||||
import { flow_template_lists_all } from '@/api/flow_template'
|
||||
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import { shallowRef, ref, computed, reactive } from 'vue'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑申请流程' : '新增申请流程'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
templateId: '',
|
||||
// applyUserId: '',
|
||||
// applyUserNickname: '',
|
||||
flowName: '',
|
||||
flowGroup: '',
|
||||
flowRemark: '',
|
||||
flowFormData: '',
|
||||
flowProcessData: '',
|
||||
status: 0,
|
||||
formValue: ''
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
templateId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入模板',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
applyUserId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入申请人id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
applyUserNickname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入申请人昵称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
flowName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入流程名称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
flowGroup: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入流程分类',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
flowRemark: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入流程描述',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
flowFormData: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入表单配置',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
flowProcessData: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入流程配置',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择状态:0待提交,1审批中,2审批完成,3审批失败',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
}
|
||||
const flow_template = ref([])
|
||||
const get_flow_template = async () => {
|
||||
flow_template.value = await flow_template_lists_all()
|
||||
}
|
||||
function handleTemplateChange(id: number) {
|
||||
console.log(id)
|
||||
flow_template.value.find((item: any) => {
|
||||
if (item.id == id) {
|
||||
formData.flowName = item.flowName
|
||||
formData.flowGroup = item.flowGroup
|
||||
formData.flowRemark = item.flowRemark
|
||||
formData.flowFormData = item.flowFormData
|
||||
formData.flowProcessData = item.flowProcessData
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
get_flow_template()
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
// if ( !data.id) {
|
||||
// delete data.id
|
||||
// }
|
||||
mode.value == 'edit' ? await flow_apply_edit(data) : await flow_apply_add(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await flow_apply_detail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
||||
194
admin/src/views/flow_apply/index.vue
Normal file
194
admin/src/views/flow_apply/index.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<div class="index-lists">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||
<el-form-item label="模板" prop="templateId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.templateId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人id" prop="applyUserId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.applyUserId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人昵称" prop="applyUserNickname">
|
||||
<el-input class="w-[280px]" v-model="queryParams.applyUserNickname" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程名称" prop="flowName">
|
||||
<el-input class="w-[280px]" v-model="queryParams.flowName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程分类" prop="flowGroup">
|
||||
<el-input class="w-[280px]" v-model="queryParams.flowGroup" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程描述" prop="flowRemark">
|
||||
<el-input class="w-[280px]" v-model="queryParams.flowRemark" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:0待提交,1审批中,2审批完成,3审批失败" prop="status">
|
||||
<el-select v-model="queryParams.status" class="w-[280px]" clearable>
|
||||
<el-option label="全部" value="" />
|
||||
<el-option
|
||||
v-for="(item, index) in dictData.flow_apply_status"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button v-perms="['flow_apply:add']" type="primary" @click="handleAdd()">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
申请
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
||||
<el-table-column label="模板" prop="templateId" min-width="100" />
|
||||
<el-table-column label="申请人id" prop="applyUserId" min-width="100" />
|
||||
<el-table-column label="申请人昵称" prop="applyUserNickname" min-width="100" />
|
||||
<el-table-column label="流程名称" prop="flowName" min-width="100" />
|
||||
<el-table-column label="流程分类" prop="flowGroup" min-width="100" />
|
||||
<el-table-column label="流程描述" prop="flowRemark" min-width="100" />
|
||||
<el-table-column label="formValue" prop="formValue" min-width="100" />
|
||||
|
||||
<el-table-column label="状态" prop="status" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-value :options="dictData.flow_apply_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['flow_apply:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="OpenViewForm(row)"
|
||||
>
|
||||
编辑表单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['flow_apply:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['flow_apply:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
:dict-data="dictData"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
<ViewForm ref="viewFormRef" :save="SaveViewForm"></ViewForm>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { flow_apply_delete, flow_apply_lists, flow_apply_edit } from '@/api/flow_apply'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
||||
import ViewForm from '@/components/flow/XForm/view.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'flow_apply'
|
||||
})
|
||||
const viewFormRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const queryParams = reactive({
|
||||
templateId: '',
|
||||
applyUserId: '',
|
||||
applyUserNickname: '',
|
||||
flowName: '',
|
||||
flowGroup: '',
|
||||
flowRemark: '',
|
||||
flowFormData: '',
|
||||
flowProcessData: '',
|
||||
status: ''
|
||||
})
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: flow_apply_lists,
|
||||
params: queryParams
|
||||
})
|
||||
const { dictData } = useDictData<{
|
||||
flow_apply_status: any[]
|
||||
}>(['flow_apply_status'])
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await flow_apply_delete({ id })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
const OpenViewForm = async (data: any) => {
|
||||
let form_data = {}
|
||||
try {
|
||||
form_data = JSON.parse(data.formValue)
|
||||
} catch (error) {}
|
||||
let form_json = {}
|
||||
try {
|
||||
form_json = JSON.parse(data.flowFormData)
|
||||
} catch (error) {}
|
||||
console.log(data, form_data, form_json)
|
||||
|
||||
viewFormRef.value?.open(data.id, form_json, form_data)
|
||||
}
|
||||
const SaveViewForm = (id, form_data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
flow_apply_edit({
|
||||
id: id,
|
||||
formValue: JSON.stringify(form_data)
|
||||
})
|
||||
.then(() => {
|
||||
feedback.msgSuccess('保存成功')
|
||||
getLists()
|
||||
resolve(true)
|
||||
})
|
||||
.catch((err) => {
|
||||
feedback.msgError(err.message)
|
||||
reject()
|
||||
})
|
||||
})
|
||||
}
|
||||
getLists()
|
||||
</script>
|
||||
208
admin/src/views/flow_history/edit.vue
Normal file
208
admin/src/views/flow_history/edit.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form-item label="申请id" prop="applyId">
|
||||
<el-input v-model="formData.applyId" placeholder="请输入申请id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板id" prop="templateId">
|
||||
<el-input v-model="formData.templateId" placeholder="请输入模板id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人id" prop="applyUserId">
|
||||
<el-input v-model="formData.applyUserId" placeholder="请输入申请人id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人昵称" prop="applyUserNickname">
|
||||
<el-input v-model="formData.applyUserNickname" placeholder="请输入申请人昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批人id" prop="approverId">
|
||||
<el-input v-model="formData.approverId" placeholder="请输入审批人id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批用户昵称" prop="approverNickname">
|
||||
<el-input v-model="formData.approverNickname" placeholder="请输入审批用户昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="节点" prop="nodeId">
|
||||
<el-input v-model="formData.nodeId" placeholder="请输入节点" />
|
||||
</el-form-item>
|
||||
<el-form-item label="表单值" prop="formValue">
|
||||
<el-input
|
||||
v-model="formData.formValue"
|
||||
placeholder="请输入表单值"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通过状态:0待处理,1通过,2拒绝" prop="passStatus">
|
||||
<el-radio-group v-model="formData.passStatus" placeholder="请选择通过状态:0待处理,1通过,2拒绝">
|
||||
<el-radio label="0">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="通过备注" prop="passRemark">
|
||||
<el-input v-model="formData.passRemark" placeholder="请输入通过备注" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { flow_history_edit, flow_history_add, flow_history_detail } from '@/api/flow_history'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑流程历史' : '新增流程历史'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
applyId: '',
|
||||
templateId: '',
|
||||
applyUserId: '',
|
||||
applyUserNickname: '',
|
||||
approverId: '',
|
||||
approverNickname: '',
|
||||
nodeId: '',
|
||||
formValue: '',
|
||||
passStatus: '',
|
||||
passRemark: '',
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入历史id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
applyId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入申请id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
templateId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入模板id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
applyUserId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入申请人id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
applyUserNickname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入申请人昵称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
approverId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入审批人id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
approverNickname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入审批用户昵称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
nodeId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入节点',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
formValue: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入表单值',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
passStatus: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择通过状态:0待处理,1通过,2拒绝',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
passRemark: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入通过备注',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
mode.value == 'edit' ? await flow_history_edit(data) : await flow_history_add(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await flow_history_detail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
||||
143
admin/src/views/flow_history/index.vue
Normal file
143
admin/src/views/flow_history/index.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<div class="index-lists">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||
<el-form-item label="申请id" prop="applyId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.applyId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板id" prop="templateId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.templateId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人id" prop="applyUserId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.applyUserId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人昵称" prop="applyUserNickname">
|
||||
<el-input class="w-[280px]" v-model="queryParams.applyUserNickname" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批人id" prop="approverId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.approverId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批用户昵称" prop="approverNickname">
|
||||
<el-input class="w-[280px]" v-model="queryParams.approverNickname" />
|
||||
</el-form-item>
|
||||
<el-form-item label="节点" prop="nodeId">
|
||||
<el-input class="w-[280px]" v-model="queryParams.nodeId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="通过状态:0待处理,1通过,2拒绝" prop="passStatus">
|
||||
<el-select v-model="queryParams.passStatus" class="w-[280px]" clearable>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="通过备注" prop="passRemark">
|
||||
<el-input class="w-[280px]" v-model="queryParams.passRemark" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button v-perms="['flow_history:add']" type="primary" @click="handleAdd()">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
||||
<el-table-column label="申请id" prop="applyId" min-width="100" />
|
||||
<el-table-column label="模板id" prop="templateId" min-width="100" />
|
||||
<el-table-column label="申请人id" prop="applyUserId" min-width="100" />
|
||||
<el-table-column label="申请人昵称" prop="applyUserNickname" min-width="100" />
|
||||
<el-table-column label="审批人id" prop="approverId" min-width="100" />
|
||||
<el-table-column label="审批用户昵称" prop="approverNickname" min-width="100" />
|
||||
<el-table-column label="节点" prop="nodeId" min-width="100" />
|
||||
<el-table-column label="表单值" prop="formValue" min-width="100" />
|
||||
<el-table-column
|
||||
label="通过状态:0待处理,1通过,2拒绝"
|
||||
prop="passStatus"
|
||||
min-width="100"
|
||||
/>
|
||||
<el-table-column label="通过备注" prop="passRemark" min-width="100" />
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['flow_history:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['flow_history:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { flow_history_delete, flow_history_list } from '@/api/flow_history'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
defineOptions({
|
||||
name: 'flow_history'
|
||||
})
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const queryParams = reactive({
|
||||
applyId: '',
|
||||
templateId: '',
|
||||
applyUserId: '',
|
||||
applyUserNickname: '',
|
||||
approverId: '',
|
||||
approverNickname: '',
|
||||
nodeId: '',
|
||||
formValue: '',
|
||||
passStatus: '',
|
||||
passRemark: ''
|
||||
})
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: flow_history_list,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await flow_history_delete({ id })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
@@ -10,6 +10,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"allowJs": true,
|
||||
"isolatedModules": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
|
||||
@@ -47,6 +47,8 @@ func RegisterGroup(rg *gin.RouterGroup) {
|
||||
|
||||
ArticleCollectRoute(rg)
|
||||
FlowTemplateRoute(rg)
|
||||
FlowApplyRoute(rg)
|
||||
FlowHistoryRoute(rg)
|
||||
|
||||
captcha.CaptchaRoute(rg)
|
||||
}
|
||||
|
||||
129
server/admin/flow_apply/flow_apply_ctl.go
Normal file
129
server/admin/flow_apply/flow_apply_ctl.go
Normal file
@@ -0,0 +1,129 @@
|
||||
package flow_apply
|
||||
|
||||
import (
|
||||
"x_admin/config"
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/util"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FlowApplyHandler struct {
|
||||
Service IFlowApplyService
|
||||
}
|
||||
|
||||
// @Summary 申请流程列表
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param templateId query int false "模板"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param flowName query string false "流程名称"
|
||||
// @Param flowGroup query int false "流程分类"
|
||||
// @Param flowRemark query string false "流程描述"
|
||||
// @Param flowFormData query string false "表单配置"
|
||||
// @Param flowProcessData query string false "流程配置"
|
||||
// @Param status query int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} []FlowApplyResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Router /api/flow_apply/list [get]
|
||||
func (hd FlowApplyHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
var listReq FlowApplyListReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &page)) {
|
||||
return
|
||||
}
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 申请流程详情
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false ""
|
||||
// @Success 200 {object} FlowApplyResp "成功"
|
||||
// @Router /api/flow_apply/detail [get]
|
||||
func (hd FlowApplyHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowApplyDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.Detail(detailReq.Id)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 申请流程新增
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/add [post]
|
||||
func (hd FlowApplyHandler) Add(c *gin.Context) {
|
||||
var addReq FlowApplyAddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
return
|
||||
}
|
||||
|
||||
var Nickname = config.AdminConfig.GetNickname(c)
|
||||
var AdminId = config.AdminConfig.GetAdminId(c)
|
||||
addReq.ApplyUserNickname = Nickname
|
||||
addReq.ApplyUserId = int(AdminId)
|
||||
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 申请流程编辑
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Param templateId body int false "模板"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param flowName body string false "流程名称"
|
||||
// @Param flowGroup body int false "流程分类"
|
||||
// @Param flowRemark body string false "流程描述"
|
||||
// @Param flowFormData body string false "表单配置"
|
||||
// @Param flowProcessData body string false "流程配置"
|
||||
// @Param status body int false "状态:0待提交,1审批中,2审批完成,3审批失败"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/edit [post]
|
||||
func (hd FlowApplyHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowApplyEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 申请流程删除
|
||||
// @Tags flow_apply-申请流程
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false ""
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_apply/del [post]
|
||||
func (hd FlowApplyHandler) Del(c *gin.Context) {
|
||||
var delReq FlowApplyDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
|
||||
}
|
||||
73
server/admin/flow_apply/flow_apply_schema.go
Normal file
73
server/admin/flow_apply/flow_apply_schema.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package flow_apply
|
||||
|
||||
import "x_admin/core"
|
||||
|
||||
//FlowApplyListReq 申请流程列表参数
|
||||
type FlowApplyListReq struct {
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyDetailReq 申请流程详情参数
|
||||
type FlowApplyDetailReq struct {
|
||||
Id int `form:"id"` //
|
||||
}
|
||||
|
||||
//FlowApplyAddReq 申请流程新增参数
|
||||
type FlowApplyAddReq struct {
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyEditReq 申请流程新增参数
|
||||
type FlowApplyEditReq struct {
|
||||
Id int `form:"id"` //
|
||||
TemplateId int `form:"templateId"` // 模板
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `form:"flowName"` // 流程名称
|
||||
FlowGroup int `form:"flowGroup"` // 流程分类
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
Status int `form:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
}
|
||||
|
||||
//FlowApplyDelReq 申请流程新增参数
|
||||
type FlowApplyDelReq struct {
|
||||
Id int `form:"id"` //
|
||||
}
|
||||
|
||||
//FlowApplyResp 申请流程返回信息
|
||||
type FlowApplyResp struct {
|
||||
Id int `json:"id" structs:"id"` //
|
||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板
|
||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||
FlowName string `json:"flowName" structs:"flowName"` // 流程名称
|
||||
FlowGroup int `json:"flowGroup" structs:"flowGroup"` // 流程分类
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
FormValue string `json:"formValue"` // 表单值
|
||||
Status int `json:"status" structs:"status"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||
}
|
||||
142
server/admin/flow_apply/flow_apply_service.go
Normal file
142
server/admin/flow_apply/flow_apply_service.go
Normal file
@@ -0,0 +1,142 @@
|
||||
package flow_apply
|
||||
|
||||
import (
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type IFlowApplyService interface {
|
||||
List(page request.PageReq, listReq FlowApplyListReq) (res response.PageResp, e error)
|
||||
Detail(id int) (res FlowApplyResp, e error)
|
||||
Add(addReq FlowApplyAddReq) (e error)
|
||||
Edit(editReq FlowApplyEditReq) (e error)
|
||||
Del(id int) (e error)
|
||||
}
|
||||
|
||||
// NewFlowApplyService 初始化
|
||||
func NewFlowApplyService(db *gorm.DB) IFlowApplyService {
|
||||
return &flowApplyService{db: db}
|
||||
}
|
||||
|
||||
// flowApplyService 申请流程服务实现类
|
||||
type flowApplyService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
// List 申请流程列表
|
||||
func (Service flowApplyService) List(page request.PageReq, listReq FlowApplyListReq) (res response.PageResp, e error) {
|
||||
// 分页信息
|
||||
limit := page.PageSize
|
||||
offset := page.PageSize * (page.PageNo - 1)
|
||||
// 查询
|
||||
dbModel := Service.db.Model(&model.FlowApply{})
|
||||
if listReq.TemplateId > 0 {
|
||||
dbModel = dbModel.Where("template_id = ?", listReq.TemplateId)
|
||||
}
|
||||
if listReq.ApplyUserId > 0 {
|
||||
dbModel = dbModel.Where("apply_user_id = ?", listReq.ApplyUserId)
|
||||
}
|
||||
if listReq.ApplyUserNickname != "" {
|
||||
dbModel = dbModel.Where("apply_user_nickname like ?", "%"+listReq.ApplyUserNickname+"%")
|
||||
}
|
||||
if listReq.FlowName != "" {
|
||||
dbModel = dbModel.Where("flow_name like ?", "%"+listReq.FlowName+"%")
|
||||
}
|
||||
if listReq.FlowGroup > 0 {
|
||||
dbModel = dbModel.Where("flow_group = ?", listReq.FlowGroup)
|
||||
}
|
||||
if listReq.FlowRemark != "" {
|
||||
dbModel = dbModel.Where("flow_remark = ?", listReq.FlowRemark)
|
||||
}
|
||||
if listReq.FlowFormData != "" {
|
||||
dbModel = dbModel.Where("flow_form_data = ?", listReq.FlowFormData)
|
||||
}
|
||||
if listReq.FlowProcessData != "" {
|
||||
dbModel = dbModel.Where("flow_process_data = ?", listReq.FlowProcessData)
|
||||
}
|
||||
if listReq.Status > 0 {
|
||||
dbModel = dbModel.Where("status = ?", listReq.Status)
|
||||
}
|
||||
// 总数
|
||||
var count int64
|
||||
err := dbModel.Count(&count).Error
|
||||
if e = response.CheckErr(err, "List Count err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 数据
|
||||
var objs []model.FlowApply
|
||||
err = dbModel.Limit(limit).Offset(offset).Order("id desc").Find(&objs).Error
|
||||
if e = response.CheckErr(err, "List Find err"); e != nil {
|
||||
return
|
||||
}
|
||||
resps := []FlowApplyResp{}
|
||||
response.Copy(&resps, objs)
|
||||
return response.PageResp{
|
||||
PageNo: page.PageNo,
|
||||
PageSize: page.PageSize,
|
||||
Count: count,
|
||||
Lists: resps,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Detail 申请流程详情
|
||||
func (Service flowApplyService) Detail(id int) (res FlowApplyResp, e error) {
|
||||
var obj model.FlowApply
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Detail First err"); e != nil {
|
||||
return
|
||||
}
|
||||
response.Copy(&res, obj)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 申请流程新增
|
||||
func (Service flowApplyService) Add(addReq FlowApplyAddReq) (e error) {
|
||||
var obj model.FlowApply
|
||||
|
||||
response.Copy(&obj, addReq)
|
||||
err := Service.db.Create(&obj).Error
|
||||
e = response.CheckErr(err, "Add Create err")
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 申请流程编辑
|
||||
func (Service flowApplyService) Edit(editReq FlowApplyEditReq) (e error) {
|
||||
var obj model.FlowApply
|
||||
err := Service.db.Where("id = ?", editReq.Id).Limit(1).First(&obj).Error
|
||||
// 校验
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Edit First err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 更新
|
||||
response.Copy(&obj, editReq)
|
||||
err = Service.db.Model(&obj).Updates(obj).Error
|
||||
e = response.CheckErr(err, "Edit Updates err")
|
||||
return
|
||||
}
|
||||
|
||||
// Del 申请流程删除
|
||||
func (Service flowApplyService) Del(id int) (e error) {
|
||||
var obj model.FlowApply
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
// 校验
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Del First err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 删除
|
||||
err = Service.db.Delete(&obj).Error
|
||||
e = response.CheckErr(err, "Del Delete err")
|
||||
return
|
||||
}
|
||||
42
server/admin/flow_apply_route.go
Normal file
42
server/admin/flow_apply_route.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
"x_admin/admin/flow_apply"
|
||||
)
|
||||
|
||||
/**
|
||||
集成
|
||||
1. 导入
|
||||
- 请先提交git避免文件覆盖!!!
|
||||
- 下载并解压压缩包后,直接复制server、admin文件夹到项目根目录即可
|
||||
|
||||
2. 注册路由
|
||||
请在 admin/entry.go 文件引入FlowApplyRoute注册路由
|
||||
|
||||
3. 后台手动添加菜单和按钮
|
||||
flow_apply:add
|
||||
flow_apply:edit
|
||||
flow_apply:del
|
||||
flow_apply:list
|
||||
flow_apply:detail
|
||||
*/
|
||||
|
||||
|
||||
// FlowApplyRoute(rg)
|
||||
func FlowApplyRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
|
||||
server := flow_apply.NewFlowApplyService(db)
|
||||
|
||||
handle := flow_apply.FlowApplyHandler{Service: server}
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_apply/list", handle.List)
|
||||
rg.GET("/flow_apply/detail", handle.Detail)
|
||||
rg.POST("/flow_apply/add", handle.Add)
|
||||
rg.POST("/flow_apply/edit", handle.Edit)
|
||||
rg.POST("/flow_apply/del", handle.Del)
|
||||
}
|
||||
154
server/admin/flow_history/flow_history_ctl.go
Normal file
154
server/admin/flow_history/flow_history_ctl.go
Normal file
@@ -0,0 +1,154 @@
|
||||
package flow_history
|
||||
|
||||
import (
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/util"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FlowHistoryHandler struct {
|
||||
Service IFlowHistoryService
|
||||
}
|
||||
|
||||
// @Summary 流程历史列表
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param applyId query int false "申请id"
|
||||
// @Param templateId query int false "模板id"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param approverId query int false "审批人id"
|
||||
// @Param approverNickname query string false "审批用户昵称"
|
||||
// @Param nodeId query string false "节点"
|
||||
// @Param formValue query string false "表单值"
|
||||
// @Param passStatus query int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark query string false "通过备注"
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Failure 400 {object} string "请求错误"
|
||||
// @Router /api/flow_history/list [get]
|
||||
func (hd FlowHistoryHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
var listReq FlowHistoryListReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &page)) {
|
||||
return
|
||||
}
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史列表-所有
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Success 200 {object} []FlowHistoryResp "成功"
|
||||
// @Router /api/flow_history/list [get]
|
||||
func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
|
||||
res, err := hd.Service.ListAll()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史详情
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false "历史id"
|
||||
// @Success 200 {object} FlowHistoryResp "成功"
|
||||
// @Router /api/flow_history/detail [get]
|
||||
func (hd FlowHistoryHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowHistoryDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
return
|
||||
}
|
||||
res, err := hd.Service.Detail(detailReq.Id)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史新增
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/add [post]
|
||||
func (hd FlowHistoryHandler) Add(c *gin.Context) {
|
||||
var addReq FlowHistoryAddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史编辑
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/edit [post]
|
||||
func (hd FlowHistoryHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowHistoryEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史删除
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Success 200 {object} response.RespType "成功"
|
||||
// @Router /api/flow_history/del [post]
|
||||
func (hd FlowHistoryHandler) Del(c *gin.Context) {
|
||||
var delReq FlowHistoryDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
|
||||
}
|
||||
|
||||
type FlowTree struct {
|
||||
Id string `json:"id"`
|
||||
Pid string `json:"pid"`
|
||||
Type string `json:"type"`
|
||||
|
||||
User string `json:"user"`
|
||||
// FieldAuth map[string]int `json:"fieldAuth"`
|
||||
|
||||
Children *FlowTree
|
||||
}
|
||||
|
||||
// 提交申请
|
||||
|
||||
// 获取下一个审批节点,中间可能存在系统任务节点和网关
|
||||
|
||||
// 同意审批(当前nodeId)
|
||||
|
||||
// 拒绝审批,驳回审批
|
||||
73
server/admin/flow_history/flow_history_schema.go
Normal file
73
server/admin/flow_history/flow_history_schema.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package flow_history
|
||||
|
||||
import "x_admin/core"
|
||||
|
||||
//FlowHistoryListReq 流程历史列表参数
|
||||
type FlowHistoryListReq struct {
|
||||
ApplyId int `form:"applyId"` // 申请id
|
||||
TemplateId int `form:"templateId"` // 模板id
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
ApproverId int `form:"approverId"` // 审批人id
|
||||
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
|
||||
NodeId string `form:"nodeId"` // 节点
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
PassStatus int `form:"passStatus"` // 通过状态:0待处理,1通过,2拒绝
|
||||
PassRemark string `form:"passRemark"` // 通过备注
|
||||
}
|
||||
|
||||
//FlowHistoryDetailReq 流程历史详情参数
|
||||
type FlowHistoryDetailReq struct {
|
||||
Id int `form:"id"` // 历史id
|
||||
}
|
||||
|
||||
//FlowHistoryAddReq 流程历史新增参数
|
||||
type FlowHistoryAddReq struct {
|
||||
ApplyId int `form:"applyId"` // 申请id
|
||||
TemplateId int `form:"templateId"` // 模板id
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
ApproverId int `form:"approverId"` // 审批人id
|
||||
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
|
||||
NodeId string `form:"nodeId"` // 节点
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
PassStatus int `form:"passStatus"` // 通过状态:0待处理,1通过,2拒绝
|
||||
PassRemark string `form:"passRemark"` // 通过备注
|
||||
}
|
||||
|
||||
//FlowHistoryEditReq 流程历史新增参数
|
||||
type FlowHistoryEditReq struct {
|
||||
Id int `form:"id"` // 历史id
|
||||
ApplyId int `form:"applyId"` // 申请id
|
||||
TemplateId int `form:"templateId"` // 模板id
|
||||
ApplyUserId int `form:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
|
||||
ApproverId int `form:"approverId"` // 审批人id
|
||||
ApproverNickname string `form:"approverNickname"` // 审批用户昵称
|
||||
NodeId string `form:"nodeId"` // 节点
|
||||
FormValue string `form:"formValue"` // 表单值
|
||||
PassStatus int `form:"passStatus"` // 通过状态:0待处理,1通过,2拒绝
|
||||
PassRemark string `form:"passRemark"` // 通过备注
|
||||
}
|
||||
|
||||
//FlowHistoryDelReq 流程历史新增参数
|
||||
type FlowHistoryDelReq struct {
|
||||
Id int `form:"id"` // 历史id
|
||||
}
|
||||
|
||||
//FlowHistoryResp 流程历史返回信息
|
||||
type FlowHistoryResp struct {
|
||||
Id int `json:"id" structs:"id"` // 历史id
|
||||
ApplyId int `json:"applyId" structs:"applyId"` // 申请id
|
||||
TemplateId int `json:"templateId" structs:"templateId"` // 模板id
|
||||
ApplyUserId int `json:"applyUserId" structs:"applyUserId"` // 申请人id
|
||||
ApplyUserNickname string `json:"applyUserNickname" structs:"applyUserNickname"` // 申请人昵称
|
||||
ApproverId int `json:"approverId" structs:"approverId"` // 审批人id
|
||||
ApproverNickname string `json:"approverNickname" structs:"approverNickname"` // 审批用户昵称
|
||||
NodeId string `json:"nodeId" structs:"nodeId"` // 节点
|
||||
FormValue string `json:"formValue" structs:"formValue"` // 表单值
|
||||
PassStatus int `json:"passStatus" structs:"passStatus"` // 通过状态:0待处理,1通过,2拒绝
|
||||
PassRemark string `json:"passRemark" structs:"passRemark"` // 通过备注
|
||||
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
|
||||
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
|
||||
}
|
||||
156
server/admin/flow_history/flow_history_service.go
Normal file
156
server/admin/flow_history/flow_history_service.go
Normal file
@@ -0,0 +1,156 @@
|
||||
package flow_history
|
||||
|
||||
import (
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type IFlowHistoryService interface {
|
||||
List(page request.PageReq, listReq FlowHistoryListReq) (res response.PageResp, e error)
|
||||
ListAll() (res []FlowHistoryResp, e error)
|
||||
|
||||
Detail(id int) (res FlowHistoryResp, e error)
|
||||
Add(addReq FlowHistoryAddReq) (e error)
|
||||
Edit(editReq FlowHistoryEditReq) (e error)
|
||||
Del(id int) (e error)
|
||||
}
|
||||
|
||||
//NewFlowHistoryService 初始化
|
||||
func NewFlowHistoryService(db *gorm.DB) IFlowHistoryService {
|
||||
return &flowHistoryService{db: db}
|
||||
}
|
||||
|
||||
//flowHistoryService 流程历史服务实现类
|
||||
type flowHistoryService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
//List 流程历史列表
|
||||
func (Service flowHistoryService) List(page request.PageReq, listReq FlowHistoryListReq) (res response.PageResp, e error) {
|
||||
// 分页信息
|
||||
limit := page.PageSize
|
||||
offset := page.PageSize * (page.PageNo - 1)
|
||||
// 查询
|
||||
dbModel := Service.db.Model(&model.FlowHistory{})
|
||||
if listReq.ApplyId > 0 {
|
||||
dbModel = dbModel.Where("apply_id = ?", listReq.ApplyId)
|
||||
}
|
||||
if listReq.TemplateId > 0 {
|
||||
dbModel = dbModel.Where("template_id = ?", listReq.TemplateId)
|
||||
}
|
||||
if listReq.ApplyUserId > 0 {
|
||||
dbModel = dbModel.Where("apply_user_id = ?", listReq.ApplyUserId)
|
||||
}
|
||||
if listReq.ApplyUserNickname != "" {
|
||||
dbModel = dbModel.Where("apply_user_nickname like ?", "%"+listReq.ApplyUserNickname+"%")
|
||||
}
|
||||
if listReq.ApproverId > 0 {
|
||||
dbModel = dbModel.Where("approver_id = ?", listReq.ApproverId)
|
||||
}
|
||||
if listReq.ApproverNickname != "" {
|
||||
dbModel = dbModel.Where("approver_nickname like ?", "%"+listReq.ApproverNickname+"%")
|
||||
}
|
||||
if listReq.NodeId != "" {
|
||||
dbModel = dbModel.Where("node_id = ?", listReq.NodeId)
|
||||
}
|
||||
if listReq.FormValue != "" {
|
||||
dbModel = dbModel.Where("form_value = ?", listReq.FormValue)
|
||||
}
|
||||
if listReq.PassStatus > 0 {
|
||||
dbModel = dbModel.Where("pass_status = ?", listReq.PassStatus)
|
||||
}
|
||||
if listReq.PassRemark != "" {
|
||||
dbModel = dbModel.Where("pass_remark = ?", listReq.PassRemark)
|
||||
}
|
||||
// 总数
|
||||
var count int64
|
||||
err := dbModel.Count(&count).Error
|
||||
if e = response.CheckErr(err, "List Count err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 数据
|
||||
var objs []model.FlowHistory
|
||||
err = dbModel.Limit(limit).Offset(offset).Order("id desc").Find(&objs).Error
|
||||
if e = response.CheckErr(err, "List Find err"); e != nil {
|
||||
return
|
||||
}
|
||||
resps := []FlowHistoryResp{}
|
||||
response.Copy(&resps, objs)
|
||||
return response.PageResp{
|
||||
PageNo: page.PageNo,
|
||||
PageSize: page.PageSize,
|
||||
Count: count,
|
||||
Lists: resps,
|
||||
}, nil
|
||||
}
|
||||
//ListAll 流程历史列表
|
||||
func (Service flowHistoryService) ListAll() (res []FlowHistoryResp, e error) {
|
||||
var objs model.FlowHistory
|
||||
|
||||
err := Service.db.Find(&objs).Error
|
||||
if e = response.CheckErr(err, "ListAll Find err"); e != nil {
|
||||
return
|
||||
}
|
||||
response.Copy(&res, objs)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
//Detail 流程历史详情
|
||||
func (Service flowHistoryService) Detail(id int) (res FlowHistoryResp, e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Detail First err"); e != nil {
|
||||
return
|
||||
}
|
||||
response.Copy(&res, obj)
|
||||
return
|
||||
}
|
||||
|
||||
//Add 流程历史新增
|
||||
func (Service flowHistoryService) Add(addReq FlowHistoryAddReq) (e error) {
|
||||
var obj model.FlowHistory
|
||||
response.Copy(&obj, addReq)
|
||||
err := Service.db.Create(&obj).Error
|
||||
e = response.CheckErr(err, "Add Create err")
|
||||
return
|
||||
}
|
||||
|
||||
//Edit 流程历史编辑
|
||||
func (Service flowHistoryService) Edit(editReq FlowHistoryEditReq) (e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", editReq.Id).Limit(1).First(&obj).Error
|
||||
// 校验
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Edit First err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 更新
|
||||
response.Copy(&obj, editReq)
|
||||
err = Service.db.Model(&obj).Updates(obj).Error
|
||||
e = response.CheckErr(err, "Edit Updates err")
|
||||
return
|
||||
}
|
||||
|
||||
//Del 流程历史删除
|
||||
func (Service flowHistoryService) Del(id int) (e error) {
|
||||
var obj model.FlowHistory
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
// 校验
|
||||
if e = response.CheckErrDBNotRecord(err, "数据不存在!"); e != nil {
|
||||
return
|
||||
}
|
||||
if e = response.CheckErr(err, "Del First err"); e != nil {
|
||||
return
|
||||
}
|
||||
// 删除
|
||||
err = Service.db.Delete(&obj).Error
|
||||
e = response.CheckErr(err, "Del Delete err")
|
||||
return
|
||||
}
|
||||
44
server/admin/flow_history_route.go
Normal file
44
server/admin/flow_history_route.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
"x_admin/admin/flow_history"
|
||||
)
|
||||
|
||||
/**
|
||||
集成
|
||||
1. 导入
|
||||
- 请先提交git避免文件覆盖!!!
|
||||
- 下载并解压压缩包后,直接复制server、admin文件夹到项目根目录即可
|
||||
|
||||
2. 注册路由
|
||||
请在 admin/entry.go 文件引入FlowHistoryRoute注册路由
|
||||
|
||||
3. 后台手动添加菜单和按钮
|
||||
flow_history:add
|
||||
flow_history:edit
|
||||
flow_history:del
|
||||
flow_history:list
|
||||
flow_history:listAll
|
||||
flow_history:detail
|
||||
*/
|
||||
|
||||
|
||||
// FlowHistoryRoute(rg)
|
||||
func FlowHistoryRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
|
||||
server := flow_history.NewFlowHistoryService(db)
|
||||
|
||||
handle := flow_history.FlowHistoryHandler{Service: server}
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_history/list", handle.List)
|
||||
rg.GET("/flow_history/listAll", handle.ListAll)
|
||||
rg.GET("/flow_history/detail", handle.Detail)
|
||||
rg.POST("/flow_history/add", handle.Add)
|
||||
rg.POST("/flow_history/edit", handle.Edit)
|
||||
rg.POST("/flow_history/del", handle.Del)
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package flow_template
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/util"
|
||||
)
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FlowTemplateHandler struct {
|
||||
Service IFlowTemplateService
|
||||
@@ -39,6 +39,14 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程模板列表-所有
|
||||
// @Tags flow_template-流程模板
|
||||
// @Router /api/flow_template/listAll [get]
|
||||
func (hd FlowTemplateHandler) ListAll(c *gin.Context) {
|
||||
res, err := hd.Service.ListAll()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程模板详情
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
@@ -55,7 +63,6 @@ func (hd FlowTemplateHandler) Detail(c *gin.Context) {
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
|
||||
// @Summary 流程模板新增
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
@@ -74,6 +81,7 @@ func (hd FlowTemplateHandler) Add(c *gin.Context) {
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 流程模板编辑
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
@@ -93,6 +101,7 @@ func (hd FlowTemplateHandler) Edit(c *gin.Context) {
|
||||
}
|
||||
response.CheckAndResp(c, hd.Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 流程模板删除
|
||||
// @Tags flow_template-流程模板
|
||||
// @Produce json
|
||||
|
||||
@@ -21,6 +21,7 @@ type FlowTemplateAddReq struct {
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
|
||||
}
|
||||
|
||||
//FlowTemplateEditReq 流程模板新增参数
|
||||
@@ -31,6 +32,7 @@ type FlowTemplateEditReq struct {
|
||||
FlowRemark string `form:"flowRemark"` // 流程描述
|
||||
FlowFormData string `form:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `form:"flowProcessData"` // 流程配置
|
||||
|
||||
}
|
||||
|
||||
//FlowTemplateDelReq 流程模板新增参数
|
||||
@@ -46,4 +48,5 @@ type FlowTemplateResp struct {
|
||||
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
|
||||
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
|
||||
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
|
||||
|
||||
}
|
||||
|
||||
@@ -4,28 +4,30 @@ import (
|
||||
"x_admin/core/request"
|
||||
"x_admin/core/response"
|
||||
"x_admin/model"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type IFlowTemplateService interface {
|
||||
List(page request.PageReq, listReq FlowTemplateListReq) (res response.PageResp, e error)
|
||||
ListAll() (res []FlowTemplateResp, e error)
|
||||
Detail(id int) (res FlowTemplateResp, e error)
|
||||
Add(addReq FlowTemplateAddReq) (e error)
|
||||
Edit(editReq FlowTemplateEditReq) (e error)
|
||||
Del(id int) (e error)
|
||||
}
|
||||
|
||||
//NewFlowTemplateService 初始化
|
||||
// NewFlowTemplateService 初始化
|
||||
func NewFlowTemplateService(db *gorm.DB) IFlowTemplateService {
|
||||
return &flowTemplateService{db: db}
|
||||
}
|
||||
|
||||
//flowTemplateService 流程模板服务实现类
|
||||
// flowTemplateService 流程模板服务实现类
|
||||
type flowTemplateService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
//List 流程模板列表
|
||||
// List 流程模板列表
|
||||
func (Service flowTemplateService) List(page request.PageReq, listReq FlowTemplateListReq) (res response.PageResp, e error) {
|
||||
// 分页信息
|
||||
limit := page.PageSize
|
||||
@@ -69,7 +71,18 @@ func (Service flowTemplateService) List(page request.PageReq, listReq FlowTempla
|
||||
}, nil
|
||||
}
|
||||
|
||||
//Detail 流程模板详情
|
||||
// ListAll 流程模板列表
|
||||
func (Service flowTemplateService) ListAll() (res []FlowTemplateResp, e error) {
|
||||
var objs []model.FlowTemplate
|
||||
err := Service.db.Find(&objs).Error
|
||||
if e = response.CheckErr(err, "ListAll Find err"); e != nil {
|
||||
return
|
||||
}
|
||||
response.Copy(&res, objs)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Detail 流程模板详情
|
||||
func (Service flowTemplateService) Detail(id int) (res FlowTemplateResp, e error) {
|
||||
var obj model.FlowTemplate
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
@@ -83,7 +96,7 @@ func (Service flowTemplateService) Detail(id int) (res FlowTemplateResp, e error
|
||||
return
|
||||
}
|
||||
|
||||
//Add 流程模板新增
|
||||
// Add 流程模板新增
|
||||
func (Service flowTemplateService) Add(addReq FlowTemplateAddReq) (e error) {
|
||||
var obj model.FlowTemplate
|
||||
response.Copy(&obj, addReq)
|
||||
@@ -92,7 +105,7 @@ func (Service flowTemplateService) Add(addReq FlowTemplateAddReq) (e error) {
|
||||
return
|
||||
}
|
||||
|
||||
//Edit 流程模板编辑
|
||||
// Edit 流程模板编辑
|
||||
func (Service flowTemplateService) Edit(editReq FlowTemplateEditReq) (e error) {
|
||||
var obj model.FlowTemplate
|
||||
err := Service.db.Where("id = ?", editReq.Id).Limit(1).First(&obj).Error
|
||||
@@ -110,7 +123,7 @@ func (Service flowTemplateService) Edit(editReq FlowTemplateEditReq) (e error) {
|
||||
return
|
||||
}
|
||||
|
||||
//Del 流程模板删除
|
||||
// Del 流程模板删除
|
||||
func (Service flowTemplateService) Del(id int) (e error) {
|
||||
var obj model.FlowTemplate
|
||||
err := Service.db.Where("id = ?", id).Limit(1).First(&obj).Error
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"x_admin/admin/flow_template"
|
||||
"x_admin/core"
|
||||
"x_admin/middleware"
|
||||
"x_admin/admin/flow_template"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -21,10 +22,10 @@ flow_template:add
|
||||
flow_template:edit
|
||||
flow_template:del
|
||||
flow_template:list
|
||||
flow_template:listAll
|
||||
flow_template:detail
|
||||
*/
|
||||
|
||||
|
||||
// FlowTemplateRoute(rg)
|
||||
func FlowTemplateRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
@@ -35,6 +36,7 @@ func FlowTemplateRoute(rg *gin.RouterGroup) {
|
||||
|
||||
rg = rg.Group("/", middleware.TokenAuth())
|
||||
rg.GET("/flow_template/list", handle.List)
|
||||
rg.GET("/flow_template/listAll", handle.ListAll)
|
||||
rg.GET("/flow_template/detail", handle.Detail)
|
||||
rg.POST("/flow_template/add", handle.Add)
|
||||
rg.POST("/flow_template/edit", handle.Edit)
|
||||
|
||||
@@ -45,7 +45,7 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) List(c *gin.Context) {
|
||||
// @Success 200 {object} []{{{ title (toCamelCase .EntityName) }}}Resp "成功"
|
||||
// @Router /api/{{{ .ModuleName }}}/list [get]
|
||||
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ListAll(c *gin.Context) {
|
||||
res, err := hd.Service.List(page, listReq)
|
||||
res, err := hd.Service.ListAll()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"x_admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
import "x_admin/core"
|
||||
|
||||
type I{{{ title (toCamelCase .EntityName) }}}Service interface {
|
||||
List(page request.PageReq, listReq {{{ title (toCamelCase .EntityName) }}}ListReq) (res response.PageResp, e error)
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="{{{ .ModuleName }}}">
|
||||
import { {{{ .ModuleName }}}_delete, {{{ .ModuleName }}}_lists } from '@/api/{{{ .ModuleName }}}'
|
||||
import { {{{ .ModuleName }}}_delete, {{{ .ModuleName }}}_list } from '@/api/{{{ .ModuleName }}}'
|
||||
import EditPopup from './edit.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
{{{- if ge (len .DictFields) 1 }}}
|
||||
@@ -162,7 +162,7 @@ const queryParams = reactive({
|
||||
const getLists = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await {{{ .ModuleName }}}_lists(queryParams)
|
||||
const data = await {{{ .ModuleName }}}_list(queryParams)
|
||||
lists.value = data
|
||||
loading.value = false
|
||||
} catch (error) {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { {{{ .ModuleName }}}_delete, {{{ .ModuleName }}}_lists } from '@/api/{{{ .ModuleName }}}'
|
||||
import { {{{ .ModuleName }}}_delete, {{{ .ModuleName }}}_list } from '@/api/{{{ .ModuleName }}}'
|
||||
{{{- if ge (len .DictFields) 1 }}}
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
{{{- end }}}
|
||||
@@ -148,7 +148,7 @@ const queryParams = reactive({
|
||||
})
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: {{{ .ModuleName }}}_lists,
|
||||
fetchFun: {{{ .ModuleName }}}_list,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ type ArticleCollect struct {
|
||||
UserId int `gorm:"comment:'用户ID'"` // 用户ID
|
||||
ArticleId int `gorm:"comment:'文章ID'"` // 文章ID
|
||||
IsDelete int `gorm:"comment:'是否删除'"` // 是否删除
|
||||
CreateTime int64 `gorm:"comment:'创建时间'"` // 创建时间
|
||||
UpdateTime int64 `gorm:"comment:'更新时间'"` // 更新时间
|
||||
DeleteTime int64 `gorm:"comment:'是否删除'"` // 是否删除
|
||||
UpdateTime int64 `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||
CreateTime int64 `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||
DeleteTime int64 `gorm:"comment:'删除时间'"` // 删除时间
|
||||
}
|
||||
|
||||
19
server/model/flow_apply.go
Normal file
19
server/model/flow_apply.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
//FlowApply 申请流程实体
|
||||
type FlowApply struct {
|
||||
Id int `gorm:"primarykey;comment:''"` //
|
||||
TemplateId int `gorm:"comment:'模板'"` // 模板
|
||||
ApplyUserId int `gorm:"comment:'申请人id'"` // 申请人id
|
||||
ApplyUserNickname string `gorm:"comment:'申请人昵称'"` // 申请人昵称
|
||||
FlowName string `gorm:"comment:'流程名称'"` // 流程名称
|
||||
FlowGroup int `gorm:"comment:'流程分类'"` // 流程分类
|
||||
FlowRemark string `gorm:"comment:'流程描述'"` // 流程描述
|
||||
FlowFormData string `gorm:"comment:'表单配置'"` // 表单配置
|
||||
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
|
||||
FormValue string `gorm:"comment:'表单值'"` // 表单值
|
||||
Status int `gorm:"comment:'状态:0待提交,1审批中,2审批完成,3审批失败'"` // 状态:0待提交,1审批中,2审批完成,3审批失败
|
||||
UpdateTime int64 `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||
CreateTime int64 `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||
DeleteTime int64 `gorm:"comment:'删除时间'"` // 删除时间
|
||||
}
|
||||
36
server/model/flow_history.go
Normal file
36
server/model/flow_history.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
//FlowHistory 流程历史实体
|
||||
type FlowHistory struct {
|
||||
|
||||
Id int `gorm:"primarykey;comment:'历史id'"` // 历史id
|
||||
|
||||
ApplyId int `gorm:"comment:'申请id'"` // 申请id
|
||||
|
||||
TemplateId int `gorm:"comment:'模板id'"` // 模板id
|
||||
|
||||
ApplyUserId int `gorm:"comment:'申请人id'"` // 申请人id
|
||||
|
||||
ApplyUserNickname string `gorm:"comment:'申请人昵称'"` // 申请人昵称
|
||||
|
||||
ApproverId int `gorm:"comment:'审批人id'"` // 审批人id
|
||||
|
||||
ApproverNickname string `gorm:"comment:'审批用户昵称'"` // 审批用户昵称
|
||||
|
||||
NodeId string `gorm:"comment:'节点'"` // 节点
|
||||
|
||||
FormValue string `gorm:"comment:'表单值'"` // 表单值
|
||||
|
||||
PassStatus int `gorm:"comment:'通过状态:0待处理,1通过,2拒绝'"` // 通过状态:0待处理,1通过,2拒绝
|
||||
|
||||
PassRemark string `gorm:"comment:'通过备注'"` // 通过备注
|
||||
|
||||
UpdateTime int64 `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间
|
||||
|
||||
|
||||
CreateTime int64 `gorm:"autoCreateTime;comment:'创建时间'"` // 创建时间
|
||||
|
||||
|
||||
DeleteTime int64 `gorm:"comment:'删除时间'"` // 删除时间
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user