Browse Source

修改流程表单ID

qin_14
hreenshan112 9 months ago
parent
commit
bcea460930
  1. 2
      src/views/sysworkflow/lowcodepage/appCardPage.vue
  2. 546
      src/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue
  3. 367
      src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue

2
src/views/sysworkflow/lowcodepage/appCardPage.vue

@ -148,7 +148,7 @@ const openApp = (val: any) => {
emits("getRongQiAttr");
pickAppInfo.value = val;
appJwtPower({ id: val.signCodeStr, types: 1 }).then(({ data }) => {
// console.log("------>data:",data)
// console.log("------>data:", data);
if (data) {
runIsOpen.value = true;
} else {

546
src/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue

@ -3,55 +3,72 @@
@ 时间: 2024-06-12 10:58:03
@ 备注: App表单有无流程处理
-->
<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,gainAppPageInfo,getFieldRecord } from '@/api/DesignForm/requestapi'
import { notAsA_BasisForJudgment,asAnApprovalActionControl,fixedValueControl,timeControl,timeEquation,submitButton, afreshSubmitButton } from '@/utils/workflow/const'
import { appPageDataInit,appWorkFlow } from "@/api/date/type"
import FlowStep from '@/views/taskplatform/taskmanagement/flowStep.vue'
<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,
gainAppPageInfo,
getFieldRecord,
} from "@/api/DesignForm/requestapi";
import {
notAsA_BasisForJudgment,
asAnApprovalActionControl,
fixedValueControl,
timeControl,
timeEquation,
submitButton,
afreshSubmitButton,
} from "@/utils/workflow/const";
import { appPageDataInit, appWorkFlow } from "@/api/date/type";
import FlowStep from "@/views/taskplatform/taskmanagement/flowStep.vue";
const props = defineProps({
isopen: {
type: Boolean,
default:true
default: true,
},
versionid: {
type: String,
default:""
default: "",
},
versiontitle: {
type: String,
default:""
default: "",
},
drawerwith: {
type: Number,
default:0
default: 0,
},
pickAppMenu: {
type: Object,
default() {
return {}
}
}
})
const formLoading = ref(false) //loading
const flowLoading = ref(false) //loading
return {};
},
},
});
const formLoading = ref(false); //loading
const flowLoading = ref(false); //loading
const flowFactor = reactive<conditionInfo[]>([]) //
const flowFactor = reactive<conditionInfo[]>([]); //
const flowMap = ref<any[]>(); //
const nextStep = ref<number>(0);
const currentProgress = ref<number>(1);
const nodeKey = ref<string>('');
const nodeKey = ref<string>("");
//
const gainFlowChart = reactive<nodeFlow>({
id:"0"
})
id: "0",
});
const nodelUserList = reactive<nodelPeoples[]>([])
const nodelUserList = reactive<nodelPeoples[]>([]);
/**
@ 作者: 秦东
@ 时间: 2024-04-08 15:35:54
@ -63,13 +80,13 @@ const state = reactive<any>({
list: [],
form: {},
config: {},
powerstr:{}
powerstr: {},
},
dict: {},
formId: props.versionid,
id: 0,
loading: true
})
loading: true,
});
const emits = defineEmits(["update:isopen", "searchquery"]);
const drawerOpenOrClose = computed({
get: () => props.isopen,
@ -80,84 +97,89 @@ const drawerOpenOrClose = computed({
const drawbox = computed({
get: () => {
// console.log("isFlowTable",isFlowTable.value)
if (isFlowTable.value) {
return 1300
return 1300;
}
return props.drawerwith
return props.drawerwith;
},
set: (val: number) => {
return val
return val;
},
});
const isFlowTable = ref(false) //
const isFlowTable = ref(false); //
//
const getTaskFormData = () => {
formLoading.value = true
flowLoading.value = true
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;
drawbox.value = 800 + 350
drawbox.value = 800 + 350;
} else {
isFlowTable.value = false;
drawbox.value = 800
}
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.formData.config.hideField = []//:confighideField,
state.dict = string2json(data.tableFormPage.dict)
state.formData.powerstr = string2json(data.tableFormPage.powerstr)
judgeSubmitCancel({"name":data.tableFormPage.mastesformjson})
.then((datajud:any) =>{
drawbox.value = 800;
}
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.formData.config.hideField = []; //:confighideField,
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)
state.formData.list.push(submitButton);
}
}
})
}
);
})
.finally(() => {
formLoading.value = false
flowLoading.value = false
})
}
formLoading.value = false;
flowLoading.value = false;
});
};
//
watch(()=>props.isopen,()=>{
watch(
() => props.isopen,
() => {
if (props.isopen) {
if (isFlow.value == 2) {
drawbox.value = 800 + 350
drawbox.value = 800 + 350;
} else {
drawbox.value = 800
drawbox.value = 800;
}
// getTaskFormData();
getTaskFormData();
initLoadData();
} else {
initData()
initData();
}
})
}
);
//
const initData = () => {
state.formData = {
list: [],
form: {},
config: {}
config: {},
};
state.dict = {};
state.formId = 0;
state.id = 0;
state.loading = true;
let aryLen = flowFactor.length
let aryLen = flowFactor.length;
console.log("改变表单值--flowMap.value--1->", flowMap.value);
flowMap.value = [];
console.log("改变表单值--flowMap.value--->", flowMap.value);
if (aryLen > 0) flowFactor.splice(0, aryLen);
}
};
//
const changeKeyVal = (key: any, val: any, type: any, attribute: any) => {
// console.log("--key--->",key)
@ -167,97 +189,102 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
// 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
let unitsVal = val;
let isUpdateFlowChart = false;
//
if (notAsA_BasisForJudgment.indexOf(type) === -1) {
let isWrite = true
let isWrite = true;
flowFactor.forEach((item: any) => {
if (item.factorid == key) {
isWrite = false
isWrite = false;
item.type=3
item.type = 3;
if (type == "checkbox") {
item.isCheckbox = true
item.answers = val.map(String)
item.isCheckbox = true;
item.answers = val.map(String);
} else {
item.isCheckbox = false
item.oneanswer = val.toString()
item.isCheckbox = false;
item.oneanswer = val.toString();
}
if (notAsA_BasisForJudgment.indexOf(type) === -1) {
isUpdateFlowChart = true
isUpdateFlowChart = true;
}
}
})
});
if (isWrite) {
if (type == "checkbox") {
flowFactor.push({
factorid: key,
type: 3,
isCheckbox: true,
answers:val.map(String)
})
answers: val.map(String),
});
} else {
flowFactor.push({
factorid: key,
type: 3,
isCheckbox: false,
oneanswer:val.toString()
})
oneanswer: val.toString(),
});
}
isUpdateFlowChart = true
isUpdateFlowChart = true;
}
// console.log("--flowFactor--->",flowFactor)
}
// console.log("--flowFactor--1->",unitsVal,timeControl,type)
//
if(timeControl.indexOf(type) > -1 || fixedValueControl.indexOf(type) > -1 || type == "input"){
if (
timeControl.indexOf(type) > -1 ||
fixedValueControl.indexOf(type) > -1 ||
type == "input"
) {
// console.log("--flowFactor--3->",unitsVal)
let addNewTime = true //
let addNewTime = true; //
flowFactor.forEach((item: any) => {
// console.log("--flowFactor--5->",item.type)
if (item.type == 2) {
addNewTime = false
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
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{ //
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()
sunItem.leftval = val[0].toString();
sunItem.rightval = val[val.length - 1].toString();
}
}
}
}
})
});
if (sunNewAdd) {
isUpdateFlowChart = true
if(timeEquation.indexOf(attribute) === -1){//
isUpdateFlowChart = true;
if (timeEquation.indexOf(attribute) === -1) {
//
let customFieldInfo = {
wordfield: key,
optType: "1",
leftval: val.toString()
}
item.customFields.push(customFieldInfo)
}else{ //
leftval: val.toString(),
};
item.customFields.push(customFieldInfo);
} else {
//
if (Array.isArray(val)) {
if (val.length >= 2) {
let customFieldInfo = {
@ -266,35 +293,37 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
leftval: val[0].toString(),
leftoptType: "3",
rightoptType: "3",
rightval:val[val.length - 1].toString()
}
item.customFields.push(customFieldInfo)
rightval: val[val.length - 1].toString(),
};
item.customFields.push(customFieldInfo);
}
}
}
}
}
}
})
});
if(addNewTime){ //
isUpdateFlowChart = true
if(timeEquation.indexOf(attribute) === -1){ //
if (addNewTime) {
//
isUpdateFlowChart = true;
if (timeEquation.indexOf(attribute) === -1) {
//
let customFieldInfo = {
wordfield: key,
optType: "1",
leftval: val.toString()
}
leftval: val.toString(),
};
let condInfo = {
factorid: "customFields",
type: 2,
isCheckbox: false,
customFields:[customFieldInfo]
}
flowFactor.push(condInfo)
}else{ //
customFields: [customFieldInfo],
};
flowFactor.push(condInfo);
} else {
//
if (Array.isArray(val)) {
if (val.length >= 2) {
let customFieldInfo = {
wordfield: key,
@ -302,60 +331,58 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
leftval: val[0].toString(),
leftoptType: "3",
rightoptType: "3",
rightval:val[val.length - 1].toString()
}
rightval: val[val.length - 1].toString(),
};
let condInfo = {
factorid: "customFields",
type: 2,
isCheckbox: false,
customFields:[customFieldInfo]
}
flowFactor.push(condInfo)
customFields: [customFieldInfo],
};
flowFactor.push(condInfo);
}
}
}
}
}
//
if (asAnApprovalActionControl.indexOf(type) > -1) {
isUpdateFlowChart = true
let isWriteUs = true
isUpdateFlowChart = true;
let isWriteUs = true;
nodelUserList.forEach((item: any) => {
if (item.factorid == key) {
isWriteUs = false
item.userList = val
isWriteUs = false;
item.userList = val;
}
})
});
if (isWriteUs) {
nodelUserList.push({
factorid: key,
userList:val
})
userList: val,
});
}
}
// console.log("--flowFactor--->",flowFactor)
//
if (isUpdateFlowChart) {
flowLoading.value = true
flowLoading.value = true;
//
gainFlowChart.conditionList=flowFactor
gainFlowChart.nodelPeople=nodelUserList
gainFlowChart.oldFlow = flowMap
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
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
})
}
flowLoading.value = false;
});
}
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:41:20
@ -364,69 +391,67 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
const afterSubmit = (type: string, val?: any) => {
// console.log("------------------>",type,val)
// console.log("------------------>",flowMap)
if (type === 'success') {
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)=>{
state: 3,
};
startRunFlow(sendInfo).then((data: any) => {
// console.log("--------1---------->",data)
})
}
});
}
}
}
closeAppSubmit()
}
closeAppSubmit();
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:49:09
@ 功能: 表单前置数据
*/
const beforeSubmit = (params: any) => {
params.formId = props.versionid
params.id = ""
params.formId = props.versionid;
params.id = "";
// emits("update:isopen", false);
return params
}
return params;
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:50:01
@ 功能: 关闭操作
*/
const closeAppSubmit = () => {
emits("searchquery")
flowMap.value = [];
emits("searchquery");
emits("update:isopen", false);
}
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:50:37
@ 功能: 保存草稿
*/
const saveDraftPage = (type: string, val?: any) => {
if (type === 'success') {
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)=>{
state: 1,
};
startRunFlow(sendInfo).then((data: any) => {
// console.log("--------1---------->",data)
})
}
});
}
}
closeAppSubmit()
}
closeAppSubmit();
};
//app
const stateForm = reactive<any>({
@ -435,25 +460,25 @@ const stateForm = reactive<any>({
list: [],
form: {},
config: {},
powerstr:{}
powerstr: {},
},
dict: {},
formId: "1",
id: 0,
formId: 0,
versionId: 0,
loading: true
})
const appInitData = ref<appPageDataInit>("")
const mastesformjson = ref("") //
const isFlow = ref(2)
const versionId = ref<string>("") //
const versionTitle = ref<string>("") //
let gainAppPageInfoPromise: any[] = []
let gainAppPageInfoData:any = {}
let getFieldRecordPromise: any[] = []
let objMastesform: any
loading: true,
});
const appInitData = ref<appPageDataInit>("");
const mastesformjson = ref(""); //
const isFlow = ref(2);
const versionId = ref<string>(""); //
const versionTitle = ref<string>(""); //
let gainAppPageInfoPromise: any[] = [];
let gainAppPageInfoData: any = {};
let getFieldRecordPromise: any[] = [];
let objMastesform: any;
//let getFieldRecordData:any = {}
/**
@ 作者: 秦东
@ -464,10 +489,10 @@ const initLoadData = () => {
// console.log("initLoadData",props.pickAppMenu.type,props.pickAppMenu.type != 1)
if (props.pickAppMenu.type != 1) {
// appFormTitle.value = props.pickAppMenu.label
gainAppPageInfoPromise.push(gainAppPageInfo({id:props.pickAppMenu.id})
.then((data)=>{
console.log("获取初始化表单数据",data)
gainAppPageInfoData = data
gainAppPageInfoPromise.push(
gainAppPageInfo({ id: props.pickAppMenu.id }).then((data) => {
console.log("获取初始化表单数据", data);
gainAppPageInfoData = data;
/* appInitData.value = data.data
// console.log("---!",appInitData.value)
mastesformjson.value = data.data.appForm.mastesformjson
@ -496,91 +521,80 @@ const initLoadData = () => {
}
})
} */
}));
})
);
Promise.all(gainAppPageInfoPromise).then(() => {
objMastesform = stringToObj(gainAppPageInfoData.data.appForm.mastesform)
objMastesform = stringToObj(gainAppPageInfoData.data.appForm.mastesform);
//console.log(objMastesform)
for (const element of objMastesform.list) {
if (element.type == "table") {
//console.log(element);
for (const item of element.list) {
if (item.options) {
if(item.type=="radio"||item.type=="select"||item.type=="checkbox"){
if (
item.type == "radio" ||
item.type == "select" ||
item.type == "checkbox"
) {
console.log(item.config.optionsType);
if (item.config.optionsType == 3) {
let paramx:string = ""+item.control.optionsValue3Field
getFieldRecordPromise.push(getFieldRecord(paramx).then(({ data }) => {
let paramx: string = "" + item.control.optionsValue3Field;
getFieldRecordPromise.push(
getFieldRecord(paramx).then(({ data }) => {
//console.log(data)
item.options = data
}));
item.options = data;
})
);
}
}
}
}
}
}
Promise.all(getFieldRecordPromise).then(() => {
console.log(gainAppPageInfoData)
console.log(gainAppPageInfoData);
let objMastesformStr = JSON.stringify(objMastesform);
gainAppPageInfoData.data.appForm.mastesform = objMastesform
gainAppPageInfoData.data.appForm.mastesformjson = objMastesformStr
gainAppPageInfoData.data.appForm.mastesform = objMastesform;
gainAppPageInfoData.data.appForm.mastesformjson = objMastesformStr;
appInitData.value = gainAppPageInfoData.data
appInitData.value = gainAppPageInfoData.data;
// console.log("---!",appInitData.value)
mastesformjson.value = gainAppPageInfoData.data.appForm.mastesformjson
isFlow.value = gainAppPageInfoData.data.appForm.flowIsOpen
mastesformjson.value = gainAppPageInfoData.data.appForm.mastesformjson;
isFlow.value = gainAppPageInfoData.data.appForm.flowIsOpen;
versionId.value = gainAppPageInfoData.data.appForm.id.toString()
versionTitle.value = gainAppPageInfoData.data.appForm.name
versionId.value = gainAppPageInfoData.data.appForm.id.toString();
versionTitle.value = gainAppPageInfoData.data.appForm.name;
if (gainAppPageInfoData.data.page) {
// console.log("data.data.mastesform", data.data)
stateForm.id=gainAppPageInfoData.data.appForm.version.toString()
stateForm.formId =gainAppPageInfoData.data.appForm.cfid.toString()
stateForm.versionId =gainAppPageInfoData.data.appForm.id.toString()
stateForm.formData = objMastesform
stateForm.formData.config.hideField = []//:confighideField,
stateForm.dict = string2json(gainAppPageInfoData.data.appForm.dict)
stateForm.formData.powerstr = string2json(gainAppPageInfoData.data.appForm.powerstr)
stateForm.id = gainAppPageInfoData.data.appForm.version.toString();
stateForm.formId = gainAppPageInfoData.data.appForm.cfid.toString();
stateForm.versionId = gainAppPageInfoData.data.appForm.id.toString();
stateForm.formData = objMastesform;
stateForm.formData.config.hideField = []; //:confighideField,
stateForm.dict = string2json(gainAppPageInfoData.data.appForm.dict);
stateForm.formData.powerstr = string2json(
gainAppPageInfoData.data.appForm.powerstr
);
// console.log("data.data.mastesform", stateForm.formData)
judgeSubmitCancel({"name":gainAppPageInfoData.data.appForm.mastesformjson})
.then((datajud:any) =>{
judgeSubmitCancel({
name: gainAppPageInfoData.data.appForm.mastesformjson,
}).then((datajud: any) => {
if (datajud.code == 0) {
if (datajud.data == 3 || datajud.data == 4) {
stateForm.formData.list.push(submitButton)
stateForm.formData.list.push(submitButton);
}
}
})
});
}
});
});
}
}
};
function optionsValue3Get3(data: any, fieldName: string) {
/* console.log(data)
@ -588,16 +602,80 @@ function optionsValue3Get3(data: any,fieldName: string){
console.log("appTableFlow","optionsValue3Get3") */
for (let i = 0; i < stateForm.formData.list.length; i++) {
if (stateForm.formData.list[i].name == fieldName) {
stateForm.formData.list[i].options = []
stateForm.formData.list[i].options = [];
for (let j = 0; j < data.length; j++) {
stateForm.formData.list[i].options.push(data[j])
stateForm.formData.list[i].options.push(data[j]);
}
}
}
}
</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="drawbox" class="drawerClass" >
<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="drawbox"
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"
@optionsValue3Get3="optionsValue3Get3"
/>
</div>
<!-- <AppFormPage
ref="formEl"
@ -614,7 +692,7 @@ function optionsValue3Get3(data: any,fieldName: string){
add-url="addData"
@optionsValue3Get3="optionsValue3Get3"
/> -->
<ak-form
<!-- <ak-form
ref="formEl"
:number="props.pickAppMenu.id"
@ -629,11 +707,10 @@ function optionsValue3Get3(data: any,fieldName: string){
:after-submit="afterSubmit"
add-url="addData"
@optionsValue3Get3="optionsValue3Get3"
/>
/> -->
</el-drawer>
</template>
<style lang='scss' scoped>
<style lang="scss" scoped>
.common-layout {
height: calc(100vh - 55px);
padding: 0 15px;
@ -655,6 +732,5 @@ function optionsValue3Get3(data: any,fieldName: string){
cursor: pointer;
}
}
}
</style>

367
src/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue

@ -3,47 +3,60 @@
@ 时间: 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'
<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
default: true,
},
versionid: {
type: String,
default:""
default: "",
},
versiontitle: {
type: String,
default:""
default: "",
},
drawerwith: {
type: Number,
default:0
}
})
const formLoading = ref(false) //loading
const flowLoading = ref(false) //loading
default: 0,
},
});
const formLoading = ref(false); //loading
const flowLoading = ref(false); //loading
const flowFactor = reactive<conditionInfo[]>([]) //
const flowFactor = reactive<conditionInfo[]>([]); //
const flowMap = ref<any[]>(); //
const nextStep = ref<number>(0);
const currentProgress = ref<number>(1);
const nodeKey = ref<string>('');
const nodeKey = ref<string>("");
//
const gainFlowChart = reactive<nodeFlow>({
id:"0"
})
id: "0",
});
const nodelUserList = reactive<nodelPeoples[]>([])
const nodelUserList = reactive<nodelPeoples[]>([]);
/**
@ 作者: 秦东
@ 时间: 2024-04-08 15:35:54
@ -55,13 +68,13 @@ const state = reactive<any>({
list: [],
form: {},
config: {},
powerstr:{}
powerstr: {},
},
dict: {},
formId: props.versionid,
id: 0,
loading: true
})
loading: true,
});
const emits = defineEmits(["update:isopen", "searchquery", "optionsValue3Get4"]);
const drawerOpenOrClose = computed({
@ -73,81 +86,81 @@ const drawerOpenOrClose = computed({
const drawbox = computed({
get: () => {
// console.log("isFlowTable",isFlowTable.value)
if (isFlowTable.value) {
return 1300
return 1300;
}
return props.drawerwith
return props.drawerwith;
},
set: (val: number) => {
return val
return val;
},
});
const isFlowTable = ref(false) //
const isFlowTable = ref(false); //
//
const getTaskFormData = () => {
formLoading.value = true
flowLoading.value = true
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
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.formData.config.hideField = []//:confighideField,
flowMap.value = data.flowPage.flowList;
state.id = props.versionid;
state.formData = stringToObj(data.tableFormPage.mastesform);
state.formData.config.hideField = []; //:confighideField,
// console.log("tableFlow---echoTableFormPage---data.tableFormPage.mastesform",data.tableFormPage.mastesform)
state.dict = string2json(data.tableFormPage.dict)
state.dict = string2json(data.tableFormPage.dict);
state.formData.powerstr = string2json(data.tableFormPage.powerstr)
judgeSubmitCancel({"name":data.tableFormPage.mastesformjson})
.then((datajud:any) =>{
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)
state.formData.list.push(submitButton);
}
}
})
}
);
})
.finally(() => {
formLoading.value = false
flowLoading.value = false
})
}
formLoading.value = false;
flowLoading.value = false;
});
};
//
watch(()=>props.isopen,()=>{
watch(
() => props.isopen,
() => {
if (props.isopen) {
getTaskFormData();
} else {
initData()
initData();
}
})
}
);
//
const initData = () => {
state.formData = {
list: [],
form: {},
config: {}
config: {},
};
state.dict = {};
state.formId = 0;
state.id = 0;
state.loading = true;
let aryLen = flowFactor.length
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)
@ -157,97 +170,102 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
// 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
let unitsVal = val;
let isUpdateFlowChart = false;
//
if (notAsA_BasisForJudgment.indexOf(type) === -1) {
let isWrite = true
let isWrite = true;
flowFactor.forEach((item: any) => {
if (item.factorid == key) {
isWrite = false
isWrite = false;
item.type=3
item.type = 3;
if (type == "checkbox") {
item.isCheckbox = true
item.answers = val.map(String)
item.isCheckbox = true;
item.answers = val.map(String);
} else {
item.isCheckbox = false
item.oneanswer = val.toString()
item.isCheckbox = false;
item.oneanswer = val.toString();
}
if (notAsA_BasisForJudgment.indexOf(type) === -1) {
isUpdateFlowChart = true
isUpdateFlowChart = true;
}
}
})
});
if (isWrite) {
if (type == "checkbox") {
flowFactor.push({
factorid: key,
type: 3,
isCheckbox: true,
answers:val.map(String)
})
answers: val.map(String),
});
} else {
flowFactor.push({
factorid: key,
type: 3,
isCheckbox: false,
oneanswer:val.toString()
})
oneanswer: val.toString(),
});
}
isUpdateFlowChart = true
isUpdateFlowChart = true;
}
// console.log("--flowFactor--->",flowFactor)
}
// console.log("--flowFactor--1->",unitsVal,timeControl,type)
//
if(timeControl.indexOf(type) > -1 || fixedValueControl.indexOf(type) > -1 || type == "input"){
if (
timeControl.indexOf(type) > -1 ||
fixedValueControl.indexOf(type) > -1 ||
type == "input"
) {
// console.log("--flowFactor--3->",unitsVal)
let addNewTime = true //
let addNewTime = true; //
flowFactor.forEach((item: any) => {
// console.log("--flowFactor--5->",item.type)
if (item.type == 2) {
addNewTime = false
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
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{ //
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()
sunItem.leftval = val[0].toString();
sunItem.rightval = val[val.length - 1].toString();
}
}
}
}
})
});
if (sunNewAdd) {
isUpdateFlowChart = true
if(timeEquation.indexOf(attribute) === -1){//
isUpdateFlowChart = true;
if (timeEquation.indexOf(attribute) === -1) {
//
let customFieldInfo = {
wordfield: key,
optType: "1",
leftval: val.toString()
}
item.customFields.push(customFieldInfo)
}else{ //
leftval: val.toString(),
};
item.customFields.push(customFieldInfo);
} else {
//
if (Array.isArray(val)) {
if (val.length >= 2) {
let customFieldInfo = {
@ -256,35 +274,37 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
leftval: val[0].toString(),
leftoptType: "3",
rightoptType: "3",
rightval:val[val.length - 1].toString()
}
item.customFields.push(customFieldInfo)
rightval: val[val.length - 1].toString(),
};
item.customFields.push(customFieldInfo);
}
}
}
}
}
}
})
});
if(addNewTime){ //
isUpdateFlowChart = true
if(timeEquation.indexOf(attribute) === -1){ //
if (addNewTime) {
//
isUpdateFlowChart = true;
if (timeEquation.indexOf(attribute) === -1) {
//
let customFieldInfo = {
wordfield: key,
optType: "1",
leftval: val.toString()
}
leftval: val.toString(),
};
let condInfo = {
factorid: "customFields",
type: 2,
isCheckbox: false,
customFields:[customFieldInfo]
}
flowFactor.push(condInfo)
}else{ //
customFields: [customFieldInfo],
};
flowFactor.push(condInfo);
} else {
//
if (Array.isArray(val)) {
if (val.length >= 2) {
let customFieldInfo = {
wordfield: key,
@ -292,60 +312,58 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
leftval: val[0].toString(),
leftoptType: "3",
rightoptType: "3",
rightval:val[val.length - 1].toString()
}
rightval: val[val.length - 1].toString(),
};
let condInfo = {
factorid: "customFields",
type: 2,
isCheckbox: false,
customFields:[customFieldInfo]
}
flowFactor.push(condInfo)
customFields: [customFieldInfo],
};
flowFactor.push(condInfo);
}
}
}
}
}
//
if (asAnApprovalActionControl.indexOf(type) > -1) {
isUpdateFlowChart = true
let isWriteUs = true
isUpdateFlowChart = true;
let isWriteUs = true;
nodelUserList.forEach((item: any) => {
if (item.factorid == key) {
isWriteUs = false
item.userList = val
isWriteUs = false;
item.userList = val;
}
})
});
if (isWriteUs) {
nodelUserList.push({
factorid: key,
userList:val
})
userList: val,
});
}
}
// console.log("--flowFactor--->",flowFactor)
//
if (isUpdateFlowChart) {
flowLoading.value = true
flowLoading.value = true;
//
gainFlowChart.conditionList=flowFactor
gainFlowChart.nodelPeople=nodelUserList
gainFlowChart.oldFlow = flowMap
gainFlowChart.conditionList = flowFactor;
gainFlowChart.nodelPeople = nodelUserList;
gainFlowChart.oldFlow = flowMap;
// console.log("--gainFlowChart--->",gainFlowChart)
realTimeUpdateFlow(gainFlowChart)
.then((data:any) =>{
realTimeUpdateFlow(gainFlowChart).then((data: any) => {
// console.log("-new-->",data)
flowMap.value = data.data.flowList
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
})
}
flowLoading.value = false;
});
}
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:41:20
@ -354,37 +372,36 @@ const changeKeyVal = (key:any,val:any,type:any,attribute:any) => {
const afterSubmit = (type: string, val?: any) => {
// console.log("------------------>",type,val)
// console.log("------------------>",flowMap)
if (type === 'success') {
emits("searchquery")
if (type === "success") {
emits("searchquery");
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)=>{
state: 3,
};
startRunFlow(sendInfo).then((data: any) => {
// console.log("--------1---------->",data)
})
}
});
}
}
}
closeAppSubmit()
}
closeAppSubmit();
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:49:09
@ 功能: 表单前置数据
*/
const beforeSubmit = (params: any) => {
params.formId = props.versionid
params.id = ""
params.formId = props.versionid;
params.id = "";
// emits("update:isopen", false);
return params
}
return params;
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:50:01
@ -392,45 +409,43 @@ const beforeSubmit = (params: any) => {
*/
const closeAppSubmit = () => {
emits("update:isopen", false);
}
};
/**
@ 作者: 秦东
@ 时间: 2024-04-09 16:50:37
@ 功能: 保存草稿
*/
const saveDraftPage = (type: string, val?: any) => {
if (type === 'success') {
emits("searchquery")
if (type === "success") {
emits("searchquery");
if (isFlowTable.value) {
if (val.code == 0) {
let sendInfo = {
id: val.data.uuid,
flowList: flowMap.value,
state:1
}
startRunFlow(sendInfo)
.then((data:any)=>{
state: 1,
};
startRunFlow(sendInfo).then((data: any) => {
// console.log("--------1---------->",data)
})
}
});
}
}
closeAppSubmit()
}
closeAppSubmit();
};
function optionsValue3Get3(data: any, fieldName: string) {
//console.log("tableFlow","optionsValue3Get3")
if (fieldName.startsWith("childTable---")) {
let tableAndFieldNameArr = fieldName.split("---")
let tableAndFieldNameArr = fieldName.split("---");
for (let i = 0; i < state.formData.list.length; i++) {
if (state.formData.list[i].name == tableAndFieldNameArr[1]) {
for (let u = 0; u < state.formData.list[i].list.length; u++) {
if (state.formData.list[i].list[u].name == tableAndFieldNameArr[2]) {
state.formData.list[i].list[u].options = []
state.formData.list[i].list[u].options = [];
for (let j = 0; j < data.length; j++) {
state.formData.list[i].list[u].options.push(data[j])
state.formData.list[i].list[u].options.push(data[j]);
}
}
}
@ -439,20 +454,26 @@ function optionsValue3Get3(data: any,fieldName: string){
} else {
for (let i = 0; i < state.formData.list.length; i++) {
if (state.formData.list[i].name == fieldName) {
state.formData.list[i].options = []
state.formData.list[i].options = [];
for (let j = 0; j < data.length; j++) {
state.formData.list[i].options.push(data[j])
state.formData.list[i].options.push(data[j]);
}
}
}
}
}
</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="drawbox" class="drawerClass" >
<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="drawbox"
class="drawerClass"
>
<div v-if="isFlowTable" class="common-layout">
<el-container>
<el-main v-loading="formLoading" element-loading-text="Loading...">
@ -472,18 +493,28 @@ function optionsValue3Get3(data: any,fieldName: string){
:save-draft-page="saveDraftPage"
/>
</el-main>
<el-aside v-loading="flowLoading" element-loading-text="Loading..." width="350px" class="flowBox">
<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" />
<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..."
v-loading="formLoading"
element-loading-text="Loading..."
:form-data="state.formData"
:type="formType"
:numrun="formType"
@ -499,9 +530,8 @@ function optionsValue3Get3(data: any,fieldName: string){
/>
</div>
</el-drawer>
</template>
<style lang='scss' scoped>
<style lang="scss" scoped>
.common-layout {
height: calc(100vh - 55px);
padding: 0 15px;
@ -523,6 +553,5 @@ function optionsValue3Get3(data: any,fieldName: string){
cursor: pointer;
}
}
}
</style>

Loading…
Cancel
Save