|
@@ -1,6 +1,6 @@
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { onMounted, ref, watch } from 'vue';
|
|
import { onMounted, ref, watch } from 'vue';
|
|
-import { getOperationSelect, getTasks, getTasksId } from '/@/views/reportManage/TaskManage/api';
|
|
|
|
|
|
+import { getOperationSelect, getSelect, getTasks, getTasksId } from '/@/views/reportManage/TaskManage/api';
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -20,45 +20,48 @@ const countryList = ref(JSON.parse(localStorage.getItem('countryList') || '[]'))
|
|
const brandNameList = ref(JSON.parse(localStorage.getItem('brandNameList') || '[]'));
|
|
const brandNameList = ref(JSON.parse(localStorage.getItem('brandNameList') || '[]'));
|
|
const platformList = ref(JSON.parse(localStorage.getItem('platformList') || '[]'));
|
|
const platformList = ref(JSON.parse(localStorage.getItem('platformList') || '[]'));
|
|
|
|
|
|
-const platformNumberOptions = ref([]);
|
|
|
|
-const platformNameOptions = ref([]);
|
|
|
|
|
|
+// const platformNumberOptions = ref([]);
|
|
|
|
+// const platformNameOptions = ref([]);
|
|
const usersOptions = ref([]);
|
|
const usersOptions = ref([]);
|
|
-const operationOptions = ref([]);
|
|
|
|
|
|
+// const operationOptions = ref([]);
|
|
const countryOptions = ref([]);
|
|
const countryOptions = ref([]);
|
|
const brandNameOptions = ref([]);
|
|
const brandNameOptions = ref([]);
|
|
const platformOptions = ref([]);
|
|
const platformOptions = ref([]);
|
|
|
|
|
|
|
|
+const updateData = ref([]);
|
|
|
|
+const filteredData = ref([]);
|
|
|
|
+
|
|
function sortCountriesByInitial(countries) {
|
|
function sortCountriesByInitial(countries) {
|
|
return countries.sort((a, b) => a.localeCompare(b));
|
|
return countries.sort((a, b) => a.localeCompare(b));
|
|
}
|
|
}
|
|
|
|
|
|
-async function fetchAllTasks() {
|
|
|
|
- let page = 1;
|
|
|
|
- const limit = 9999;
|
|
|
|
- let allData = [];
|
|
|
|
- let hasNext = true;
|
|
|
|
-
|
|
|
|
- while (hasNext) {
|
|
|
|
- try {
|
|
|
|
- const response = await getTasks({ page, limit });
|
|
|
|
- const data = response.data;
|
|
|
|
- allData = allData.concat(data);
|
|
|
|
- hasNext = response.is_next;
|
|
|
|
- page += 1;
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error('Error fetching tasks data:', error);
|
|
|
|
- hasNext = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- platformNumberOptions.value = [...new Set(allData.map(item => item.platformNumber))];
|
|
|
|
- platformNameOptions.value = [...new Set(allData.map(item => item.platformName))];
|
|
|
|
- operationOptions.value = [...new Set(allData.map(item => item.operater))];
|
|
|
|
- countryOptions.value = sortCountriesByInitial([...new Set(allData.map(item => item.country))]);
|
|
|
|
- brandNameOptions.value = [...new Set(allData.map(item => item.brandName))];
|
|
|
|
- platformOptions.value = [...new Set(allData.map(item => item.platform).filter(platform => platform !== null && platform !== undefined && platform !== ''))];
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+// async function fetchAllTasks() {
|
|
|
|
+// let page = 1;
|
|
|
|
+// const limit = 9999;
|
|
|
|
+// let allData = [];
|
|
|
|
+// let hasNext = true;
|
|
|
|
+//
|
|
|
|
+// while (hasNext) {
|
|
|
|
+// try {
|
|
|
|
+// const response = await getTasks({ page, limit });
|
|
|
|
+// const data = response.data;
|
|
|
|
+// allData = allData.concat(data);
|
|
|
|
+// hasNext = response.is_next;
|
|
|
|
+// page += 1;
|
|
|
|
+// } catch (error) {
|
|
|
|
+// console.error('Error fetching tasks data:', error);
|
|
|
|
+// hasNext = false;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// // platformNumberOptions.value = [...new Set(allData.map(item => item.platformNumber))];
|
|
|
|
+// // platformNameOptions.value = [...new Set(allData.map(item => item.platformName))];
|
|
|
|
+// operationOptions.value = [...new Set(allData.map(item => item.operater))];
|
|
|
|
+// countryOptions.value = sortCountriesByInitial([...new Set(allData.map(item => item.country))]);
|
|
|
|
+// brandNameOptions.value = [...new Set(allData.map(item => item.brandName))];
|
|
|
|
+// platformOptions.value = [...new Set(allData.map(item => item.platform).filter(platform => platform !== null && platform !== undefined && platform !== ''))];
|
|
|
|
+// }
|
|
|
|
+//
|
|
async function fetchUsersSelect() {
|
|
async function fetchUsersSelect() {
|
|
try {
|
|
try {
|
|
const resp = await getOperationSelect();
|
|
const resp = await getOperationSelect();
|
|
@@ -70,8 +73,18 @@ async function fetchUsersSelect() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-const updateData = ref([]);
|
|
|
|
-const filteredData = ref([]);
|
|
|
|
|
|
+async function fetchSelectData() {
|
|
|
|
+ try {
|
|
|
|
+ const resp = await getSelect();
|
|
|
|
+ countryOptions.value = sortCountriesByInitial(resp.data.country)
|
|
|
|
+ brandNameOptions.value = resp.data.brandName;
|
|
|
|
+ platformOptions.value = resp.data.platform;
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error('Failed to fetch select data:', e);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
async function fetchFilteredData() {
|
|
async function fetchFilteredData() {
|
|
const filters: any = {};
|
|
const filters: any = {};
|
|
@@ -141,7 +154,8 @@ watch([countryList, brandNameList, usersList, platformList], () => {
|
|
});
|
|
});
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- fetchAllTasks();
|
|
|
|
|
|
+ // fetchAllTasks();
|
|
|
|
+ fetchSelectData();
|
|
fetchUsersSelect();
|
|
fetchUsersSelect();
|
|
emitChange();
|
|
emitChange();
|
|
});
|
|
});
|