Browse Source

隐藏项目管理附件

NoNZero 8 năm trước cách đây
mục cha
commit
a42c4d86ef

+ 10 - 0
protected/class/itemfile.php

@@ -48,6 +48,16 @@ class ItemFile
         return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
     }
 
+    public function delItem($iaid)
+    {
+        $this->__itemfile->delete(array('where' => 'iaid=?', 'param' => array($iaid)));
+    }
+
+    public function getGroupOwnerid($pmid)
+    {
+        return $pmid ? $this->__itemfile->find(array('where' => 'pmid=?', 'groupby' => 'ownerid', 'param' => array($pmid), 'asArray' => TRUE)) : FALSE;
+    }
+
 }
 
 ?>

+ 53 - 3
protected/class/itemmeasurenum.php

@@ -28,9 +28,46 @@ class ItemMeasureNumpofper
         return $this->__itemMeasureNum->insert();
     }
 
-    public function getItemMeasureNum($tenderid)
+    public function getItemMeasureNum($tenderid, $limit, $numpname, $userid)
     {
-        return $this->__itemMeasureNum->find(array('where' => 'pmid=? AND isdel=0', 'param' => array($tenderid), 'asArray' => TRUE));
+        if (!empty($limit)) {
+            if (isset($numpname) && isset($userid)) {
+                return $this->__itemMeasureNum->limit($limit, null, 'imnid', array('where' => "pmid=? AND isdel=0 AND numpname=? AND ownerid=?", 'param' => array($tenderid, $numpname, $userid), 'asArray' => TRUE));
+            } elseif (isset($numpname)) {
+                return $this->__itemMeasureNum->limit($limit, null, 'imnid', array('where' => "pmid=? AND isdel=0 AND numpname=?", 'param' => array($tenderid, $numpname), 'asArray' => TRUE));
+            } elseif (isset($userid)) {
+                return $this->__itemMeasureNum->limit($limit, null, 'imnid', array('where' => "pmid=? AND isdel=0 AND ownerid=?", 'param' => array($tenderid, $userid), 'asArray' => TRUE));
+            } else {
+                return $this->__itemMeasureNum->limit($limit, null, 'imnid', array('where' => "pmid=? AND isdel=0", 'param' => array($tenderid), 'asArray' => TRUE));
+            }
+        } else {
+            return $this->__itemMeasureNum->find(array('where' => 'pmid=? AND isdel=0', 'param' => array($tenderid), 'asArray' => TRUE));
+        }
+    }
+
+    public function getItemMeasureNumDel($limit, $tenderid)
+    {
+        if (!empty($limit)) {
+            return $this->__itemMeasureNum->limit($limit, null, 'imnid', array('where' => "pmid=? AND isdel=1", 'param' => array($tenderid), 'asArray' => TRUE));
+        } else {
+            return $this->__itemMeasureNum->find(array('where' => 'pmid=? AND isdel=1', 'param' => array($tenderid), 'asArray' => TRUE));
+        }
+
+    }
+
+    public function getCount($tenderid, $deltag = 1, $numpname, $userid)
+    {
+        if (isset($numpname) && isset($userid)) {
+            return $this->__itemMeasureNum->count(array('where' => 'pmid=? AND isdel=? AND numpname=? AND ownerid=?', 'param' => array($tenderid, $deltag, $numpname, $userid), 'asArray' => TRUE));
+        }
+        if (isset($numpname)) {
+            return $this->__itemMeasureNum->count(array('where' => 'pmid=? AND isdel=? AND numpname=? ', 'param' => array($tenderid, $deltag, $numpname), 'asArray' => TRUE));
+        }
+        if (isset($userid)) {
+            return $this->__itemMeasureNum->count(array('where' => 'pmid=? AND isdel=? AND ownerid=?', 'param' => array($tenderid, $deltag, $userid), 'asArray' => TRUE));
+        }
+        return $this->__itemMeasureNum->count(array('where' => 'pmid=? AND isdel=?', 'param' => array($tenderid, $deltag), 'asArray' => TRUE));
+
     }
 
     public function getRowData($imnid)
@@ -49,9 +86,17 @@ class ItemMeasureNumpofper
         return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($id)));
     }
 
