diff --git a/application/admin/controller/Estimate.php b/application/admin/controller/Estimate.php
index aa622af..83189a5 100644
--- a/application/admin/controller/Estimate.php
+++ b/application/admin/controller/Estimate.php
@@ -62,6 +62,7 @@ class Estimate extends Base{
public function estimate_add(){
return $this->fetch();
}
+ // 规则详情页面
public function estimate_content_observe(){
$data = input();
$result = Db::table('admin_estimate')->where(['id'=>$data['id']])->find();
@@ -72,6 +73,7 @@ class Estimate extends Base{
'list'=>[],
];
$temporary_array = json_decode($result['content'],true);
+ return $this->msg($temporary_array);
$temporary_array2 = [];
foreach ($temporary_array as $key => $value) {
$num = array_push($temporary_array2,[
@@ -82,39 +84,43 @@ class Estimate extends Base{
$num2 = array_push($temporary_array2[$num-1]['list'],[
'title'=>$k1,
'score'=>'',
- 'gender'=>'',
'choose_num'=>'',
+ 'choose_all'=>count($v1),
'list'=>[],
]);
foreach ($v1 as $k2 => $v2) {
$temporary_array2[$num-1]['list'][$num2-1]['score'] = $v2['score'];
- $temporary_array2[$num-1]['list'][$num2-1]['gender'] = $v2['gender'];
+
+
$temporary_array2[$num-1]['list'][$num2-1]['choose_num'] = $v2['choose_num'];
- // $num3 = array_push($temporary_array2[$num-1]['list'][$num2-1]['list'],[
- // 'title'=>$k2,
- // 'list'=>[],
- // ]);
+ $num3 = array_push($temporary_array2[$num-1]['list'][$num2-1]['list'],[
+ 'title'=>$k2,
+ 'gender'=>'',
+ 'unit_data'=>$v2['unit_data'],
+ 'proportion'=>$v2['proportion'],
+ 'list'=>count($v2['content'])==0?[['成绩','无'],['数据','无']]:[['成绩'],['数据']],
+ ]);
+ if($v2['gender'] == '1'){
+ $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '男生';
+ }else if($v2['gender'] == '2'){
+ $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '女生';
+ }else{
+ $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '男生&女生';
+ }
+ foreach ($v2['content'] as $k3 => $v3) {
+ array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][0],$v3[2]);
+ array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][1],$v3[1].$v3[0]);
+ }
+
}
}
}
$data['list'] = $temporary_array2;
- // foreach ($variable as $key => $value) {
- // # code...
- // }
- // foreach ($temporary_array as $key => $value) {
- // array_push($temporary_array2,[
- // 'province'=>$result['province'],
- // 'city'=>$result['city']=='无'?'':'-'.$result['city'],
- // 'title'=>$key.'评定标准',
- // 'list'=>[],
- // ]);
- // }
-
- dump($data);
- // dump($temporary_array2);
- dump($temporary_array);
- die;
- // return $this->fetch();
+ $this->assign([
+ 'result' => $data,
+ 'num' => 1,
+ ]);
+ return $this->fetch();
}
################################################################业务接口################################################################
@@ -136,11 +142,12 @@ class Estimate extends Base{
}
if($file){
// 移动到框架应用根目录/public/uploads/ 目录下
- $file_name_new = time().'_ceshi.xlsx';
+ $file_name_new = date('YmdHis').'_ceshi.xlsx';
$info = $file->validate(['size' => 2048000, 'ext' => 'xlsx'])->move(ROOT_PATH . 'public' . DS . 'estimate',$file_name_new);
if($info){
$original_data = $this->excelToArray(ROOT_PATH . 'public' . DS . 'estimate' . DS . $info->getSaveName());
$handle_data = $this->transformation_data($original_data,$address_data,$name['type']);
+ // die;
if($name['type'] == 'create'){
$result = Db::table('admin_estimate')->insert($handle_data);
}else{
@@ -223,54 +230,92 @@ class Estimate extends Base{
];
}
$temporary_array = [];
+
+
+ $gender = [];
foreach ($data as $key => $value) {
- if(!array_key_exists($value[0],$temporary_array)){
- // 如果第一分类不存在
- $temporary_array[$value[0]][$value[1]][$value[3]] = [
- 'score'=>$value[2],
- 'unit_data'=>$value[4],
- 'gender'=>$value[5],
- 'choose_num'=>$value[9],
- 'proportion'=>$value[10],
- 'content'=>[
- [$value[6],$value[7],$value[8]]
- ],
- ];
- }else{
- // 第一分类存在
- if(!array_key_exists($value[1],$temporary_array[$value[0]])){
- // 如果第二分类不存在
- // array_push($temporary_array[$value[0]]);
- $temporary_array[$value[0]][$value[1]][$value[3]] = [
- 'score'=>$value[2],
+ $gender = explode(',',$value[5]);
+ foreach ($gender as $gk => $gv) {
+ if(!array_key_exists($gv,$temporary_array)){
+ $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
+ $temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]] = [
'unit_data'=>$value[4],
- 'gender'=>$value[5],
- 'choose_num'=>$value[9],
'proportion'=>$value[10],
- 'content'=>[
- [$value[6],$value[7],$value[8]]
- ],
+ 'value'=>$value[11],
+ 'type'=>$value[12],
];
- }else{
- // 第二分类存在
- if(!array_key_exists($value[3],$temporary_array[$value[0]][$value[1]])){
- // 如果项目名不存在
- $temporary_array[$value[0]][$value[1]][$value[3]] = [
- 'score'=>$value[2],
- 'unit_data'=>$value[4],
- 'gender'=>$value[5],
- 'choose_num'=>$value[9],
- 'proportion'=>$value[10],
- 'content'=>[
- [$value[6],$value[7],$value[8]]
- ],
- ];
+ if($value[6] == null){
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['score'] = $value[8];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [];
}else{
- array_push($temporary_array[$value[0]][$value[1]][$value[3]]['content'],[$value[6],$value[7],$value[8]]);
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
+ }
+ }else{
+ // 如果性别已经存在
+ if(!array_key_exists($value[0],$temporary_array[$gv])){
+ // 如果第一分类不存在
+ $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
+ $temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]] = [
+ 'unit_data'=>$value[4],
+ 'proportion'=>$value[10],
+ 'value'=>$value[11],
+ 'type'=>$value[12],
+ ];
+ if($value[6] == null){
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['score'] = $value[8];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [];
+ }else{
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
+ }
+ }else{
+ // 第一分类存在
+ if(!array_key_exists($value[1],$temporary_array[$gv][$value[0]])){
+ // 如果第二分类不存在
+ // array_push($temporary_array[$value[0]]);
+ $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
+ $temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]] = [
+ 'unit_data'=>$value[4],
+ 'proportion'=>$value[10],
+ 'value'=>$value[11],
+ 'type'=>$value[12],
+ ];
+ if($value[6] == null){
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['score'] = $value[8];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [];
+ }else{
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
+ }
+ }else{
+ // 第二分类存在
+
+ if(!array_key_exists($value[3],$temporary_array[$gv][$value[0]][$value[1]])){
+ // 如果项目名不存在
+ $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
+ $temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]] = [
+ 'unit_data'=>$value[4],
+ 'proportion'=>$value[10],
+ 'value'=>$value[11],
+ 'type'=>$value[12],
+ ];
+ if($value[6] == null){
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['score'] = $value[8];
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [];
+ }else{
+ $temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
+ }
+ }else{
+ array_push($temporary_array[$gv][$value[0]][$value[1]][$value[3]]['content'],[$value[6],$value[7],$value[8]]);
+ }
+ }
}
}
}
}
+
// return $temporary_array;
$temporary_array = json_encode($temporary_array);
$return_result['content'] = $temporary_array;
diff --git a/application/admin/view/estimate/device_edit.html b/application/admin/view/estimate/device_edit.html
deleted file mode 100644
index d80b175..0000000
--- a/application/admin/view/estimate/device_edit.html
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
-
-
- 设备管理_edit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/admin/view/estimate/estimate_content_observe.html b/application/admin/view/estimate/estimate_content_observe.html
index 4f849f6..898bea9 100644
--- a/application/admin/view/estimate/estimate_content_observe.html
+++ b/application/admin/view/estimate/estimate_content_observe.html
@@ -11,349 +11,77 @@
-
+