|
@@ -218,9 +218,12 @@ const allSteps = ref([]);
|
|
|
const tabs = ref([]);
|
|
|
const curStep = ref('');
|
|
|
const flowId = props.sop.flowId;
|
|
|
+const crmInfo = ref({});
|
|
|
|
|
|
const initNew = async () => {
|
|
|
loading.value = true;
|
|
|
+ const flowRes = await sopFlowViewApi({ flowId });
|
|
|
+ crmInfo.value = flowRes.crmInfo;
|
|
|
const res = await flowFormPropertiesApi({
|
|
|
flowDeploymentId: props.sop.flowDeploymentId,
|
|
|
});
|
|
@@ -239,6 +242,7 @@ const initNew = async () => {
|
|
|
const initFill = async () => {
|
|
|
loading.value = true;
|
|
|
const res = await sopFlowViewApi({ flowId });
|
|
|
+ crmInfo.value = res.crmInfo;
|
|
|
loading.value = false;
|
|
|
curStep.value = res.currFlowTaskResult.taskName;
|
|
|
res.flowTaskHistoryList = res.flowTaskHistoryList || [];
|
|
@@ -306,18 +310,51 @@ const init = () => {
|
|
|
init();
|
|
|
|
|
|
const curFormConfig = computed(() => {
|
|
|
- const formProperty =
|
|
|
- allSteps.value.find((item) => item.taskName === curStep.value)
|
|
|
- ?.formProperty || [];
|
|
|
+ const stepData = allSteps.value.find(
|
|
|
+ (item) => item.taskName === curStep.value
|
|
|
+ );
|
|
|
+ if (!stepData) return [];
|
|
|
+
|
|
|
+ const formProperty = stepData.formProperty || [];
|
|
|
formProperty.forEach((item) => {
|
|
|
if (IS_EDIT_MODE.value) {
|
|
|
- item.writable = true;
|
|
|
item.value = allFormData.value[item.formName];
|
|
|
} else if (IS_FILL_MODE.value) {
|
|
|
item.value = item.value ? JSON.parse(item.value).value : null;
|
|
|
// item.value = null;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 填报时第一步的特殊处理
|
|
|
+ if ((IS_FILL_MODE.value || IS_NEW_MODE.value) && stepData.setup === 1) {
|
|
|
+ // region_user_id_1 区域协调人
|
|
|
+ // engineer_user_id_1 实施工程师
|
|
|
+ // assistant_engineer_user_id_1 助理工程师
|
|
|
+ formProperty.forEach((field) => {
|
|
|
+ // 区域协调人
|
|
|
+ if (field.formId.startsWith('region_user') && !field.value) {
|
|
|
+ field.value = crmInfo.value.regionCoordinatorName;
|
|
|
+ }
|
|
|
+ // 实施工程师
|
|
|
+ if (field.formId.startsWith('engineer_user')) {
|
|
|
+ field.options = crmInfo.value.effectEngineerList.map((user) => {
|
|
|
+ return {
|
|
|
+ label: user.name,
|
|
|
+ value: user.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 助理工程师
|
|
|
+ if (field.formId.startsWith('assistant_engineer_user')) {
|
|
|
+ field.options = crmInfo.value.assistantEngineerList.map((user) => {
|
|
|
+ return {
|
|
|
+ label: user.name,
|
|
|
+ value: user.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
return formProperty;
|
|
|
});
|
|
|
watch(curFormConfig, (val) => {
|