fix: Issues #259 done.
This commit is contained in:
@@ -14,15 +14,8 @@
|
|||||||
<!-- Upload text -->
|
<!-- Upload text -->
|
||||||
<div>
|
<div>
|
||||||
<div v-if="!isDisabled"></div>
|
<div v-if="!isDisabled"></div>
|
||||||
<div v-else-if="isInform" class="flex justify-start items-center space-x-2 duration-700">
|
|
||||||
<span class="material-symbols-outlined text-primary">notifications</span>
|
|
||||||
<p class="text-primary text-sm">
|
|
||||||
Please verify the label for each column before uploading.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div v-else class="flex justify-start items-center space-x-2 duration-700">
|
<div v-else class="flex justify-start items-center space-x-2 duration-700">
|
||||||
<span class="material-symbols-outlined material-fill text-danger">warning</span>
|
<p class="text-primary text-sm">
|
||||||
<p class="text-danger text-sm">
|
|
||||||
Need to select
|
Need to select
|
||||||
<span v-for="(item, index) in informData" :key="index">{{ item.label }}<span v-if="index !== informData.length - 1">, </span></span>.
|
<span v-for="(item, index) in informData" :key="index">{{ item.label }}<span v-if="index !== informData.length - 1">, </span></span>.
|
||||||
</p>
|
</p>
|
||||||
@@ -51,12 +44,12 @@
|
|||||||
v-model="selectedColumns[index]"
|
v-model="selectedColumns[index]"
|
||||||
:options="columnType"
|
:options="columnType"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
placeholder="Not Assigned"
|
placeholder=""
|
||||||
class="w-full !border-neutral-500"
|
class="w-52 !border-neutral-500"
|
||||||
:data-type="item"
|
:data-type="item"
|
||||||
:inputId="index.toString()"
|
:inputId="index.toString()"
|
||||||
:inputClass="selectedColumns[index]?.color"
|
:inputClass="[selectedColumns[index]?.color, 'text-sm']"
|
||||||
inputClass="!text-sm">
|
>
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div :class="slotProps.option.color" class="text-sm">
|
<div :class="slotProps.option.color" class="text-sm">
|
||||||
<span>{{ slotProps.option.name }}</span>
|
<span>{{ slotProps.option.name }}</span>
|
||||||
@@ -122,8 +115,7 @@ export default {
|
|||||||
{ name: 'Not Assigned', code: '', color: '!text-neutral-700', value: '', label: 'Not Assigned', required: false },
|
{ name: 'Not Assigned', code: '', color: '!text-neutral-700', value: '', label: 'Not Assigned', required: false },
|
||||||
],
|
],
|
||||||
selectedColumns: [],
|
selectedColumns: [],
|
||||||
isInform: true, // true: 藍字提示; false: 紅字提示
|
informData: [], // 藍字提示,尚未選擇的 type
|
||||||
informData: [], // 紅字提示,尚未選擇的 type
|
|
||||||
repeatedData: [], // 紅字提示,重複選擇的 type
|
repeatedData: [], // 紅字提示,重複選擇的 type
|
||||||
fileName: this.uploadFileName,
|
fileName: this.uploadFileName,
|
||||||
};
|
};
|
||||||
@@ -197,7 +189,7 @@ export default {
|
|||||||
return width;
|
return width;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 驗證,根據新的 selectedColumns 更新 isInform、informData 和 repeatedData
|
* 驗證,根據新的 selectedColumns 更新 informData 和 repeatedData
|
||||||
* @param {Array} data
|
* @param {Array} data
|
||||||
*/
|
*/
|
||||||
updateValidationData(data) {
|
updateValidationData(data) {
|
||||||
@@ -225,7 +217,6 @@ export default {
|
|||||||
this.informData = this.columnType.filter(item => item.required ? !selectedData.includes(item.name) : false);
|
this.informData = this.columnType.filter(item => item.required ? !selectedData.includes(item.name) : false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.isInform = (this.informData.length === 0 && this.repeatedData.length === 0) ? true : false;
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Reset Button
|
* Reset Button
|
||||||
@@ -296,7 +287,7 @@ export default {
|
|||||||
this.uploadConfirm(fetchData);
|
this.uploadConfirm(fetchData);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
// 只監聽第一次
|
// 只監聽第一次
|
||||||
let unwatch = this.$watch('fileName', (newValue) => {
|
let unwatch = this.$watch('fileName', (newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
@@ -308,9 +299,9 @@ export default {
|
|||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
this.isInform = true; // 初始為藍字提示
|
|
||||||
this.showEdit = true;
|
this.showEdit = true;
|
||||||
if(this.uploadId) this.filesStore.getUploadDetail();
|
if(this.uploadId) await this.filesStore.getUploadDetail();
|
||||||
|
this.selectedColumns = await Array.from({ length: this.uploadDetail.columns.length }, () => this.columnType[this.columnType.length - 1]); // 預設選 Not Assigned
|
||||||
unwatch();
|
unwatch();
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user