招标
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

132 lines
4.4 KiB

<?php
/**
* Member.php
* Date: 2020-12-21 09:45:13
* User: chenlong <vip_chenlong@163.com>
*/
namespace app\admin\page;
use app\common\BasePage;
use sdModule\layui\Layui;
use sdModule\layui\TablePage;
use sdModule\layui\tablePage\TableAux;
use sdModule\layuiSearch\Form;
use sdModule\layui\defaultForm\FormData;
use app\admin\model\Member as MyModel;
use sdModule\layuiSearch\SearchForm;
use sdModule\layuiSearch\generate\TimeRange;
/**
* Class Member
* @package app\admin\page
*/
class Member extends BasePage
{
/**
* 获取创建列表table的数据
* @return TablePage
*/
public string $list_template = 'common/list_page_edit';
public function getTablePageData(): TablePage
{
$table = TablePage::create([
TablePage::column(['type' => 'checkbox']),
TableAux::column('id', 'ID','',['width'=>80]),
TableAux::column('username', '姓名'),
TableAux::column('mobile', '手机号'),
TableAux::column('avatar', '头像', '@image'),
TableAux::column('email', '邮箱'),
TableAux::column('company', '公司名称'),
TableAux::column('position', '职务'),
TableAux::column('status_edit', '登录状态',function (){
return <<<JS
return '<input type="checkbox" '+(obj.status_edit== 1 ? 'checked':'')+' data-id="'+(obj.id)+'" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">';
JS;
},['width'=>100]),
TableAux::column('is_tender', '投标状态',function (){
return <<<JS
return '<input type="checkbox" '+(obj.is_tender== 1 ? 'checked':'')+' data-id="'+(obj.id)+'" lay-skin="switch" lay-filter="is_tender" lay-text="ON|OFF">';
JS;
},['width'=>100]),
TableAux::column('create_time', '创建时间'),
]);
//重置密码
$table->addEvent('resetPassword');
$table->setEventHtml('resetPassword',Layui::button('重置密码','ii')->setEvent('resetPassword')->setBtnClass('xs')->warm());
$table->setEventJs('resetPassword',TableAux::ajax(url('resetPassword'),'get','您确认重置该用户登录密码?重置过后登录密码:123456,请牢记登录密码'));
//导入
$table->addBarEvent('Import');
$table->setBarEventHtml('Import',Layui::button('导入会员','ii')->setEvent('Import')->setBtnClass('sm'));
$table->setBarEventJs('Import',TableAux::openPage(url('member/importForm'), '导入会员'));
$table->setHandleWidth(250);
return $table;
}
/**
* 生成表单的数据
* @return array
*/
public function formData(): array
{
return [
FormData::hidden('id'),
FormData::text('username', '姓名'),
FormData::text('mobile', '手机号'),
FormData::image('avatar', '头像'),
FormData::text('email', '邮箱'),
FormData::text('company', '公司名称'),
FormData::text('position', '职务'),
FormData::radio('is_tender', '投标状态', MyModel::getStatusSc(false))->preset(1),
FormData::radio('status', '登录状态', MyModel::getStatusSc(false))->preset(1),
];
}
/**
* 导入会员
* @return array
*/
public function importForm(): array
{
return [
FormData::upload('file', '上传文件','excel'),
];
}
/**
* 列表页面的名字
* @return string
*/
public function listPageName(): string
{
return "会员管理";
}
/**
* 创建搜索表单的数据
* @return string
*/
public function searchFormData():string
{
$form_data = [
SearchForm::Text('i.username%%', "姓名")->label(true)->html(),
SearchForm::Text('i.mobile', "手机号")->label(true)->html(),
SearchForm::Text('i.email%%', "邮箱")->label(true)->html(),
SearchForm::Text('i.company%%', "公司名称")->label(true)->html(),
SearchForm::Select('i.status', "状态")->label(true)->html(MyModel::getStatusSc(false)),
SearchForm::TimeRange("i.create_time_~", "注册时间")->label(true)->html(TimeRange::TYPE_DATETIME),
];
return Form::CreateHTML($form_data);
}
/**
* @return array 设置快捷搜索
*/
public function setQuickSearchField():array
{
return [
];
}
}