|
|
@ -1,5 +1,5 @@ |
|
|
|
<script setup> |
|
|
|
import { ref, onMounted, reactive, computed, watch, nextTick, h } from "vue"; |
|
|
|
import { ref, onMounted, reactive, computed, watch, nextTick } from "vue"; |
|
|
|
import { ElMessage } from "element-plus"; |
|
|
|
import { Plus } from "@element-plus/icons-vue"; |
|
|
|
import axios from "axios"; |
|
|
@ -160,7 +160,7 @@ const getActivity = async function () { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API.post( |
|
|
|
"http://192.168.8.93:10010/recharge/activity/select", |
|
|
|
{} |
|
|
|
{ activity: { status: 1 } } |
|
|
|
); |
|
|
|
|
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
@ -385,8 +385,6 @@ const vJwcodeLoadmore = { |
|
|
|
// directives.loadmore(jwcodeSelectRef.value, loadMore(rangeNumber.value)); |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// 添加行数加载对象 |
|
|
|
const loading = ref(false); |
|
|
|
// 添加行数对象 |
|
|
|
const addLineObj = ref(0); |
|
|
|
//添加一行 |
|
|
@ -396,27 +394,50 @@ const addLine = function () { |
|
|
|
showInput: true, |
|
|
|
}); |
|
|
|
}; |
|
|
|
const loading = ref(false); |
|
|
|
// 添加多行 |
|
|
|
const addLines = function () { |
|
|
|
// const addLines = async function () { |
|
|
|
// try { |
|
|
|
// for (let j = 0; j < addLineObj.value; j++) { |
|
|
|
// batchData.value.unshift({ |
|
|
|
// line: ++i.value, |
|
|
|
// showInput: true, |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// ElMessage.success("添加成功"); |
|
|
|
// } catch (error) { |
|
|
|
// console.log("添加失败", error); |
|
|
|
// ElMessage.error("添加失败"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
const addLines = async function () { |
|
|
|
try { |
|
|
|
loading.value = true; |
|
|
|
if (loading.value) { |
|
|
|
console.log("loading===", loading.value); |
|
|
|
loading.value = true; // 操作开始前,将loading设为true,显示加载动画 |
|
|
|
await nextTick(); // 等待视图更新,确保加载动画能及时显示出来 |
|
|
|
|
|
|
|
const addLinesPromises = []; |
|
|
|
for (let j = 0; j < addLineObj.value; j++) { |
|
|
|
addLinesPromises.push(new Promise((resolve) => { |
|
|
|
batchData.value.unshift({ |
|
|
|
line: ++i.value, |
|
|
|
showInput: true, |
|
|
|
}); |
|
|
|
resolve(); |
|
|
|
})); |
|
|
|
} |
|
|
|
loading.value = false; |
|
|
|
} |
|
|
|
await Promise.all(addLinesPromises); |
|
|
|
|
|
|
|
// 所有数据添加操作完成后,准备关闭加载动画 |
|
|
|
await nextTick(); // 再次等待视图更新,确保数据添加操作引起的视图变化已完成 |
|
|
|
loading.value = false; // 将loading设为false,关闭加载动画 |
|
|
|
ElMessage.success("添加成功"); |
|
|
|
} catch (error) { |
|
|
|
console.log("添加失败", error); |
|
|
|
ElMessage.error("添加失败"); |
|
|
|
// 如果出现异常,也要确保关闭加载动画 |
|
|
|
loading.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
// 导入excel按钮的ref |
|
|
|
const uploadRefMap = ref({}); |
|
|
|
// 获取excel数据 |
|
|
@ -878,7 +899,7 @@ onMounted(async function () { |
|
|
|
<!-- <el-button type="primary" @click="addLine()" style="margin-right: 10px">新增一行</el-button> --> |
|
|
|
<div style="font-weight: bold; font-size: 20px;"> |
|
|
|
<span>添加</span> |
|
|
|
<el-input style="width: 40px;" v-model="addLineObj"></el-input> |
|
|
|
<el-input style="width: 60px;" v-model="addLineObj"></el-input> |
|
|
|
<span>行</span> |
|
|
|
<el-button type="primary" @click="addLines()" style="margin-right: 10px;">添加</el-button> |
|
|
|
</div> |
|
|
@ -889,9 +910,9 @@ onMounted(async function () { |
|
|
|
</el-upload> --> |
|
|
|
<el-button type="danger" plain @click="batchDel()" style="margin-right: 10px; width: 130px">批量删除</el-button> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-table :data="batchData" border max-height="540px" style="height: 540px" |
|
|
|
@selection-change="handleSelectionChangebatch" v-loading="loading"> |
|
|
|
<el-row > |
|
|
|
<el-table v-loading="loading" :data="batchData" border max-height="540px" style="height: 540px" |
|
|
|
@selection-change="handleSelectionChangebatch"> |
|
|
|
<el-table-column type="selection" width="50px" /> |
|
|
|
<el-table-column property="index" label="序号" width="55px"> |
|
|
|
<template #default="scope"> |
|
|
|