Merge remote-tracking branch 'origin/master'

This commit is contained in:
menxipeng
2025-10-14 23:15:54 +08:00

View File

@@ -1,4 +1,4 @@
<template>
@<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="通知标题" prop="title">
@@ -84,6 +84,16 @@
v-hasPermi="['system:notifications:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-s-promotion"
size="mini"
:disabled="single"
@click="handleSendAll"
>发送全部用户</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -97,11 +107,6 @@
<el-tag type="primary">系统通知</el-tag>
</template>
</el-table-column>
<el-table-column label="计划发送时间" align="center" prop="sendTime" width="180">
<template slot-scope="scope">
<span>{{ scope.row.sendTime }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@@ -156,16 +161,6 @@
<el-option label="系统通知" value="system" />
</el-select>
</el-form-item>
<el-form-item label="计划发送时间" prop="sendTime">
<el-date-picker clearable
v-model="form.sendTime"
type="datetime"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划发送时间"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@@ -259,6 +254,7 @@
<script>
import { listNotifications, getNotifications, delNotifications, addNotifications, updateNotifications, bindUsers, getBindUsers, publishNotification } from "@/api/notify/notifications"
import { listShopUser } from "@/api/member/shopuser"
import request from '@/utils/request'
export default {
name: "Notifications",
@@ -325,17 +321,7 @@ export default {
],
notificationType: [
{ required: true, message: "通知类型不能为空", trigger: "change" }
],
sendTime: [
{ required: true, message: "计划发送时间不能为空", trigger: "blur" }
]
},
// 日期选择器配置
pickerOptions: {
disabledDate(time) {
// 禁用今天之前的日期
return time.getTime() < Date.now() - 8.64e7; // 减去一天的毫秒数,确保今天可选
}
}
}
},
@@ -621,6 +607,29 @@ export default {
this.getList();
});
}).catch(() => {});
},
/** 发送全部用户按钮操作 */
handleSendAll(row) {
const id = row.id || this.ids;
if (!id) {
this.$message.warning("请选择一条通知记录");
return;
}
this.$confirm('确认要向全部用户发送该通知吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: `/back/notifications/sendAll/${id}`,
method: 'post'
}).then(response => {
this.$modal.msgSuccess(response.msg || "发送成功");
this.getList();
});
}).catch(() => {});
}
}
}