|
@@ -8,7 +8,7 @@ import {
|
|
|
getOperationSelect,
|
|
|
postUpdateTask,
|
|
|
postDeleteTask,
|
|
|
- getCurrencyCodeSelect, exportTaskData
|
|
|
+ getCurrencyCodeSelect, exportTaskData, postUpdateTaskStatus
|
|
|
} from '/src/views/reportManage/TaskManage/api.ts';
|
|
|
import { ComponentSize, ElMessage, FormInstance, FormRules } from 'element-plus';
|
|
|
import { Plus, Delete } from '@element-plus/icons-vue';
|
|
@@ -130,6 +130,7 @@ const gridOptions = reactive<VxeGridProps<RowVO>>({
|
|
|
title: '平台编号',
|
|
|
editRender: {autofocus: '.vxe-input--inner'},
|
|
|
slots: {edit: 'number_edit'},
|
|
|
+ minWidth:97
|
|
|
},
|
|
|
{
|
|
|
field: 'platformName',
|
|
@@ -137,32 +138,32 @@ const gridOptions = reactive<VxeGridProps<RowVO>>({
|
|
|
editRender: {autofocus: '.vxe-input--inner'},
|
|
|
slots: {edit: 'name_edit'},
|
|
|
align: 'center',
|
|
|
- width: 150
|
|
|
+ minWidth: 150
|
|
|
},
|
|
|
{
|
|
|
field: 'country',
|
|
|
title: '国家',
|
|
|
editRender: {autofocus: '.vxe-input--inner'},
|
|
|
slots: {edit: 'country_edit'},
|
|
|
- width: 89,
|
|
|
+ minWidth: 89,
|
|
|
align: 'center'
|
|
|
},
|
|
|
- {field: 'brandName', title: '品牌', editRender: {}, slots: {edit: 'brand_edit'}, align: 'center'},
|
|
|
- {field: 'user_name', title: '运营', editRender: {}, slots: {edit: 'operation_edit'}, align: 'center'},
|
|
|
- {field: 'currencyCode', title: '回款币种', editRender: {}, slots: {edit: 'currency_edit'}, align: 'center'},
|
|
|
+ {field: 'brandName', title: '品牌', editRender: {}, slots: {edit: 'brand_edit'}, align: 'center',minWidth: 89,},
|
|
|
+ {field: 'user_name', title: '运营', editRender: {}, slots: {edit: 'operation_edit'}, align: 'center',minWidth: 89},
|
|
|
+ {field: 'currencyCode', title: '回款币种', editRender: {}, slots: {edit: 'currency_edit'}, align: 'center',minWidth: 89},
|
|
|
{
|
|
|
field: 'currencyCodePlatform',
|
|
|
title: '回款/余额币种',
|
|
|
editRender: {},
|
|
|
slots: {edit: 'currencyCodePlatform_edit'},
|
|
|
- width: 130,
|
|
|
+ minWidth: 130,
|
|
|
align: 'center'
|
|
|
},
|
|
|
- {field: 'line', title: '线路', editRender: {}, slots: {edit: 'line_edit'}, align: 'center'},
|
|
|
- {field: 'ipaddress', title: 'IP地址', editRender: {}, slots: {edit: 'ipaddress_edit'}, width: 138},
|
|
|
- {field: 'company', title: '注册公司', editRender: {}, slots: {edit: 'company_edit'}, align: 'center'},
|
|
|
- {field: 'platform', title: '平台', editRender: {}, slots: {edit: 'platform_edit'}, align: 'center'},
|
|
|
- {field: 'status', title: '状态', editRender: {}, slots: {edit: 'status_edit'}, align: 'center'},
|
|
|
+ {field: 'line', title: '线路', editRender: {}, slots: {edit: 'line_edit'}, align: 'center',minWidth: 89},
|
|
|
+ {field: 'ipaddress', title: 'IP地址', editRender: {}, slots: {edit: 'ipaddress_edit'}, minWidth: 138},
|
|
|
+ {field: 'company', title: '注册公司', editRender: {}, slots: {edit: 'company_edit'}, align: 'center',minWidth: 89},
|
|
|
+ {field: 'platform', title: '平台', editRender: {}, slots: {edit: 'platform_edit'}, align: 'center',minWidth: 89},
|
|
|
+ {field: 'status', title: '状态', slots: {default: 'status_default'}, align: 'center',minWidth: 89},
|
|
|
{title: '操作', width: 120, slots: {default: 'operate'}},
|
|
|
],
|
|
|
data: [],
|
|
@@ -180,18 +181,18 @@ const gridEvents: VxeGridListeners<RowVO> = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-async function fetchAllTasks(page = 1, limit = 100) {
|
|
|
- try {
|
|
|
- const response = await getTasks({page, limit});
|
|
|
- allTasks = allTasks.concat(response.data);
|
|
|
-
|
|
|
- if (response.data.length === limit) {
|
|
|
- await fetchAllTasks(page + 1, limit);
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('Error fetching all tasks:', error);
|
|
|
- }
|
|
|
-}
|
|
|
+//async function fetchAllTasks(page = 1, limit = 100) {
|
|
|
+// try {
|
|
|
+// const response = await getTasks({page, limit});
|
|
|
+// allTasks = allTasks.concat(response.data);
|
|
|
+//
|
|
|
+// if (response.data.length === limit) {
|
|
|
+// await fetchAllTasks(page + 1, limit);
|
|
|
+// }
|
|
|
+// } catch (error) {
|
|
|
+// console.error('Error fetching all tasks:', error);
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
async function getTaskList(filters = {}) {
|
|
|
try {
|
|
@@ -204,8 +205,8 @@ async function getTaskList(filters = {}) {
|
|
|
gridOptions.data = response.data;
|
|
|
gridOptions.pagerConfig.total = response.total;
|
|
|
|
|
|
- allTasks = []; // 重置 allTasks
|
|
|
- await fetchAllTasks(); // 获取所有任务数据
|
|
|
+ //allTasks = []; // 重置 allTasks
|
|
|
+ //await fetchAllTasks(); // 获取所有任务数据
|
|
|
} catch (error) {
|
|
|
console.error('Error fetching task data:', error);
|
|
|
} finally {
|
|
@@ -317,7 +318,6 @@ const requiredFields = [
|
|
|
{field: 'ipaddress', title: 'IP地址'},
|
|
|
{field: 'company', title: '注册公司'},
|
|
|
{field: 'platform', title: '平台'},
|
|
|
- {field: 'status', title: '状态'},
|
|
|
];
|
|
|
|
|
|
const validateRow = (row) => {
|
|
@@ -354,7 +354,6 @@ async function updateRow(row) {
|
|
|
ipaddress: row.ipaddress,
|
|
|
company: row.company,
|
|
|
platform: row.platform,
|
|
|
- status: row.status,
|
|
|
};
|
|
|
//console.log('updatedRowData', updatedRowData);
|
|
|
try {
|
|
@@ -372,6 +371,30 @@ async function updateRow(row) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+async function handleStatusChange(row) {
|
|
|
+ const $grid = xGrid.value;
|
|
|
+ if ($grid) {
|
|
|
+ const updatedData = {
|
|
|
+ id: row.id,
|
|
|
+ status: row.status,
|
|
|
+ };
|
|
|
+ const query ={partial:1,}
|
|
|
+ console.log('updatedData', updatedData);
|
|
|
+ try {
|
|
|
+ const response = await postUpdateTaskStatus(query,updatedData);
|
|
|
+ if (response.code === 2000) {
|
|
|
+ ElMessage.success('更新成功');
|
|
|
+ } else if (response.code == 400) {
|
|
|
+ ElMessage.warning(`${response.data.description}`);
|
|
|
+ } else {
|
|
|
+ ElMessage.error('更新失败');
|
|
|
+ }
|
|
|
+ }catch (error){
|
|
|
+ console.log('error:', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const saveRowEvent = async (row: RowVO) => {
|
|
|
const $grid = xGrid.value;
|
|
|
if ($grid) {
|
|
@@ -574,8 +597,16 @@ onMounted(() => {
|
|
|
<template #platform_edit="{ row }">
|
|
|
<vxe-input v-model="row.platform"></vxe-input>
|
|
|
</template>
|
|
|
- <template #status_edit="{ row }">
|
|
|
- <vxe-input v-model="row.status"></vxe-input>
|
|
|
+ <template #status_default="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.status"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ inline-prompt
|
|
|
+ active-text="是"
|
|
|
+ inactive-text="否"
|
|
|
+ @change="handleStatusChange(row)"
|
|
|
+ />
|
|
|
</template>
|
|
|
<template #operation_edit="{ row }">
|
|
|
<vxe-select v-model="row.user" multiple>
|