新增简化列表+员工端删除

This commit is contained in:
2025-09-15 18:55:49 +08:00
parent f8289ea4c1
commit 3dd879b130
3 changed files with 90 additions and 28 deletions

View File

@@ -4,9 +4,9 @@ NODE_ENV=development
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://192.168.1.144:48080'
# VITE_BASE_URL='http://192.168.1.144:48080'
# VITE_BASE_URL='http://47.79.98.113:48080'
# VITE_BASE_URL='https://backstageapi.yolozs.com'
VITE_BASE_URL='https://backstageapi.yolozs.com'
# 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务
VITE_UPLOAD_TYPE=server

View File

@@ -65,6 +65,10 @@ export const EmployeeHostsApi = {
deleteEmployeeHosts: async (id: number) => {
return await request.delete({ url: `/server/employee-hosts/delete?id=` + id })
},
// 删除员工分配主播
deleteEmployeeHostsList: async (ids: number[]) => {
return await request.delete({ url: `/server/employee-hosts/delete-list`, params: { ids: ids.join(',') } })
},
// 导出员工分配主播 Excel
exportEmployeeHosts: async (params) => {

View File

@@ -125,6 +125,9 @@
<!-- <el-button type="success" plain @click="handleExport" v-hasPermi="['server:new-hosts:export']">
<Icon icon="ep:download" class="mr-5px" /> {{ t('newHosts.export') }}
</el-button> -->
<el-button type="danger" @click="handleDeleteList">
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
@@ -134,6 +137,10 @@
<div class="center-justify" style="margin-top: -15px;">
<el-button type="primary" @click="isShowSearch = !isShowSearch">{{ isShowSearch ? $t('employee.showSearch') :
$t('employee.hideSearch') }}</el-button>
<div v-if="isMobile">
<el-switch v-model="simpleModel" />
简化列表
</div>
</div>
<!-- 列表区域 -->
@@ -195,32 +202,67 @@
<!-- 移动端使用卡片列表 -->
<div v-else>
<div v-for="(item, index) in list" :key="index" class="mobile-card">
<div class="card-row" style="color:green;">
<b>{{ $t('employee.hostsId') }}</b><span @click="openHtml(item, item.hostsId)"
style=" text-decoration: underline;margin-right: 50px;">{{ item.hostsId }}</span>
<el-link @click="handleCopy(item.hostsId)" type="primary">复制id</el-link>
</div>
<div v-if="simpleModel">
<!-- PC 端使用 table -->
<el-table v-loading="loading" :data="list" :stripe="true" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" /> -->
<!-- <div class="card-row"><b>{{ $t('employee.userId') }}</b>{{ item.userId }}</div> -->
<div class="card-row"><b>{{ $t('employee.hostsLevel') }}</b>{{ item.hostsLevel }}</div>
<div class="card-row"><b>{{ $t('employee.hostsCoins') }}</b>{{ item.hostsCoins }}</div>
<div class="card-row"><b>{{ $t('employee.fans') }}</b>{{ item.fans }}</div>
<div class="card-row"><b>{{ $t('employee.fllowernum') }}</b>{{ item.fllowernum }}</div>
<div class="card-row"><b>{{ $t('employee.hostsCountry') }}</b>{{ item.country }}</div>
<div class="card-row"><b>{{ $t('employee.hostsKind') }}</b>{{ item.hostsKind }}</div>
<div class="card-row"><b>{{ $t('employee.remark') }}</b>{{ item.remake }}</div>
<div class="card-row"><b>{{ $t('employee.flag') }}</b><dict-tag :type="DICT_TYPE.FLAG_TYPE"
:value="item.flag" />
</div>
<div class="card-row"><b>{{ $t('employee.operationStatus') }}</b>
<dict-tag :type="DICT_TYPE.OPERATION_STATE" :value="item.operationStatus" />
</div>
<div class="card-row"><b>{{ $t('employee.createTime') }}</b>{{ formatTimestamp(item.createTime) }}</div>
<div class="card-row"><b>{{ $t('employee.updateTime') }}</b>{{ formatTimestamp(item.updateTime) }}</div>
<div class="card-row action-row">
<el-button link type="primary" @click="openForm('update', item.id, index)">{{ $t('employee.edit')
}}</el-button>
<el-table-column :label="$t('employee.hostsId')" align="center" prop="hostsId">
<template #default="scope">
<div style="color: green; text-decoration: underline;" @click="openHtml(scope.row, scope.row.hostsId)">
{{ scope.row.hostsId }}</div>
</template>
</el-table-column>
<el-table-column :label="$t('employee.operationStatus')" align="center" prop="operationStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.OPERATION_STATE" :value="scope.row.operationStatus" />
</template>
</el-table-column>
<el-table-column :label="$t('employee.remark')" align="center" prop="remake" />
<!-- <el-table-column :label="$t('employee.createTime')" align="center" prop="createTime"
:formatter="dateFormatter" width="180px" />
<el-table-column :label="$t('employee.updateTime')" align="center" prop="updateTime"
:formatter="dateFormatter" width="180px" />
<el-table-column :label="$t('employee.action')" align="center" min-width="120px">
<template #default="scope">
<el-button link type="primary" @click="openForm('update', scope.row.id)">{{ $t('employee.edit')
}}</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
<div v-else>
<div v-for="(item, index) in list" :key="index" class="mobile-card">
<div class="card-row" style="color:green;">
<b>{{ $t('employee.hostsId') }}</b><span @click="openHtml(item, item.hostsId)"
style=" text-decoration: underline;margin-right: 50px;">{{ item.hostsId }}</span>
<el-link @click="handleCopy(item.hostsId)" type="primary">复制id</el-link>
</div>
<!-- <div class="card-row"><b>{{ $t('employee.userId') }}</b>{{ item.userId }}</div> -->
<div class="card-row"><b>{{ $t('employee.hostsLevel') }}</b>{{ item.hostsLevel }}</div>
<div class="card-row"><b>{{ $t('employee.hostsCoins') }}</b>{{ item.hostsCoins }}</div>
<div class="card-row"><b>{{ $t('employee.fans') }}</b>{{ item.fans }}</div>
<div class="card-row"><b>{{ $t('employee.fllowernum') }}</b>{{ item.fllowernum }}</div>
<div class="card-row"><b>{{ $t('employee.hostsCountry') }}</b>{{ item.country }}</div>
<div class="card-row"><b>{{ $t('employee.hostsKind') }}</b>{{ item.hostsKind }}</div>
<div class="card-row"><b>{{ $t('employee.remark') }}</b>{{ item.remake }}</div>
<div class="card-row"><b>{{ $t('employee.flag') }}</b><dict-tag :type="DICT_TYPE.FLAG_TYPE"
:value="item.flag" />
</div>
<div class="card-row"><b>{{ $t('employee.operationStatus') }}</b>
<dict-tag :type="DICT_TYPE.OPERATION_STATE" :value="item.operationStatus" />
</div>
<div class="card-row"><b>{{ $t('employee.createTime') }}</b>{{ formatTimestamp(item.createTime) }}</div>
<div class="card-row"><b>{{ $t('employee.updateTime') }}</b>{{ formatTimestamp(item.updateTime) }}</div>
<div class="card-row action-row">
<el-button link type="primary" @click="openForm('update', item.id, index)">{{ $t('employee.edit')
}}</el-button>
<el-button link type="danger" @click="handleDelete(item.id)">{{ $t('employee.delete')
}}</el-button>
</div>
</div>
</div>
</div>
@@ -250,6 +292,8 @@ import MobilePagination from '@/components/MobilePagination.vue'
const { wsCache } = useCache()
let simpleModel = ref(false)
/** 员工分配主播 列表 */
defineOptions({ name: 'EmployeeHosts' })
@@ -363,6 +407,18 @@ const handleDelete = async (id: number) => {
await getList()
} catch { }
}
/** 删除按钮操作 */
const handleDeleteList = async () => {
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await EmployeeHostsApi.deleteEmployeeHostsList(checkedIds.value)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch { }
}
/** 导出按钮操作 */
const handleExport = async () => {
@@ -445,10 +501,12 @@ function formatTimestamp(milliseconds) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
/** 批量删除按钮操作 */
const checkedIds = ref<number[]>([])
//分配按钮操作
const handleSelectionChange = (val) => {
selectHostList.value = val
checkedIds.value = val.map((row) => row.id)
console.log(selectHostList.value)
}