fix(项目管理): 缺陷模板多选字段默认值保存后有误
--bug=1046409 --user=宋昌昌 【项目管理】编辑缺陷模版-多值输入类型字段-编辑后保存无效 https://www.tapd.cn/55049933/s/1578713
This commit is contained in:
parent
3baf12d0e0
commit
3497df836f
|
@ -184,7 +184,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
|
||||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||||
|
@ -387,7 +386,7 @@
|
||||||
formRules.value = [];
|
formRules.value = [];
|
||||||
if (Array.isArray(arr) && arr.length) {
|
if (Array.isArray(arr) && arr.length) {
|
||||||
formRules.value = arr.map((item: any) => {
|
formRules.value = arr.map((item: any) => {
|
||||||
const initOptions = item.options || JSON.parse(item.platformOptionJson || '{}');
|
const initOptions = item.options || JSON.parse(item.platformOptionJson || '[]');
|
||||||
const initValue = getInitValue(item, initOptions);
|
const initValue = getInitValue(item, initOptions);
|
||||||
return {
|
return {
|
||||||
type: item.type,
|
type: item.type,
|
||||||
|
|
|
@ -601,7 +601,7 @@
|
||||||
return customFields.map((item: any) => {
|
return customFields.map((item: any) => {
|
||||||
const currentFormRules = FieldTypeFormRules[item.type];
|
const currentFormRules = FieldTypeFormRules[item.type];
|
||||||
let selectOptions: any = [];
|
let selectOptions: any = [];
|
||||||
const multipleType = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER', 'MULTIPLE_INPUT'];
|
const multipleType = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
|
||||||
if (item.options && item.options.length) {
|
if (item.options && item.options.length) {
|
||||||
selectOptions = item.options.map((optionItem: any) => {
|
selectOptions = item.options.map((optionItem: any) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -306,14 +306,15 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => {
|
||||||
*/
|
*/
|
||||||
export const getCustomDetailFields = (totalData: DefinedFieldItem[], customFields: CustomField[]) => {
|
export const getCustomDetailFields = (totalData: DefinedFieldItem[], customFields: CustomField[]) => {
|
||||||
const customFieldsIds = customFields.map((index: any) => index.fieldId);
|
const customFieldsIds = customFields.map((index: any) => index.fieldId);
|
||||||
return totalData.filter((item) => {
|
return totalData
|
||||||
const currentCustomFieldIndex = customFieldsIds.findIndex((it: any) => it === item.id);
|
.filter((item) => {
|
||||||
|
const index = customFieldsIds.findIndex((it: any) => it === item.id);
|
||||||
if (customFieldsIds.indexOf(item.id) > -1) {
|
if (customFieldsIds.indexOf(item.id) > -1) {
|
||||||
const currentForm = item.formRules?.map((it: any) => {
|
const currentForm = item.formRules?.map((it: any) => {
|
||||||
it.props.modelValue = customFields[currentCustomFieldIndex].defaultValue;
|
it.props.modelValue = customFields[index].defaultValue;
|
||||||
return {
|
return {
|
||||||
...it,
|
...it,
|
||||||
value: customFields[currentCustomFieldIndex].defaultValue,
|
value: customFields[index].defaultValue,
|
||||||
effect: {
|
effect: {
|
||||||
required: item.required,
|
required: item.required,
|
||||||
},
|
},
|
||||||
|
@ -321,12 +322,14 @@ export const getCustomDetailFields = (totalData: DefinedFieldItem[], customField
|
||||||
});
|
});
|
||||||
const formItem = item;
|
const formItem = item;
|
||||||
formItem.formRules = cloneDeep(currentForm);
|
formItem.formRules = cloneDeep(currentForm);
|
||||||
formItem.apiFieldId = customFields[currentCustomFieldIndex].apiFieldId;
|
formItem.apiFieldId = customFields[index].apiFieldId;
|
||||||
formItem.required = customFields[currentCustomFieldIndex].required;
|
formItem.required = customFields[index].required;
|
||||||
|
formItem.index = index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
})
|
||||||
|
.sort((f1, f2) => f1.index - f2.index);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {};
|
export default {};
|
||||||
|
|
Loading…
Reference in New Issue