Browse Source

Merge branch 'feature/附件后续功能' into feature/短信类型增加UI调整

# Conflicts:
#	protected/controller/ProjectController.php
#	protected/view/r-project-section-files.html
#	protected/view/w-project-section-detail.html
NoNZero 8 years ago
parent
commit
c75a0dd0d0

+ 17 - 0
protected/class/itemfile.php

@@ -22,6 +22,8 @@ class ItemFile
         $this->__itemfile->filesize = $postArray['filesize'];
         $this->__itemfile->filepath = $postArray['filepath'];
         $this->__itemfile->intime = time();
+        if (isset($postArray['oldiaid']))
+            $this->__itemfile->oldiaid = $postArray['oldiaid'];
         return $this->__itemfile->insert();
     }
 
@@ -35,12 +37,27 @@ class ItemFile
         return $pmid ? $this->__itemfile->find(array('where' => 'pmid=?', 'param' => array($pmid), 'asArray' => TRUE)) : FALSE;
     }
 
+    public function getFileHistory($oldiaid)
+    {
+        return $oldiaid ? $this->__itemfile->find(array('where' => 'oldiaid=?', 'param' => array($oldiaid), 'asArray' => TRUE)) : FALSE;
+    }
+
     public function updateItemFields($id, $fname)
     {
         $this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
         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;
+    }
+
 }
 
 ?>

+ 70 - 2
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=?', '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)
@@ -44,8 +81,39 @@ class ItemMeasureNumpofper
         return $this->__itemMeasureNum->update(array('where' => 'imnid=?', 'param' => array($id)));
     }
 
+    public function deleteItem($id)
+    {
+        return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($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)));
+    }
+
+    public function updateIAID($oldiaid, $newiaid)
+    {
+        $this->__itemMeasureNum->iaid = $newiaid;
+        return $this->__itemMeasureNum->update(array('where' => 'iaid=?', 'param' => array($oldiaid)));
+    }
+
+
     public function delItemFields($imnid)
     {
         return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($imnid)));
     }
+
+    public function delItemIAID($iaid)
+    {
+        return $this->__itemMeasureNum->delete(array('where' => 'iaid=?', 'param' => array($iaid)));
+    }
 }

