|
@@ -34,6 +34,14 @@ if ($result && $row = $result->fetch_assoc()) {
|
|
|
// 检查是否为导出请求
|
|
|
$is_export = isset($_GET['export']) && $_GET['export'] == 'excel';
|
|
|
|
|
|
+// 如果是导出请求但当前用户不是管理员,则拒绝导出
|
|
|
+if ($is_export && $current_permission_role != 1) {
|
|
|
+ // 不允许导出,重定向回当前页面(不带export参数)
|
|
|
+ $redirect_url = strtok($_SERVER['REQUEST_URI'], '?') . '?' . http_build_query(array_diff_key($_GET, ['export' => '', 'type' => '']));
|
|
|
+ echo "<script>alert('只有管理员才有权限导出数据'); window.location.href='$redirect_url';</script>";
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
// 获取日期范围参数
|
|
|
$date_params = getDateRangeParams();
|
|
|
$start_date = $date_params['start_date_sql'];
|
|
@@ -279,7 +287,10 @@ function renderEmployeeConversionRateTable($data, $is_export = false) {
|
|
|
echo '<div class="card">';
|
|
|
echo '<div class="card-header d-flex justify-content-between align-items-center">';
|
|
|
echo '<span>业务员询盘转化率统计</span>';
|
|
|
- echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=employee" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ // 只有管理员才显示导出按钮
|
|
|
+ if ($current_permission_role == 1) {
|
|
|
+ echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=employee" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ }
|
|
|
echo '</div>';
|
|
|
echo '<div class="card-body">';
|
|
|
echo '<div class="table-responsive">';
|
|
@@ -353,7 +364,10 @@ function renderChannelTotalConversionRateTable($data, $is_export = false) {
|
|
|
echo '<div class="card">';
|
|
|
echo '<div class="card-header d-flex justify-content-between align-items-center">';
|
|
|
echo '<span>渠道询盘转化率汇总</span>';
|
|
|
- echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=channel" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ // 只有管理员才显示导出按钮
|
|
|
+ if ($current_permission_role == 1) {
|
|
|
+ echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=channel" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ }
|
|
|
echo '</div>';
|
|
|
echo '<div class="card-body">';
|
|
|
echo '<div class="table-responsive">';
|
|
@@ -427,7 +441,10 @@ function renderCountryChannelConversionRateTable($data, $is_export = false) {
|
|
|
echo '<div class="card">';
|
|
|
echo '<div class="card-header d-flex justify-content-between align-items-center">';
|
|
|
echo '<span>国家/渠道月度转化率明细</span>';
|
|
|
- echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=country_channel" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ // 只有管理员才显示导出按钮
|
|
|
+ if ($current_permission_role == 1) {
|
|
|
+ echo '<a href="' . $_SERVER['REQUEST_URI'] . '&export=excel&type=country_channel" class="btn btn-sm btn-success ml-3">导出CSV</a>';
|
|
|
+ }
|
|
|
echo '</div>';
|
|
|
echo '<div class="card-body">';
|
|
|
echo '<div class="table-responsive">';
|