1.1需求完成

This commit is contained in:
2025-07-04 13:46:11 +08:00
parent 62260e8483
commit c6f765f858
52 changed files with 1993 additions and 1012 deletions

View File

@@ -39,6 +39,9 @@ export default {
editLoading: false,
byteCount: "",
isOverLimit: false,
total: 0,
pageSizes: [50, 100, 300],
currentPage: 1,
}
},
@@ -54,8 +57,7 @@ export default {
if (token) {
this.fetchList(this.listParams);
}
},
methods: {
async fetchList(params) {
@@ -64,6 +66,7 @@ export default {
const res = await listBroadcast(params)
if (res.code === 200) {
this.tableData = res.rows
this.total = res.total
}
this.setLoading('broadcastLoading', false);
},
@@ -109,6 +112,7 @@ export default {
handleClose() {
this.dialogVisible = false;
this.addParams.content = ""
this.setLoading('bthLoading', false);
},
sureAddBroadcast() {
@@ -136,6 +140,7 @@ export default {
handleEditClose() {
this.editDialogVisible = false;
this.editParams.content = ""
this.setLoading('editLoading', false);
},
handelDelete(row) {
this.deleteBroadcast({ id: row.id });
@@ -184,9 +189,28 @@ export default {
handelTime(time) {
return `${time.split("T")[0]} ${time.split("T")[1]}`
}
},
handleSizeChange(val) {
console.log(`每页 ${val}`);
this.listParams.pageSize = val
this.listParams.pageNum = 1
this.currentPage = 1
this.fetchList(this.listParams);
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.listParams.pageNum = val
this.fetchList(this.listParams);
}
},
},
}

View File

@@ -1,153 +1,234 @@
<template>
<div v-loading="broadcastLoading">
<div class="main-title-box">
<div class="main-title">{{$t("backendSystem.publishedBroadcast")}}</div>
<el-button class="add-btn" @click="handelAddBroadcast">{{$t("backendSystem.addBroadcast")}} <i class="iconfont icon-youjiantou1 arrow"></i></el-button>
</div>
<el-table
:data="tableData"
border
style="width: 100%; margin-bottom: 18px"
:header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }"
>
<el-table-column prop="id" label="ID" width="60" show-overflow-tooltip />
<el-table-column prop="createTime" :label="$t('backendSystem.createTime')" width="160" show-overflow-tooltip>
<template slot-scope="scope">
{{ handelTime(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column prop="content" :label="$t('backendSystem.content')" show-overflow-tooltip/>
<el-table-column prop="createUser" :label="$t('backendSystem.createUser')" width="160" show-overflow-tooltip/>
<el-table-column prop="updateTime" :label="$t('backendSystem.updateTime')" width="160" show-overflow-tooltip>
<template slot-scope="scope">
{{ handelTime(scope.row.updateTime) }}
</template>
</el-table-column>
<el-table-column prop="updateUser" :label="$t('backendSystem.updateUser')" width="160" show-overflow-tooltip/>
<el-table-column :label="$t('backendSystem.operation')" width="160" >
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.row)">{{$t("backendSystem.edit")}}</el-button>
<el-popconfirm
:confirm-button-text='$t(`work.confirm`)'
:cancel-button-text='$t(`work.cancel`)'
icon="el-icon-info"
icon-color="red"
:title="$t(`alerts.deleteRemind`)"
@confirm="handelDelete(scope.row)"
>
<el-button class="elBtn" size="mini" slot="reference">{{ $t(`personal.delete`) }}</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<!-- 新增广播弹窗 -->
<el-dialog
:title="$t('backendSystem.dialogTitle')"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose"
:close-on-click-modal="false"
>
<el-form :model="addParams" >
<!-- v-if="isOverLimit" -->
<el-form-item >
<el-input resize="none" v-model="addParams.content" type="textarea" :rows="5" @input="val => handleInput(val, 'add')" />
<div style="color: #999; font-size: 12px; margin-top: 4px;display: flex;align-items: center;justify-content: space-between;">
<span v-if="isOverLimit"> {{$t("backendSystem.exceedingInput")}}</span>
<span> {{$t("backendSystem.newlineInvalid")}}</span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">{{$t("backendSystem.cancel")}}</el-button>
<el-button type="primary" :loading="bthLoading" @click="sureAddBroadcast">{{$t("backendSystem.publish")}}</el-button>
</div>
</el-dialog>
<!-- 修改广播弹窗 -->
<el-dialog
:title="$t('backendSystem.editContent')"
:visible.sync="editDialogVisible"
width="50%"
:before-close="handleEditClose"
:close-on-click-modal="false"
>
<el-form :model="editParams" >
<el-form-item >
<el-input resize="none" v-model="editParams.content" type="textarea" :rows="5" @input="val => handleInput(val, 'edit')" />
<div style="color: #999; font-size: 12px; margin-top: 4px;display: flex;align-items: center;justify-content: space-between;">
<span v-if="isOverLimit"> {{$t("backendSystem.exceedingInput")}}</span>
<span> {{$t("backendSystem.newlineInvalid")}}</span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleEditClose">{{$t("backendSystem.cancel")}}</el-button>
<el-button type="primary" :loading="editLoading" @click="sureEditBroadcast">{{$t("backendSystem.editBroadcast")}}</el-button>
</div>
</el-dialog>
<div v-loading="broadcastLoading">
<div class="main-title-box">
<div class="main-title">{{ $t("backendSystem.publishedBroadcast") }}</div>
<el-button class="add-btn" @click="handelAddBroadcast"
>{{ $t("backendSystem.addBroadcast") }}
<i class="iconfont icon-youjiantou1 arrow"></i
></el-button>
</div>
<el-table
:data="tableData"
border
style="width: 100%; margin-bottom: 18px"
:header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }"
height="60vh"
>
<el-table-column prop="id" label="ID" width="60" show-overflow-tooltip />
<el-table-column
prop="createTime"
:label="$t('backendSystem.createTime')"
width="160"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ handelTime(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column
prop="content"
:label="$t('backendSystem.content')"
show-overflow-tooltip
/>
<el-table-column
prop="createUser"
:label="$t('backendSystem.createUser')"
width="160"
show-overflow-tooltip
/>
<el-table-column
prop="updateTime"
:label="$t('backendSystem.updateTime')"
width="160"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ handelTime(scope.row.updateTime) }}
</template>
</el-table-column>
<el-table-column
prop="updateUser"
:label="$t('backendSystem.updateUser')"
width="160"
show-overflow-tooltip
/>
<el-table-column :label="$t('backendSystem.operation')" width="160">
<template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.row)">{{
$t("backendSystem.edit")
}}</el-button>
<el-popconfirm
:confirm-button-text="$t(`work.confirm`)"
:cancel-button-text="$t(`work.cancel`)"
icon="el-icon-info"
icon-color="red"
:title="$t(`alerts.deleteRemind`)"
@confirm="handelDelete(scope.row)"
>
<el-button class="elBtn" size="mini" slot="reference">{{
$t(`personal.delete`)
}}</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-row>
<el-col :span="24" style="display: flex; justify-content: center">
<el-pagination
style="margin: 0 auto; margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-sizes="pageSizes"
:page-size="listParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</el-col>
</el-row>
<!-- 新增广播弹窗 -->
<el-dialog
:title="$t('backendSystem.dialogTitle')"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose"
:close-on-click-modal="false"
>
<el-form :model="addParams">
<!-- v-if="isOverLimit" -->
<el-form-item>
<el-input
resize="none"
v-model="addParams.content"
type="textarea"
:rows="5"
@input="(val) => handleInput(val, 'add')"
/>
<div
style="
color: #999;
font-size: 12px;
margin-top: 4px;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<span v-if="isOverLimit">
{{ $t("backendSystem.exceedingInput") }}</span
>
<span> {{ $t("backendSystem.newlineInvalid") }}</span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">{{
$t("backendSystem.cancel")
}}</el-button>
<el-button
type="primary"
:loading="bthLoading"
@click="sureAddBroadcast"
>{{ $t("backendSystem.publish") }}</el-button
>
</div>
</el-dialog>
<!-- 修改广播弹窗 -->
<el-dialog
:title="$t('backendSystem.editContent')"
:visible.sync="editDialogVisible"
width="50%"
:before-close="handleEditClose"
:close-on-click-modal="false"
>
<el-form :model="editParams">
<el-form-item>
<el-input
resize="none"
v-model="editParams.content"
type="textarea"
:rows="5"
@input="(val) => handleInput(val, 'edit')"
/>
<div
style="
color: #999;
font-size: 12px;
margin-top: 4px;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<span v-if="isOverLimit">
{{ $t("backendSystem.exceedingInput") }}</span
>
<span> {{ $t("backendSystem.newlineInvalid") }}</span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleEditClose">{{
$t("backendSystem.cancel")
}}</el-button>
<el-button
type="primary"
:loading="editLoading"
@click="sureEditBroadcast"
>{{ $t("backendSystem.editBroadcast") }}</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import Index from './index'
import Index from "./index";
export default {
mixins:[Index],
}
mixins: [Index],
};
</script>
<style scoped lang="scss">
.main-title-box{
.main-title-box {
display: flex;
align-items: center;
margin-bottom: 20px;
.add-btn{
background: #661FFB;
.add-btn {
background: #661ffb;
color: #fff;
border:none;
border: none;
margin-left: 28px;
border-radius: 20px;
padding: 10px 20px;
transition: all 0.3s ease;
.arrow{
.arrow {
margin-left: 10px;
}
}
.add-btn:hover{
transform: scale(1.05);
.add-btn:hover {
transform: scale(1.05);
}
}
.main-title{
.main-title {
font-size: 24px;
font-weight: bold;
color: #333;
}
.elBtn{
.elBtn {
background: #e60751;
color: #fff;
border:none;
border: none;
margin-left: 18px;
}
</style>