省市級聯 資料庫 基礎資料表

2021-08-20 07:54:25 字數 2230 閱讀 8912

table: area_base

字段資訊

field

type

comment

area_code

varchar(32)

地區碼parent_area_code

varchar(32)

父地區碼

area_name

varchar(128)

地區名稱

area_type

tinyint(2)

地區型別:0--無 1--省級地區 2--市級地區 3--縣級地區

create_time

timestamp

建立時間

索引資訊

indexes

columns

index_type

primary

area_code

unique

ddl資訊

create table

create table `area_base` (

`area_code` varchar(32) not null comment '地區碼',

`parent_area_code` varchar(32) default null comment '父地區碼',

`area_name` varchar(128) not null comment '地區名稱',

`area_type` tinyint(2) not null default '0' comment '地區型別:0--無 1--省級地區 2--市級地區 3--縣級地區',

`create_time` timestamp not null default '0000-00-00 00:00:00' comment '建立時間',

primary key (`area_code`)

) engine=innodb default charset=utf8

初始化基礎資料 :

insert into `area_base` 

(`area_code`, `parent_area_code`, `area_name`, `area_type`, `create_time`) 

values 

('1001', null, '河南省', '1', '0000-00-00 00:00:00'),

('2001', '1001', '鄭州市', '2', '0000-00-00 00:00:00'),

('2002', '1001', '洛陽市', '2', '0000-00-00 00:00:00'),

('2003', '1001', '開封市', '2', '0000-00-00 00:00:00'),

('2004', '1001', '商丘市', '2', '0000-00-00 00:00:00'),

('2005', '1001', '許昌市', '2', '0000-00-00 00:00:00'),

('3001', '2001', '金水區', '3', '0000-00-00 00:00:00'),

('3002', '2001', '惠濟區', '3', '0000-00-00 00:00:00'),

('3003', '2001', '二七區', '3', '0000-00-00 00:00:00')

省級地區

--請選擇--

河南省市級地區

--請選擇--

鄭州市洛陽市

開封市商丘市

許昌市縣級地區

--請選擇--

金水區惠濟區

二七區利用ajax實現級聯操作:

處理市級顯示:

$("#province").change(function()

$.ajax(,

datatype:"json",

success:function(data)                        

//處理返回的資料   塞進  $("#city")裡

},error:function(data)

});處理縣級顯示:  同理市級……

Element UI 省市區級聯資料

前端工作過程中難免會要用到選擇位址的時候,除了從後台獲取特定地區資料的情況外,一般都是全國的省市區提供給使用者選擇,element ui 提供了乙個很好的外掛程式。element ui 中國省市區級聯資料 1.安裝 使用 npm npm install element china area data...

Element UI 中國省市區級聯資料

npm install element china area data s位址在此,網頁開啟會比較慢 import from element china area data provinceandcitydata是省市二級聯動資料 不帶 全部 選項 regiondata是省市區 聯動資料 不帶 全部...

MySQL 資料庫 資料表

1 檢視原始資料庫information schema中的表,並顯示出views表的字段結構屬性資訊 第一步 檢視所有的資料庫 show databases 如圖一 第二步 檢視information schema 內容 如圖二 第三步 檢視views 結構 如圖三 2 建立乙個offcn資料庫,並...