laiguoran před 5 roky
rodič
revize
8a484f52bc

+ 1 - 0
214to217.sql

@@ -0,0 +1 @@
+ALTER TABLE `jl_project` ADD `switch_change` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '变更管理是否启动,1为启动,0为关闭' AFTER `intime`;

+ 3 - 2
global/js/jlzf-change-pnumset.js

@@ -681,8 +681,9 @@ function makedecimals(num){
 function roundnum(val,decimals){
     if(val !== ''){
         val = parseFloat(val);
+        var _sign = (val < 0) ? -1 : 1;
         if(decimals < 1){
-            val = (Math.round(val)).toString();
+            val = (Math.round(val * _sign)/_sign).toString();
         }else{
             var num = val.toString();
             if(num.lastIndexOf('.') == -1){
@@ -695,7 +696,7 @@ function roundnum(val,decimals){
                     // num += makezero(parseInt(decimals)-parseInt(valdecimals));
                     val = num;
                 }else if(parseInt(valdecimals) > parseInt(decimals)){
-                    val = parseFloat(val) != 0 ? Math.round(val.mul(makemultiple(decimals))).div(makemultiple(decimals)) : makedecimalzero(decimals);
+                    val = parseFloat(val) != 0 ? Math.round(val.mul(makemultiple(decimals))*_sign).div(makemultiple(decimals)*_sign) : makedecimalzero(decimals);
                     var num = val.toString();
                     if(num.lastIndexOf('.') == -1){
                         // num += '.';

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
global/js/jlzf-change-pnumset.min.js


+ 7 - 6
jlweb214.sql

@@ -164,9 +164,9 @@ CREATE TABLE `jl_change_audit_list` (
   `lnum` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '清单编号',
   `lname` varchar(500) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称',
   `unit` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT '单位',
-  `unitprice` float NOT NULL COMMENT '单价',
-  `oamount` float NOT NULL COMMENT '原数量',
-  `camount` float NOT NULL COMMENT '变更数量',
+  `unitprice` double NOT NULL COMMENT '单价',
+  `oamount` double NOT NULL COMMENT '原数量',
+  `camount` double NOT NULL COMMENT '变更数量',
   `samount` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT '审批变更后数量',
   `auditjson` varchar(5000) COLLATE utf8_unicode_ci NOT NULL COMMENT '用户变更json数据'
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='变更用户申报清单关联表';
@@ -200,8 +200,8 @@ CREATE TABLE `jl_change_list` (
   `lnum` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '清单编号',
   `lname` varchar(500) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称',
   `unit` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT '单位',
-  `unitprice` float NOT NULL COMMENT '单价',
-  `amount` float NOT NULL COMMENT '数量'
+  `unitprice` double NOT NULL COMMENT '单价',
+  `amount` double NOT NULL COMMENT '数量'
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='签约清单表';
 
 -- --------------------------------------------------------
@@ -345,7 +345,8 @@ CREATE TABLE `jl_project` (
   `pid` int(11) NOT NULL,
   `uid` mediumint(9) NOT NULL,
   `pname` char(255) NOT NULL,
-  `intime` int(11) NOT NULL
+  `intime` int(11) NOT NULL,
+  `switch_change` tinyint(1) NOT NULL DEFAULT '1' COMMENT '变更管理是否启动,1为启动,0为关闭'
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 -- --------------------------------------------------------

+ 6 - 1
protected/class/actmeasure.php

@@ -43,7 +43,12 @@ class actMeasure
 
     public function getRowUser2($uid)
     {
-        return $this->__mmeasure->find(array('where' => 'uid=?', 'param' => array($uid), 'asc' => 'convert(pmname using gbk)', 'asArray' => TRUE));
+        $sql = 'SELECT a.* FROM `jl_project_measure` as a join `jl_project` as b on a.pid=b.pid WHERE a.uid='.$uid.' and b.switch_change=1 order by convert(a.pmname using gbk)';
+        $query = Doo::db ()->query ( $sql );
+
+        $result = $query->fetchAll ();
+        return $result;
+//        return $this->__mmeasure->find(array('where' => 'uid=?', 'param' => array($uid), 'asc' => 'convert(pmname using gbk)', 'asArray' => TRUE));
     }
 
     public function getGroupProject($uid)

+ 8 - 8
protected/class/change.php

@@ -81,9 +81,9 @@ class Changes
     public function getListbyMydetail($pmid='',$uid,$limit)
     {
         if(empty($pmid)){
-            return $this->__change->find(array('where' => '(status="checking" or status="back" or status="uncheck") and cid in(select `jl_change_audit`.cid from `jl_change_audit` where `jl_change_audit`.uid=? and `jl_change_audit`.status="checking")', 'param' => array($uid), 'desc' => 'cid', 'limit' => $limit, 'asArray' => TRUE));
+            return $this->__change->find(array('where' => '(status="checking" or status="back" or status="uncheck") and cid in(select `jl_change_audit`.cid from `jl_change_audit` where `jl_change_audit`.uid=? and `jl_change_audit`.status="checking") and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)', 'param' => array($uid), 'desc' => 'cid', 'limit' => $limit, 'asArray' => TRUE));
         }else{
-            return $this->__change->find(array('where' => 'pmid=? and (status="checking" or status="back" or status="uncheck") and cid in(select `jl_change_audit`.cid from `jl_change_audit` where `jl_change_audit`.uid=? and `jl_change_audit`.status="checking")', 'param' => array($pmid,$uid), 'desc' => 'cid', 'limit' => $limit, 'asArray' => TRUE));
+            return $this->__change->find(array('where' => 'pmid=? and (status="checking" or status="back" or status="uncheck") and cid in(select `jl_change_audit`.cid from `jl_change_audit` where `jl_change_audit`.uid=? and `jl_change_audit`.status="checking") and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)', 'param' => array($pmid,$uid), 'desc' => 'cid', 'limit' => $limit, 'asArray' => TRUE));
         }
     }
 
@@ -152,9 +152,9 @@ class Changes
     public function getChangebyPnumPmid($pnum,$pmid,$cid = '')
     {
         if($cid != ''){
-            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and cid!=? and status!="del"', 'param' => array($pnum,$pmid,$cid), 'asArray' => TRUE));
+            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and cid!=? and status!="del" and status!="checkno"', 'param' => array($pnum,$pmid,$cid), 'asArray' => TRUE));
         }else{
-            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and status!="del"', 'param' => array($pnum,$pmid), 'asArray' => TRUE));
+            return $this->__change->getOne(array('where' => 'pnum=? and pmid=? and status!="del" and status!="checkno"', 'param' => array($pnum,$pmid), 'asArray' => TRUE));
         }
 
     }
@@ -215,13 +215,13 @@ class Changes
     //changeaudit
     public function getNeedChangeNumbyUid($uid)
     {
-        return $this->__changeaudit->count(array('where' => 'uid=? and status="checking"', 'param' => array($uid), 'asArray' => TRUE));
+        return $this->__changeaudit->count(array('where' => 'uid=? and status="checking" and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)', 'param' => array($uid), 'asArray' => TRUE));
     }
 
     public function getPmidGroup($uid)
     {
         // return $this->__changeaudit->find(array('where' => 'uid=? and cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck")', 'param' => array($uid), 'groupby' => 'pmid', 'asArray' => TRUE));
-        $sql = 'SELECT a.* FROM `jl_change_audit` as a join `jl_project_measure` as b on a.pmid=b.pmid WHERE a.uid='.$uid.' and a.cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck") GROUP BY a.pmid order by convert(b.pmname using gbk)';
+        $sql = 'SELECT a.* FROM `jl_change_audit` as a join `jl_project_measure` as b on a.pmid=b.pmid WHERE a.uid='.$uid.' and a.cid in (SELECT `jl_change`.`cid` FROM `jl_change` WHERE `jl_change`.status!="uncheck") and a.pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1) GROUP BY a.pmid order by convert(b.pmname using gbk)';
         $query = Doo::db ()->query ( $sql );
 
         $result = $query->fetchAll ();
@@ -232,9 +232,9 @@ class Changes
     public function getNumbyMydetail($pmid='',$uid)
     {
         if(empty($pmid)){
-            return $this->__changeaudit->count(array('where' => 'uid=? and status="checking"', 'param' => array($uid), 'asArray' => TRUE));
+            return $this->__changeaudit->count(array('where' => 'uid=? and status="checking" and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)', 'param' => array($uid), 'asArray' => TRUE));
         }else{
-            return $this->__changeaudit->count(array('where' => 'pmid=? and uid=? and status="checking"', 'param' => array($pmid,$uid), 'asArray' => TRUE));
+            return $this->__changeaudit->count(array('where' => 'pmid=? and uid=? and status="checking" and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)', 'param' => array($pmid,$uid), 'asArray' => TRUE));
         }
     }
 

+ 10 - 2
protected/class/project.php

@@ -12,13 +12,14 @@ class Project
         $this->pro = new Pro();
     }
 
-    public function insertProject($uid, $pname)
+    public function insertProject($uid, $pname, $switch_change)
     {
         if (!isset($pname) && $pname)
             return FALSE;
         $this->pro->uid = filter_var($uid, FILTER_VALIDATE_INT);
         $this->pro->pname = filter_var($pname, FILTER_SANITIZE_STRING);
         $this->pro->intime = time();
+        $this->pro->switch_change = $switch_change;
         return $this->pro->insert();
     }
 
@@ -47,9 +48,10 @@ class Project
         return $this->pro->find(array('where' => 'uid=?', 'param' => array($uid), 'asArray' => TRUE));
     }
 
-    public function updateProName($pid, $pname)
+    public function updateProName($pid, $pname, $switch_change)
     {
         $this->pro->pname = filter_var($pname, FILTER_SANITIZE_STRING);
+        $this->pro->switch_change = $switch_change;
         return $this->pro->update(array('where' => 'pid=?', 'param' => array($pid)));
     }
 
@@ -57,6 +59,12 @@ class Project
     {
         return $this->pro->delete(array('where' => 'pid=?', 'param' => array($pid)));
     }
+
+    public function getswitchChange($pid)
+    {
+        $result = $this->pro->getOne(array('where' => 'pid=?', 'param' => array($pid), 'asArray' => TRUE));
+        return $result['switch_change'];
+    }
 }
 
 ?>

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

@@ -446,4 +446,9 @@ $route['*']['/api/client/change/get/:pmid/list'] = array('ClientController', 'ch
  * 软件删除变更令后返回结果
  */
 $route['*']['/api/client/change/delete'] = array('ClientController', 'changeDelete');
+
+/**
+ * 软件变更管理查询开关
+ */
+$route['*']['/api/client/change/switch'] = array('ClientController', 'changeSwitch');
 ?>

+ 1 - 1
protected/config/ver.conf.php

@@ -1,5 +1,5 @@
 <?php
 
 // Version
-$config['ver'] = 'v2.1.5';
+$config['ver'] = 'v2.1.7';
 

+ 1 - 1
protected/controller/ChangeController.php

@@ -205,7 +205,7 @@ class ChangeController extends DooController
                 array_push($pmidArray,$clv['pmid']);
             }
         }
-        $sql = '';
+        $sql = ' and pid in (SELECT `jl_project`.`pid` FROM `jl_project` WHERE `jl_project`.`switch_change`=1)';
         $pmid = isset($this->params['pmid']) ? $this->params['pmid'] : '';
         $userchangepower = 1;
         if(!empty($prolist)){

+ 20 - 0
protected/controller/ClientController.php

@@ -2056,6 +2056,26 @@ class ClientController extends DooController
     }
 
     /**
+     * 软件变更管理查询开关
+     */
+    public function changeSwitch(){
+        if(isset($_POST['id']) && is_numeric($_POST['id'])){
+            $tendermsg = $this->actmeasure->getRowByPmid($_POST['id']);
+            if(!empty($tendermsg)){
+                $result = $this->project->getswitchChange($tendermsg['pid']);
+                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $result), JSON_UNESCAPED_UNICODE);
+                die();
+            }else{
+                echo json_encode(array('status' => 'FALSE', 'msg' => '标段不存在'), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        }else{
+            echo json_encode(array('status' => 'FALSE', 'msg' => '参数有误'), JSON_UNESCAPED_UNICODE);
+            die();
+        }
+    }
+
+    /**
      * 中间计量表添加草图功能开关
      */
     public function interMediateSwitch(){

+ 4 - 4
protected/controller/ProjectController.php

@@ -102,12 +102,12 @@ class ProjectController extends DooController
      */
     public function index()
     {
-        if (isset($_POST['pname']) && $_POST['pname']) {
-            $this->project->insertProject($this->auth->getUid(), $_POST['pname']);
+        if (isset($_POST['pname']) && $_POST['pname'] && isset($_POST['switch_change'])) {
+            $this->project->insertProject($this->auth->getUid(), $_POST['pname'], $_POST['switch_change']);
             return Doo::conf()->APP_URL . 'project/index';
         }
-        if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid']) {
-            $this->project->updateProName($_POST['ppid'], $_POST['target_pname']);
+        if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid'] && isset($_POST['switch_change'])) {
+            $this->project->updateProName($_POST['ppid'], $_POST['target_pname'], $_POST['switch_change']);
             return Doo::conf()->APP_URL . 'project/index';
         }
         if (isset($_POST['proid']) && is_numeric($_POST['proid']) && isset($_POST['delpro'])) {

+ 2 - 1
protected/model/pro.php

@@ -11,9 +11,10 @@ class Pro extends DooModel {
     public $uid;
     public $pname;
     public $intime;
+    public $switch_change;
     public $_table = 'jl_project';
     public $_primarykey = 'pid';
-    public $_fields = array('pid', 'uid', 'pname', 'intime');
+    public $_fields = array('pid', 'uid', 'pname', 'intime', 'switch_change');
 
     public function __construct() {
 	parent::setupModel(__CLASS__);

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

@@ -143,8 +143,10 @@
                                     </a>
                                     <ul class="dropdown-menu">
                                         <!--<li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>-->
+                                        <!-- if {{itemMeasureArray' value.ownerid}} == {{user.userid}} -->
                                         <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
                                         </li>
+                                        <!-- endif -->
                                         <li><a id="down_{{itemMeasureArray' value.imnid}}" iaid="{{itemMeasureArray' value.iaid}}"><i class="icon-download-alt"></i>&nbsp;下载</a></li>
                                     </ul>
                                 </div>

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

@@ -139,8 +139,10 @@
                                     </a>
                                     <ul class="dropdown-menu">
                                         <!--<li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>-->
+                                        <!-- if {{itemMeasureArray' value.ownerid}} == {{user.userid}} -->
                                         <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
                                         </li>
+                                        <!-- endif -->
                                         <li><a id="down_{{itemMeasureArray' value.imnid}}" iaid="{{itemMeasureArray' value.iaid}}"><i class="icon-download-alt"></i>&nbsp;下载</a></li>
                                     </ul>
                                 </div>

+ 2 - 0
protected/view/w-project-section-files.html

@@ -139,8 +139,10 @@
                                     </a>
                                     <ul class="dropdown-menu">
                                         <!--<li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>-->
+                                        <!-- if {{itemMeasureArray' value.ownerid}} == {{user.userid}} -->
                                         <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
                                         </li>
+                                        <!-- endif -->
                                         <li><a id="down_{{itemMeasureArray' value.imnid}}" iaid="{{itematta' value.iaid}}"><i class="icon-download-alt"></i>&nbsp;下载</a></li>
                                     </ul>
                                 </div>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 26 - 2
protected/view/w-project.html