数通互联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

274 lines
8.1 KiB

<!--
@ 作者: 秦东
@ 时间: 2024-06-17 15:30:36
@ 备注: App执行任务
-->
<script lang="ts" setup>
import {
submitButton,
afreshSubmitButton,
editFormCont,
draftSubmitButton,
editLookFormCont,
} from "@/utils/workflow/const";
import {
json2string,
objToStringify,
string2json,
stringToObj,
} from "@/utils/DesignForm/form";
import {
haveCustomerFormVersion,
generateFlow,
gainTaskFormInfo,
gainEditDataLog,
} from "@/api/taskapi/management";
import RunFlowStepApp from "@/views/taskplatform/taskmanagement/runFlowStepApp.vue";
import {
judgeSubmitCancel,
startRunFlow,
afreshRunFlow,
onlyPublishFlow,
gainEditFormFlowInfo,
} from "@/api/DesignForm/requestapi";
import FlowStep from "@/views/taskplatform/taskmanagement/flowStep.vue";
const props = defineProps({
isshow: {
type: Boolean,
default: true,
},
drawerWith: {
type: Number,
default: 0,
},
flowLogInfo: {
type: Object,
default() {
return {};
},
},
operState: {
type: Number,
default: 1,
},
});
const flowAry = ref<any[]>();
const emits = defineEmits(["update:isshow", "getmytodolist"]);
const isOpen = computed({
get: () => props.isshow,
set: (val) => {
emits("update:isshow", val);
},
});
const logistrue = ref(false);
const formLoading = ref(false);
const loadingData = ref(false); //加载表单数据
const flowLoading = ref(false); //加载流程数据
const versiontitle = ref<any>("");
const flowMap = ref<any>();
const nextStep = ref(0);
const nodeKey = ref<string>("");
const purviewAry = ref<any[]>([]);
const currentProgress = ref<number>(1);
const newLogAry = ref<any>("");
const oldLogAry = ref<any>("");
const newDataLen = ref<number>(0);
//表单相关内容
const formState = reactive({
formData: {
list: [],
form: {},
config: {},
},
dict: {},
formId: 25,
id: 1,
loading: true,
});
const formEl = ref<any>();
const drawerBeforeClose = () => {
// console.log("监听打开关闭",false)
emits("getmytodolist");
emits("update:isshow", false);
};
onMounted(() => {
versiontitle.value = props.flowLogInfo.title;
flowMap.value = JSON.parse(props.flowLogInfo.flowcont);
// console.log("监听打开关闭",props.flowLogInfo)
gainFormData();
});
const pageLog = ref<any[]>([]);
//获取表单内容
const gainFormData = () => {
formLoading.value = true;
console.log("获取表单内容--->", props.flowLogInfo);
nextStep.value = props.flowLogInfo.nextStep;
nodeKey.value = props.flowLogInfo.currentNodeKey;
purviewAry.value = props.flowLogInfo.powerAry;
currentProgress.value = props.flowLogInfo.currentStep;
// console.log("props.flowLogInfo--5-------->",props.flowLogInfo.mastesform)
formState.formData = stringToObj(props.flowLogInfo.mastesform);
gainTaskFormInfo({ id: props.flowLogInfo.mastersKeyStr ,runFlowId: props.flowLogInfo.runFlowIdStr })
.then((data: any) => {
if (data.data.logistrue) {
formState.formData.list.push(editLookFormCont);
}
// console.log("res----获得数据回显------->",data)
formEl.value.setValue(data.data.masterDataInfo);
newLogAry.value = data.data.newData;
oldLogAry.value = data.data.oldData;
logistrue.value = data.data.logistrue;
newDataLen.value = data.data.newDataLen;
formLoading.value = false;
nextTick(() => {
// console.log("获取自定义表单内容-1111-->",data.data.tableData)
formEl.value.setValue(data.data.tableData);
});
})
.finally(() => {
formLoading.value = false;
gainEditDataLog({ id: props.flowLogInfo.mastersKeyStr.toString() }).then(({ data }) => {
// console.log("获取修改记录-1111-->",data)
pageLog.value = data;
});
});
// haveCustomerFormVersion({id:props.flowLogInfo.version_id.toString()})
// .then(({ data }) =>{
// formState.dict = string2json(data.dict)
// judgeSubmitCancel({"name":data.mastesformjson})
// .then((dataBut:any) =>{
// if(dataBut.code == 0){
// formState.formData.list.push(afreshSubmitButton)
// // console.log("res----判断按钮------->",dataBut,props.operState)
// // if (dataBut.data == 3 || dataBut.data == 4){
// // formInfo.formData.list.push(editFormCont)
// // }
// }
// })
// })
// .finally(() => {
// formLoading.value = false;
// formEl
// })
};
</script>
<template>
<el-drawer
v-model="isOpen"
v-loading="loadingData"
element-loading-my-text="Loading..."
:title="versiontitle"
:close-on-click-modal="false"
:close-on-press-escape="false"
:destroy-on-close="true"
:size="props.drawerWith"
class="drawerClass"
:before-close="drawerBeforeClose"
>
<table border="0" class="tableFlowBox">
<tr>
<td valign="top">
<div class="drawerFormBox boxLeft">
<ak-form
ref="formEl"
v-loading="formLoading"
element-loading-text="Loading..."
:form-data="formState.formData"
:type="formType"
:dict="formState.dict"
request-url="getFormContent"
add-url="saveFormContent"
edit-url="editFormContent"
:before-submit="beforeSubmit"
:close-app-submit="closeAppSubmit"
:change-key-val="changeKeyVal"
:anew-submit="anewSubmit"
:save-edit-form-info="saveEditFormInfo"
:send-draft-submit="sendDraftSubmit"
:node-key="nodeKey"
:purview="purviewAry"
/>
<el-divider v-if="pageLog && pageLog.length > 0" content-position="left"
>历史记录</el-divider
>
<el-timeline>
<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"
:key="sonIndex"
:label="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>
<table style="margin-top: 20px">
<tr>
<td class="biankuang" width="100">修改说明:</td>
<td class="biankuang">{{ item.explicate }}</td>
</tr>
</table>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</td>
<td valign="top" width="350">
<RunFlowStepApp
ref="runstep"
v-model:flowary="flowAry"
:flow-key="props.flowLogInfo.idStr"
:current-progress="currentProgress"
@updatelist="drawerBeforeClose"
/>
</td>
</tr>
</table>
</el-drawer>
</template>
<style lang="scss" scoped>
.biankuang {
border: 1px solid #d4d7de;
padding: 10px 10px;
}
</style>