-    public function updateDeltag($id)
+    public function updateDeltag($id, $deluid)
     {
         $this->__itemMeasureNum->isdel = 1;
+        $this->__itemMeasureNum->deltime = time();
+        $this->__itemMeasureNum->deluid = $deluid;
+        return $this->__itemMeasureNum->update(array('where' => 'imnid=?', 'param' => array($id)));
+    }
+
+    public function recoveryDel($id)
+    {
+        $this->__itemMeasureNum->isdel = 0;
         return $this->__itemMeasureNum->update(array('where' => 'imnid=?', 'param' => array($id)));
     }
 
@@ -66,4 +111,9 @@ class ItemMeasureNumpofper
     {
         return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($imnid)));
     }
+
+    public function delItemIAID($iaid)
+    {
+        return $this->__itemMeasureNum->delete(array('where' => 'iaid=?', 'param' => array($iaid)));
+    }
 }

+ 12 - 0
protected/config/routes.conf.php

@@ -16,7 +16,19 @@ $route['*']['/project/section/get'] = array('ProjectController', 'getAjaxSection
 $route['*']['/project/:pid/section/:mpid/measure'] = array('ProjectController', 'proSectionMeasure');
 $route['*']['/project/:pid/section/:pmid/detail'] = array('ProjectController', 'proDetail');
 $route['*']['/project/:pid/section/:pmid/files'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/page/:pindex'] = array('ProjectController', 'proSectionFiles');
 $route['*']['/project/:pid/section/:pmid/files/recover'] = array('ProjectController', 'proSectionFilesRecover');
+$route['*']['/project/:pid/section/:pmid/files/recover/page/:pindex'] = array('ProjectController', 'proSectionFilesRecover');
+$route['*']['/project/section/:iaid/file'] = array('ProjectController', 'getItemFileHistory');
+$route['*']['/project/:pid/section/:pmid/files/num/:numpname/page/:pindex'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/user/:userid/page/:pindex'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/num/:numpname/user/:userid/page/:pindex'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/user/:userid/num/:numpname/page/:pindex'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/user/:userid/page/:pindex/num/:numpname'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/num/:numpname/page/:pindex/user/:userid'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/page/:pindex/num/:numpname/user/:userid'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/page/:pindex/user/:userid/num/:numpname'] = array('ProjectController', 'proSectionFiles');
+
 // R
 $route['*']['/rproject/index'] = array('RProjectController', 'index');
 $route['*']['/rproject/:pid/section'] = array('RProjectController', 'proSection');

+ 84 - 8
protected/controller/ProjectController.php

@@ -10,6 +10,7 @@ Doo::loadClass('measureauditact');
 Doo::loadClass('itemmeasurenum');
 Doo::loadClass('itemfile');
 Doo::loadClass('attachment');
+Doo::loadHelper('DooPager');
 
 /* * proDetail
  * MainController
@@ -383,7 +384,7 @@ class ProjectController extends DooController
         if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
             $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
             if ($imnidArray['iaid'] > 0) {
-                $this->itemmeasurenum->updateDeltag($_POST['imnid']);
+                $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
                 echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
                 die();
             }
@@ -399,6 +400,7 @@ class ProjectController extends DooController
                 die();
             }
         }
+
         // 面包屑导航项目
         $this->data['currproArray'] = $this->data['allproArray'] = NULL;
         $this->data['pmid'] = $this->params['pmid'];
@@ -438,7 +440,36 @@ class ProjectController extends DooController
                 }
             }
         }
-        $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
+        // 选取查询
+        $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
+        $this->data['groupArray'] = $groupArray;
+        $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
+        foreach ($owneridArray as $k => $v) {
+            $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
+            $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
+        }
+
+
+// 分页
+        $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
+        if ($totalArchive) {
+            if ($this->params['numpname'] && $this->params['userid']) {
+                $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/user/' . $this->params['userid'] . '/page', $totalArchive, 30, 100);
+            } elseif ($this->params['numpname']) {
+                $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 30, 100);
+            } elseif ($this->params['userid']) {
+                $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 30, 100);
+            } else {
+                $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 30, 100);
+            }
+            $pager->setCss('', 'disabled', 'active');
+            if (isset($this->params['pindex']))
+                $pager->paginate(intval($this->params['pindex']));
+            else
+                $pager->paginate(1);
+            $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
+        }
+
         foreach ($this->data['itemMeasureArray'] as $k => $v) {
             $fileArray = $this->itemfle->getItemFile($v['iaid']);
             $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
@@ -450,11 +481,39 @@ class ProjectController extends DooController
         $this->data['pid'] = $this->params['pid'];
         $this->data['pmid'] = $this->params['pmid'];
         $this->data['mpid'] = $this->params['mpid'];
+        $this->data['user'] = $this->params['userid'];
+        $this->data['num'] = $this->params['numpname'];
+        $this->data['pager'] = $pager->output;
         $this->render('w-project-section-files', $this->data, TRUE);
     }
 
     function proSectionFilesRecover()
     {
+        if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $this->itemmeasurenum->recoveryDel($_POST['imnid']);
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+
+        if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
+                if ($iaidArray['ownerid'] == $this->auth->getUid()) {
+                    $this->itemfle->delItem($imnidArray['iaid']);
+                    $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
+                    echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                    die();
+                } else {
+                    echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
+                    die();
+                }
+            }
+        }
+
         // 面包屑导航项目
         $this->data['currproArray'] = $this->data['allproArray'] = NULL;
         $this->data['pmid'] = $this->params['pmid'];
@@ -494,23 +553,33 @@ class ProjectController extends DooController
                 }
             }
         }
-        $this->data['itematta'] = $this->itemfle->getFilesAll($this->params['pmid']);
-        foreach ($this->data['itematta'] as $k => $v) {
-            $this->data['itematta'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
-            $this->data['itematta'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
+
+        $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
+        if ($totalArchive) {
+            $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 1, 1);
+            $pager->setCss('', 'disabled', 'active');
+            if (isset($this->params['pindex']))
+                $pager->paginate(intval($this->params['pindex']));
+            else
+                $pager->paginate(1);
+            $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
         }
-        $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
+
+
         foreach ($this->data['itemMeasureArray'] as $k => $v) {
             $fileArray = $this->itemfle->getItemFile($v['iaid']);
             $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
+            $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
             $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
             $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
             $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
             $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
+            $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
         }
         $this->data['pid'] = $this->params['pid'];
         $this->data['pmid'] = $this->params['pmid'];
         $this->data['mpid'] = $this->params['mpid'];
+        $this->data['pager'] = $pager->output;
         $this->render('w-project-section-files-recover', $this->data, TRUE);
     }
 
@@ -520,9 +589,15 @@ class ProjectController extends DooController
             $iaidArray = $this->itemfle->getItemFile($this->params['iaid']);
             if ($iaidArray['oldiaid'] > 0) {
                 $oldiaidArray = $this->itemfle->getFileHistory($iaidArray['oldiaid']);
+                $htmlstr = '';
                 foreach ($oldiaidArray as $k => $v) {
-                    $htmlstr = '<div class="media"><div class="pull-left"><h4>#1</h4></div><div class="media-body"><h5>陈特&nbsp;上传于 2016-10-10 10:10</h5><a href="#" target="_blank">QQ截图20160629164352.png</a></div></div>';
+                    $countInt = $k + 1;
+                    $formatDate = date('Y-m-d H:i:s', $v['intime']);
+                    $profileArray = $this->profile->getProWithUid($v['ownerid']);
+                    $htmlstr .= '<div class="media"><div class="pull-left"><h4>#' . $countInt . '</h4></div><div class="media-body"><h5>' . $profileArray['name'] . '&nbsp;上传于 ' . $formatDate . '</h5><a href="/' . $v['filepath'] . '" target="_blank">' . $v['filename'] . '</a></div></div>';
                 }
+                echo json_encode(array('html' => $htmlstr), JSON_UNESCAPED_UNICODE);
+                die();
             }
         }
     }
@@ -732,6 +807,7 @@ class ProjectController extends DooController
         $this->att->setUploadDir();
         return $this->att->uploadMut($fildname, $param);
     }
+
 }
 
 ?>

+ 2 - 1
protected/model/itemmnum.php

@@ -16,12 +16,13 @@ class ItemMeasureNumofper extends DooModel
     public $isdel;
     public $intime;
     public $deltime;
+    public $deluid;
     public $ownerid;
     public $categoryid;
     public $tips;
     public $_table = 'jl_item_measure_numofper';
     public $_primarykey = 'imnid';
-    public $_fields = array('imnid', 'iaid', 'pid', 'pmid', 'numpname', 'softwareitemid', 'isdel', 'intime', 'deltime', 'ownerid', 'categoryid', 'tips');
+    public $_fields = array('imnid', 'iaid', 'pid', 'pmid', 'numpname', 'softwareitemid', 'isdel', 'intime', 'deltime', 'deluid', 'ownerid', 'categoryid', 'tips');
 
     public function __construct()
     {

+ 1 - 1
protected/view/w-project-section-detail.html

@@ -56,7 +56,7 @@
 			    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
 			</li>
 				<li>
-					<a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files/{{mpid}}">附件</a>
+					<a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files">附件</a>
 				</li>
 <!--			<li><a href="/project/{{pid}}/section/{{pmid}}/measure">计量台帐</a></li>-->
 		    </ul>

+ 129 - 29
protected/view/w-project-section-files-recover.html

@@ -69,7 +69,8 @@
                         </a>
                         <ul class="dropdown-menu">
                             <!-- loop allconArray -->
-                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray'
+                                value.stname}}</a></li>
                             <!-- endloop -->
                         </ul>
                     </li>
@@ -81,7 +82,8 @@
                         <ul class="dropdown-menu">
                             <!-- loop allactmeasureArray -->
                             <li>
-                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray' value.pmname}}</a></li>
+                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray'
+                                    value.pmname}}</a></li>
                             <!-- endloop -->
                             <!--				    <li class="divider"></li>
                                                 <li><a href="#">共18标段,查看更多</a></li>-->
@@ -120,14 +122,25 @@
                         </thead>
                         <tbody>
                         <tr>
-                            <!-- loop itematta -->
-                            <td width=""><span class="fileico ico-jpg"></span><a href="#">{{itematta' value.filename}}</a></td>
-                            <td>第二期</td>
-                            <td>203-1-a 挖土方</td>
-                            <td width="">陈工</td>
-                            <td width="">2014-11-20 10:10</td>
-                            <td class="text-error">陈工</td>
-                            <td class="text-error">2014-11-20 10:10</td>
+                            <!-- loop itemMeasureArray -->
+                            <td width=""><span class="fileico ico-jpg"></span><a
+                                    fileext="{{itemMeasureArray' value.fileext}}"
+                                    imnid="{{itematta' value.imnid}}"
+                                    iaid="{{itematta' value.iaid}}"
+                                    filename="{{itemMeasureArray' value.filename}}"
+                                    realname="{{itemMeasureArray' value.realname}}"
+                                    intime="{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}"
+                                    tips="{{itemMeasureArray' value.tips}}"
+                                    href="#"
+                                    numpname="第{{ToChinaseNum(itemMeasureArray' value.numpname)}}期"
+                                    id="fname_{{itemMeasureArray' value.imnid}}"
+                                    href="#">{{itemMeasureArray' value.filename}}</a></td>
+                            <td>第{{ToChinaseNum(itemMeasureArray' value.numpname)}}期</td>
+                            <td>{{itemMeasureArray' value.pmname}}</td>
+                            <td width="">{{itemMeasureArray' value.realname}}</td>
+                            <td width="">{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}</td>
+                            <td class="text-error">{{itemMeasureArray' value.delname}}</td>
+                            <td class="text-error">{{formatDate(itemMeasureArray' value.deltime,'Y-m-d')}}</td>
                             <td>
                                 <div class="btn-group">
                                     <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
@@ -135,8 +148,11 @@
                                     </a>
                                     <ul class="dropdown-menu">
                                         <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
-                                        <li><a><i class="icon-download-alt"></i>&nbsp;下载</a></li>
-                                        <li><a href="#file-replace" data-toggle="modal"><i class="icon-repeat"></i>&nbsp;恢复</a>
+                                        <li><a href="{{rootUrl}}{{itemMeasureArray' value.filepath}}"><i
+                                                class="icon-download-alt"></i>&nbsp;下载</a></li>
+                                        <li><a id="recovery_{{itemMeasureArray' value.imnid}}"
+                                               imnid="{{itemMeasureArray' value.imnid}}" href="#"
+                                               data-toggle="modal"><i class="icon-repeat"></i>&nbsp;恢复</a>
                                         </li>
                                     </ul>
                                 </div>
@@ -145,18 +161,21 @@
                         <!-- endloop -->
                         </tbody>
                     </table>
+
                     <div class="pagination">
                         <ul>
-                            <li class="disabled"><a href="#">&laquo;</a></li>
-                            <li class="active"><a href="#">1</a></li>
-                            <li><a href="#">2</a></li>
-                            <li><a href="#">3</a></li>
-                            <li><a href="#">4</a></li>
-                            <li><a href="#">5</a></li>
+                            {{pager}}
+                            <!--<li class="disabled"><a href="#">&laquo;</a></li>-->
+                            <!--<li class="active"><a href="#">1</a></li>-->
+                            <!--<li><a href="#">2</a></li>-->
+                            <!--<li><a href="#">3</a></li>-->
+                            <!--<li><a href="#">4</a></li>-->
+                            <!--<li><a href="#">5</a></li>-->
                         </ul>
                     </div>
                 </div>
-                <div class="filesDetail">
+                <div class="filesDetail hide">
+                    <input type="hidden" id="imnid" value="0"/>
                     <table class="table table-striped">
                         <thead>
                         <tr>
@@ -165,23 +184,23 @@
                         </thead>
                         <tr>
                             <th width="60">文件名</th>
-                            <td colspan="3"> K0+800-K1+000图纸</td>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
                         </tr>
                         <tr>
                             <th width="60">格式</th>
-                            <td><span class="fileico ico-jpg"></span>.jpg</td>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
                             <th width="60">所在期</th>
-                            <td>第二期</td>
+                            <td id="numpname">第二期</td>
                         </tr>
                         <tr>
                             <th width="60">上传者</th>
-                            <td>陈工</td>
+                            <td id="realname">陈工</td>
                             <th width="60">上传时间</th>
-                            <td>2014-11-20 14:20</td>
+                            <td id="intime">2014-11-20 14:20</td>
                         </tr>
                         <tr>
                             <th width="60">备注/描述</th>
-                            <td colspan="3">内容内容内容内容</td>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
                         </tr>
                         <tr>
                             <th width="60">更多操作</th>
@@ -189,9 +208,6 @@
                                 <button class="btn btn-mini btn-danger" type="button" href="#file-del"
                                         data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
                                 </button>
-                                <button class="btn btn-mini btn-danger" type="button" href="#file-del2"
-                                        data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
-                                </button>
                             </td>
                         </tr>
                     </table>
@@ -229,7 +245,7 @@
     </div>
     <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
-        <button class="btn btn-danger">确定删除</button>
+        <button id="del" class="btn btn-danger">确定删除</button>
     </div>
 </div>
 </div>
@@ -251,4 +267,88 @@
 </div>
 <!-- 删除弹出 -->
 <script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+
+        $("a[id^='fname_']").click(function () {
+            var fileext = $(this).attr('fileext');
+            var filename = $(this).attr('filename');
+            var realname = $(this).attr('realname');
+            var intime = $(this).attr('intime');
+            var tips = $(this).attr('tips');
+            var numpname = $(this).attr('numpname');
+            var imnid = $(this).attr('imnid');
+            var iaid = $(this).attr('iaid');
+            $("#fn").html(filename);
+            $("#fileico").html(fileext);
+            $("#realname").html(realname);
+            $("#intime").html(intime);
+            $("#tips").html(tips);
+            $("#numpname").html(numpname);
+            $("#imnid").val(imnid);
+            $(".filesDetail").show();
+        });
+
+        $("#filedown").click(function () {
+            var file_data = $('#file').prop('files')[0];
+            var form_data = new FormData();
+            form_data.append('file', file_data);
+            form_data.append('optype', 'replace');
+            var imnid = $("#fid").val();
+            form_data.append('imnid', imnid);
+            $.ajax({
+                type: "POST",
+                dataType: "text",
+                cache: false,
+                contentType: false,
+                data: form_data,
+                url: "/project/{{pid}}/section/{{pmid}}/files",
+                processData: false,
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}project/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("a[id^='recovery_']").click(function () {
+            var imnid = $(this).attr('imnid');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"imnid": imnid, "optype": 'reconvery'},
+                url: "/project/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-replace").show();
+                        window.location.href = "{{rootUrl}}project/{{pid}}/section/{{pmid}}/files/recover";
+                    }
+                }
+            });
+        });
+
+        $("#del").click(function () {
+            var imnid = $("#imnid").val();
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"imnid": imnid, "optype": 'del'},
+                url: "/project/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-del").hide();
+                        window.location.href = "{{rootUrl}}project/{{pid}}/section/{{pmid}}/files/recover";
+                    }
+                    if (data['status'] == 2) {
+                        $("#file-del2").show();
+                        $("#file-del").hide();
+                    }
+                }
+            });
+        });
+    });
+</script>
 </body>

+ 89 - 22
protected/view/w-project-section-files.html

@@ -34,7 +34,8 @@
                         </a>
                         <ul class="dropdown-menu">
                             <!-- loop allconArray -->
-                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray'
+                                value.stname}}</a></li>
                             <!-- endloop -->
                         </ul>
                     </li>
@@ -46,7 +47,8 @@
                         <ul class="dropdown-menu">
                             <!-- loop allactmeasureArray -->
                             <li>
-                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray' value.pmname}}</a></li>
+                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray'
+                                    value.pmname}}</a></li>
                             <!-- endloop -->
                             <!--				    <li class="divider"></li>
                                                 <li><a href="#">共18标段,查看更多</a></li>-->
@@ -66,19 +68,20 @@
             <!--筛选工具-->
             <div class="clearfix">
                 <form class="form-inline">
-                    <select class="span2">
-                        <option>不限期数</option>
-                        <option>第二期</option>
-                        <option>第一期</option>
-                    </select>
-                    <select class="span2">
-                        <option>上传者</option>
-                        <option>陈特</option>
-                        <option>任杰</option>
+                    <select id="numpname" class="span2">
+                        <option value="0">不限期数</option>
+                        <!-- loop groupArray -->
+                        <option <!-- if {{num}} == {{groupArray' value.mpid}} --> selected <!-- endif -->
+                        value="{{groupArray' value.mpid}}">第{{ToChinaseNum(groupArray' value.numpname)}}期
+                        </option>
+                        <!-- endloop -->
                     </select>
-                    <select class="span2">
-                        <option>清单</option>
-                        <option>203-1-a 挖土方</option>
+                    <select id="uploaduser" class="span2">
+                        <option value="0">上传者</option>
+                        <!-- loop owneridArray -->
+                        <option <!-- if {{user}} == {{owneridArray' value.iaid}} --> selected <!-- endif -->
+                        value="{{owneridArray' value.iaid}}">{{owneridArray' value.name}}</option>
+                        <!-- endloop -->
                     </select>
                     <a href="/project/{{pid}}/section/{{pmid}}/files/recover" class="fR">附件回收站</a>
                 </form>
@@ -104,6 +107,7 @@
                             <td width=""><span class="fileico ico-jpg"></span><a
                                     fileext="{{itemMeasureArray' value.fileext}}"
                                     imnid="{{itematta' value.imnid}}"
+                                    iaid="{{itematta' value.iaid}}"
                                     filename="{{itemMeasureArray' value.filename}}"
                                     realname="{{itemMeasureArray' value.realname}}"
                                     intime="{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}"
@@ -136,12 +140,7 @@
                     </table>
                     <div class="pagination">
                         <ul>
-                            <li class="disabled"><a href="#">&laquo;</a></li>
-                            <li class="active"><a href="#">1</a></li>
-                            <li><a href="#">2</a></li>
-                            <li><a href="#">3</a></li>
-                            <li><a href="#">4</a></li>
-                            <li><a href="#">5</a></li>
+                            {{pager}}
                         </ul>
                     </div>
                 </div>
@@ -178,7 +177,7 @@
                                 <button class="btn btn-mini btn-primary" type="button" href="#file-replace"
                                         data-toggle="modal"><i class="icon-retweet icon-white"></i>替换
                                 </button>
-                                <button class="btn btn-mini btn-info" type="button" href="#file-history"
+                                <button class="btn btn-mini btn-info" id="historyAtt" type="button" href="#file-history"
                                         data-toggle="modal"><i class="icon-time icon-white"></i>历史版本
                                 </button>
                                 &nbsp;&nbsp;&nbsp;&nbsp;
@@ -275,11 +274,12 @@
 <!-- 历史版本弹出 -->
 <div id="file-history" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
      aria-hidden="true">
+    <input type="hidden" name="iaid" value="0" id="iaid"/>
     <div class="modal-header">
         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
         <h3 id="myModalLabel">历史版本</h3>
     </div>
-    <div class="modal-body">
+    <div id="historyHTML" class="modal-body">
     </div>
     <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
@@ -298,6 +298,7 @@
             var tips = $(this).attr('tips');
             var numpname = $(this).attr('numpname');
             var imnid = $(this).attr('imnid');
+            var iaid = $(this).attr('iaid');
             $("#fn").html(filename);
             $("#fileico").html(fileext);
             $("#realname").html(realname);
@@ -306,6 +307,7 @@
             $("#numpname").html(numpname);
             $(".filesDetail").show();
             $("#fid").val(imnid);
+            $("#iaid").val(iaid);
         });
 
         $("a[id^='dropdown_']").click(function () {
@@ -369,6 +371,71 @@
                 }
             });
         });
+
+        $("#historyAtt").click(function () {
+            var iaid = $("#iaid").val();
+            $("#historyHTML").html('');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"iaid": iaid},
+                url: "/project/section/" + iaid + "/file",
+                success: function (data) {
+                    $("#historyHTML").html(data['html']);
+                }
+            });
+        });
+
+        $("#numpname").change(function () {
+            var localurl = window.location.href;
+            var page = localurl.indexOf("/page/");
+            var user = localurl.indexOf("user/");
+            if (page != "-1") {
+                if (user != "-1") {
+                    var nowurl = localurl.replace(/\/num\/\d+/, "");
+                    var url = nowurl + "/num/" + $(this).val();
+                    window.location.href = url;
+                } else {
+                    var nowurl = localurl.replace(/num\/\d+/, "");
+                    var url = nowurl + "num/" + $(this).val();
+                    window.location.href = url;
+                }
+            } else {
+                if (user != "-1") {
+                    var url = window.location.href + "num/" + $(this).val() + "/page/1";
+                    window.location.href = url;
+                } else {
+                    var url = window.location.href + "/num/" + $(this).val() + "/page/1";
+                    window.location.href = url;
+                }
+            }
+        });
+
+        $("#uploaduser").change(function () {
+            var localurl = window.location.href;
+            var page = localurl.indexOf("page/");
+            var num = localurl.indexOf("num/");
+            if (page != "-1") {
+                if (num != "-1") {
+                    var nowurl = localurl.replace(/\/user\/\d+/, "");
+                    var url = nowurl + "/user/" + $(this).val();
+                    window.location.href = url;
+                } else {
+                    var nowurl = localurl.replace(/user\/\d+/, "");
+                    var url = nowurl + "user/" + $(this).val();
+                    window.location.href = url;
+                }
+            } else {
+                if (num != "-1") {
+                    var url = window.location.href + "user/" + $(this).val() + "/page/1";
+                    window.location.href = url;
+                } else {
+                    var url = window.location.href + "/user/" + $(this).val() + "/page/1";
+                    window.location.href = url;
+                }
+            }
+        });
     });
 </script>
 </body>

+ 3 - 1
附件.sql

@@ -23,4 +23,6 @@ CREATE TABLE IF NOT EXISTS `jl_item_measure_numofper` (
   PRIMARY KEY (`imnid`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
 
-ALTER TABLE  `jl_item_attachment` ADD  `oldiaid` MEDIUMINT NOT NULL ;
+ALTER TABLE  `jl_item_attachment` ADD  `oldiaid` MEDIUMINT NOT NULL ;
+
+ALTER TABLE  `jl_item_measure_numofper` ADD  `deluid` MEDIUMINT NOT NULL AFTER  `deltime` ;