2024-02-05 11:27:33 +08:00
|
|
|
<template>
|
2024-02-19 17:41:26 +08:00
|
|
|
<div class="page-bg-wrap">
|
|
|
|
|
<div class="itc-create-flow">
|
|
|
|
|
<div class="toolbar">
|
|
|
|
|
<a-space :size="10" wrap>
|
|
|
|
|
<a-button style="margin-right: 10px">
|
|
|
|
|
<slot name="icon">
|
|
|
|
|
<close-outlined />
|
|
|
|
|
</slot>
|
|
|
|
|
关闭
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button type="primary">
|
|
|
|
|
<slot name="icon">
|
|
|
|
|
<send-outlined />
|
|
|
|
|
</slot>
|
|
|
|
|
提交
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button>
|
|
|
|
|
<slot name="icon">
|
|
|
|
|
<clock-circle-outlined />
|
|
|
|
|
</slot>
|
|
|
|
|
暂存
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button>
|
|
|
|
|
<slot name="icon">
|
|
|
|
|
<printer-outlined />
|
|
|
|
|
</slot>
|
|
|
|
|
打印
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button @click="openFlowChart">
|
|
|
|
|
<slot name="icon">
|
|
|
|
|
<apartment-outlined />
|
|
|
|
|
</slot>
|
|
|
|
|
流程图
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-space>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flow-content">
|
|
|
|
|
<FormInformation :key="randKey" ref="formInformation" :disabled="false" :formAssignmentData="data.formAssignmentData" :formInfos="data.formInfos" :opinions="data.opinions" :opinionsComponents="data.opinionsComponents" />
|
|
|
|
|
</div>
|
2024-02-06 17:36:55 +08:00
|
|
|
</div>
|
2024-02-19 17:41:26 +08:00
|
|
|
<a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px">
|
|
|
|
|
<process-information :process-id="processId" :xml="data.xml" />
|
|
|
|
|
<template #footer>
|
|
|
|
|
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
</a-modal>
|
2024-02-05 11:27:33 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-02-06 17:36:55 +08:00
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
import userTaskItem from '/@/views/workflow/task/hooks/userTaskItem';
|
|
|
|
|
import FormInformation from '/@/views/secondDev/FormInformation.vue';
|
2024-02-19 17:41:26 +08:00
|
|
|
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
|
2024-02-06 17:36:55 +08:00
|
|
|
import { getStartProcessInfo, getReStartProcessInfo } from '/@/api/workflow/task';
|
|
|
|
|
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
2024-02-19 17:41:26 +08:00
|
|
|
import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined } from '@ant-design/icons-vue';
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
const router = useRouter();
|
|
|
|
|
const tabStore = useMultipleTabStore();
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
import { nextTick, onMounted, ref, toRaw } from 'vue';
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
const { data, initProcessData } = userTaskItem();
|
|
|
|
|
const currentRoute = router.currentRoute;
|
|
|
|
|
const rParams = currentRoute.value.query;
|
|
|
|
|
const rSchemaId = rParams.schemaId;
|
|
|
|
|
let formInformation = ref();
|
2024-02-19 17:41:26 +08:00
|
|
|
const showFlowChart = ref(false);
|
2024-02-06 17:36:55 +08:00
|
|
|
let randKey = ref('randkey'); // 强制表单重新渲染
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-19 17:41:26 +08:00
|
|
|
function closeFlowChart() {
|
|
|
|
|
showFlowChart.value = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openFlowChart() {
|
|
|
|
|
showFlowChart.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
const props = defineProps({
|
|
|
|
|
schemaId: {
|
|
|
|
|
type: String,
|
2024-02-19 17:41:26 +08:00
|
|
|
required: true
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
draftsJsonStr: {
|
2024-02-19 17:41:26 +08:00
|
|
|
type: String
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
draftsId: {
|
2024-02-19 17:41:26 +08:00
|
|
|
type: String
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
taskId: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
2024-02-19 17:41:26 +08:00
|
|
|
default: ''
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
processId: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
2024-02-19 17:41:26 +08:00
|
|
|
default: ''
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
formData: {
|
2024-02-19 17:41:26 +08:00
|
|
|
type: Object
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
formId: {
|
2024-02-19 17:41:26 +08:00
|
|
|
type: String
|
2024-02-06 17:36:55 +08:00
|
|
|
},
|
|
|
|
|
rowKeyData: {
|
2024-02-19 17:41:26 +08:00
|
|
|
type: String
|
|
|
|
|
}
|
2024-02-06 17:36:55 +08:00
|
|
|
});
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (props.processId) {
|
|
|
|
|
// 重新发起
|
|
|
|
|
let res = await getReStartProcessInfo(props.taskId, props.processId);
|
|
|
|
|
res.taskApproveOpinions = [];
|
|
|
|
|
initProcessData(res);
|
|
|
|
|
} else if (props.schemaId && props.formId) {
|
|
|
|
|
let res = await getStartProcessInfo(props.schemaId);
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
if (props.formData && props.formId) {
|
|
|
|
|
res.formInfos.map((m) => {
|
|
|
|
|
if (m.formConfig.formId === props.formId) {
|
|
|
|
|
m.formData = toRaw(props.formData);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
initProcessData(res);
|
|
|
|
|
} else {
|
|
|
|
|
// 发起流程
|
|
|
|
|
let res = await getStartProcessInfo(rSchemaId);
|
|
|
|
|
const title = res?.schemaInfo?.name;
|
|
|
|
|
if (title) {
|
|
|
|
|
tabStore.changeTitle('new_' + rSchemaId, '新建 - ' + title);
|
|
|
|
|
}
|
|
|
|
|
initProcessData(res);
|
2024-02-05 11:27:33 +08:00
|
|
|
}
|
2024-02-06 17:36:55 +08:00
|
|
|
} catch (error) {}
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
await nextTick();
|
|
|
|
|
initDraftsFormData();
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
randKey.value = Math.random() + '';
|
|
|
|
|
});
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
async function initDraftsFormData() {
|
|
|
|
|
//isPublish.value = Object.keys(data.formInfos).length > 0 ? false : true;
|
|
|
|
|
if (props.draftsJsonStr) {
|
|
|
|
|
let formDataJson = JSON.parse(props.draftsJsonStr);
|
|
|
|
|
let formData = [];
|
2024-02-05 11:27:33 +08:00
|
|
|
|
2024-02-06 17:36:55 +08:00
|
|
|
data.formInfos.forEach((item) => {
|
2024-02-19 17:41:26 +08:00
|
|
|
if (formDataJson && item.formConfig && item.formConfig.key && formDataJson[item.formConfig.key]) {
|
2024-02-06 17:36:55 +08:00
|
|
|
formData.push(item.formConfig.key ? formDataJson[item.formConfig.key] : {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
await formInformation.value.setFormData(formData);
|
2024-02-05 11:27:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2024-02-06 17:36:55 +08:00
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.itc-create-flow {
|
2024-02-19 17:41:26 +08:00
|
|
|
padding: 10px;
|
2024-02-06 17:36:55 +08:00
|
|
|
background-color: #fff;
|
|
|
|
|
|
|
|
|
|
.toolbar {
|
|
|
|
|
padding-bottom: 15px;
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-19 17:41:26 +08:00
|
|
|
|
|
|
|
|
.page-bg-wrap {
|
|
|
|
|
background-color: rgb(246 247 249);
|
|
|
|
|
padding: 10px;
|
|
|
|
|
}
|
2024-02-06 17:36:55 +08:00
|
|
|
</style>
|