15 changed files with 1001 additions and 50 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,292 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-03 13:39:16 |
||||
|
@ 备注: 列表内容展示 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { submitButton, afreshSubmitButton,editFormCont,draftSubmitButton,editLookFormCont } from "@/utils/workflow/const"; |
||||
|
import { json2string,objToStringify,string2json,stringToObj } from '@/utils/DesignForm/form' |
||||
|
import { gainTaskFormInfo,generateFlow,gainEditDataLog } from '@/api/taskapi/management' |
||||
|
import { Close } from '@element-plus/icons-vue' |
||||
|
import { judgeSubmitCancel } from '@/api/DesignForm/requestapi' |
||||
|
import { submitButtonEs } from '@/api/DesignForm/tableButton' |
||||
|
|
||||
|
import RunFlowStep from '@/views/taskplatform/taskmanagement/runFlowStep.vue' |
||||
|
|
||||
|
|
||||
|
const props = defineProps({ |
||||
|
isShow:{ |
||||
|
type:Boolean, |
||||
|
default:false, |
||||
|
}, |
||||
|
drawerWith:{ |
||||
|
type:Number, |
||||
|
default:0 |
||||
|
}, |
||||
|
tablePageClass:{ |
||||
|
type:Number, |
||||
|
default:1 |
||||
|
}, |
||||
|
pageInfo:{ |
||||
|
type:Object, |
||||
|
default(){ |
||||
|
return {} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
const formEl = ref<any>(); |
||||
|
const emits = defineEmits(["update:isShow","getPageData"]); |
||||
|
const formLoading = ref(false); |
||||
|
const flowAry = ref<any[]>(); //流程列表 |
||||
|
const currentProgress = ref<number>(1); //当前步进值 |
||||
|
//表单ID |
||||
|
const openOfClose = computed({ |
||||
|
get() { |
||||
|
return props.isShow |
||||
|
}, |
||||
|
set(val: boolean) { |
||||
|
emits('update:isShow', val) |
||||
|
} |
||||
|
}); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-03 14:09:24 |
||||
|
@ 功能: 监听状态变化处理数据 |
||||
|
*/ |
||||
|
watch(()=>props.isShow,(val:bool)=>{ |
||||
|
|
||||
|
if(val){ |
||||
|
formLoading.value = true; |
||||
|
getCustomrrFormInfo(); |
||||
|
} |
||||
|
}) |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-03 14:25:15 |
||||
|
@ 功能: 关闭抽屉 |
||||
|
*/ |
||||
|
const closeDrawer = () => { |
||||
|
emits('update:isShow', false) |
||||
|
} |
||||
|
|
||||
|
//表单相关内容 |
||||
|
const formState = reactive({ |
||||
|
formData: { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}, |
||||
|
dict: {}, |
||||
|
formId: props.pageInfo.id, |
||||
|
id: 1, |
||||
|
loading: true |
||||
|
}) |
||||
|
const pageLog = ref<any[]>([]) |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-03 14:33:15 |
||||
|
@ 功能: 获取自定义表单内容 |
||||
|
*/ |
||||
|
const getCustomrrFormInfo = () => { |
||||
|
gainTaskFormInfo({id:props.pageInfo.masters_key}) |
||||
|
.then(({data})=>{ |
||||
|
// console.log("获取自定义表单内容",data,data.structure) |
||||
|
formState.formData = stringToObj(data.structure.mastesform) |
||||
|
// console.log("获取自定义表单内容--->",formState) |
||||
|
formState.dict = string2json(data.structure.dict) |
||||
|
// formState.formData.list.push(editLookFormCont) |
||||
|
if(props.tablePageClass != 4){ |
||||
|
judgeSubmitCancel({"name":data.structure.mastesformjson}) |
||||
|
.then((data:any) =>{ |
||||
|
if(data.code == 0){ |
||||
|
if (data.data == 3 || data.data == 4){ |
||||
|
formState.formData.list.push(submitButtonEs) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
nextTick(()=>{ |
||||
|
// console.log("获取自定义表单内容-1111-->",data.tableData) |
||||
|
formEl.value.setValue(data.tableData) |
||||
|
}) |
||||
|
}) |
||||
|
.finally(()=>{ |
||||
|
formLoading.value = false; |
||||
|
gainEditDataLog({id:props.pageInfo.masters_key}) |
||||
|
.then(({data})=>{ |
||||
|
console.log("获取修改记录-1111-->",data) |
||||
|
pageLog.value = data.logAry |
||||
|
}); |
||||
|
}) |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-07 10:55:34 |
||||
|
@ 功能: 表单动作回调 |
||||
|
*/ |
||||
|
const afterSubmit = (type: string) => { |
||||
|
console.log("表单提交成功") |
||||
|
if (type === 'success') { |
||||
|
// router.go(-1) |
||||
|
// console.log("表单提交成功") |
||||
|
emits("getPageData"); |
||||
|
closeDrawer(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
const closeAppSubmit = () => { |
||||
|
closeDrawer() |
||||
|
} |
||||
|
//流程执行 |
||||
|
const drawerBeforeClose = () => { |
||||
|
console.log("监听打开关闭",false) |
||||
|
// emits("getmytodolist") |
||||
|
// emits("update:isshow", false); |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer |
||||
|
v-model="openOfClose" |
||||
|
title="查看表单内容" |
||||
|
:size="drawerWith" |
||||
|
:with-header="false" |
||||
|
:close-on-click-modal="false" |
||||
|
:close-on-press-escape="false" |
||||
|
:destroy-on-close="true" |
||||
|
> |
||||
|
<div v-if="props.pageInfo.flowIsOpen==1" class="common-layout"> |
||||
|
|
||||
|
<el-container> |
||||
|
<el-main> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
v-loading="formLoading" element-loading-text="Loading..." |
||||
|
:form-data="formState.formData" |
||||
|
:type="props.tablePageClass" |
||||
|
:dict="formState.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:close-app-submit="closeDrawer" |
||||
|
:change-key-val="changeKeyVal" |
||||
|
:anew-submit = "anewSubmit" |
||||
|
:save-edit-form-info="saveEditFormInfo" |
||||
|
:send-draft-submit= "sendDraftSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
/> |
||||
|
|
||||
|
<el-divider v-if="pageLog&&pageLog.length > 0" content-position="left">历史记录</el-divider> |
||||
|
<el-timeline style="width: 100%"> |
||||
|
<el-timeline-item v-for="(item,index) in pageLog" :key="index" :timestamp="item.time+' 操作人:'+item.creater" placement="top"> |
||||
|
<el-card> |
||||
|
<el-descriptions border> |
||||
|
<el-descriptions-item v-for="(mastItem,mastIndex) in item.masterdata" :key="mastIndex" :label="mastIndex"> |
||||
|
{{mastItem}} |
||||
|
</el-descriptions-item> |
||||
|
</el-descriptions> |
||||
|
<el-tabs v-if="item.sunList" type="border-card" style="margin-top:20px;"> |
||||
|
<el-tab-pane v-for="(sonItem,sonIndex) in item.sunList" :label="sonIndex" :key="sonIndex"> |
||||
|
<el-descriptions v-for="(sonVal,sonIndex) in sonItem" :key="sonIndex" border> |
||||
|
<el-descriptions-item v-for="(sonCentor,sonKey) in sonVal" :key="sonKey" :label="sonKey"> {{sonCentor}} |
||||
|
</el-descriptions-item> |
||||
|
</el-descriptions> |
||||
|
</el-tab-pane> |
||||
|
</el-tabs> |
||||
|
</el-card> |
||||
|
</el-timeline-item> |
||||
|
</el-timeline> |
||||
|
</el-main> |
||||
|
<el-aside width="350px" class="flowBox"> |
||||
|
<el-header height="30px"> |
||||
|
<div class="workFlowHead"> |
||||
|
<el-text>审批流程</el-text> |
||||
|
<el-icon @click="closeDrawer"><Close /></el-icon> |
||||
|
</div> |
||||
|
</el-header> |
||||
|
<el-scrollbar class="scorllbarBox"> |
||||
|
<RunFlowStep ref="runstep" v-model:flowary="flowAry" :flow-key="props.pageInfo.masters_key" :current-progress="currentProgress" @updatelist="drawerBeforeClose" /> |
||||
|
</el-scrollbar> |
||||
|
</el-aside> |
||||
|
|
||||
|
</el-container> |
||||
|
</div> |
||||
|
<div v-else class="common-layout"> |
||||
|
<el-header height="30px"> |
||||
|
<el-icon @click="closeDrawer"><Close /></el-icon> |
||||
|
</el-header> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
v-loading="formLoading" element-loading-text="Loading..." |
||||
|
:form-data="formState.formData" |
||||
|
:type="props.tablePageClass" |
||||
|
:dict="formState.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:close-app-submit="closeDrawer" |
||||
|
:change-key-val="changeKeyVal" |
||||
|
:anew-submit = "anewSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
:save-edit-form-info="saveEditFormInfo" |
||||
|
:send-draft-submit= "sendDraftSubmit" |
||||
|
/> |
||||
|
<el-divider v-if="pageLog&&pageLog.length > 0" content-position="left">历史记录</el-divider> |
||||
|
<el-timeline style="width: 100%"> |
||||
|
<el-timeline-item v-for="(item,index) in pageLog" :key="index" :timestamp="item.time+' 操作人:'+item.creater" placement="top"> |
||||
|
<el-card> |
||||
|
<el-descriptions border> |
||||
|
<el-descriptions-item v-for="(mastItem,mastIndex) in item.masterdata" :key="mastIndex" :label="mastIndex"> |
||||
|
{{mastItem}} |
||||
|
</el-descriptions-item> |
||||
|
</el-descriptions> |
||||
|
<el-tabs v-if="item.sunList" type="border-card" style="margin-top:20px;"> |
||||
|
<el-tab-pane v-for="(sonItem,sonIndex) in item.sunList" :label="sonIndex" :key="sonIndex"> |
||||
|
<el-descriptions v-for="(sonVal,sonIndex) in sonItem" :key="sonIndex" border> |
||||
|
<el-descriptions-item v-for="(sonCentor,sonKey) in sonVal" :key="sonKey" :label="sonKey"> {{sonCentor}} |
||||
|
</el-descriptions-item> |
||||
|
</el-descriptions> |
||||
|
</el-tab-pane> |
||||
|
</el-tabs> |
||||
|
</el-card> |
||||
|
</el-timeline-item> |
||||
|
</el-timeline> |
||||
|
</div> |
||||
|
</el-drawer> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
.common-layout{ |
||||
|
height: 100vh; |
||||
|
padding: 0 15px; |
||||
|
.el-main{ |
||||
|
height: 100vh; |
||||
|
padding:0; |
||||
|
} |
||||
|
.flowBox{ |
||||
|
height: 100vh; |
||||
|
border-left: 1px solid #ccc; |
||||
|
.scorllbarBox{ |
||||
|
height: calc(100vh - 35px) |
||||
|
} |
||||
|
.workFlowHead{ |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
} |
||||
|
.el-header{ |
||||
|
padding:0 10px; |
||||
|
line-height:30px; |
||||
|
text-align:right; |
||||
|
font-size:20px; |
||||
|
i{ |
||||
|
cursor:pointer; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,470 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-08 15:21:19 |
||||
|
@ 备注: 表单。有无流程处理 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { nodeFlow,conditionInfo,nodelPeoples } from '@/api/taskapi/types' |
||||
|
import { haveCustomerFormVersion,generateFlow,echoTableFormPage,realTimeUpdateFlow } from '@/api/taskapi/management' |
||||
|
import { string2json,stringToObj } from '@/utils/DesignForm/form' |
||||
|
import { judgeSubmitCancel,startRunFlow } from '@/api/DesignForm/requestapi' |
||||
|
import { notAsA_BasisForJudgment,asAnApprovalActionControl,fixedValueControl,timeControl,timeEquation,submitButton, afreshSubmitButton } from '@/utils/workflow/const' |
||||
|
|
||||
|
import FlowStep from '@/views/taskplatform/taskmanagement/flowStep.vue' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
isopen:{ |
||||
|
type:Boolean, |
||||
|
default:true |
||||
|
}, |
||||
|
versionid:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
versiontitle:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
drawerwith:{ |
||||
|
type:Number, |
||||
|
default:0 |
||||
|
} |
||||
|
}) |
||||
|
const formLoading = ref(false) //loading |
||||
|
const flowLoading = ref(false) //loading |
||||
|
|
||||
|
const flowFactor = reactive<conditionInfo[]>([]) //表单组件 |
||||
|
const flowMap = ref<any[]>(); //工作流 |
||||
|
const nextStep = ref<number>(0); |
||||
|
const currentProgress = ref<number>(1); |
||||
|
const nodeKey = ref<string>(''); |
||||
|
//获取工作流条件 |
||||
|
const gainFlowChart = reactive<nodeFlow>({ |
||||
|
id:"0" |
||||
|
}) |
||||
|
|
||||
|
const nodelUserList = reactive<nodelPeoples[]>([]) |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-08 15:35:54 |
||||
|
@ 功能: 表单基本数据结构 |
||||
|
*/ |
||||
|
const state = reactive<any>({ |
||||
|
type: 1, // 1新增;2修改;3查看(表单模式) ;4查看; 5设计 |
||||
|
formData: { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {}, |
||||
|
powerstr:{} |
||||
|
}, |
||||
|
dict: {}, |
||||
|
formId: props.versionid, |
||||
|
id: 0, |
||||
|
loading: true |
||||
|
}) |
||||
|
const emits = defineEmits(["update:isopen","searchquery"]); |
||||
|
const drawerOpenOrClose = computed({ |
||||
|
get: () => props.isopen, |
||||
|
set: (val) => { |
||||
|
emits("update:isopen", val); |
||||
|
}, |
||||
|
}); |
||||
|
const isFlowTable = ref(false) //判断是不是流程表单 |
||||
|
//获取表单数据 |
||||
|
const getTaskFormData = () =>{ |
||||
|
formLoading.value = true |
||||
|
flowLoading.value = true |
||||
|
echoTableFormPage({id:props.versionid.toString()}) |
||||
|
.then(({ data }) =>{ |
||||
|
console.log("表单数据",data) |
||||
|
if(data.tableFormPage.flowIsOpen == 1 && data.tableFormPage.flowkeystr != "0"){ |
||||
|
isFlowTable.value = true; |
||||
|
|
||||
|
}else{ |
||||
|
isFlowTable.value = false; |
||||
|
} |
||||
|
gainFlowChart.id=data.tableFormPage.flowkeystr |
||||
|
console.log("表单数据--->1",data.flowPage.flowList) |
||||
|
flowMap.value = data.flowPage.flowList |
||||
|
state.id=props.versionid |
||||
|
state.formData = stringToObj(data.tableFormPage.mastesform) |
||||
|
state.dict = string2json(data.tableFormPage.dict) |
||||
|
state.formData.powerstr = string2json(data.tableFormPage.powerstr) |
||||
|
judgeSubmitCancel({"name":data.tableFormPage.mastesformjson}) |
||||
|
.then((datajud:any) =>{ |
||||
|
if(datajud.code == 0){ |
||||
|
if (datajud.data == 3 || datajud.data == 4){ |
||||
|
state.formData.list.push(submitButton) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
.finally(()=>{ |
||||
|
formLoading.value = false |
||||
|
flowLoading.value = false |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
//监听页面变化 |
||||
|
watch(()=>props.isopen,()=>{ |
||||
|
if(props.isopen){ |
||||
|
getTaskFormData(); |
||||
|
}else{ |
||||
|
initData() |
||||
|
} |
||||
|
}) |
||||
|
//数据初始化 |
||||
|
const initData = () => { |
||||
|
state.formData = { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}; |
||||
|
state.dict = {}; |
||||
|
state.formId = 0; |
||||
|
state.id = 0; |
||||
|
state.loading = true; |
||||
|
let aryLen = flowFactor.length |
||||
|
if(aryLen > 0) flowFactor.splice(0,aryLen); |
||||
|
} |
||||
|
//组件解析 |
||||
|
const changeKeyVal = (key:any,val:any,type:any,attribute:any) => { |
||||
|
// console.log("改变表单值--key--->",key) |
||||
|
// console.log("改变表单值--val--->",val,Array.isArray(val)) |
||||
|
// console.log("改变表单值--type--->",type) |
||||
|
// console.log("改变表单值--attribute--->",attribute) |
||||
|
|
||||
|
// console.log("改变表单值--type-1-true->",notAsA_BasisForJudgment.indexOf(type)) |
||||
|
|
||||
|
|
||||
|
// console.log("改变表单值--flowFactor--->",flowFactor) |
||||
|
|
||||
|
|
||||
|
// if(notAsA_BasisForJudgment.indexOf(type) != -1){ |
||||
|
// console.log("改变表单值--type--true->",notAsA_BasisForJudgment.indexOf(type)) |
||||
|
// } |
||||
|
let unitsVal = val |
||||
|
let isUpdateFlowChart = false |
||||
|
//单选,多选,下拉菜单 |
||||
|
if(notAsA_BasisForJudgment.indexOf(type) === -1){ |
||||
|
let isWrite = true |
||||
|
flowFactor.forEach((item:any)=>{ |
||||
|
if(item.factorid == key){ |
||||
|
isWrite = false |
||||
|
|
||||
|
item.type=3 |
||||
|
if(type == "checkbox"){ |
||||
|
item.isCheckbox = true |
||||
|
item.answers = val.map(String) |
||||
|
}else{ |
||||
|
item.isCheckbox = false |
||||
|
item.oneanswer = val.toString() |
||||
|
} |
||||
|
if(notAsA_BasisForJudgment.indexOf(type) === -1){ |
||||
|
isUpdateFlowChart = true |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
if(isWrite){ |
||||
|
if(type == "checkbox"){ |
||||
|
flowFactor.push({ |
||||
|
factorid:key, |
||||
|
type:3, |
||||
|
isCheckbox:true, |
||||
|
answers:val.map(String) |
||||
|
}) |
||||
|
}else{ |
||||
|
flowFactor.push({ |
||||
|
factorid:key, |
||||
|
type:3, |
||||
|
isCheckbox:false, |
||||
|
oneanswer:val.toString() |
||||
|
}) |
||||
|
} |
||||
|
isUpdateFlowChart = true |
||||
|
} |
||||
|
// console.log("改变表单值--flowFactor--->",flowFactor) |
||||
|
|
||||
|
} |
||||
|
// console.log("改变表单值--flowFactor--1->",unitsVal,timeControl,type) |
||||
|
//时间类空间附加判断条件 |
||||
|
if(timeControl.indexOf(type) > -1 || fixedValueControl.indexOf(type) > -1 || type == "input"){ |
||||
|
// console.log("改变表单值--flowFactor--3->",unitsVal) |
||||
|
let addNewTime = true //判断是否新增 |
||||
|
flowFactor.forEach((item:any)=>{ |
||||
|
// console.log("改变表单值--flowFactor--5->",item.type) |
||||
|
if(item.type == 2){ |
||||
|
addNewTime = false |
||||
|
// console.log("改变表单值--flowFactor--5====1->",item.type) |
||||
|
// console.log("改变表单值--flowFactor--5====3->",item.customFields,item.customFields.length) |
||||
|
if(item.customFields && item.customFields.length > 0){ |
||||
|
// console.log("改变表单值--flowFactor--5====2->",item.customFields) |
||||
|
let sunNewAdd = true |
||||
|
item.customFields.forEach((sunItem:any)=>{ |
||||
|
// console.log("改变表单值--flowFactor-4->",sunItem.wordfield , key,sunItem.wordfield == key) |
||||
|
if(sunItem.wordfield == key){ |
||||
|
sunNewAdd = false |
||||
|
isUpdateFlowChart = true |
||||
|
if(timeEquation.indexOf(attribute) === -1){ //非区间性时间 |
||||
|
sunItem.leftval = val.toString() |
||||
|
}else{ //区间性时间 |
||||
|
if(Array.isArray(val)){ |
||||
|
if(val.length >= 2){ |
||||
|
sunItem.leftval = val[0].toString() |
||||
|
sunItem.rightval = val[val.length - 1].toString() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
if(sunNewAdd){ |
||||
|
isUpdateFlowChart = true |
||||
|
if(timeEquation.indexOf(attribute) === -1){//非区间性时间 |
||||
|
let customFieldInfo = { |
||||
|
wordfield: key, |
||||
|
optType: "1", |
||||
|
leftval: val.toString() |
||||
|
} |
||||
|
item.customFields.push(customFieldInfo) |
||||
|
}else{ //区间性时间 |
||||
|
if(Array.isArray(val)){ |
||||
|
if(val.length >= 2){ |
||||
|
let customFieldInfo = { |
||||
|
wordfield: key, |
||||
|
optType: "6", |
||||
|
leftval: val[0].toString(), |
||||
|
leftoptType:"3", |
||||
|
rightoptType:"3", |
||||
|
rightval:val[val.length - 1].toString() |
||||
|
} |
||||
|
item.customFields.push(customFieldInfo) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if(addNewTime){ //新增自定义类数据判断 |
||||
|
isUpdateFlowChart = true |
||||
|
if(timeEquation.indexOf(attribute) === -1){ //非区间性时间 |
||||
|
let customFieldInfo = { |
||||
|
wordfield: key, |
||||
|
optType: "1", |
||||
|
leftval: val.toString() |
||||
|
} |
||||
|
let condInfo = { |
||||
|
factorid:"customFields", |
||||
|
type:2, |
||||
|
isCheckbox:false, |
||||
|
customFields:[customFieldInfo] |
||||
|
} |
||||
|
flowFactor.push(condInfo) |
||||
|
}else{ //区间性时间 |
||||
|
if(Array.isArray(val)){ |
||||
|
|
||||
|
if(val.length >= 2){ |
||||
|
let customFieldInfo = { |
||||
|
wordfield: key, |
||||
|
optType: "6", |
||||
|
leftval: val[0].toString(), |
||||
|
leftoptType:"3", |
||||
|
rightoptType:"3", |
||||
|
rightval:val[val.length - 1].toString() |
||||
|
} |
||||
|
let condInfo = { |
||||
|
factorid:"customFields", |
||||
|
type:2, |
||||
|
isCheckbox:false, |
||||
|
customFields:[customFieldInfo] |
||||
|
} |
||||
|
flowFactor.push(condInfo) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
//操作人 |
||||
|
if(asAnApprovalActionControl.indexOf(type) > -1){ |
||||
|
isUpdateFlowChart = true |
||||
|
let isWriteUs = true |
||||
|
nodelUserList.forEach((item:any)=>{ |
||||
|
if(item.factorid == key){ |
||||
|
isWriteUs = false |
||||
|
item.userList = val |
||||
|
} |
||||
|
}) |
||||
|
if(isWriteUs){ |
||||
|
nodelUserList.push({ |
||||
|
factorid:key, |
||||
|
userList:val |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// console.log("改变表单值--flowFactor--->",flowFactor) |
||||
|
//更新工作流图 |
||||
|
if(isUpdateFlowChart){ |
||||
|
flowLoading.value = true |
||||
|
//获取工作流不进图 |
||||
|
gainFlowChart.conditionList=flowFactor |
||||
|
gainFlowChart.nodelPeople=nodelUserList |
||||
|
gainFlowChart.oldFlow = flowMap |
||||
|
// console.log("获取工作流不进图--gainFlowChart--->",gainFlowChart) |
||||
|
realTimeUpdateFlow(gainFlowChart) |
||||
|
.then((data:any) =>{ |
||||
|
// console.log("获取工作流不进图-new-->",data) |
||||
|
flowMap.value = data.data.flowList |
||||
|
nextStep.value = data.data.nextStep; |
||||
|
currentProgress.value = data.data.Step; |
||||
|
nodeKey.value = data.data.nodeKey; |
||||
|
// // console.log("获取工作流不进图-1-->",flowMap.value) |
||||
|
flowLoading.value = false |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-09 16:41:20 |
||||
|
@ 功能: 提交成功回调 |
||||
|
*/ |
||||
|
const afterSubmit = (type: string,val?:any) => { |
||||
|
console.log("表单提交成功------------------>",type,val) |
||||
|
console.log("流程------------------>",flowMap) |
||||
|
if (type === 'success') { |
||||
|
if(isFlowTable.value){ |
||||
|
if(val.code == 0){ |
||||
|
if(val.data){ |
||||
|
let sendInfo ={ |
||||
|
id:val.data.uuid, |
||||
|
flowList:flowMap.value, |
||||
|
state:3 |
||||
|
} |
||||
|
startRunFlow(sendInfo) |
||||
|
.then((data:any)=>{ |
||||
|
console.log("流程提交成功--------1---------->",data) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
closeAppSubmit() |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-09 16:49:09 |
||||
|
@ 功能: 表单前置数据 |
||||
|
*/ |
||||
|
const beforeSubmit = (params: any) => { |
||||
|
params.formId = props.versionid |
||||
|
params.id = "" |
||||
|
// emits("update:isopen", false); |
||||
|
return params |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-09 16:50:01 |
||||
|
@ 功能: 关闭操作 |
||||
|
*/ |
||||
|
const closeAppSubmit = () =>{ |
||||
|
emits("update:isopen", false); |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-09 16:50:37 |
||||
|
@ 功能: 保存草稿 |
||||
|
*/ |
||||
|
const saveDraftPage = (type: string,val?:any) => { |
||||
|
if (type === 'success') { |
||||
|
if(isFlowTable.value){ |
||||
|
if(val.code == 0){ |
||||
|
let sendInfo ={ |
||||
|
id:val.data.uuid, |
||||
|
flowList:flowMap.value, |
||||
|
state:1 |
||||
|
} |
||||
|
startRunFlow(sendInfo) |
||||
|
.then((data:any)=>{ |
||||
|
// console.log("流程提交成功--------1---------->",data) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
closeAppSubmit() |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer v-model="drawerOpenOrClose" v-loading="loadingData" :title="versiontitle" :close-on-click-modal="false" :close-on-press-escape="false" :destroy-on-close="true" :size="props.drawerwith" class="drawerClass" > |
||||
|
<div v-if="isFlowTable" class="common-layout"> |
||||
|
<el-container> |
||||
|
<el-main v-loading="formLoading" element-loading-text="Loading..."> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
:numrun="formType" |
||||
|
:form-data="state.formData" |
||||
|
:type="formType" |
||||
|
:dict="state.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
:close-app-submit="closeAppSubmit" |
||||
|
:change-key-val="changeKeyVal" |
||||
|
:save-draft-page="saveDraftPage" |
||||
|
/> |
||||
|
</el-main> |
||||
|
<el-aside v-loading="flowLoading" element-loading-text="Loading..." width="350px" class="flowBox"> |
||||
|
<el-text size="large">审批流程</el-text> |
||||
|
<FlowStep v-model:flow-map="flowMap" :next-step="nextStep" :current-progress="currentProgress" :node-key="nodeKey" /> |
||||
|
</el-aside> |
||||
|
</el-container> |
||||
|
</div> |
||||
|
<!--无流程表单--> |
||||
|
<div v-else class="common-layout"> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
v-loading="formLoading" element-loading-text="Loading..." |
||||
|
:form-data="state.formData" |
||||
|
:type="formType" |
||||
|
:numrun="formType" |
||||
|
:dict="state.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
:close-app-submit="closeAppSubmit" |
||||
|
:save-draft-page="saveDraftPage" |
||||
|
/> |
||||
|
</div> |
||||
|
</el-drawer> |
||||
|
|
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
.common-layout{ |
||||
|
height: calc(100vh - 55px); |
||||
|
padding: 0 15px; |
||||
|
.el-main{ |
||||
|
height: calc(100vh - 55px); |
||||
|
padding:0; |
||||
|
} |
||||
|
.flowBox{ |
||||
|
height: calc(100vh - 55px); |
||||
|
border-left: 1px solid #ccc; |
||||
|
padding: 0 15px; |
||||
|
} |
||||
|
.el-header{ |
||||
|
padding:0 10px; |
||||
|
line-height:30px; |
||||
|
text-align:right; |
||||
|
font-size:20px; |
||||
|
i{ |
||||
|
cursor:pointer; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</style> |
||||
Loading…
Reference in new issue