+ 33 - 1
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');
@@ -24,13 +36,33 @@ $route['*']['/rproject/:pid/section/:mpid/measure'] = array('RProjectController'
 $route['*']['/rproject/:pid/section/:pmid/detail'] = array('RProjectController', 'proDetail');
 $route['*']['/rproject/:pmid/measure/detail'] = array('RProjectController', 'proMeasure');
 $route['*']['/rproject/:pid/section/:pmid/report/:mpid'] = array('RProjectController', 'proReport');
-$route['*']['/rproject/:pid/section/:pmid/files/:mpid'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/recover'] = array('RProjectController', 'proSectionFilesRecover');
 $route['*']['/rproject/section/get/:iaid/attachment'] = array('RProjectController', 'proSectionGetFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/num/:numpname/page/:pindex'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/user/:userid/page/:pindex'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/num/:numpname/user/:userid/page/:pindex'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/user/:userid/num/:numpname/page/:pindex'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/user/:userid/page/:pindex/num/:numpname'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/num/:numpname/page/:pindex/user/:userid'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/page/:pindex/num/:numpname/user/:userid'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/:pid/section/:pmid/files/page/:pindex/user/:userid/num/:numpname'] = array('RProjectController', 'proSectionFiles');
+
 // S
 $route['get']['/sproject/index'] = array('SProjectController', 'index');
 $route['get']['/sproject/:pid/section'] = array('SProjectController', 'proSection');
 $route['get']['/sproject/:pid/section/:pmid/detail'] = array('SProjectController', 'proDetail');
 $route['get']['/sproject/:pid/section/measure'] = array('SProjectController', 'proMeasure');
+$route['*']['/sproject/:pid/section/:pmid/files'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/recover'] = array('SProjectController', 'proSectionFilesRecover');
+$route['*']['/sproject/:pid/section/:pmid/files/num/:numpname/page/:pindex'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/user/:userid/page/:pindex'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/num/:numpname/user/:userid/page/:pindex'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/user/:userid/num/:numpname/page/:pindex'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/user/:userid/page/:pindex/num/:numpname'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/num/:numpname/page/:pindex/user/:userid'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/page/:pindex/num/:numpname/user/:userid'] = array('SProjectController', 'proSectionFiles');
+$route['*']['/sproject/:pid/section/:pmid/files/page/:pindex/user/:userid/num/:numpname'] = array('SProjectController', 'proSectionFiles');
 // 登入登出API
 $route['*']['/user/profile'] = array('UserController', 'index');
 $route['*']['/user/profile/sms'] = array('UserController', 'sms');

+ 153 - 25
protected/controller/ProjectController.php

@@ -9,6 +9,8 @@ Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
 Doo::loadClass('itemmeasurenum');
 Doo::loadClass('itemfile');
+Doo::loadClass('attachment');
+Doo::loadHelper('DooPager');
 
 /* * proDetail
  * MainController
@@ -20,7 +22,7 @@ Doo::loadClass('itemfile');
 class ProjectController extends DooController
 {
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>'), $itemmeasurenum, $itemfle;
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>'), $itemmeasurenum, $itemfle, $att;
 
     public function beforeRun($resource, $action)
     {
@@ -46,6 +48,7 @@ class ProjectController extends DooController
         $this->measureauditact = new MeasureauditAct();
         $this->itemmeasurenum = new ItemMeasureNumpofper();
         $this->itemfle = new ItemFile();
+        $this->att = new attachment();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 'p';
         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
@@ -355,6 +358,49 @@ class ProjectController extends DooController
 
     function proSectionFiles()
     {
+        if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $fileArray = $this->upItemFile('file')[0];
+                if (isset($fileArray['filepath'])) {
+                    $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
+                    if (isset($itemArray)) {
+                        if ($itemArray['oldiaid'] > 0) {
+                            $oldiaid = $itemArray['oldiaid'];
+                        } else {
+                            $oldiaid = $imnidArray['iaid'];
+                        }
+                        $postArray = array('ownerid' => $this->auth->getUid(), 'pid' => $itemArray['pid'], 'pmid' => $itemArray['pmid'], 'filename' => $fileArray['filename'], 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'oldiaid' => $oldiaid);
+                        $iaid = $this->itemfle->insertItemFileRecord($postArray);
+                        if ($iaid > 1) {
+                            $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
+                            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) {
+                $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+        if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
+            $filename = $_POST['filename'];
+            $filedesc = $_POST['filedesc'];
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc);
+                $this->itemfle->updateItemFields($imnidArray['iaid'], $filename);
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+
         // 面包屑导航项目
         $this->data['currproArray'] = $this->data['allproArray'] = NULL;
         $this->data['pmid'] = $this->params['pmid'];
@@ -394,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'];
@@ -406,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'];
@@ -450,17 +553,55 @@ 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']);
+        }
+
+
+        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);
     }
 
+    function getItemFileHistory()
+    {
+        if ($this->params['iaid']) {
+            $iaidArray = $this->itemfle->getItemFile($this->params['iaid']);
+            if ($iaidArray['oldiaid'] > 0) {
+                $oldiaidArray = $this->itemfle->getFileHistory($iaidArray['oldiaid']);
+                $htmlstr = '';
+                foreach ($oldiaidArray as $k => $v) {
+                    $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();
+            }
+        }
+    }
+
     Function fNumber($number)
     {
         if ($number == '')
@@ -652,25 +793,6 @@ class ProjectController extends DooController
         $this->render('welcome', $this->data);
     }
 
-    public function prolist()
-    {
-//	if (!$this->auth->isLoggedIn())
-//	    return Doo::conf()->APP_URL;
-//	$proArray = new stdClass();
-//	$jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
-//	$extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
-//	if ($handle = opendir($extPathdir)) {
-//	    while (false !== ($file = readdir($handle))) {
-//		$filename = pathinfo($file);
-//		if ($filename['extension'] == 'json')
-//		    $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
-//	    }
-//	    closedir($handle);
-//	}
-//	$this->data['proArray'] = null;
-        $this->render('s-project', $this->data);
-    }
-
 // ajax提取密码名称
     public function getAjaxSection()
     {
@@ -679,6 +801,12 @@ class ProjectController extends DooController
         echo json_encode($_POST);
     }
 
+    function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
+    {
+        $this->att->setUploadDir();
+        return $this->att->uploadMut($fildname, $param);
+    }
+
 }
 
 ?>

+ 226 - 17
protected/controller/RProjectController.php

@@ -7,10 +7,12 @@ Doo::loadClass('contractact');
 Doo::loadClass('actmeasure');
 Doo::loadClass('measureauditact');
 Doo::loadClass('numofperact');
-Doo::loadClass('itemmeasurenum');
-Doo::loadClass('itemfile');
 Doo::loadModelAt('aconfig', 'admin');
 Doo::loadClass('sms');
+Doo::loadClass('itemmeasurenum');
+Doo::loadClass('itemfile');
+Doo::loadClass('attachment');
+Doo::loadHelper('DooPager');
 
 /**
  * MainController
@@ -22,7 +24,7 @@ class RProjectController extends DooController
 {
 
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过'), $aconfig, $sms, $itemfile, $itemmeasurenum;
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过'), $aconfig, $sms, $itemfile, $itemmeasurenum, $itemfle, $att;
 
     public function __construct()
     {
@@ -37,6 +39,8 @@ class RProjectController extends DooController
         $this->itemfile = new ItemFile();
         $this->itemmeasurenum = new ItemMeasureNumpofper();
         $this->aconfig = new AConfig();
+        $this->itemfle = new ItemFile();
+        $this->att = new attachment();
         $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 'r';
@@ -229,30 +233,235 @@ class RProjectController extends DooController
         $this->render('r-project-section-measure', $this->data, TRUE);
     }
 
+
     function proSectionFiles()
     {
-        $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
-        foreach ($mpidArray as $k1 => $v1) {
-            if ($v1['pid'] != $this->params['pid'])
-                $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
+        if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $fileArray = $this->upItemFile('file')[0];
+                if (isset($fileArray['filepath'])) {
+                    $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
+                    if (isset($itemArray)) {
+                        if ($itemArray['oldiaid'] > 0) {
+                            $oldiaid = $itemArray['oldiaid'];
+                        } else {
+                            $oldiaid = $imnidArray['iaid'];
+                        }
+                        $postArray = array('ownerid' => $this->auth->getUid(), 'pid' => $itemArray['pid'], 'pmid' => $itemArray['pmid'], 'filename' => $fileArray['filename'], 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'oldiaid' => $oldiaid);
+                        $iaid = $this->itemfle->insertItemFileRecord($postArray);
+                        if ($iaid > 1) {
+                            $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
+                            echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                            die();
+                        }
+                    }
+                }
+            }
         }
-        $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
-        $this->data['itematta'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
-        foreach ($this->data['itematta'] as $k => $v) {
-            $fileArray = $this->itemfile->getItemFile($v['iaid']);
-            $this->data['itematta'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
-            $this->data['itematta'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
-            $this->data['itematta'][$k]['filename'] = $fileArray['filename'];
-            $this->data['itematta'][$k]['fileext'] = $fileArray['fileext'];
-            $this->data['itematta'][$k]['iaid'] = $fileArray['iaid'];
-            $this->data['itematta'][$k]['tips'] = $v['tips'];
+        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->auth->getUid());
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+        if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
+            $filename = $_POST['filename'];
+            $filedesc = $_POST['filedesc'];
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc);
+                $this->itemfle->updateItemFields($imnidArray['iaid'], $filename);
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+
+        // 面包屑导航项目
+        $this->data['currproArray'] = $this->data['allproArray'] = NULL;
+        $this->data['pmid'] = $this->params['pmid'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+        // 选取查询
+        $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 . 'rproject/' . $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 . 'rproject/' . $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 . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 30, 100);
+            } else {
+                $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $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'];
+            $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['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('r-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'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+
+        $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
+        if ($totalArchive) {
+            $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $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']);
+        }
+
+
+        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('r-project-section-files-recover', $this->data, TRUE);
+    }
+
     /**
      * @return actMeasure
      */

+ 259 - 13
protected/controller/SProjectController.php

@@ -8,6 +8,10 @@ Doo::loadClass('contractact');
 Doo::loadClass('actmeasure');
 Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
+Doo::loadClass('itemmeasurenum');
+Doo::loadClass('itemfile');
+Doo::loadClass('attachment');
+Doo::loadHelper('DooPager');
 
 /**
  * MainController
@@ -15,11 +19,13 @@ Doo::loadClass('measureauditact');
  *
  * @author darkredz
  */
-class SProjectController extends DooController {
+class SProjectController extends DooController
+{
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $measureauditact;
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $measureauditact, $itemmeasurenum, $itemfle, $att;
 
-    public function beforeRun($resource, $action) {
+    public function beforeRun($resource, $action)
+    {
 //	$uGroups = $this->profile->getProWithUid($this->auth->getUid());
 //	$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
 //	if (!$falg)
@@ -29,12 +35,13 @@ class SProjectController extends DooController {
             $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
             if (!$falg)
                 return Doo::acl()->defaultFailedRoute;
-        }else {
+        } else {
             return Doo::acl()->defaultFailedRoute;
         }
     }
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->auth = new Auth();
         $this->attfile = new attFile();
         $this->profile = new Profile();
@@ -43,6 +50,9 @@ class SProjectController extends DooController {
         $this->actmeasure = new actMeasure();
         $this->numofperact = new NumofperAct();
         $this->measureauditact = new MeasureauditAct();
+        $this->itemmeasurenum = new ItemMeasureNumpofper();
+        $this->itemfle = new ItemFile();
+        $this->att = new attachment();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 's';
         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
@@ -58,7 +68,8 @@ class SProjectController extends DooController {
         }
     }
 
-    public function index() {
+    public function index()
+    {
         $this->data['conArray'] = NULL;
         $conArray = $this->actmeasure->getGroupProject($this->auth->getUid());
         if (isset($conArray)) {
@@ -86,7 +97,8 @@ class SProjectController extends DooController {
         $this->render('s-project', $this->data, TRUE);
     }
 
-    public function proOverview() {
+    public function proOverview()
+    {
 //	$this->data['pros'] = $this->project->getAll();
 //	if (isset($_POST['pname']) && $_POST['pname']) {
 //	    $this->project->insertProject($_POST['pname']);
@@ -96,7 +108,8 @@ class SProjectController extends DooController {
         $this->render('w-project-detail', $this->data);
     }
 
-    public function proSection() {
+    public function proSection()
+    {
         $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
         foreach ($proArray as $v) {
             $pidArray[] = $v['pid'];
@@ -166,7 +179,8 @@ class SProjectController extends DooController {
         $this->render('s-project-section', $this->data, TRUE);
     }
 
-    public function proDetail() {
+    public function proDetail()
+    {
         $this->data['currproArray'] = $this->data['allproArray'] = NULL;
         $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
         foreach ($proArray as $v) {
@@ -222,12 +236,14 @@ class SProjectController extends DooController {
             }
         }
         $this->data['pid'] = $this->params['pid'];
+        $this->data['pmid'] = $this->params['pmid'];
         // 获取当前合同段的期数
 //	$this->data['allNumArray'] = $this->numofperact->getNumByStid(1);
         $this->render('s-project-section-detail', $this->data, TRUE);
     }
 
-    public function proMeasure() {
+    public function proMeasure()
+    {
         $MpidArray = $this->measureauditact->getRowByMpid(1);
         foreach ($MpidArray as $key => $value) {
             $uidArray = $value['uid'];
@@ -236,7 +252,8 @@ class SProjectController extends DooController {
         $this->render('s-project-section-measure', $this->data);
     }
 
-    Function fNumber($number) {
+    Function fNumber($number)
+    {
         if ($number == '')
             Return "-";
         $nlen = strlen($number);
@@ -252,7 +269,8 @@ class SProjectController extends DooController {
         Return $fNumber;
     }
 
-    public function welcome() {
+    public function welcome()
+    {
 //	if (!$this->auth->isLoggedIn())
 //	    return Doo::conf()->APP_URL;
         if ($this->profile->getProWithUid($_SESSION['uid'])['userid'])
@@ -266,7 +284,8 @@ class SProjectController extends DooController {
         $this->render('welcome', $this->data);
     }
 
-    public function prolist() {
+    public function prolist()
+    {
 //	if (!$this->auth->isLoggedIn())
 //	    return Doo::conf()->APP_URL;
 //	$proArray = new stdClass();
@@ -284,6 +303,233 @@ class SProjectController extends DooController {
         $this->render('s-project', $this->data);
     }
 
+    function proSectionFiles()
+    {
+        if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $fileArray = $this->upItemFile('file')[0];
+                if (isset($fileArray['filepath'])) {
+                    $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
+                    if (isset($itemArray)) {
+                        if ($itemArray['oldiaid'] > 0) {
+                            $oldiaid = $itemArray['oldiaid'];
+                        } else {
+                            $oldiaid = $imnidArray['iaid'];
+                        }
+                        $postArray = array('ownerid' => $this->auth->getUid(), 'pid' => $itemArray['pid'], 'pmid' => $itemArray['pmid'], 'filename' => $fileArray['filename'], 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'oldiaid' => $oldiaid);
+                        $iaid = $this->itemfle->insertItemFileRecord($postArray);
+                        if ($iaid > 1) {
+                            $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
+                            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) {
+                $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+        if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
+            $filename = $_POST['filename'];
+            $filedesc = $_POST['filedesc'];
+            $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
+            if ($imnidArray['iaid'] > 0) {
+                $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc);
+                $this->itemfle->updateItemFields($imnidArray['iaid'], $filename);
+                echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }
+
+        // 面包屑导航项目
+        $this->data['currproArray'] = $this->data['allproArray'] = NULL;
+        $this->data['pmid'] = $this->params['pmid'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+        // 选取查询
+        $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'];
+            $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['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('s-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'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+
+        $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
+        if ($totalArchive) {
+            $pager = new DooPager(Doo::conf()->APP_URL . 'sproject/' . $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']);
+        }
+
+
+        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('s-project-section-files-recover', $this->data, TRUE);
+    }
+
 }
 
 ?>

+ 2 - 2
protected/model/itematt.php

@@ -18,10 +18,10 @@ class ItemAtt extends DooModel
     public $filepath;
     public $intime;
     public $isdel;
-    public $tips;
+    public $oldiaid;
     public $_table = 'jl_item_attachment';
     public $_primarykey = 'iaid';
-    public $_fields = array('iaid', 'ownerid', 'pid', 'pmid', 'filename', 'fileext', 'filesize', 'filepath', 'intime', 'isdel', 'tips');
+    public $_fields = array('iaid', 'ownerid', 'pid', 'pmid', 'filename', 'fileext', 'filesize', 'filepath', 'intime', 'isdel', 'oldiaid');
 
     public function __construct()
     {

+ 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()
     {

+ 2 - 3
protected/view/r-project-section-detail.html

@@ -31,8 +31,7 @@
                         </a>
                         <ul class="dropdown-menu">
                             <!-- loop allproArray -->
-                            <li><a href="{{rootUrl}}sproject/{{allproArray' value.pid}}/section">{{allproArray'
-                                value.pname}}</a></li>
+                            <li><a href="{{rootUrl}}sproject/{{allproArray' value.pid}}/section">{{allproArray' value.pname}}</a></li>
                             <!-- endloop -->
                         </ul>
                     </li>
@@ -73,7 +72,7 @@
                     <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail">标段概况</a>
                 </li>
                 <li>
-                    <a href="/rproject/{{pid}}/section/{{pmid}}/files/{{mpid}}">附件</a>
+                    <a href="/rproject/{{pid}}/section/{{pmid}}/files">附件</a>
                 </li>
                 <!-- if {{mpid}}>0 -->
                 <li>

+ 319 - 0
protected/view/r-project-section-files-recover.html

@@ -0,0 +1,319 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray'
+                                value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allactmeasureArray -->
+                            <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>-->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active"><a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files">附件</a></li>
+                <!--<li><a href="w-project-section-measure.html">计量台帐</a></li>-->
+            </ul>
+            <!--导航-->
+
+            <div class="title">
+                <h1>附件回收站</h1>
+            </div>
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">期</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                            <th width="">删除</th>
+                            <th width="">删除时间</th>
+                            <th width="40">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr>
+                            <!-- 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="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <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>
+                            </td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+
+                    <div class="pagination">
+                        <ul>
+                            {{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 hide">
+                    <input type="hidden" id="imnid" value="0"/>
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在期</th>
+                            <td id="numpname">第二期</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td id="realname">陈工</td>
+                            <th width="60">上传时间</th>
+                            <td id="intime">2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <button class="btn btn-mini btn-danger" type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
+                                </button>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-success">恢复成功。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-error">彻底删除无法还原,所有清单下挂的该文件都将移除。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="del" class="btn btn-danger">确定删除</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-warning">文件上传者才有彻底删除权限。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</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: "/rproject/{{pid}}/section/{{pmid}}/files",
+                processData: false,
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}rproject/{{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: "/rproject/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-replace").show();
+                        window.location.href = "{{rootUrl}}rproject/{{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: "/rproject/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-del").hide();
+                        window.location.href = "{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files/recover";
+                    }
+                    if (data['status'] == 2) {
+                        $("#file-del2").show();
+                        $("#file-del").hide();
+                    }
+                }
+            });
+        });
+    });
+</script>
+</body>

+ 326 - 36
protected/view/r-project-section-files.html

@@ -22,17 +22,34 @@
         <div class="mainContent">
             <div class="title clearfix">
                 <ul class="nav nav-pills">
-                    <li class="dropdown"><a title="返回" href="{{rootUrl}}rproject/{{pid}}/section"><span
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
                             class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
                     <li class="dropdown">
-                        <a href="{{rootUrl}}sproject/{{currproArray.pid}}/section" data-toggle="dropdown"
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
                            class="dropdown-toggle">
-                            {{currproArray.pname}}<b class="caret"></b>
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
                         </a>
                         <ul class="dropdown-menu">
-                            <!-- loop allproArray -->
-                            <li><a href="{{rootUrl}}sproject/{{allproArray' value.pid}}/section">{{allproArray' value.pname}}</a></li>
+                            <!-- loop allactmeasureArray -->
+                            <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>-->
                         </ul>
                     </li>
                 </ul>
@@ -42,9 +59,7 @@
                 <li>
                     <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail">标段概况</a>
                 </li>
-                <li class="active">
-                    <a href="/rproject/{{pid}}/section/{{pmid}}/files/{{mpid}}">附件</a>
-                </li>
+                <li class="active"><a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files">附件</a></li>
                 <!-- if {{mpid}}>0 -->
                 <li>
                     <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/report/{{mpid}}">审批</a>
@@ -52,6 +67,28 @@
                 <!-- endif -->
             </ul>
             <!--导航-->
+            <!--筛选工具-->
+            <div class="clearfix">
+                <form class="form-inline">
+                    <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 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="/rproject/{{pid}}/section/{{pmid}}/files/recover" class="fR">附件回收站</a>
+                </form>
+            </div>
+            <!--筛选工具-->
             <!--文件管理-->
             <div class="filesWrap">
                 <div class="filesList">
@@ -59,52 +96,72 @@
                         <thead>
                         <tr>
                             <th width="">文件名</th>
+                            <th width="">期</th>
                             <th width="">节点</th>
                             <th width="">上传者</th>
                             <th width="">上传时间</th>
+                            <th width="40">操作</th>
                         </tr>
                         </thead>
                         <tbody>
-                        <!-- loop itematta -->
+                        <!-- loop itemMeasureArray -->
                         <tr>
-                            <td width=""><span class="fileico ico-{{itematta' value.fileext}}"></span><a
-                                    fileext="{{itematta' value.fileext}}"
+                            <td width=""><span class="fileico ico-jpg"></span><a
+                                    fileext="{{itemMeasureArray' value.fileext}}"
+                                    imnid="{{itematta' value.imnid}}"
                                     iaid="{{itematta' value.iaid}}"
-                                    filename="{{itematta' value.filename}}"
-                                    realname="{{itematta' value.realname}}"
-                                    intime="{{formatDate(itematta' value.intime,'Y-m-d')}}"
-                                    tips="{{itematta' value.tips}}"
+                                    filename="{{itemMeasureArray' value.filename}}"
+                                    realname="{{itemMeasureArray' value.realname}}"
+                                    intime="{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}"
+                                    tips="{{itemMeasureArray' value.tips}}"
                                     href="#"
-                                    numpname="第{{ToChinaseNum(itematta' value.numpname)}}期"
-                                    id="fname_{{itematta' value.imnid}}">{{itematta' value.filename}}</a></td>
-                            <td>{{itematta' value.pmname}}</td>
-                            <td width="">{{itematta' value.realname}}</td>
-                            <td width="">{{formatDate(itematta' value.intime,'Y-m-d')}}</td>
+                                    numpname="第{{ToChinaseNum(itemMeasureArray' value.numpname)}}期"
+                                    id="fname_{{itemMeasureArray' value.imnid}}">{{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>
+                                <div class="btn-group">
+                                    <a imnid="{{itemMeasureArray' value.imnid}}"
+                                       id="dropdown_{{itemMeasureArray' value.imnid}}"
+                                       class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
+                                        </li>
+                                        <li><a><i class="icon-download-alt"></i>&nbsp;下载</a></li>
+                                    </ul>
+                                </div>
+                            </td>
                         </tr>
                         <!-- endloop -->
                         </tbody>
                     </table>
+                    <div class="pagination">
+                        <ul>
+                            {{pager}}
+                        </ul>
+                    </div>
                 </div>
-                <div class="filesDetail">
+                <div class="filesDetail hide">
                     <table class="table table-striped">
                         <thead>
                         <tr>
                             <th colspan="4">文件详情</th>
-                            <input type="hidden" value="" id="uuid"/>
                         </tr>
                         </thead>
                         <tr>
                             <th width="60">文件名</th>
-                            <td colspan="3"><a href="#" id="filename" target="_blank">K0+800-K1+000图纸</a><span
-                                    class="fR"><button
-                                    class="btn btn-mini btn-primary" id="filedown"
-                                    type="button">下载</button></span></td>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
                         </tr>
                         <tr>
                             <th width="60">格式</th>
-                            <td id="fileext"><span class="fileico ico-jpg"></span>.jpg</td>
-                            <th width="60">所在</th>
-                            <td>台帐附件</td>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在</th>
+                            <td id="numpname">第二期</td>
                         </tr>
                         <tr>
                             <th width="60">上传者</th>
@@ -114,7 +171,24 @@
                         </tr>
                         <tr>
                             <th width="60">备注/描述</th>
-                            <td id="tips" colspan="3">内容内容内容内容</td>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <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" id="historyAtt" type="button" href="#file-history"
+                                        data-toggle="modal"><i class="icon-time icon-white"></i>历史版本
+                                </button>
+                                &nbsp;&nbsp;&nbsp;&nbsp;
+                                <button id="del"
+                                        imnid="" class="btn btn-mini btn-danger"
+                                        type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>删除
+                                </button>
+                            </td>
                         </tr>
                     </table>
                 </div>
@@ -124,6 +198,97 @@
         <!--内容-->
     </div>
 </div>
+<!-- 编辑弹出 -->
+<div id="file-edit" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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 class="form">
+            <form class="form-horizontal">
+                <input type="hidden" id="upimnid" name="upimnid" value=""/>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">文件名称</label>
+                    <div class="controls">
+                        <input name="upfilename" id="upfilename" type="text"/>
+                    </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">备注/描述</label>
+                    <div class="controls">
+                        <textarea name="upfiledesc" id="upfiledesc"></textarea>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="updateFileDesc" class="btn btn-primary">确定修改</button>
+    </div>
+</div>
+<!-- 编辑弹出 -->
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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 class="form">
+            <form class="form-horizontal">
+                <input type="hidden" name="fid" value="0" id="fid"/>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">选择文件</label>
+                    <div class="controls">
+                        <input name="file" id="file" type="file">
+                        <span class="help-block">替换新文件后,所有已下挂该文件的清单都将更新。</span>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="btreplacefile" class="btn btn-primary">确定替换</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-success">文件删除成功,您可以在附件回收站恢复它。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 历史版本弹出 -->
+<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 id="historyHTML" class="modal-body">
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 历史版本1弹出 -->
 <script type="text/javascript">autoFlashHeight();</script>
 <script type="text/javascript">
     $(document).ready(function () {
@@ -134,19 +299,144 @@
             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');
-            $("#filename").html(filename);
+            $("#fn").html(filename);
             $("#fileico").html(fileext);
             $("#realname").html(realname);
             $("#intime").html(intime);
             $("#tips").html(tips);
             $("#numpname").html(numpname);
-            $("#fileext").html(fileext);
-            $("#uuid").val(iaid);
+            $(".filesDetail").show();
+            $("#fid").val(imnid);
+            $("#iaid").val(iaid);
+        });
+
+        $("a[id^='dropdown_']").click(function () {
+            var imnid = $(this).attr('imnid');
+            $("#upimnid").val(imnid);
+        });
+
+        $("#del").click(function () {
+            var imnid = $(this).attr('imnid');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"imnid": imnid, "optype": 'del'},
+                url: "/rproject/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#updateFileDesc").click(function () {
+            var upfilename = $("#upfilename").val();
+            var upfiledesc = $("#upfiledesc").val();
+            var imnid = $("#upimnid").val();
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"upimnid": imnid, "filename": upfilename, "filedesc": upfiledesc},
+                url: "/rproject/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#btreplacefile").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: "/rproject/{{pid}}/section/{{pmid}}/files",
+                processData: false,
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#historyAtt").click(function () {
+            var iaid = $("#iaid").val();
+            $("#historyHTML").html('');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"iaid": iaid},
+                url: "/rproject/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;
+                }
+            }
         });
-        $("#filedown").click(function () {
-            var uuid = $("#uuid").val();
-            location.href = "{{rootUrl}}rproject/section/get/" + uuid + "/attachment";
+
+        $("#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>

+ 1 - 3
protected/view/s-project-section-detail.html

@@ -62,9 +62,7 @@
 			<li class="active">
 			    <a href="{{rootUrl}}sproject/{{pid}}/section/detail">标段概况</a>
 			</li>
-			<li>
-			    <!--<a href="{{rootUrl}}sproject/{{pid}}/section/measure">计量台帐</a>-->
-			</li>
+				<li><a href="{{rootUrl}}sproject/{{pid}}/section/{{pmid}}/files">附件</a></li>
 		    </ul>
 		    <div class="project">
 			<div class="proSection clearfix">

+ 319 - 0
protected/view/s-project-section-files-recover.html

@@ -0,0 +1,319 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray'
+                                value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allactmeasureArray -->
+                            <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>-->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active"><a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files">附件</a></li>
+                <!--<li><a href="w-project-section-measure.html">计量台帐</a></li>-->
+            </ul>
+            <!--导航-->
+
+            <div class="title">
+                <h1>附件回收站</h1>
+            </div>
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">期</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                            <th width="">删除</th>
+                            <th width="">删除时间</th>
+                            <th width="40">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr>
+                            <!-- 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="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <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>
+                            </td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+
+                    <div class="pagination">
+                        <ul>
+                            {{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 hide">
+                    <input type="hidden" id="imnid" value="0"/>
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在期</th>
+                            <td id="numpname">第二期</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td id="realname">陈工</td>
+                            <th width="60">上传时间</th>
+                            <td id="intime">2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <button class="btn btn-mini btn-danger" type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
+                                </button>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-success">恢复成功。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-error">彻底删除无法还原,所有清单下挂的该文件都将移除。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="del" class="btn btn-danger">确定删除</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-warning">文件上传者才有彻底删除权限。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</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: "/sproject/{{pid}}/section/{{pmid}}/files",
+                processData: false,
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}sproject/{{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: "/sproject/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-replace").show();
+                        window.location.href = "{{rootUrl}}sproject/{{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: "/sproject/{{pid}}/section/{{pmid}}/files/recover",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        $("#file-del").hide();
+                        window.location.href = "{{rootUrl}}sproject/{{pid}}/section/{{pmid}}/files/recover";
+                    }
+                    if (data['status'] == 2) {
+                        $("#file-del2").show();
+                        $("#file-del").hide();
+                    }
+                }
+            });
+        });
+    });
+</script>
+</body>

+ 443 - 0
protected/view/s-project-section-files.html

@@ -0,0 +1,443 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allactmeasureArray -->
+                            <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>-->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active"><a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/files">附件</a></li>
+                <!-- if {{mpid}}>0 -->
+                <li>
+                    <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/report/{{mpid}}">审批</a>
+                </li>
+                <!-- endif -->
+            </ul>
+            <!--导航-->
+            <!--筛选工具-->
+            <div class="clearfix">
+                <form class="form-inline">
+                    <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 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="/sproject/{{pid}}/section/{{pmid}}/files/recover" class="fR">附件回收站</a>
+                </form>
+            </div>
+            <!--筛选工具-->
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">期</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                            <th width="40">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <!-- loop itemMeasureArray -->
+                        <tr>
+                            <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}}">{{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>
+                                <div class="btn-group">
+                                    <a imnid="{{itemMeasureArray' value.imnid}}"
+                                       id="dropdown_{{itemMeasureArray' value.imnid}}"
+                                       class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
+                                        </li>
+                                        <li><a><i class="icon-download-alt"></i>&nbsp;下载</a></li>
+                                    </ul>
+                                </div>
+                            </td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+                    <div class="pagination">
+                        <ul>
+                            {{pager}}
+                        </ul>
+                    </div>
+                </div>
+                <div class="filesDetail hide">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在期</th>
+                            <td id="numpname">第二期</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td id="realname">陈工</td>
+                            <th width="60">上传时间</th>
+                            <td id="intime">2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <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" id="historyAtt" type="button" href="#file-history"
+                                        data-toggle="modal"><i class="icon-time icon-white"></i>历史版本
+                                </button>
+                                &nbsp;&nbsp;&nbsp;&nbsp;
+                                <button id="del"
+                                        imnid="" class="btn btn-mini btn-danger"
+                                        type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>删除
+                                </button>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<!-- 编辑弹出 -->
+<div id="file-edit" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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 class="form">
+            <form class="form-horizontal">
+                <input type="hidden" id="upimnid" name="upimnid" value=""/>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">文件名称</label>
+                    <div class="controls">
+                        <input name="upfilename" id="upfilename" type="text"/>
+                    </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">备注/描述</label>
+                    <div class="controls">
+                        <textarea name="upfiledesc" id="upfiledesc"></textarea>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="updateFileDesc" class="btn btn-primary">确定修改</button>
+    </div>
+</div>
+<!-- 编辑弹出 -->
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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 class="form">
+            <form class="form-horizontal">
+                <input type="hidden" name="fid" value="0" id="fid"/>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">选择文件</label>
+                    <div class="controls">
+                        <input name="file" id="file" type="file">
+                        <span class="help-block">替换新文件后,所有已下挂该文件的清单都将更新。</span>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button id="btreplacefile" class="btn btn-primary">确定替换</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <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">
+        <h5 class="text-success">文件删除成功,您可以在附件回收站恢复它。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 历史版本弹出 -->
+<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 id="historyHTML" class="modal-body">
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 历史版本1弹出 -->
+<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);
+            $(".filesDetail").show();
+            $("#fid").val(imnid);
+            $("#iaid").val(iaid);
+        });
+
+        $("a[id^='dropdown_']").click(function () {
+            var imnid = $(this).attr('imnid');
+            $("#upimnid").val(imnid);
+        });
+
+        $("#del").click(function () {
+            var imnid = $(this).attr('imnid');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"imnid": imnid, "optype": 'del'},
+                url: "/sproject/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}sproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#updateFileDesc").click(function () {
+            var upfilename = $("#upfilename").val();
+            var upfiledesc = $("#upfiledesc").val();
+            var imnid = $("#upimnid").val();
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"upimnid": imnid, "filename": upfilename, "filedesc": upfiledesc},
+                url: "/sproject/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}sproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#btreplacefile").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: "/sproject/{{pid}}/section/{{pmid}}/files",
+                processData: false,
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}sproject/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#historyAtt").click(function () {
+            var iaid = $("#iaid").val();
+            $("#historyHTML").html('');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"iaid": iaid},
+                url: "/sproject/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 - 3
protected/view/w-project-section-detail.html

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

+ 131 - 66
protected/view/w-project-section-files-recover.html

@@ -14,44 +14,9 @@
     <script src="{{rootUrl}}global/js/jl.js"></script>
 </head>
 <body>
-<div class="wrapHeader"><h1 title="纵横计量支付" class="mainLogo"></h1>
-    <div class="userInfo"><img src="images/avtra.png" class="fR">
-        <div class="btn-group">
-            <button data-toggle="dropdown" class="btn btn-inverse dropdown-toggle">张三&nbsp;<span class="caret"></span>
-            </button>
-            <ul class="dropdown-menu">
-                <li><a href="#">个人信息</a></li>
-                <li><a href="#"><span data-icon="r" aria-hidden="true"></span>&nbsp;工作组</a></li>
-                <li><a href="#"><span data-icon="B" aria-hidden="true"></span>&nbsp;我的任务</a></li>
-                <li class="divider"></li>
-                <li><a href="#">帮助中心</a></li>
-                <li><a href="#">退出</a></li>
-            </ul>
-        </div>
-    </div>
-</div>
+<!-- include "top" -->
 <div class="wrapContent">
-    <div class="mainSidebar">
-        <div class="mainNav">
-            <ul>
-                <li><a href="w-project.html" title="项目管理" class="focus">
-                    <div data-icon="A" aria-hidden="true" class="navIcon"></div>
-                    项目管理</a></li>
-                <li><a href="r-project.html" title="需审批项目">
-                    <div data-icon="C" aria-hidden="true" class="navIcon"></div>
-                    审批项目</a><span class="badge badge-warning">4</span></li>
-                <li><a href="s-project.html" title="我编制的项目">
-                    <div data-icon="B" aria-hidden="true" class="navIcon"></div>
-                    编制项目</a></li>
-                <li><a href="" title="生成报表">
-                    <div data-icon="D" aria-hidden="true" class="navIcon"></div>
-                    报表</a></li>
-                <li><a href="" title="数据汇总">
-                    <div data-icon="E" aria-hidden="true" class="navIcon"></div>
-                    汇总</a></li>
-            </ul>
-        </div>
-    </div>
+    <!-- include "left" -->
     <div class="mainContainer">
         <!--内容-->
         <div class="mainContent">
@@ -69,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>
@@ -81,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>-->
@@ -120,14 +87,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 +113,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 +126,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 +149,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 +173,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 +210,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 +232,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>

+ 163 - 48
protected/view/w-project-section-files.html

@@ -66,19 +66,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 +105,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')}}"
@@ -117,7 +119,9 @@
                             <td width="">{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}</td>
                             <td>
                                 <div class="btn-group">
-                                    <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
+                                    <a imnid="{{itemMeasureArray' value.imnid}}"
+                                       id="dropdown_{{itemMeasureArray' value.imnid}}"
+                                       class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
                                         <span class="caret"></span>
                                     </a>
                                     <ul class="dropdown-menu">
@@ -134,16 +138,11 @@
                     </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>
-                <div class="filesDetail">
+                <div class="filesDetail hide">
                     <table class="table table-striped">
                         <thead>
                         <tr>
@@ -176,11 +175,13 @@
                                 <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;
-                                <button id="deletefile" class="btn btn-mini btn-danger" type="button" href="#file-del"
+                                <button id="del"
+                                        imnid="" class="btn btn-mini btn-danger"
+                                        type="button" href="#file-del"
                                         data-toggle="modal"><i class="icon-remove icon-white"></i>删除
                                 </button>
                             </td>
@@ -203,17 +204,17 @@
     <div class="modal-body">
         <div class="form">
             <form class="form-horizontal">
+                <input type="hidden" id="upimnid" name="upimnid" value=""/>
                 <div class="control-group">
                     <label class="control-label" for="inputEmail">文件名称</label>
                     <div class="controls">
-                        <input name="filename" id="filename" type="text">
+                        <input name="upfilename" id="upfilename" type="text"/>
                     </div>
                 </div>
-                </div>
                 <div class="control-group">
                     <label class="control-label" for="inputEmail">备注/描述</label>
                     <div class="controls">
-                        <textarea name="filedesc" id="filedesc"></textarea>
+                        <textarea name="upfiledesc" id="upfiledesc"></textarea>
                     </div>
                 </div>
             </form>
@@ -221,7 +222,7 @@
     </div>
     <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
-        <button class="btn btn-primary">确定修改</button>
+        <button id="updateFileDesc" class="btn btn-primary">确定修改</button>
     </div>
 </div>
 <!-- 编辑弹出 -->
@@ -235,10 +236,11 @@
     <div class="modal-body">
         <div class="form">
             <form class="form-horizontal">
+                <input type="hidden" name="fid" value="0" id="fid"/>
                 <div class="control-group">
                     <label class="control-label" for="inputEmail">选择文件</label>
                     <div class="controls">
-                        <input type="file">
+                        <input name="file" id="file" type="file">
                         <span class="help-block">替换新文件后,所有已下挂该文件的清单都将更新。</span>
                     </div>
                 </div>
@@ -247,7 +249,7 @@
     </div>
     <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
-        <button class="btn btn-primary">确定替换</button>
+        <button id="btreplacefile" class="btn btn-primary">确定替换</button>
     </div>
 </div>
 <!-- 替换弹出 -->
@@ -270,29 +272,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 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>
-        <div class="media">
-            <div class="pull-left">
-                <h4>#2</h4>
-            </div>
-            <div class="media-body">
-                <h5>陈特&nbsp;上传于 2016-9-24 17:30</h5>
-                <a href="#" target="_blank">dfsdf.png</a>
-            </div>
-        </div>
+    <div id="historyHTML" class="modal-body">
     </div>
     <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
@@ -310,15 +295,145 @@
             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);
+            $(".filesDetail").show();
+            $("#fid").val(imnid);
+            $("#iaid").val(iaid);
+            $("#del").attr("imnid", imnid);
+        });
+
+        $("a[id^='dropdown_']").click(function () {
+            var imnid = $(this).attr('imnid');
+            $("#upimnid").val(imnid);
+        });
+
+        $("#del").click(function () {
+            var imnid = $(this).attr('imnid');
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"imnid": imnid, "optype": 'del'},
+                url: "/project/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}project/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#updateFileDesc").click(function () {
+            var upfilename = $("#upfilename").val();
+            var upfiledesc = $("#upfiledesc").val();
+            var imnid = $("#upimnid").val();
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"upimnid": imnid, "filename": upfilename, "filedesc": upfiledesc},
+                url: "/project/{{pid}}/section/{{pmid}}/files",
+                success: function (data) {
+                    if (data['status'] == 1) {
+                        window.location.href = "{{rootUrl}}project/{{pid}}/section/{{pmid}}/files";
+                    }
+                }
+            });
+        });
+
+        $("#btreplacefile").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";
+                    }
+                }
+            });
+        });
+
+        $("#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;
+                }
+            }
         });
-        $("#deletefile").click(function () {
 
+        $("#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>

+ 5 - 1
附件.sql

@@ -21,4 +21,8 @@ CREATE TABLE IF NOT EXISTS `jl_item_measure_numofper` (
   `categoryid` mediumint(9) NOT NULL,
   `tips` text NOT NULL,
   PRIMARY KEY (`imnid`)
-) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
+
+ALTER TABLE  `jl_item_attachment` ADD  `oldiaid` MEDIUMINT NOT NULL ;
+
+ALTER TABLE  `jl_item_measure_numofper` ADD  `deluid` MEDIUMINT NOT NULL AFTER  `deltime` ;