@@ -73,8 +72,9 @@
v-model="formItem.required"
class="mr-1"
@change="(value) => changeState(value, formItem as DefinedFieldItem)"
- >{{ t('system.orgTemplate.required') }}
+ {{ t('system.orgTemplate.required') }}
+
@@ -131,6 +131,7 @@
v-model:api="formItem.fApi"
v-model:rule="formItem.formRules"
:option="configOptions"
+ is-in-for
@click="activeHandler(index)"
/>
{
+ if (item.fApi && typeof item.fApi.validate === 'function') {
+ return item.fApi.validate();
+ }
+ return Promise.resolve(false);
+ });
+ return validationPromises;
+ }
+
// 保存
function saveHandler(isContinue = false) {
isContinueFlag.value = isContinue;
- formRef.value?.validate().then((res) => {
+ formRef.value?.validate().then(async (res) => {
if (!res) {
- // const allThirdApi = selectData.value.filter(
- // (item: any) =>
- // item.formRules[0].value || (Array.isArray(item.formRules[0].value) && item.formRules[0].value.length)
- // );
-
- // const allThirdApiIds = allThirdApi.map((item) => item.fieldId);
- // const allValidatePromises = Object.keys(refStepMap).map((key) => {
- // return refStepMap[key].validate();
- // });
-
- // Promise.all(allValidatePromises).then((results) => {
- // const allValid = results.every((result) => !result);
- // if (allValid) {
- // return save();
- // }
- // });
- return save();
+ const results = await Promise.all(validateAll());
+ const allValid = results.every((result) => result === true);
+ if (allValid) {
+ return save();
+ }
}
return scrollIntoView(document.querySelector('.arco-form-item-message'), { block: 'center' });
});
@@ -475,7 +475,6 @@
title.value = t('system.orgTemplate.createTemplateType', {
type: getTemplateName('organization', route.query.type as string),
});
- // templateForm.value.name = title.value;
}
});
@@ -582,7 +581,6 @@
} else {
initValue = item.defaultValue;
}
-
return {
...item,
id: item.fieldId,
@@ -667,7 +665,9 @@
selectData.value = [];
totalTemplateField.value = [];
await getClassifyField();
- getFieldOptionList();
+ if (!isEdit.value) {
+ getFieldOptionList();
+ }
if (isEdit.value) {
getTemplateInfo();
}
@@ -784,30 +784,6 @@
:deep(.selfClass) {
margin-bottom: 0;
}
-
- // :deep(.contentClass > .arco-input-wrapper) {
- // border-color: transparent;
- // &:hover {
- // border-color: var(--color-text-input-border);
- // }
- // &:hover > .arco-input {
- // font-weight: normal;
- // text-decoration: none;
- // color: var(--color-text-1);
- // }
- // & > .arco-input {
- // font-weight: 500;
- // text-decoration: underline;
- // color: var(--color-text-1);
- // }
- // }
- // :deep(.contentClass > .arco-input-focus) {
- // border-color: rgb(var(--primary-5));
- // & > .arco-input {
- // font-weight: normal;
- // text-decoration: none;
- // }
- // }
.ghost {
border: 1px solid rgba(var(--primary-5));
background-color: var(--color-text-n9);
diff --git a/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue b/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue
index cf0448e5e9..2b616f4ee5 100644
--- a/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue
+++ b/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue
@@ -273,7 +273,6 @@
const confirmHandler = async (isContinue = false) => {
try {
drawerLoading.value = true;
- console.log(fieldForm.value);
const formCopy = cloneDeep(fieldForm.value);
formCopy.scene = route.query.type;
diff --git a/frontend/src/views/setting/organization/template/components/fieldSetting.ts b/frontend/src/views/setting/organization/template/components/fieldSetting.ts
index 500a8dbb99..05b5ea0dab 100644
--- a/frontend/src/views/setting/organization/template/components/fieldSetting.ts
+++ b/frontend/src/views/setting/organization/template/components/fieldSetting.ts
@@ -284,7 +284,7 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => {
title: item.name,
field: item.id,
effect: {
- required: false,
+ required: item.internal,
},
props: {
...currentFormRules.props,
@@ -294,7 +294,7 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => {
},
],
fApi: null,
- required: false,
+ required: item.internal,
};
});
};