feat: bb
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
<!-- eslint-disable vue/no-parsing-error -->
|
||||
<script setup lang='ts'>
|
||||
import { ref,onMounted } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import useStore from '@/store'
|
||||
import {storeToRefs } from 'pinia'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import * as XLSX from 'xlsx'
|
||||
import { readFile } from '@/utils/file'
|
||||
import {filterData,addOtherInfo} from '@/utils'
|
||||
import { filterData, addOtherInfo } from '@/utils'
|
||||
import DaiysuiTable from '@/components/DaiysuiTable/index.vue'
|
||||
|
||||
const personConfig = useStore().personConfig
|
||||
const globalConfig = useStore().globalConfig
|
||||
const { getAllPersonList:allPersonList} = storeToRefs(personConfig)
|
||||
const {getRowCount:rowCount}=storeToRefs(globalConfig)
|
||||
const { getAllPersonList: allPersonList,getAlreadyPersonList:alreadyPersonList } = storeToRefs(personConfig)
|
||||
const { getRowCount: rowCount } = storeToRefs(globalConfig)
|
||||
const limitType = '.xlsx,.xls'
|
||||
const excelData = ref<any[]>([])
|
||||
// const personList = ref<any[]>([])
|
||||
@@ -22,8 +22,8 @@ const handleFileChange = async (e: any) => {
|
||||
let workBook = XLSX.read(dataBinary, { type: 'binary', cellDates: true })
|
||||
let workSheet = workBook.Sheets[workBook.SheetNames[0]]
|
||||
excelData.value = XLSX.utils.sheet_to_json(workSheet)
|
||||
const uploadData = filterData(excelData.value,rowCount.value)
|
||||
const allData=addOtherInfo(uploadData);
|
||||
const uploadData = filterData(excelData.value, rowCount.value)
|
||||
const allData = addOtherInfo(uploadData);
|
||||
personConfig.resetPerson()
|
||||
personConfig.addNotPersonList(allData)
|
||||
}
|
||||
@@ -31,6 +31,7 @@ const handleFileChange = async (e: any) => {
|
||||
const deleteAll = () => {
|
||||
personConfig.deleteAllPerson()
|
||||
}
|
||||
|
||||
const delPersonItem = (row: any) => {
|
||||
personConfig.deletePerson(row)
|
||||
}
|
||||
@@ -49,14 +50,14 @@ const tableColumns = [
|
||||
props: 'department',
|
||||
},
|
||||
{
|
||||
label: '职位',
|
||||
props: 'other',
|
||||
label: '身份',
|
||||
props: 'identity',
|
||||
},
|
||||
{
|
||||
label:'是否已中奖',
|
||||
label: '是否已中奖',
|
||||
props: 'isWin',
|
||||
formatValue(row: any) {
|
||||
return row.isWin? '是' : '否'
|
||||
return row.isWin ? '是' : '否'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -86,20 +87,30 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<div class="min-w-1000px">
|
||||
<div class="flex justify-center gap-3">
|
||||
<div class="flex gap-3 justify-">
|
||||
<button class="btn btn-error btn-sm" @click="deleteAll">全部删除</button>
|
||||
<div class="tooltip tooltip-bottom" data-tip="下载文件后,请在excel中填写数据,并保存为xlsx格式">
|
||||
<a class="no-underline btn btn-secondary btn-sm" download="人口登记表.xlsx" target="_blank" href="/log-lottery/人口登记表.xlsx">下载模板</a>
|
||||
</div>
|
||||
<div class="">
|
||||
<label for="explore">
|
||||
<input type="file"
|
||||
class=""
|
||||
id="explore"
|
||||
style="display: none"
|
||||
@change="handleFileChange" :accept="limitType" />
|
||||
<span class="btn btn-primary btn-sm">上传文件</span>
|
||||
|
||||
<div class="tooltip tooltip-bottom" data-tip="上传修改好的excel文件">
|
||||
<input type="file" class="" id="explore" style="display: none" @change="handleFileChange"
|
||||
:accept="limitType" />
|
||||
|
||||
<span class="btn btn-primary btn-sm">上传文件</span>
|
||||
</div>
|
||||
</label>
|
||||
<!-- <button class="btn btn-primary btn-sm">上传excel</button> -->
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<span>中奖人数:</span>
|
||||
<span>{{ alreadyPersonList.length }}</span>
|
||||
<span> / </span>
|
||||
<span>{{ allPersonList.length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<DaiysuiTable :tableColumns="tableColumns" :data="allPersonList"></DaiysuiTable>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- eslint-disable vue/no-parsing-error -->
|
||||
<script setup lang='ts'>
|
||||
import { ref } from 'vue';
|
||||
// import { ref } from 'vue';
|
||||
import useStore from '@/store'
|
||||
import { storeToRefs } from 'pinia';
|
||||
import DaiysuiTable from '@/components/DaiysuiTable/index.vue'
|
||||
@@ -13,9 +13,9 @@ const { getAlreadyPersonList: alreadyPersonList } = storeToRefs(personConfig)
|
||||
// )
|
||||
|
||||
|
||||
const deleteAll = () => {
|
||||
personConfig.deleteAllPerson()
|
||||
}
|
||||
// const deleteAll = () => {
|
||||
// personConfig.deleteAllPerson()
|
||||
// }
|
||||
const handleMoveNotPerson=(row:any)=>{
|
||||
personConfig.moveAlreadyToNot(row)
|
||||
}
|
||||
@@ -24,6 +24,7 @@ const tableColumns = [
|
||||
{
|
||||
label: '编号',
|
||||
props: 'uid',
|
||||
sort:true
|
||||
},
|
||||
{
|
||||
label: '姓名',
|
||||
@@ -34,12 +35,13 @@ const tableColumns = [
|
||||
props: 'department',
|
||||
},
|
||||
{
|
||||
label: '职位',
|
||||
props: 'other',
|
||||
label: '身份',
|
||||
props: 'identity',
|
||||
},
|
||||
{
|
||||
label:'奖品',
|
||||
props:'prizeName'
|
||||
props:'prizeName',
|
||||
sort:true
|
||||
},
|
||||
{
|
||||
label: '中奖时间',
|
||||
@@ -71,9 +73,12 @@ const tableColumns = [
|
||||
|
||||
<template>
|
||||
<div class="overflow-y-auto">
|
||||
<div class="flex justify-center gap-3">
|
||||
<button class="btn btn-error btn-sm" @click="deleteAll">全部删除</button>
|
||||
|
||||
<div class="flex justify-start gap-3">
|
||||
<!-- <button class="btn btn-error btn-sm" @click="deleteAll">全部删除</button> -->
|
||||
<div>
|
||||
<span>中奖人数:</span>
|
||||
<span>{{ alreadyPersonList.length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<DaiysuiTable :tableColumns="tableColumns" :data="alreadyPersonList"></DaiysuiTable>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user