fix:修改请求的数据格式错误的问题

This commit is contained in:
MTrun 2022-03-22 09:39:53 +08:00
parent 27fcec9846
commit 2e038ad7db
3 changed files with 22 additions and 18 deletions

View File

@ -18,7 +18,7 @@ export default {
},
{
'product': '@name',
'dataOne1|100-900': 3,
'dataOne|100-900': 3,
'dataTwo|100-900': 3,
},
{

View File

@ -8,7 +8,7 @@
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in getDimensionsAndSource" :key="index">
<tr v-for="(item, index) in dimensionsAndSource" :key="index">
<td>{{ item.field }}</td>
<td>{{ item.mapping }}</td>
<td>
@ -91,52 +91,53 @@ const { DocumentAddIcon, DocumentDownloadIcon } = icon.carbon
const uploadFileListRef = ref()
const source = ref()
const dimensions = ref()
const dimensionsAndSource = ref()
//
const getSource = computed(() => {
return JSON.stringify(source.value)
})
watch(() => props.targetData?.option?.dataset, (newData) => {
if (newData) {
source.value = newData.source
dimensions.value = newData.dimensions
}
}, {
immediate: true
})
//
const matchingHandle = (mapping: string) => {
let res = DataResultEnum.SUCCESS
for (let i = 0; i < source.value.length; i++) {
if (source.value[i][mapping] === undefined) {
res = DataResultEnum.FAILURE
break
return res
}
return res
}
return DataResultEnum.SUCCESS
}
//
const getDimensionsAndSource = computed(() => {
const dimensionsAndSourceHandle = () => {
//
return dimensions.value.map((item: string, index: number) => {
return dimensions.value.map((dimensionsItem: string, index: number) => {
return index === 0 ?
{
//
field: '通用标识',
//
mapping: item,
mapping: dimensionsItem,
//
result: DataResultEnum.NULL
} : {
field: `数据项-${index}`,
mapping: item,
result: matchingHandle(item)
mapping: dimensionsItem,
result: matchingHandle(dimensionsItem)
}
})
}
watch(() => props.targetData?.option?.dataset, (newData) => {
if (newData) {
source.value = newData.source
dimensions.value = newData.dimensions
dimensionsAndSource.value = dimensionsAndSourceHandle()
}
}, {
immediate: true
})
//@ts-ignore

View File

@ -0,0 +1,3 @@
const useFile = () => {
}