jq插件 jquery-weui select
php phpExcel
php代码:
function get_xw_xk_zd(code){//硕士
path_excel=WWW.'upload/'.PHPReader = new PHPExcel_Reader_Excel2007();;
if(!path_excel)){
PHPReader->canRead(PHPExcel = path_excel);
/读取excel文件中的第一个工作表/
PHPExcel->getSheet(0);
/取得最大的列号/
currentSheet->getHighestColumn();
/*取得一共有多少行/
currentSheet->getHighestRow();
colIndex='A';allColumn;addr = cell = addr)->getValue();
if(cell = bzzd[cell){
error){
background_output(['state'=>'false','msg'=>'解析失败']);
}else{
doctorate_one=[];
doctorate_two_relavite__all=[];
rowIndex=2;allRow;colIndex='A';allColumn;addr = rowIndex;
currentSheet->getCell(cell instanceof PHPExcel_RichText) {
//富文本转换字符串
cell->__toString();
}
//拼接sql
if(a=colIndex=='B'){
cell;
}elseif(c=colIndex=='D'){
cell;
}elseif(e=colIndex=='F'){
cell;
}
}
$doctorate[$e]=[
'name'=>$d,
'code'=>$e,
'type'=>$b,
'parent_number'=>$f,
];
$xk_type=[
'title'=>$b,
'value'=>$a,
];
if(!in_array($xk_type,$xk_type_all)){
array_push($xk_type_all,$xk_type);
}
if($f==0&&$a==$type_code){
$doctorate_one=[
'title'=>$d,
'value'=>$e,
];
array_push($doctorate_one_all,$doctorate_one);
}
if($f>0&&$f<103){
$doctorate_two[$c]=$d;
if($code&&$f==$code){
$doctorate_two_relavite=[
'title'=>$d,
'value'=>$e,
];
array_push($doctorate_two_relavite__all,$doctorate_two_relavite);
}
}
}
}
//array_unique(result=[
'data1'=>json_encode(doctorate_two,//二级学科字典
'data3'=>doctorate_two_relavite__all,true),//二级学科
'data5'=>json_encode($xk_type_all,true),//学科门类
];
return $result;
}
前端代码:
<div class="my_cell">
<div class="my_cell_hd">
<label class="my-label ">硕博学科门类:</label>
</div>
<div class="my_cell_bd">
<input type="text" class="my-input select" name="postdb[BH_PSUBC]" :value="tab_one_data.BH_PSUBC" id="select1">
</div>
</div>
<div class="my_cell">
<div class="my_cell_hd">
<label class="my-label ">一级学科:</label>
</div>
<div class="my_cell_bd">
<input type="text" class="my-input select" name="postdb[BH_PSUB]" :value="tab_one_data.BH_PSUB" id="select2">
</div>
</div>
<div class="my_cell">
<div class="my_cell_hd">
<label class="my-label "> 二级学科:</label>
</div>
<div class="my_cell_bd">
<input type="text" class="my-input select" name="postdb[BH_PSUB_2]" :value="tab_one_data.BH_PSUB_2" id="select3">
</div>
</div>
js主要代码:
function change_one_tab() {
var url='<{.ajax({
type: "post",
url:url,
dataType:"json",
data:{getJsonOne:3,subject_xk:1},
success:function(json){
if(json.state=='ok'){
my_detail.change_tab='one';
my_detail.tab_one_data=json.data;
var xkzd=json.bs_xk_zd;
$("#select1").select({
title: "选择学科门类",
items: JSON.parse(xkzd),
onChange: function(d){
if(d.values){
get_one_xk(d.values);
}
},
onClose: function () {
},
});
}
},
error: function(json) {
//alert('加载有误!')
},
})
}
function get_one_xk(code) {
var url='<{.ajax({
type: "post",
url:url,
dataType:"json",
data:{getJsonOne:4,type_code:code,subject_xk:1},
success:function(json){
if(json.state=='ok'){
var xkzd1=json.bs_xk_zd;
console.log(xkzd1);
$("#select2").select(
"update",
{
title: "选择一级学科",
items: JSON.parse(xkzd1),
onChange: function(d){
if(d.values){
get_two_xk(d.values);
}
},
}
);
}
},
error: function(json) {
//alert('加载有误!')
},
})
}
网友评论