Skip to content

Commit

Permalink
[fix]增加数据字典文件 && 修改数据提交方式
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Nov 20, 2018
1 parent 5ffc084 commit 7cb0799
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ $form->distpicker(['province_id', 'city_id', 'district_id'])->autoselect(1);

```

表单提交的时候,默认是使用`地域名称`作为表单值提交,如果你要提交`地域编码`,使用下面的方法:
```php
$form->distpicker(['province_id', 'city_id', 'district_id'])->attribute('data-value-type', 'code');
```

## 地区编码数据

[Distpicker](https://github.com/fengyuanchen/distpicker)所使用的地域编码是基于国家统计局发布的数据, 数据字典可以在https://github.com/eduosi/district 下载到
[Distpicker](https://github.com/fengyuanchen/distpicker)所使用的地域编码是基于国家统计局发布的数据, 数据字典为`china_area.sql`文件.

## 支持

Expand Down
55 changes: 55 additions & 0 deletions china_area.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/views/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="{{$viewClass['field']}} form-inline">

@include('admin::form.error')
<div id="{{ $id }}" {!! $attributes !!} data-value-type="code">
<div id="{{ $id }}" {!! $attributes !!}>
<select class="form-control" name="{{$name['province']}}"></select>
<select class="form-control" name="{{$name['city']}}"></select>
<select class="form-control" name="{{$name['district']}}"></select>
Expand Down

0 comments on commit 7cb0799

Please # to comment.