发起审批 && 清理代码

This commit is contained in:
ChenXinXin committed 2024-04-30 16:40:08 +08:00
1 parent 5f7e5a038f
commit b64c952d0f
30 files changed
+308 -1228

No files matched your search

+49 -39
View File
@@ -8,51 +8,61 @@
<!-- {{taskData.workflowForm}} -->
<!-- 表单 -->
<v-row class="ma-4 mt-2">
<v-col cols="12" v-for="(formItem, index) in taskData.workflowForm" :key="index" class="px-2 py-1 ma-0">
<span class="jh-input-label">{{ index + 1 }}. {{ formItem.statement }}<span v-show="formItem.isRequire" class="red--text ml-1">*</span></span>
<form-component-list v-if="isDrawerShown" :form-item="formItem" :disabled='false' :readonly='false' @calc-workflow="getWorkflow" ></form-component-list>
</v-col>
<template v-if="taskData.workflowForm && taskData.workflowForm.length > 0">
<v-col cols="12" v-for="(formItem, index) in taskData.workflowForm" :key="index" class="px-2 py-1 ma-0">
<span class="jh-input-label">{{ index + 1 }}. {{ formItem.statement }}<span v-show="formItem.isRequire" class="red--text ml-1">*</span></span>
<form-component-list v-if="isDrawerShown" :form-item="formItem" :disabled='false' :readonly='false' @calc-workflow="getWorkflow" ></form-component-list>
</v-col>
</template>
<template v-else>
暂无表单,请联系管理员!
</template>
</v-row>
<v-divider class="jh-divider"></v-divider>
<!-- 审批流 -->
<v-row class="ma-4 mt-2">
<v-col cols="12" class="font-weight-bold pa-0 mx-0 my-2">审批流程</v-col>
<v-col cols="12" class="pa-0 ma-0">
<div v-for="(node, nodeIndex) in curWorkflow">
<div class="node-box">
<div class="node-box-stepper" color="#cdcfd1">
<v-icon v-if="node.properties.type == 'approvalTask'" color="#cdcfd1">mdi-account-circle</v-icon>
<v-icon v-if="node.properties.type == 'noticeTask'" color="#cdcfd1">mdi-send-circle</v-icon>
<div v-if="nodeIndex < curWorkflow.length - 1" class="vertical-line"></div>
</div>
<div class="node-box-item">
<div class="item-label font-weight-bold ">
{{node.properties.label}}
<v-chip class="ml-1 px-1 py-2" x-small v-if="node.properties.approvalType" label outlined color="#4caf50">
{{node.properties.approvalType}}
</v-chip>
<template v-if="curWorkflow.length > 0">
<v-col cols="12" class="pa-0 ma-0">
<div v-for="(node, nodeIndex) in curWorkflow">
<div class="node-box">
<div class="node-box-stepper" color="#cdcfd1">
<v-icon v-if="node.properties.type == 'approvalTask'" color="#cdcfd1">mdi-account-circle</v-icon>
<v-icon v-if="node.properties.type == 'noticeTask'" color="#cdcfd1">mdi-send-circle</v-icon>
<div v-if="nodeIndex < curWorkflow.length - 1" class="vertical-line"></div>
</div>
<div class="d-flex align-center">
<template v-for="(userId, userIndex) in node.properties.userIdList">
<div class="item-user-box d-flex justify-space-between px-2 mr-2">
<span class="omit">{{ constantObj.userList.find(u => u.userId == userId)?.username || userId }}</span>
<v-icon class="ml-1" color="#a4a7aa" @click="doUiAction('deleteNodeUser', {nodeIndex ,userIndex})">mdi-close</v-icon>
</div>
<v-icon v-if="userIndex != node.properties.userIdList.length && node.properties.approvalType == '依次审批'"
class="mr-2" color="#afb1b4" small>
mdi-arrow-right-thin
</v-icon>
</template>
<template>
<div class="abb-user d-flex justify-center align-center" @click="doUiAction('startAddNodeUser', nodeIndex)">
<v-icon color="#4caf50">mdi-plus</v-icon>
</div>
</template>
<div class="node-box-item">
<div class="item-label font-weight-bold ">
{{node.properties.label}}
<v-chip class="ml-1 px-1 py-2" x-small v-if="node.properties.approvalType" label outlined color="#4caf50">
{{node.properties.approvalType}}
</v-chip>
</div>
<div class="d-flex align-center">
<template v-for="(userId, userIndex) in node.properties.userIdList">
<div class="item-user-box d-flex justify-space-between px-2 mr-2">
<span class="omit">{{ constantObj.userList.find(u => u.userId == userId)?.username || userId }}</span>
<v-icon class="ml-1" color="#a4a7aa" @click="doUiAction('deleteNodeUser', {nodeIndex ,userIndex})">mdi-close</v-icon>
</div>
<v-icon v-if="userIndex != node.properties.userIdList.length && node.properties.approvalType == '依次审批'"
class="mr-2" color="#afb1b4" small>
mdi-arrow-right-thin
</v-icon>
</template>
<template>
<div class="abb-user d-flex justify-center align-center" @click="doUiAction('startAddNodeUser', nodeIndex)">
<v-icon color="#4caf50">mdi-plus</v-icon>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</v-col>
</v-col>
</template>
<template v-else>
暂无节点,请联系管理员!
</template>
</v-row>
<v-row class="justify-end mx-0 my-8 px-4">
<!-- 抽屉操作按钮 -->
@@ -111,7 +121,7 @@
</template>
</v-card>
</template>
{% include 'component/tpl/tplFormDesign.html' %}
<script type="module">
Vue.component("create-task-drawer", {
template: '#create-task-drawer',
@@ -205,9 +215,9 @@ Vue.component("create-task-drawer", {
let formObj = _.cloneDeep(item);
formObj.workflowInfo = {
workflowName: item.workflowName,
...JSON.parse(item.workflowInfo),
...item.workflowInfo,
}
formObj.workflowConfig = formObj.workflowConfig ? JSON.parse(formObj.workflowConfig) : null;
formObj.workflowConfig = formObj.workflowConfig ? formObj.workflowConfig : null;
formObj.workflowForm = formObj.workflowForm ? (typeof formObj.workflowForm == 'string'? JSON.parse(formObj.workflowForm): formObj.workflowForm) : [];
formObj.workflowForm.forEach(f => f.answer = []) // 兼容多选
this.defaultWorkflowConfig = _.cloneDeep(formObj.workflowConfig);
+3
View File
@@ -119,6 +119,9 @@
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Popup.js"></script>
<!-- <<<<<<<<<<<<< 加载logicflow组件 -->
{% include 'component/flow/editLine.html' %}
{% include 'component/flow/editNode.html' %}
<script type="module">
Vue.component("process-flow", {
template: '#process-flow',
@@ -1,170 +0,0 @@
<template id="form-item-list-review">
<div class="form-item-list-review-container">
<!-- 单选 -->
<template v-if="formItem.type === 'single'">
<span class="jh-input-label">{{ formItem.statement }}</span>
<v-radio-group readonly v-model="formItem.user.answer">
<v-radio
v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex"
:label="assignmentOptionKey[optionIndex]+': '+option" :value="option"></v-radio>
</v-radio-group>
</template>
<!-- 多选和填空 -->
<template v-if="['fillBlank', 'multiple'].includes(formItem.type)">
<span class="jh-input-label" style="white-space:nowrap !important;" v-if="formItem.type === 'fillBlank'">
<template v-for="(blank, blankIndex) in formItem.statement" :key="blankIndex">
<span class="fill-blank fill-blank-input" v-if="blank.type === 'input'">{{
formItem.user.answer[blank.id] }}</span>
<span v-else>{{ blank.value }}</span>
</template>
</span>
<span class="jh-input-label" v-else>{{ formItem.statement }}</span>
<template v-if="formItem.type === 'multiple'">
<template v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex">
<v-checkbox
readonly style="margin-top: 0px;" v-model="formItem.user.answer" :value="option"
:label="assignmentOptionKey[optionIndex]+': '+option" hide-details color="red"></v-checkbox>
</template>
</template>
</template>
<!-- 多行文本,问答和markdown -->
<template v-if="['textarea', 'questionAnswer', 'markdown'].includes(formItem.type)">
<span class="jh-input-label">{{ formItem.statement }}</span>
<template v-if="formItem.type === 'markdown'" cols="12">
<md2html :article-content="formItem.user.answer" @complete="isContentLoading = false"></md2html>
</template>
<template v-else cols="12">
<v-textarea readonly dense filled single-line v-model="formItem.user.answer" :rows="5" auto-grow />
</template>
</template>
<!-- 题目组 -->
<template v-if="formItem.type === 'questionGroup'">
<span class="jh-input-label">{{ formItem.statement }}</span>
<md2html :article-content="formItem.markdownContent" @complete="isContentLoading = false">
</md2html>
<form-item-list-review
:form-item-list="formItem.itemList" :review-data="reviewData"
:answer-check="answerCheck" />
</template>
<!-- 纯标题 -->
<v-list-item-content v-if="formItem.type === 'displayText'">
<p>{{formItem.statement}}</p>
</v-list-item-content>
</div>
</template>
<script>
Vue.component("form-item-list-review", {
template: '#form-item-list-review',
vuetify: new Vuetify(),
name: 'form-item-list-review',
props: {
formItem: {
type: Object,
default: () => {
return {};
},
},
reviewData: {
type: Object,
default: () => {
return {};
},
},
answerCheck: {
type: Object,
default: () => {
return {};
},
},
},
data: () => ({
overlay: false,
imgSrc: '',
assignmentOptionKey: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'],
}),
computed: {
isMobile() {
return window.innerWidth < 500;
}
},
destroyed() {
},
watch: {},
created() {
},
methods: {}
})
</script>
<style scoped>
.form-item-list-review-container {
background-color: unset;
}
.form-item-list-review-container .jh-input-label {
white-space: pre-line;
font-weight: bold;
font-size: 16px !important;
}
.form-item-list-review-container audio {
height: 35px;
}
.form-item-list-review-container .audio-box {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
/*.form-item-list-review-container .submit-handle-box {
position: relative;
}
.form-item-list-review-container .submit-handle-box::after {
position: absolute;
width: 1px;
content: '';
background-color: #e0e0e0;
height: 200px;
top: auto;
bottom: auto;
}*/
.student-remark textarea {
color: rgb(0, 172, 37) !important;
}
.fill-blank {
display: inline-block;
}
.fill-blank-input {
padding-left: 10px;
padding-right: 10px;
border-bottom: 2px solid gray;
margin-left: 5px;
margin-right: 5px;
}
.icon-close {
position: fixed;
right: 10px;
top: 5px;
z-index: 50000
}
.icon-download {
position: fixed;
right: 50px;
top: 5px;
z-index: 50000
}
.file-prev-wrap {
overflow: auto;
max-width: 80vw;
max-height: 90vh;
}
</style>
+3 -20
View File
@@ -4,28 +4,11 @@
<form-item-list-generator
:form-item-list="form"
ref="formItemListGenerator"/>
<!-- <v-navigation-drawer v-model="formItemListPreviewDrawer" fixed temporary bottom width="90%">
<v-toolbar dark class="blue darken-3" dense>
<v-toolbar-title>表单预览</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn dark text @click="formItemListPreviewDrawer = false">关闭</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-card class="mt-3">
<v-row>
<v-col cols="12" md="6" class="pa-0">
<codemirror v-model="JSON.stringify(formItemList, null, 4)" :options="codemirrorOptions"/>
</v-col>
<v-col cols="12" md="6">
<form-item-list-render :form-item-list="formItemList"></form-item-list-render>
</v-col>
</v-row>
</v-card>
</v-navigation-drawer> -->
</div>
</template>
{% include 'component/tpl/formItemListGenerator.html' %}
<script type="module">
Vue.component("tpl-form-design", {
template: "#tpl-form-design",
+55 -59
View File
@@ -2,50 +2,61 @@
<div class="workflow-basic-info-container">
<v-row>
<v-col cols="12" sm="12" md="12" xl="12">
<span class="jh-input-label">流程名<span class="red--text text--accent-2 ml-1">*必填</span></span>
<v-text-field
class="jh-v-input mr-2" dense filled single-line color="success"
v-model="workflowInfo['workflowName']" :rules="validationRules.requireRules">
</v-text-field>
<span class="jh-input-label">流程名<span class="red--text text--accent-2 ml-1">*必填</span></span>
<v-text-field
class="jh-v-input mr-2" dense filled single-line color="success"
v-model="workflowInfo['workflowName']" :rules="validationRules.requireRules">
</v-text-field>
</v-col>
<v-col cols="12" sm="12" md="12" xl="12">
<span class="jh-input-label">模板图标</span>
<v-menu
:nudge-right="40"
transition="scale-transition"
offset-y
min-width="auto"
max-width="20%"
max-height="60%"
class="block"
>
<template v-slot:activator="{ on, attrs }">
<v-text-field
class="jh-v-input"
dense
single-line
filled
v-model="workflowInfo['taskTemplateIcon']"
v-bind="attrs"
v-on="on"
<span class="jh-input-label">模板图标</span>
<v-menu
:nudge-right="40"
transition="scale-transition"
offset-y
min-width="auto"
max-width="75%"
max-height="60%"
class="block"
>
<template #prepend-inner>
<v-icon size="18" class="mr-1" color="green">mdi-{{workflowInfo['taskTemplateIcon']}}</v-icon>
<template v-slot:activator="{ on, attrs }">
<v-text-field
class="jh-v-input"
dense
single-line
filled
v-model="workflowInfo['taskTemplateIcon']"
v-bind="attrs"
v-on="on"
>
<template #prepend-inner>
<template v-if="workflowInfo.taskTemplateIcon">
<v-img
max-height="30"
max-width="30"
:src="`/<$ ctx.app.config.appId $>/public${workflowInfo.taskTemplateIcon}`"
></v-img>
</template>
</template>
</v-text-field>
</template>
</v-text-field>
</template>
<v-card>
<div class="d-flex flex-wrap">
<div
<v-card>
<div class="d-flex flex-wrap">
<div
v-for="icon in materialDesignIcons"
class="item-icon pa-1"
@click="setIcon(icon)"
>
<v-icon size="18" class="mr-1" :color="workflowInfo['taskTemplateIcon'] == icon ? 'green' : ''">mdi-{{icon}}</v-icon>
:class="`item-icon pa-1 ${workflowInfo.taskTemplateIcon == icon && 'green'}`"
@click="workflowInfo.taskTemplateIcon = icon"
>
<v-img
max-height="30"
max-width="30"
:src="`/<$ ctx.app.config.appId $>/public${icon}`"
></v-img>
</div>
</div>
</div>
</v-card>
</v-menu>
</v-card>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="12" xl="12" class="pb-1">
@@ -54,16 +65,19 @@
filled small hide-actions hide-controls hide-details>
</v-combobox>
</v-col>
<v-col cols="12" sm="12" md="12" xl="12">
<!-- <v-col cols="12" sm="12" md="12" xl="12">
<span class="jh-input-label">备注</span>
<v-text-field
class="jh-v-input mr-2" dense filled single-line color="success"
v-model="workflowInfo['workflowRemark']">
</v-text-field>
</v-col>
</v-col> -->
</v-row>
</div>
</template>
<script src="/<$ ctx.app.config.appId $>/public/task-template-icons.js"></script>
<script type="module">
Vue.component("workflow-basic-info", {
template: '#workflow-basic-info',
@@ -86,27 +100,9 @@ Vue.component("workflow-basic-info", {
],
},
constantObj: {
modeList: [
{text: '串行', value: 'serial'},
{text: '并行', value: 'parallel'},
],
taskTemplateGroup: ['行政', '人事', '其他']
},
materialDesignIcons: [
'account',
'account-lock',
'account-lock-open',
'account-lock-open-outline',
'account-lock-outline',
'account-minus',
'account-minus-outline',
],
// materialDesignIcons: [
// '10001.png',
// '10002.png',
// '10003.png',
// '10004.png',
// ],
materialDesignIcons
}
},
watch: {
+3 -16
View File
@@ -16,7 +16,7 @@
<div class="px-4 mt-2">
<v-form ref="form">
<template>
<v-stepper non-linear flat outlined>
<v-stepper non-linear flat outlined v-model="step">
<v-stepper-header>
<v-stepper-step
editable
@@ -94,10 +94,7 @@
</template>
{% include 'component/tpl/tplFormDesign.html' %}
{% include 'component/tpl/formItemListGenerator.html' %}
{% include 'component/flow/processFlow.html' %}
{% include 'component/flow/editLine.html' %}
{% include 'component/flow/editNode.html' %}
{% include 'component/workflowBasicInfo.html' %}
<script type="module">
Vue.component("workflow-editor-drawer", {
@@ -125,7 +122,7 @@ Vue.component("workflow-editor-drawer", {
isHelpPageDrawerShown: false,
formSubmitData: null,
tab: null
step: 1
}
},
computed: {
@@ -144,7 +141,6 @@ Vue.component("workflow-editor-drawer", {
switch (uiActionId) {
case 'open':
await this.prepareFormObj(uiActionData);
// await this.buildConstantWorkflowFormList();
await this.buildConstantWorkflowConfig();
await this.openDrawer();
break;
@@ -202,6 +198,7 @@ Vue.component("workflow-editor-drawer", {
async closeDrawer() {
this.$refs.processFlow.setDisplayMode(1)
this.step = 1
this.isDrawerShown = false;
},
@@ -261,16 +258,6 @@ Vue.component("workflow-editor-drawer", {
},
// -- <<<<<<<<<<<<< 获取数据 --------------------
// -- constantObj 数据构建 >>>>>>>>>>> ---------------
buildConstantWorkflowFormList() {
if (!this.formObj.workflowForm) return;
this.constantObj.workflowFormList = [];
for (const item of this.formObj.workflowForm) {
this.constantObj.workflowFormList.push({
text: item.statement,
value: item.id
})
}
},
buildConstantWorkflowConfig() {
if (!this.formObj.workflowConfig) return;