|
@@ -8,7 +8,7 @@ import {
|
|
|
getOperationSelect,
|
|
|
postUpdateTask,
|
|
|
postDeleteTask,
|
|
|
- getCurrencyCodeSelect
|
|
|
+ getCurrencyCodeSelect, exportTaskData
|
|
|
} from '/src/views/reportManage/TaskManage/api.ts';
|
|
|
import { ComponentSize, ElMessage, FormInstance, FormRules } from 'element-plus';
|
|
|
import { Plus, Delete } from '@element-plus/icons-vue';
|
|
@@ -24,6 +24,10 @@ interface taskRuleForm {
|
|
|
operation: string[];
|
|
|
currency: string;
|
|
|
currencyCodePlatform: string;
|
|
|
+ line: string;
|
|
|
+ ipaddress: string;
|
|
|
+ company: string;
|
|
|
+ platform: string;
|
|
|
}
|
|
|
|
|
|
const formSize = ref<ComponentSize>('default');
|
|
@@ -50,6 +54,10 @@ const rules = reactive<FormRules>({
|
|
|
operation: [{required: true, message: '请选择运营', trigger: 'change'}],
|
|
|
currency: [{required: true, message: '请输入回款/余额币种', trigger: 'blur'}],
|
|
|
currencyCodePlatform: [{required: true, message: '请输入平台货币', trigger: 'blur'}],
|
|
|
+ line: [{required: true, message: '请输入线路', trigger: 'blur'}],
|
|
|
+ ipaddress: [{required: true, message: '请输入IP地址', trigger: 'blur'}],
|
|
|
+ company: [{required: true, message: '请输入注册公司', trigger: 'blur'}],
|
|
|
+ platform: [{required: true, message: '请输入平台', trigger: 'blur'}],
|
|
|
});
|
|
|
const currencyList = ref([]);
|
|
|
|
|
@@ -64,6 +72,10 @@ interface RowVO {
|
|
|
currencyCodePlatform: string;
|
|
|
child_user_number: number;
|
|
|
user: [];
|
|
|
+ line: string;
|
|
|
+ ipaddress: string;
|
|
|
+ company: string;
|
|
|
+ platform: string;
|
|
|
}
|
|
|
|
|
|
const xGrid = ref<VxeGridInstance<RowVO>>();
|
|
@@ -73,8 +85,8 @@ let allTasks = []; // 用于存储所有任务数据
|
|
|
const gridOptions = reactive<VxeGridProps<RowVO>>({
|
|
|
border: 'inner',
|
|
|
keepSource: true,
|
|
|
- showOverflow: true,
|
|
|
- height: 850,
|
|
|
+ //showOverflow: true,
|
|
|
+ height: 900,
|
|
|
loading: false,
|
|
|
round: true,
|
|
|
toolbarConfig: {
|
|
@@ -84,7 +96,8 @@ const gridOptions = reactive<VxeGridProps<RowVO>>({
|
|
|
},
|
|
|
slots: {
|
|
|
buttons: 'toolbar_buttons',
|
|
|
- },
|
|
|
+ tools: 'toolbar_tools'
|
|
|
+ }
|
|
|
},
|
|
|
rowConfig: {
|
|
|
isHover: true,
|
|
@@ -117,19 +130,39 @@ const gridOptions = reactive<VxeGridProps<RowVO>>({
|
|
|
title: '平台编号',
|
|
|
editRender: {autofocus: '.vxe-input--inner'},
|
|
|
slots: {edit: 'number_edit'},
|
|
|
- sortable: true,
|
|
|
},
|
|
|
{
|
|
|
field: 'platformName',
|
|
|
title: '平台名称',
|
|
|
editRender: {autofocus: '.vxe-input--inner'},
|
|
|
- slots: {edit: 'name_edit'}
|
|
|
+ slots: {edit: 'name_edit'},
|
|
|
+ align: 'center',
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'country',
|
|
|
+ title: '国家',
|
|
|
+ editRender: {autofocus: '.vxe-input--inner'},
|
|
|
+ slots: {edit: 'country_edit'},
|
|
|
+ width: 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: 'currencyCodePlatform',
|
|
|
+ title: '回款/余额币种',
|
|
|
+ editRender: {},
|
|
|
+ slots: {edit: 'currencyCodePlatform_edit'},
|
|
|
+ width: 130,
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
- {field: 'country', title: '国家', editRender: {autofocus: '.vxe-input--inner'}, slots: {edit: 'country_edit'}},
|
|
|
- {field: 'brandName', title: '品牌', editRender: {}, slots: {edit: 'brand_edit'}},
|
|
|
- {field: 'user_name', title: '运营', editRender: {}, slots: {edit: 'operation_edit'}},
|
|
|
- {field: 'currencyCode', title: '回款币种', editRender: {}, slots: {edit: 'currency_edit'}},
|
|
|
- {field: 'currencyCodePlatform', title: '回款/余额币种', editRender: {}, slots: {edit: 'currencyCodePlatform_edit'}},
|
|
|
+ {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'},
|
|
|
{title: '操作', width: 120, slots: {default: 'operate'}},
|
|
|
],
|
|
|
data: [],
|
|
@@ -251,6 +284,11 @@ async function deleteTask() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const isDeleteDisabled = computed(() => {
|
|
|
+ const $grid = xGrid.value;
|
|
|
+ return !$grid || $grid.getCheckboxRecords().length === 0;
|
|
|
+});
|
|
|
+
|
|
|
const removeEvent = async () => {
|
|
|
const $grid = xGrid.value;
|
|
|
if ($grid) {
|
|
@@ -274,7 +312,12 @@ const requiredFields = [
|
|
|
{field: 'brandName', title: '品牌'},
|
|
|
{field: 'user', title: '运营'},
|
|
|
{field: 'currencyCode', title: '回款币种'},
|
|
|
- {field: 'currencyCodePlatform', title: '回款/余额币种'}
|
|
|
+ {field: 'currencyCodePlatform', title: '回款/余额币种'},
|
|
|
+ {field: 'line', title: '线路'},
|
|
|
+ {field: 'ipaddress', title: 'IP地址'},
|
|
|
+ {field: 'company', title: '注册公司'},
|
|
|
+ {field: 'platform', title: '平台'},
|
|
|
+ {field: 'status', title: '状态'},
|
|
|
];
|
|
|
|
|
|
const validateRow = (row) => {
|
|
@@ -307,6 +350,11 @@ async function updateRow(row) {
|
|
|
user: row.user,
|
|
|
currencyCode: row.currencyCode,
|
|
|
currencyCodePlatform: row.currencyCodePlatform,
|
|
|
+ line: row.line,
|
|
|
+ ipaddress: row.ipaddress,
|
|
|
+ company: row.company,
|
|
|
+ platform: row.platform,
|
|
|
+ status: row.status,
|
|
|
};
|
|
|
//console.log('updatedRowData', updatedRowData);
|
|
|
try {
|
|
@@ -348,6 +396,10 @@ async function createTask() {
|
|
|
brandName: taskRuleForm.brand,
|
|
|
currencyCode: taskRuleForm.currency,
|
|
|
currencyCodePlatform: taskRuleForm.currencyCodePlatform,
|
|
|
+ line: taskRuleForm.line,
|
|
|
+ ipaddress: taskRuleForm.ipaddress,
|
|
|
+ company: taskRuleForm.company,
|
|
|
+ platform: taskRuleForm.platform,
|
|
|
user: taskRuleForm.operation,
|
|
|
};
|
|
|
try {
|
|
@@ -389,7 +441,18 @@ const submitForm = async (formEl) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+async function handleExport() {
|
|
|
+ gridOptions.loading = true;
|
|
|
+ const response = await exportTaskData();
|
|
|
+ const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = url;
|
|
|
+ link.setAttribute('download', '店铺数据.xlsx');
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ gridOptions.loading = false;
|
|
|
+ ElMessage.success('导出数据成功');
|
|
|
+}
|
|
|
|
|
|
function handleClose(done: Function) {
|
|
|
if (taskRuleFormRef.value) taskRuleFormRef.value.resetFields();
|
|
@@ -431,7 +494,7 @@ const handleCurrencyCodePlatformSelect = item => {
|
|
|
taskRuleForm.currencyCodePlatform = item;
|
|
|
};
|
|
|
|
|
|
-function handleRowSelect (item, row){
|
|
|
+function handleRowSelect(item, row) {
|
|
|
row.currencyCode = item;
|
|
|
}
|
|
|
|
|
@@ -439,6 +502,19 @@ function handelRowCurrencyCodePlatformSelect(item, row) {
|
|
|
row.currencyCodePlatform = item;
|
|
|
}
|
|
|
|
|
|
+const cellStyle = () => {
|
|
|
+ return {
|
|
|
+ fontSize: '13px',
|
|
|
+ fontWeight: '500',
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+const headerCellStyle = () => {
|
|
|
+ return {
|
|
|
+ fontSize: '14px',
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
onMounted(() => {
|
|
|
getTaskList();
|
|
@@ -453,10 +529,17 @@ onMounted(() => {
|
|
|
</el-card>
|
|
|
<el-card class="mx-8 my-3">
|
|
|
<div style="position: relative">
|
|
|
- <vxe-grid ref="xGrid" stripe v-bind="gridOptions" v-on="gridEvents">
|
|
|
+ <vxe-grid ref="xGrid" :cell-style="cellStyle" :header-cell-style="headerCellStyle" stripe v-bind="gridOptions"
|
|
|
+ v-on="gridEvents">
|
|
|
<template #toolbar_buttons>
|
|
|
<el-button :icon="Plus" plain type="primary" @click="dialogFormVisible = true"> 添加任务</el-button>
|
|
|
- <el-button :icon="Delete" plain type="danger" @click="removeEvent">删除</el-button>
|
|
|
+ <el-button :disabled="isDeleteDisabled" :icon="Delete" plain type="danger" @click="removeEvent">删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template #toolbar_tools>
|
|
|
+ <div class="mx-3.5">
|
|
|
+ <vxe-button circle icon="vxe-icon-download" @click="handleExport"></vxe-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #operate="{ row }">
|
|
|
<template v-if="hasActiveEditRow(row)">
|
|
@@ -479,6 +562,21 @@ onMounted(() => {
|
|
|
<template #brand_edit="{ row }">
|
|
|
<vxe-input v-model="row.brandName"></vxe-input>
|
|
|
</template>
|
|
|
+ <template #line_edit="{ row }">
|
|
|
+ <vxe-input v-model="row.line"></vxe-input>
|
|
|
+ </template>
|
|
|
+ <template #ipaddress_edit="{ row }">
|
|
|
+ <vxe-input v-model="row.ipaddress"></vxe-input>
|
|
|
+ </template>
|
|
|
+ <template #company_edit="{ row }">
|
|
|
+ <vxe-input v-model="row.company"></vxe-input>
|
|
|
+ </template>
|
|
|
+ <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>
|
|
|
<template #operation_edit="{ row }">
|
|
|
<vxe-select v-model="row.user" multiple>
|
|
|
<vxe-option v-for="item in operationList" :key="item.value" :label="item.label"
|
|
@@ -577,6 +675,18 @@ onMounted(() => {
|
|
|
</template>
|
|
|
</el-autocomplete>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="线路" prop="line">
|
|
|
+ <el-input v-model="taskRuleForm.line" placeholder="请输入线路" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="IP地址" prop="ipaddress">
|
|
|
+ <el-input v-model="taskRuleForm.ipaddress" placeholder="请输入IP地址" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="注册公司" prop="company">
|
|
|
+ <el-input v-model="taskRuleForm.company" placeholder="请输入" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="平台" prop="platform">
|
|
|
+ <el-input v-model="taskRuleForm.platform" placeholder="请输入" />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|