代码整理
This commit is contained in:
1 parent
0f1c3b51e5
commit
1f99dcd134
6 files changed
+97
-111
No files matched your search
@@ -807,18 +807,55 @@ Vue.component("process-flow", {
|
||||
this.isPassValidate = true
|
||||
const { lineList, nodeList } = this.workflowConfig;
|
||||
|
||||
// 不允许没有审核节点
|
||||
if(!nodeList.some(node => node.properties.type == 'approvalTask')){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许存在无审批人的审批流程!\n"
|
||||
}else{
|
||||
// 检查条件节点是否选了条件 检查审核/抄送节点是否选了类型
|
||||
for (var index = 0; index < nodeList.length; index++) {
|
||||
const element = nodeList[index];
|
||||
|
||||
if(['conditionTask'].includes(element.properties.type)){
|
||||
if(!element.properties?.priority){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有设置优先级!\n`
|
||||
}else{
|
||||
if(element.properties?.priority != -1 && element.properties?.conditionList?.length <= 0){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n`
|
||||
}
|
||||
}
|
||||
}else if(['approvalTask'].includes(element.properties.type)){
|
||||
if(!element.properties.approvalType || !element.properties.approverType){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}else if(element.properties.approverType != '申请人自选'){
|
||||
if(!(element.properties.user && element.properties.user?.length > 0)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}
|
||||
}
|
||||
}else if(['noticeTask'].includes(element.properties.type)){
|
||||
if(!element.properties.noticerType){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}else if(element.properties.noticerType != '申请人自选'){
|
||||
if(!(element.properties.user && element.properties.user?.length > 0)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 不允许单节点回环
|
||||
if(lineList.filter(l => l.sourceNodeId == l.targetNodeId).length > 0){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许单节点回环!\n"
|
||||
}
|
||||
|
||||
// 不允许没有审核节点
|
||||
if(!nodeList.some(node => node.properties.type == 'approvalTask')){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许存在无审批人的审批流程!\n"
|
||||
}
|
||||
|
||||
// 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线
|
||||
var lineBySourceNodeId = _.groupBy(lineList, 'sourceNodeId'),
|
||||
lineByTargetNodeId = _.groupBy(lineList, 'targetNodeId'),
|
||||
@@ -868,6 +905,11 @@ Vue.component("process-flow", {
|
||||
if(_.some(node, i => i.properties.type != "conditionTask")){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!\n"
|
||||
}else{
|
||||
if(!_.some(node, i => i.properties?.priority == -1)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n"
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(node.length > 1){
|
||||
@@ -878,57 +920,7 @@ Vue.component("process-flow", {
|
||||
}
|
||||
}
|
||||
|
||||
// 不允许有条件节点的优先级没有默认优先级节点, 允许存在多个默认节点,读取顺序按放置时间的先后顺序
|
||||
var conditionNodeLineBySourceNodeId = _.groupBy(lineList.filter(i => i.targetNodeId.startsWith('conditionTask-')), 'sourceNodeId');
|
||||
for (const key in conditionNodeLineBySourceNodeId) {
|
||||
if (Object.hasOwnProperty.call(conditionNodeLineBySourceNodeId, key)) {
|
||||
const element = conditionNodeLineBySourceNodeId[key];
|
||||
// 拿到同一层的条件节点
|
||||
var conditionNode = element.map(l => nodeList.find(n => n.id === l.targetNodeId))
|
||||
|
||||
if(!_.some(conditionNode, i => i.properties?.priority == -1)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查条件节点是否选了条件 检查审核/抄送节点是否选了类型
|
||||
for (var index = 0; index < nodeList.length; index++) {
|
||||
const element = nodeList[index];
|
||||
|
||||
if(['conditionTask'].includes(element.properties.type)){
|
||||
if(!element.properties?.priority){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有设置优先级!\n`
|
||||
}else{
|
||||
if(element.properties?.priority != -1 && element.properties?.conditionList.length <= 0){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n`
|
||||
}
|
||||
}
|
||||
}else if(['approvalTask'].includes(element.properties.type)){
|
||||
if(!element.properties.approvalType || !element.properties.approverType){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}else if(element.properties.approverType != '申请人自选'){
|
||||
if(!(element.properties.user && element.properties.user?.length > 0)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}
|
||||
}
|
||||
}else if(['noticeTask'].includes(element.properties.type)){
|
||||
if(!element.properties.noticerType){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}else if(element.properties.noticerType != '申请人自选'){
|
||||
if(!(element.properties.user && element.properties.user?.length > 0)){
|
||||
this.isPassValidate = false
|
||||
this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.isPassValidate){
|
||||
await window.vtoast.fail('流程设置:' + this.disPassValidateText);
|
||||
|
||||
@@ -169,10 +169,8 @@
|
||||
},
|
||||
})
|
||||
).data.appData.resultData.rows;
|
||||
this.isLoading = false;
|
||||
|
||||
this.userList = rows;
|
||||
console.log('this.userList',this.userList );
|
||||
this.isLoading = false;
|
||||
},
|
||||
async buildTreeData() {
|
||||
let data = [...this.userList];
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="12" xl="12" class="pb-0">
|
||||
<span class="jh-input-label title-label">审批过程时,当审批人账号被禁用</span>
|
||||
<!-- 自动同意、自动交接给指定人员 -->
|
||||
<v-radio-group v-model="workflowInfo['abnormalType']" dense>
|
||||
<v-radio
|
||||
label="自动同意"
|
||||
@@ -124,20 +123,12 @@
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="12" xl="12" class="pb-0">
|
||||
<span class="jh-input-label title-label">审批过程时,一人多节点自动审批配置</span>
|
||||
<!-- 仅首个节点需要审批,其余自动同意 -->
|
||||
<!-- 仅连续审批时自动同意 -->
|
||||
<!-- 每个节点都需要审批 -->
|
||||
<v-radio-group v-model="workflowInfo['autoApproval']" dense>
|
||||
<v-radio
|
||||
label="仅首个节点需要审批,其余自动同意"
|
||||
value="1"
|
||||
dense
|
||||
></v-radio>
|
||||
<!-- <v-radio
|
||||
label="仅连续审批时自动同意"
|
||||
value="2"
|
||||
dense
|
||||
></v-radio> -->
|
||||
<v-radio
|
||||
label="每个节点都需要审批"
|
||||
value="2"
|
||||
@@ -146,13 +137,6 @@
|
||||
</v-radio>
|
||||
|
||||
</v-col>
|
||||
<!-- <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-row>
|
||||
</v-form>
|
||||
</div>
|
||||
@@ -163,7 +147,6 @@
|
||||
<script type="module">
|
||||
Vue.component("workflow-basic-info", {
|
||||
template: '#workflow-basic-info',
|
||||
// vuetify: new Vuetify(),
|
||||
props: {
|
||||
workflowInfo: {
|
||||
type: Object,
|
||||
@@ -239,7 +222,6 @@ Vue.component("workflow-basic-info", {
|
||||
}
|
||||
|
||||
.title-label{
|
||||
/* font-weight: 600 !important; */
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user