新增csv导出选择
parent
1c9ff5e568
commit
5661fcf8de
|
|
@ -51,6 +51,7 @@ class Config extends Common
|
||||||
{
|
{
|
||||||
// 静态数据
|
// 静态数据
|
||||||
MyViewAssign('common_excel_charset_list', MyConst('common_excel_charset_list'));
|
MyViewAssign('common_excel_charset_list', MyConst('common_excel_charset_list'));
|
||||||
|
MyViewAssign('common_excel_export_type_list', MyConst('common_excel_export_type_list'));
|
||||||
MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list'));
|
MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list'));
|
||||||
MyViewAssign('common_login_type_list', MyConst('common_login_type_list'));
|
MyViewAssign('common_login_type_list', MyConst('common_login_type_list'));
|
||||||
MyViewAssign('common_close_open_list', MyConst('common_close_open_list'));
|
MyViewAssign('common_close_open_list', MyConst('common_close_open_list'));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,14 @@
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="am-form-group">
|
||||||
|
<label>{{$data.common_excel_export_type.name}}<span class="am-form-group-label-tips">{{$data.common_excel_export_type.describe}}</span></label>
|
||||||
|
<select name="{{$data.common_excel_export_type.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.common_excel_export_type.error_tips}}" required>
|
||||||
|
{{foreach $common_excel_export_type_list as $v}}
|
||||||
|
<option value="{{$v.id}}" {{if isset($data['common_excel_export_type']['value']) and $data['common_excel_export_type']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
|
||||||
|
{{/foreach}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="am-form-group">
|
<div class="am-form-group">
|
||||||
<label>{{$data.common_page_size.name}}<span class="am-form-group-label-tips">{{$data.common_page_size.describe}}</span></label>
|
<label>{{$data.common_page_size.name}}<span class="am-form-group-label-tips">{{$data.common_page_size.describe}}</span></label>
|
||||||
<input type="number" name="{{$data.common_page_size.only_tag}}" placeholder="{{$data.common_page_size.name}}" pattern="{{:MyConst('common_regex_page_number')}}" data-validation-message="{{$data.common_page_size.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_page_size.value}}"{{/if}} required />
|
<input type="number" name="{{$data.common_page_size.only_tag}}" placeholder="{{$data.common_page_size.name}}" pattern="{{:MyConst('common_regex_page_number')}}" data-validation-message="{{$data.common_page_size.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_page_size.value}}"{{/if}} required />
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class ConstService
|
||||||
],
|
],
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
'common_state_list' => [
|
'common_state_list' => [
|
||||||
0 => ['id' => 0, 'name' => '不可用'],
|
0 => ['id' => 0, 'name' => '不可用'],
|
||||||
1 => ['id' => 1, 'name' => '可用', 'checked' => true],
|
1 => ['id' => 1, 'name' => '可用', 'checked' => true],
|
||||||
],
|
],
|
||||||
|
|
@ -151,6 +151,12 @@ class ConstService
|
||||||
1 => ['id' => 1, 'value' => 'gbk', 'name' => 'gbk'],
|
1 => ['id' => 1, 'value' => 'gbk', 'name' => 'gbk'],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// excel导出类型列表
|
||||||
|
'common_excel_export_type_list' => [
|
||||||
|
0 => ['id' => 0, 'name' => 'CSV', 'checked' => true],
|
||||||
|
1 => ['id' => 1, 'name' => 'Excel'],
|
||||||
|
],
|
||||||
|
|
||||||
// 支付支付状态
|
// 支付支付状态
|
||||||
'common_order_pay_status' => [
|
'common_order_pay_status' => [
|
||||||
0 => ['id' => 0, 'name' => '待支付', 'checked' => true],
|
0 => ['id' => 0, 'name' => '待支付', 'checked' => true],
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,34 @@ class Excel
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出CSV文件
|
* 文件导出
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 0.0.1
|
||||||
|
* @datetime 2017-01-10T15:12:01+0800
|
||||||
|
*/
|
||||||
|
public function Export()
|
||||||
|
{
|
||||||
|
// 是否有数据
|
||||||
|
if(empty($this->title) && empty($this->data))
|
||||||
|
{
|
||||||
|
echo '<script>alert("'.$this->msg.'");</script>';
|
||||||
|
echo '<script>window.location.href="'.$this->jump_url.'"</script>';
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出类型
|
||||||
|
$export_type = MyC('common_excel_export_type', 0, true);
|
||||||
|
if($export_type == 0)
|
||||||
|
{
|
||||||
|
$this->ExportCsv();
|
||||||
|
} else {
|
||||||
|
$this->ExportExcel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* csv导出文件
|
||||||
* @author Devil
|
* @author Devil
|
||||||
* @blog http://gong.gg/
|
* @blog http://gong.gg/
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
|
|
@ -167,7 +194,7 @@ class Excel
|
||||||
* @version 0.0.1
|
* @version 0.0.1
|
||||||
* @datetime 2017-01-10T15:12:01+0800
|
* @datetime 2017-01-10T15:12:01+0800
|
||||||
*/
|
*/
|
||||||
public function Export()
|
public function ExportExcel()
|
||||||
{
|
{
|
||||||
// 是否有数据
|
// 是否有数据
|
||||||
if(empty($this->title) && empty($this->data))
|
if(empty($this->title) && empty($this->data))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue