Compare commits
4 Commits
54f460a242
...
15fdd3ba57
| Author | SHA1 | Date | |
|---|---|---|---|
| 15fdd3ba57 | |||
| 7aaa66d2dc | |||
| a9a66063b4 | |||
| 6c491bac81 |
@@ -31,6 +31,8 @@ class Channel extends Backend
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'code', 'name'];
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
private array $currentChannelIds = [];
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
|
||||
@@ -23,7 +23,9 @@ class CommissionRecord extends Backend
|
||||
|
||||
protected array $withJoinTable = ['settlementPeriod', 'channel', 'admin'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
@@ -21,7 +21,9 @@ class SettlementPeriod extends Backend
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@ class GameConfig extends Backend
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'asc'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@ class Config extends Backend
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'asc'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
@@ -23,7 +23,9 @@ class Period extends Backend
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
33
app/admin/controller/operation/OperationNotice.php
Normal file
33
app/admin/controller/operation/OperationNotice.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\operation;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use support\Response;
|
||||
use Webman\Http\Request as WebmanRequest;
|
||||
|
||||
/**
|
||||
* 运营公告
|
||||
*/
|
||||
class OperationNotice extends Backend
|
||||
{
|
||||
protected ?object $model = null;
|
||||
|
||||
protected string|array $preExcludeFields = ['id', 'create_time', 'update_time'];
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'title'];
|
||||
|
||||
protected string|array $defaultSortField = ['id' => 'desc'];
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
$this->model = new \app\common\model\OperationNotice();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
35
app/admin/controller/operation/UserNoticeRead.php
Normal file
35
app/admin/controller/operation/UserNoticeRead.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\operation;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use support\Response;
|
||||
use Webman\Http\Request as WebmanRequest;
|
||||
|
||||
/**
|
||||
* 用户公告阅读记录
|
||||
*/
|
||||
class UserNoticeRead extends Backend
|
||||
{
|
||||
protected ?object $model = null;
|
||||
|
||||
protected string|array $preExcludeFields = ['id', 'create_time'];
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'user_id', 'notice_id'];
|
||||
|
||||
protected string|array $defaultSortField = ['id' => 'desc'];
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||
|
||||
protected array $withJoinTable = ['user', 'operationNotice'];
|
||||
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
$this->model = new \app\common\model\UserNoticeRead();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,9 @@ class DepositOrder extends Backend
|
||||
{
|
||||
protected ?object $model = null;
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'order_no', 'pay_channel', 'remark'];
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ class WithdrawOrder extends Backend
|
||||
{
|
||||
protected ?object $model = null;
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
protected bool $modelValidate = true;
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'order_no', 'remark'];
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@ class User extends Backend
|
||||
|
||||
protected array $withJoinTable = ['channel', 'admin'];
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'username', 'phone', 'email', 'register_invite_code'];
|
||||
protected string|array $quickSearchField = ['id', 'username', 'phone'];
|
||||
|
||||
protected bool $modelSceneValidate = true;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
|
||||
40
app/common/model/OperationNotice.php
Normal file
40
app/common/model/OperationNotice.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use support\think\Model;
|
||||
|
||||
class OperationNotice extends Model
|
||||
{
|
||||
protected $name = 'operation_notice';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
protected $type = [
|
||||
'create_time' => 'integer',
|
||||
'update_time' => 'integer',
|
||||
'publish_at' => 'integer',
|
||||
'notice_type' => 'integer',
|
||||
'status' => 'integer',
|
||||
];
|
||||
|
||||
public function setPublishAtAttr($value)
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return 0;
|
||||
}
|
||||
if (is_int($value)) {
|
||||
return $value;
|
||||
}
|
||||
if (is_string($value)) {
|
||||
if (ctype_digit($value)) {
|
||||
return (int) $value;
|
||||
}
|
||||
$ts = strtotime($value);
|
||||
if ($ts !== false) {
|
||||
return $ts;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
28
app/common/model/UserNoticeRead.php
Normal file
28
app/common/model/UserNoticeRead.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use support\think\Model;
|
||||
|
||||
class UserNoticeRead extends Model
|
||||
{
|
||||
protected $name = 'user_notice_read';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
protected $type = [
|
||||
'create_time' => 'integer',
|
||||
'read_at' => 'integer',
|
||||
'confirmed' => 'integer',
|
||||
];
|
||||
|
||||
public function user(): \think\model\relation\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function operationNotice(): \think\model\relation\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(OperationNotice::class, 'notice_id', 'id');
|
||||
}
|
||||
}
|
||||
28
app/common/validate/AgentCommissionRecord.php
Normal file
28
app/common/validate/AgentCommissionRecord.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AgentCommissionRecord extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'settlement_period_id' => 'require|integer|gt:0',
|
||||
'channel_id' => 'require|integer|gt:0',
|
||||
'admin_id' => 'require|integer|gt:0',
|
||||
'commission_rate' => 'require|float|egt:0',
|
||||
'calc_base_amount' => 'require|float',
|
||||
'commission_amount' => 'require|float',
|
||||
'status' => 'in:0,1,2',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['settlement_period_id', 'channel_id', 'admin_id', 'commission_rate', 'calc_base_amount', 'commission_amount', 'status', 'remark'],
|
||||
'edit' => ['commission_rate', 'calc_base_amount', 'commission_amount', 'status', 'remark'],
|
||||
];
|
||||
}
|
||||
25
app/common/validate/AgentSettlementPeriod.php
Normal file
25
app/common/validate/AgentSettlementPeriod.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AgentSettlementPeriod extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'settlement_no' => 'require|max:64|unique:agent_settlement_period',
|
||||
'period_start_at' => 'require|integer|egt:0',
|
||||
'period_end_at' => 'require|integer|egt:0',
|
||||
'status' => 'in:0,1,2',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['settlement_no', 'period_start_at', 'period_end_at', 'status', 'remark'],
|
||||
'edit' => ['period_start_at', 'period_end_at', 'status', 'remark'],
|
||||
];
|
||||
}
|
||||
26
app/common/validate/Channel.php
Normal file
26
app/common/validate/Channel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Channel extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'code' => 'require|max:255|unique:channel',
|
||||
'name' => 'require|max:255',
|
||||
'agent_mode' => 'require|in:turnover,affiliate',
|
||||
'status' => 'in:0,1',
|
||||
'admin_id' => 'require|integer|gt:0',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['code', 'name', 'agent_mode', 'status', 'admin_id', 'remark'],
|
||||
'edit' => ['name', 'agent_mode', 'status', 'admin_id', 'remark'],
|
||||
];
|
||||
}
|
||||
23
app/common/validate/DepositOrder.php
Normal file
23
app/common/validate/DepositOrder.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class DepositOrder extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'order_no' => 'require|max:64|unique:deposit_order',
|
||||
'user_id' => 'require|integer|gt:0',
|
||||
'status' => 'require|in:0,1,2,3',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['order_no', 'user_id', 'status'],
|
||||
'edit' => ['status'],
|
||||
];
|
||||
}
|
||||
23
app/common/validate/GameConfig.php
Normal file
23
app/common/validate/GameConfig.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GameConfig extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'config_key' => 'require|max:64|unique:game_config',
|
||||
'value_type' => 'require|in:string,int,decimal,json',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['config_key', 'value_type', 'remark'],
|
||||
'edit' => ['value_type', 'remark'],
|
||||
];
|
||||
}
|
||||
26
app/common/validate/GamePeriod.php
Normal file
26
app/common/validate/GamePeriod.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GamePeriod extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'period_no' => 'require|max:64|unique:game_period',
|
||||
'period_start_at' => 'integer',
|
||||
'status' => 'require|in:0,1,2,3,4,5',
|
||||
'draw_mode' => 'in:0,1',
|
||||
'preset_number' => 'between:1,36',
|
||||
'result_number' => 'between:1,36',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['period_no', 'period_start_at', 'status', 'draw_mode', 'preset_number', 'result_number'],
|
||||
'edit' => ['period_start_at', 'status', 'draw_mode', 'preset_number', 'result_number'],
|
||||
];
|
||||
}
|
||||
41
app/common/validate/OperationNotice.php
Normal file
41
app/common/validate/OperationNotice.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class OperationNotice extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|max:255',
|
||||
'notice_type' => 'require|in:0,1',
|
||||
'status' => 'require|in:0,1',
|
||||
'publish_at' => 'require|checkPublishAt',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'notice_type', 'status', 'publish_at'],
|
||||
'edit' => ['title', 'notice_type', 'status', 'publish_at'],
|
||||
];
|
||||
|
||||
protected function checkPublishAt($value): bool
|
||||
{
|
||||
if (is_int($value)) {
|
||||
return $value >= 0;
|
||||
}
|
||||
if (is_string($value)) {
|
||||
if ($value === '') {
|
||||
return false;
|
||||
}
|
||||
if (ctype_digit($value)) {
|
||||
return true;
|
||||
}
|
||||
return strtotime($value) !== false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
32
app/common/validate/User.php
Normal file
32
app/common/validate/User.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class User extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'username' => 'require|max:255',
|
||||
'password' => 'require|min:6|max:255',
|
||||
'phone' => 'max:32',
|
||||
'email' => 'email',
|
||||
'channel_id' => 'require|integer|gt:0',
|
||||
'status' => 'in:0,1',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['username', 'password', 'phone', 'email', 'channel_id', 'status'],
|
||||
'edit' => ['username', 'password', 'phone', 'email', 'channel_id', 'status'],
|
||||
];
|
||||
|
||||
public function sceneEdit(): static
|
||||
{
|
||||
return $this->only(['username', 'password', 'phone', 'email', 'channel_id', 'status'])
|
||||
->remove('password', 'require');
|
||||
}
|
||||
}
|
||||
24
app/common/validate/UserNoticeRead.php
Normal file
24
app/common/validate/UserNoticeRead.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class UserNoticeRead extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'user_id' => 'require|integer|gt:0',
|
||||
'notice_id' => 'require|integer|gt:0',
|
||||
'confirmed' => 'in:0,1',
|
||||
'read_at' => 'integer',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['user_id', 'notice_id', 'confirmed', 'read_at'],
|
||||
'edit' => ['user_id', 'notice_id', 'confirmed', 'read_at'],
|
||||
];
|
||||
}
|
||||
25
app/common/validate/WithdrawOrder.php
Normal file
25
app/common/validate/WithdrawOrder.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class WithdrawOrder extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'order_no' => 'require|max:64|unique:withdraw_order',
|
||||
'user_id' => 'require|integer|gt:0',
|
||||
'amount' => 'float|egt:0',
|
||||
'status' => 'require|in:0,1,2,3',
|
||||
'remark' => 'max:255',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['order_no', 'user_id', 'amount', 'status', 'remark'],
|
||||
'edit' => ['amount', 'status', 'remark'],
|
||||
];
|
||||
}
|
||||
15
web/src/lang/backend/en/operation/operationNotice.ts
Normal file
15
web/src/lang/backend/en/operation/operationNotice.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
'quick Search Fields': 'ID/Title',
|
||||
id: 'ID',
|
||||
title: 'Title',
|
||||
content: 'Content',
|
||||
notice_type: 'Notice type',
|
||||
'notice_type 0': 'Inbox (silent)',
|
||||
'notice_type 1': 'Pop-up',
|
||||
status: 'Status',
|
||||
'status 0': 'Draft',
|
||||
'status 1': 'Published',
|
||||
publish_at: 'Publish time',
|
||||
create_time: 'Created',
|
||||
update_time: 'Updated',
|
||||
}
|
||||
13
web/src/lang/backend/en/operation/userNoticeRead.ts
Normal file
13
web/src/lang/backend/en/operation/userNoticeRead.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export default {
|
||||
'quick Search Fields': 'ID/User ID/Notice ID',
|
||||
id: 'ID',
|
||||
user_id: 'User',
|
||||
notice_id: 'Notice',
|
||||
notice_title: 'Notice title',
|
||||
username: 'Username',
|
||||
read_at: 'Read at',
|
||||
confirmed: 'Confirmed',
|
||||
'confirmed 0': 'No',
|
||||
'confirmed 1': 'Yes',
|
||||
create_time: 'Created',
|
||||
}
|
||||
15
web/src/lang/backend/zh-cn/operation/operationNotice.ts
Normal file
15
web/src/lang/backend/zh-cn/operation/operationNotice.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
'quick Search Fields': 'ID/标题',
|
||||
id: 'ID',
|
||||
title: '标题',
|
||||
content: '正文',
|
||||
notice_type: '公告类型',
|
||||
'notice_type 0': '静默信箱',
|
||||
'notice_type 1': '强弹窗',
|
||||
status: '状态',
|
||||
'status 0': '草稿',
|
||||
'status 1': '发布',
|
||||
publish_at: '发布时间',
|
||||
create_time: '创建时间',
|
||||
update_time: '更新时间',
|
||||
}
|
||||
13
web/src/lang/backend/zh-cn/operation/userNoticeRead.ts
Normal file
13
web/src/lang/backend/zh-cn/operation/userNoticeRead.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export default {
|
||||
'quick Search Fields': 'ID/用户ID/公告ID',
|
||||
id: 'ID',
|
||||
user_id: '用户',
|
||||
notice_id: '公告',
|
||||
notice_title: '公告标题',
|
||||
username: '用户名',
|
||||
read_at: '阅读时间',
|
||||
confirmed: '已确认',
|
||||
'confirmed 0': '未确认',
|
||||
'confirmed 1': '已确认',
|
||||
create_time: '创建时间',
|
||||
}
|
||||
130
web/src/views/backend/operation/operationNotice/index.vue
Normal file
130
web/src/views/backend/operation/operationNotice/index.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="default-main ba-table-box">
|
||||
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||
|
||||
<TableHeader
|
||||
:buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||
:quick-search-placeholder="t('Quick search placeholder', { fields: t('operation.operationNotice.quick Search Fields') })"
|
||||
></TableHeader>
|
||||
|
||||
<Table ref="tableRef"></Table>
|
||||
<PopupForm />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import PopupForm from './popupForm.vue'
|
||||
import { baTableApi } from '/@/api/common'
|
||||
import { defaultOptButtons } from '/@/components/table'
|
||||
import TableHeader from '/@/components/table/header/index.vue'
|
||||
import Table from '/@/components/table/index.vue'
|
||||
import baTableClass from '/@/utils/baTable'
|
||||
|
||||
defineOptions({
|
||||
name: 'operation/operationNotice',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const tableRef = useTemplateRef('tableRef')
|
||||
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete'])
|
||||
|
||||
const baTable = new baTableClass(
|
||||
new baTableApi('/admin/operation.OperationNotice/'),
|
||||
{
|
||||
pk: 'id',
|
||||
column: [
|
||||
{ type: 'selection', align: 'center', operator: false },
|
||||
{ label: t('operation.operationNotice.id'), prop: 'id', align: 'center', width: 80, operator: 'RANGE', sortable: 'custom' },
|
||||
{
|
||||
label: t('operation.operationNotice.title'),
|
||||
prop: 'title',
|
||||
align: 'center',
|
||||
minWidth: 200,
|
||||
operator: 'LIKE',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
label: t('operation.operationNotice.notice_type'),
|
||||
prop: 'notice_type',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
operator: 'eq',
|
||||
render: 'tag',
|
||||
effect: 'dark',
|
||||
custom: { 0: 'info', 1: 'warning' },
|
||||
replaceValue: {
|
||||
'0': t('operation.operationNotice.notice_type 0'),
|
||||
'1': t('operation.operationNotice.notice_type 1'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('operation.operationNotice.status'),
|
||||
prop: 'status',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
operator: 'eq',
|
||||
render: 'tag',
|
||||
effect: 'dark',
|
||||
custom: { 0: 'info', 1: 'success' },
|
||||
replaceValue: {
|
||||
'0': t('operation.operationNotice.status 0'),
|
||||
'1': t('operation.operationNotice.status 1'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('operation.operationNotice.publish_at'),
|
||||
prop: 'publish_at',
|
||||
align: 'center',
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
width: 170,
|
||||
sortable: 'custom',
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{
|
||||
label: t('operation.operationNotice.create_time'),
|
||||
prop: 'create_time',
|
||||
align: 'center',
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
width: 170,
|
||||
sortable: 'custom',
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{
|
||||
label: t('operation.operationNotice.update_time'),
|
||||
prop: 'update_time',
|
||||
align: 'center',
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
width: 170,
|
||||
sortable: 'custom',
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{ label: t('Operate'), align: 'center', minWidth: 80, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
|
||||
],
|
||||
},
|
||||
{
|
||||
defaultItems: { status: 0, notice_type: 0 },
|
||||
}
|
||||
)
|
||||
|
||||
provide('baTable', baTable)
|
||||
|
||||
onMounted(() => {
|
||||
baTable.table.ref = tableRef.value
|
||||
baTable.mount()
|
||||
baTable.getData()?.then(() => {
|
||||
baTable.initSort()
|
||||
baTable.dragSort()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<el-dialog class="ba-operate-dialog" :close-on-click-modal="false" :model-value="['Add', 'Edit'].includes(baTable.form.operate!)" @close="baTable.toggleForm">
|
||||
<template #header>
|
||||
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">{{ baTable.form.operate ? t(baTable.form.operate) : '' }}</div>
|
||||
</template>
|
||||
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
|
||||
<div class="ba-operate-form" :class="'ba-' + baTable.form.operate + '-form'" :style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'">
|
||||
<el-form v-if="!baTable.form.loading" ref="formRef" @submit.prevent="" @keyup.enter="baTable.onSubmit(formRef)" :model="baTable.form.items" :label-position="config.layout.shrink ? 'top' : 'right'" :label-width="baTable.form.labelWidth + 'px'" :rules="rules">
|
||||
<FormItem :label="t('operation.operationNotice.title')" type="string" v-model="baTable.form.items!.title" prop="title" />
|
||||
<FormItem :label="t('operation.operationNotice.content')" type="textarea" v-model="baTable.form.items!.content" prop="content" :input-attr="{ rows: 8 }" />
|
||||
<FormItem
|
||||
:label="t('operation.operationNotice.notice_type')"
|
||||
type="radio"
|
||||
v-model="baTable.form.items!.notice_type"
|
||||
prop="notice_type"
|
||||
:input-attr="{ content: { '0': t('operation.operationNotice.notice_type 0'), '1': t('operation.operationNotice.notice_type 1') } }"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('operation.operationNotice.status')"
|
||||
type="radio"
|
||||
v-model="baTable.form.items!.status"
|
||||
prop="status"
|
||||
:input-attr="{ content: { '0': t('operation.operationNotice.status 0'), '1': t('operation.operationNotice.status 1') } }"
|
||||
/>
|
||||
<FormItem :label="t('operation.operationNotice.publish_at')" type="datetime" v-model="baTable.form.items!.publish_at" prop="publish_at" />
|
||||
</el-form>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
|
||||
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
|
||||
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { FormItemRule } from 'element-plus'
|
||||
import { inject, reactive, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import FormItem from '/@/components/formItem/index.vue'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import type baTableClass from '/@/utils/baTable'
|
||||
|
||||
const config = useConfig()
|
||||
const formRef = useTemplateRef('formRef')
|
||||
const baTable = inject('baTable') as baTableClass
|
||||
const { t } = useI18n()
|
||||
|
||||
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||
title: [{ required: true, message: t('Please input field', { field: t('operation.operationNotice.title') }) }],
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
116
web/src/views/backend/operation/userNoticeRead/index.vue
Normal file
116
web/src/views/backend/operation/userNoticeRead/index.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="default-main ba-table-box">
|
||||
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||
|
||||
<TableHeader
|
||||
:buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||
:quick-search-placeholder="t('Quick search placeholder', { fields: t('operation.userNoticeRead.quick Search Fields') })"
|
||||
></TableHeader>
|
||||
|
||||
<Table ref="tableRef"></Table>
|
||||
<PopupForm />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import PopupForm from './popupForm.vue'
|
||||
import { baTableApi } from '/@/api/common'
|
||||
import { defaultOptButtons } from '/@/components/table'
|
||||
import TableHeader from '/@/components/table/header/index.vue'
|
||||
import Table from '/@/components/table/index.vue'
|
||||
import baTableClass from '/@/utils/baTable'
|
||||
|
||||
defineOptions({
|
||||
name: 'operation/userNoticeRead',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const tableRef = useTemplateRef('tableRef')
|
||||
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete'])
|
||||
|
||||
const baTable = new baTableClass(
|
||||
new baTableApi('/admin/operation.UserNoticeRead/'),
|
||||
{
|
||||
pk: 'id',
|
||||
column: [
|
||||
{ type: 'selection', align: 'center', operator: false },
|
||||
{ label: t('operation.userNoticeRead.id'), prop: 'id', align: 'center', width: 100, operator: 'RANGE', sortable: 'custom' },
|
||||
{ label: t('operation.userNoticeRead.user_id'), prop: 'user_id', align: 'center', width: 100, operator: 'RANGE', show: false },
|
||||
{
|
||||
label: t('operation.userNoticeRead.username'),
|
||||
prop: 'user.username',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
operator: 'LIKE',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
render: 'tags',
|
||||
},
|
||||
{ label: t('operation.userNoticeRead.notice_id'), prop: 'notice_id', align: 'center', width: 100, operator: 'RANGE', show: false },
|
||||
{
|
||||
label: t('operation.userNoticeRead.notice_title'),
|
||||
prop: 'operationNotice.title',
|
||||
align: 'center',
|
||||
minWidth: 180,
|
||||
operator: 'LIKE',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
render: 'tags',
|
||||
},
|
||||
{
|
||||
label: t('operation.userNoticeRead.read_at'),
|
||||
prop: 'read_at',
|
||||
align: 'center',
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
width: 170,
|
||||
sortable: 'custom',
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{
|
||||
label: t('operation.userNoticeRead.confirmed'),
|
||||
prop: 'confirmed',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
operator: 'eq',
|
||||
render: 'tag',
|
||||
effect: 'dark',
|
||||
custom: { 0: 'info', 1: 'success' },
|
||||
replaceValue: {
|
||||
'0': t('operation.userNoticeRead.confirmed 0'),
|
||||
'1': t('operation.userNoticeRead.confirmed 1'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('operation.userNoticeRead.create_time'),
|
||||
prop: 'create_time',
|
||||
align: 'center',
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
width: 170,
|
||||
sortable: 'custom',
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{ label: t('Operate'), align: 'center', minWidth: 80, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
|
||||
],
|
||||
},
|
||||
{
|
||||
defaultItems: { confirmed: 0 },
|
||||
}
|
||||
)
|
||||
|
||||
provide('baTable', baTable)
|
||||
|
||||
onMounted(() => {
|
||||
baTable.table.ref = tableRef.value
|
||||
baTable.mount()
|
||||
baTable.getData()?.then(() => {
|
||||
baTable.initSort()
|
||||
baTable.dragSort()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
74
web/src/views/backend/operation/userNoticeRead/popupForm.vue
Normal file
74
web/src/views/backend/operation/userNoticeRead/popupForm.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<el-dialog class="ba-operate-dialog" :close-on-click-modal="false" :model-value="['Add', 'Edit'].includes(baTable.form.operate!)" @close="baTable.toggleForm">
|
||||
<template #header>
|
||||
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">{{ baTable.form.operate ? t(baTable.form.operate) : '' }}</div>
|
||||
</template>
|
||||
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
|
||||
<div class="ba-operate-form" :class="'ba-' + baTable.form.operate + '-form'" :style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'">
|
||||
<el-form v-if="!baTable.form.loading" ref="formRef" @submit.prevent="" @keyup.enter="baTable.onSubmit(formRef)" :model="baTable.form.items" :label-position="config.layout.shrink ? 'top' : 'right'" :label-width="baTable.form.labelWidth + 'px'" :rules="rules">
|
||||
<FormItem
|
||||
:label="t('operation.userNoticeRead.user_id')"
|
||||
type="remoteSelect"
|
||||
v-model="baTable.form.items!.user_id"
|
||||
prop="user_id"
|
||||
:key="'uid-' + (baTable.form.items!.id ?? 'new')"
|
||||
:input-attr="{
|
||||
pk: 'id',
|
||||
field: 'username',
|
||||
remoteUrl: '/admin/user.User/index',
|
||||
placeholder: t('Click select'),
|
||||
}"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('operation.userNoticeRead.notice_id')"
|
||||
type="remoteSelect"
|
||||
v-model="baTable.form.items!.notice_id"
|
||||
prop="notice_id"
|
||||
:key="'nid-' + (baTable.form.items!.id ?? 'new')"
|
||||
:input-attr="{
|
||||
pk: 'id',
|
||||
field: 'title',
|
||||
remoteUrl: '/admin/operation.OperationNotice/index',
|
||||
placeholder: t('Click select'),
|
||||
}"
|
||||
/>
|
||||
<FormItem :label="t('operation.userNoticeRead.read_at')" type="datetime" v-model="baTable.form.items!.read_at" prop="read_at" />
|
||||
<FormItem
|
||||
:label="t('operation.userNoticeRead.confirmed')"
|
||||
type="radio"
|
||||
v-model="baTable.form.items!.confirmed"
|
||||
prop="confirmed"
|
||||
:input-attr="{ content: { '0': t('operation.userNoticeRead.confirmed 0'), '1': t('operation.userNoticeRead.confirmed 1') } }"
|
||||
/>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
|
||||
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
|
||||
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { FormItemRule } from 'element-plus'
|
||||
import { inject, reactive, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import FormItem from '/@/components/formItem/index.vue'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import type baTableClass from '/@/utils/baTable'
|
||||
|
||||
const config = useConfig()
|
||||
const formRef = useTemplateRef('formRef')
|
||||
const baTable = inject('baTable') as baTableClass
|
||||
const { t } = useI18n()
|
||||
|
||||
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||
user_id: [{ required: true, message: t('Please input field', { field: t('operation.userNoticeRead.user_id') }) }],
|
||||
notice_id: [{ required: true, message: t('Please input field', { field: t('operation.userNoticeRead.notice_id') }) }],
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
Reference in New Issue
Block a user