lvhao 9 годин тому
батько
коміт
899441739e
2 змінених файлів з 26 додано та 6 видалено
  1. 21 5
      core/CoreApp/controllers/Color.php
  2. 5 1
      template/erp/color.html

+ 21 - 5
core/CoreApp/controllers/Color.php

@@ -72,6 +72,8 @@ class Color extends Start_Controller {
 			$timetj = $this->input->post('timetj',true);
 			$timetk = strtotime($timetk);
 			$timetj = strtotime($timetj);
+			$xztime = $this->input->post('xztime',true);
+			$time_type = empty($xztime)?0:2;
 			$where = "1=1";
 			if($title)
             {
@@ -96,10 +98,18 @@ class Color extends Start_Controller {
             if($developer){
                  $where  .= " and developer = '$developer'";
             }
-			if($timetk && $timetj)
-            {
-                $where  .= " and time > '$timetk' and time < '$timetj'";
-            }
+			if($time_type == 2){
+				if($timetk && $timetj)
+				{
+					$where  .= " and time > '$timetk' and time < '$timetj'";
+				}
+			}else{
+				if($timetk && $timetj)
+				{
+					$where  .= " and edittime > '$timetk' and edittime < '$timetj'";
+				}
+			}
+			
             if($color){
                 $where  .= " and color like '%$color%'";
             }
@@ -107,7 +117,12 @@ class Color extends Start_Controller {
                 $where  .= " and lowe like '%$lowe%'";
             }
 			//数据排序
-            $order_str = "edittime desc";
+			if($time_type == 2){
+				$order_str = "id desc";
+			}else{
+				$order_str = "edittime desc";
+			}
+            
             if(empty($page))
 		    {
                 $start = 0;
@@ -117,6 +132,7 @@ class Color extends Start_Controller {
 		    {
                 $start = ($page - 1)*$perpage;
             }
+			
 			$info_list = $this->color->find_all($where,'id,title,state,type,color,lowe,img,developer,craft_process,content,time,edittime',$order_str,$start,$perpage);
 			foreach ($info_list as $key=>$value) 
 		    {

+ 5 - 1
template/erp/color.html

@@ -28,7 +28,11 @@
 <li>备注:<input value="" name="content" type="text" style="width:150px"></li>
 <li>开发人:<input value="" name="developer" type="text" style="width:150px"></li>
 
-<li>添加时间:<input id="timetk"  value="2020-01-01 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})">
+<li>选择时间条件:<select name="xztime" class="select">
+    <option value="0">更新时间</option>
+    <option value="2">创建时间</option>
+    </select></li>
+    <li><input id="timetk"  value="2020-01-01 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})">
 至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time()+24*3600)} 0:00" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"></li>
 <li><span>确 定</span></li>
 </ul>