Переглянути джерело

会议新增修改会议室

q 1 рік тому
батько
коміт
7deec4b0db

+ 3 - 0
webmain/flow/input/inputjs/mode_meeting.js

@@ -10,6 +10,9 @@ function initbodys(){
         changetotal();
     });
 
+    $("#div_room_id").hide();
+
+
     c.onselectdata['meeting_room']=function(d) {
         form('room_id').value=d.value;
         console.log(d.value);

Різницю між файлами не показано, бо вона завелика
+ 90 - 1
webmain/flow/page/view_meeting_0.html


+ 2 - 6
webmain/flow/page/view_meeting_key_0.html

@@ -12,9 +12,7 @@
     </tr>
     <tr>
         <td height="34" width="15%" align="right" class="ys1">^compere^</td>
-        <td width="35%" class="ys2">{compere}</td>
-        <td height="34" align="right" class="ys1"></td>
-        <td class="ys2"></td>
+        <td width="35%" class="ys2" colspan="3">{compere}</td>
     </tr>
     <tr>
         <td height="34" align="right" class="ys1">^attendees^</td>
@@ -26,9 +24,7 @@
     </tr>
     <tr>
         <td height="34" width="15%" align="right" class="ys1">^meeting_room^</td>
-        <td width="35%" class="ys2">{meeting_room}</td>
-        <td height="34" align="right" class="ys1"></td>
-        <td class="ys2"></td>
+        <td width="35%" class="ys2" colspan="3">{meeting_room}</td>
     </tr>
     <tr>
         <td class="ys2" style="background-color:#CCCCCC;" colspan="4"><strong>会议议题</strong></td>

+ 41 - 20
webmain/model/flow/meetingModel.php

@@ -3,7 +3,7 @@
 class flow_meetingClassModel extends flowModel
 {
 
-    public $hyarra, $ytarra, $hyarrb, $dbobj, $reatearr;
+    public $hyarra, $ytarra, $hyarrb, $dbobj, $reatearr, $meeting_room;
 
     public function initModel()
     {
@@ -12,6 +12,8 @@ class flow_meetingClassModel extends flowModel
         $this->hyarrb 	= array('green','blue','#ff6600','#888888');
         $this->dbobj	= c('date');
 
+        $this->meeting_room = m("meeting_room")->meetingRoomIdList();
+
         $this->reatearr = array(
             'd' => '每天',
             'w1' => '每周一',
@@ -26,6 +28,11 @@ class flow_meetingClassModel extends flowModel
         );
     }
 
+    //录入页上的标题
+    public function inputtitle() {
+        return "会议室审批单";
+    }
+
     //子表数据替换处理$lx=0编辑时,1展示时
     protected function flowsubdata($rows, $lx=0){
 
@@ -48,8 +55,10 @@ class flow_meetingClassModel extends flowModel
 
 //        m('log')->addlog('会议单据', json_encode($rs, true));
 
+        $this->id    = $rs['id'];
         $zt 		 = $rs['meet_state'];
-        $is_hand 	 = $rs['is_hand'];
+        $is_hand 	 = $rs['is_hand'] ?? 0;
+        $room_id 	 = $rs['room_id'];
         $nzt 		 = $zt;
         $time 		 = time();
 
@@ -57,7 +66,7 @@ class flow_meetingClassModel extends flowModel
         $etime 	= strtotime($rs['end_time']);
 
 
-        if($is_hand != 2){
+        if($is_hand != 1){
             if($etime < $time){
                 $nzt = 2;
             } else if ($stime > $time){
@@ -83,6 +92,7 @@ class flow_meetingClassModel extends flowModel
 
         // 将id转换为文字
         $rs['meet_state'] = $this->getstatezt($zt);
+        if (!empty($room_id)) $rs['room_id'] = $this->meeting_room[$room_id]['room_name'];
 
 
         return $rs;
@@ -117,7 +127,7 @@ class flow_meetingClassModel extends flowModel
             }
 
             if (isset($topics[count($topics) - 1]) && $topics[count($topics) - 1]['topic_state'] == 2) {
-                m('meeting')->update(['is_hand'=>2,'meet_state'=>2], "id={$this->id}");
+                m('meeting')->update(['is_hand'=>1,'meet_state'=>2], "id={$this->id}");
             }
 
         } else if ($ors['num'] == 'enableMeeting') {
@@ -130,12 +140,12 @@ class flow_meetingClassModel extends flowModel
             if ($stime < $time){
                 $data = [
                     'meet_state'=>1,
-                    'is_hand'=>2
+                    'is_hand'=>1
                 ];
             } else if ($stime >= $time) {
                 $data = [
                     'meet_state'=>0,
-                    'is_hand'=>2
+                    'is_hand'=>1
                 ];
             }
             m('meeting')->update($data, "id={$this->id}");
@@ -148,10 +158,23 @@ class flow_meetingClassModel extends flowModel
 
 //            $data = [
 //                'meet_state'=>2,
-//                'is_hand'=>2
+//                'is_hand'=>1
 //            ];
 //
 //            m('meeting_key')->update($data, "id={$this->id}");
+        } else if ($ors['num'] == "noup") {
+
+            //  动作名
+            if ($ors['actname'] == "change_room") {
+                $data = $this->rs;
+                $roomName = $this->meeting_room[$data['room_id']]['room_name'];
+                if (!empty($roomName)) {
+                    $this->update([
+                        "meeting_room"=>$roomName,
+                    ], "id={$this->id}");
+                }
+            }
+
         }
     }
 
@@ -185,30 +208,28 @@ class flow_meetingClassModel extends flowModel
         }
 
         if (!empty($depts)) {
-            $deptSql = "select distinct b.mobile from [Q]dept a left join [Q]admin b on a.headid = b.id where a.id in (".implode(',', $depts).") and a.headid is not null";
+            $deptSql = "select distinct b.mobile, a.name from [Q]dept a left join [Q]admin b on a.headid = b.id where a.id in (".implode(',', $depts).") ";
             m("log")->addlog("会议室审批", $deptSql);
             $depts = $this->db->getall($deptSql);
+            $depts_e = [];
             // 部门负责人手机号
             foreach ($depts as $val) {
-                $mobile[] = $val['mobile'];
+                if (empty($val['mobile'])) {
+                    $depts_e[] = $val['name'];
+                } else {
+                    $mobile[] = $val['mobile'];
+                }
             }
         }
-
-        m("log")->addlog("会议室审批", "短信包括:".implode(' ', $mobile));
-
-    }
-
-    //提交时调用
-    protected function flowsubmit($na, $sm) {
-
-        if ($this->id == null) {
-            return ;
+        $infoText = "短信包括:".implode('、', $mobile);
+        if (!empty($depts_e)) {
+            $infoText .= ",其中".implode('、', $mobile)."未设负责人,无法通知";
         }
+        m("log")->addlog("会议室审批", $infoText);
 
     }
 
 
-
     public function getstatezt($zt)
     {
         if (isset($this->hyarrb[$zt])) {

+ 28 - 7
webmain/model/flow/meeting_keyModel.php

@@ -2,6 +2,12 @@
 
 class flow_meeting_keyClassModel extends flowModel
 {
+    public $meeting_room;
+
+    protected function flowinit(){
+        $this->subsubdatastyle = "custom:min-width:60px; padding: 15px; vertical-align:top;";
+        $this->meeting_room = m("meeting_room")->meetingRoomIdList();
+    }
 
     //删除单据时调用
     public function flowdeletebill($sm) {
@@ -41,8 +47,10 @@ class flow_meeting_keyClassModel extends flowModel
 
 //        m('log')->addlog('会议单据', json_encode($rs, true));
 
+        $this->id    = $rs['id'];
         $zt 		 = $rs['meet_state'];
-        $is_hand 	 = $rs['is_hand'] ?? 1;
+        $is_hand 	 = $rs['is_hand'] ?? 0;
+        $room_id 	 = $rs['room_id'];
         $nzt 		 = $zt;
         $time 		 = time();
 
@@ -50,7 +58,7 @@ class flow_meeting_keyClassModel extends flowModel
         $etime 	= strtotime($rs['end_time']);
 
         // 会议状态
-        if($is_hand != 2){
+        if($is_hand != 1){
             if($etime < $time){
                 $nzt = 2;
             } else if ($stime > $time){
@@ -75,6 +83,7 @@ class flow_meeting_keyClassModel extends flowModel
 
         // 会议状态-将id转换为文字
         $rs['meet_state'] = m("meeting")->getstatezt($zt);
+        $rs['room_id'] = $this->meeting_room[$room_id]['room_name'];
 
         return $rs;
     }
@@ -110,7 +119,7 @@ class flow_meeting_keyClassModel extends flowModel
             }
 
             if (isset($topics[count($topics) - 1]) && $topics[count($topics) - 1]['topic_state'] == 2) {
-                m('meeting_key')->update(['is_hand' => 2, 'meet_state' => 2], "id={$this->id}");
+                m('meeting_key')->update(['is_hand' => 1, 'meet_state' => 2], "id={$this->id}");
             }
 
         } else if ($ors['num'] == 'enableMeeting') {
@@ -123,12 +132,12 @@ class flow_meeting_keyClassModel extends flowModel
             if ($stime < $time){
                 $data = [
                     'meet_state'=>1,
-                    'is_hand'=>2
+                    'is_hand'=>1
                 ];
             } else if ($stime >= $time) {
                 $data = [
                     'meet_state'=>0,
-                    'is_hand'=>2
+                    'is_hand'=>1
                 ];
             }
             m('meeting_key')->update($data, "id={$this->id}");
@@ -141,7 +150,7 @@ class flow_meeting_keyClassModel extends flowModel
 
 //            $data = [
 //                'meet_state'=>2,
-//                'is_hand'=>2
+//                'is_hand'=>1
 //            ];
 //
 //            m('meeting_key')->update($data, "id={$this->id}");
@@ -154,7 +163,7 @@ class flow_meeting_keyClassModel extends flowModel
         if ($lx == 1) {
             for ($i = 0; $i < count($rows); $i++) {
                 $index = $rows[$i]['topic_state'] ?? 0;
-                $rows[$i]['topic_state'] = m('meeting')->ytarra[$index];
+                $rows[$i]['topic_state'] = $this->getTopicState($index);
 //                if (isset($rows[$i]['topic_state']) && !empty($rows[$i]['topic_state'])) {
 //                    $rows[$i]['topic_state'] = m('meeting')->ytarra[$index];
 //                } else {
@@ -166,4 +175,16 @@ class flow_meeting_keyClassModel extends flowModel
         return $rows;
     }
 
+
+    public function getTopicState($zt)
+    {
+        $colors = ["#ff83ec", "#ff8b1a", "#00c959", "#ff4974"];
+        if (isset(m('meeting')->hyarrb[$zt])) {
+            $html = '<font style="background-color:'.$colors[$zt].'; padding: 4px 8px; border-radius: 4px;">'.m('meeting')->ytarra[$zt].'</font>';
+            return $html;
+        } else {
+            return null;
+        }
+    }
+
 }

+ 9 - 3
webmain/model/meetingModel.php

@@ -23,10 +23,14 @@ class meetingClassModel extends Model
         if ($meetType == 1) {
             $sql        =  /** @lang text */
                 'select id, meeting_room, start_time, end_time, title
-                   from [Q]meeting  where id <> '.$id.' and meet_state in (0, 1)
+                   from [Q]meeting 
+                  where id <> '.$id.' 
+                    and meet_state in (0, 1)
                  union all
                  select id, meeting_room, start_time, end_time, title
-                   from [Q]meeting_key where meet_state in (0, 1)';
+                   from [Q]meeting_key 
+                  where meet_state in (0, 1)
+                    ';
         } else {
             $sql        =  /** @lang text */
                 'select id, meeting_room, start_time, end_time, title
@@ -35,11 +39,13 @@ class meetingClassModel extends Model
                  select id, meeting_room, start_time, end_time, title 
                    from [Q]meeting_key where id <> '.$id.' and meet_state in (0, 1)';
         }
-//        m('log')->addlog("验证", $sql);
+        m('log')->addlog("验证1", $sql);
 
         $rows 		= $this->db->getall($sql);
 
         foreach($rows as $k=>$rs){
+//            m('log')->addlog("验证2", $rs['meeting_room']);
+//            m('log')->addlog("验证3", $hyname);
             if($rs['meeting_room'] != $hyname)continue;
             $sdt = $rs['start_time'];
             $edt = $rs['end_time'];

+ 19 - 0
webmain/model/meeting_roomModel.php

@@ -17,4 +17,23 @@ class meeting_roomClassModel extends Model
         return $arr;
     }
 
+    public function meetingRoomIdList() {
+
+        $dataArr = $this->getall('1=1');
+        $arr = [];
+        for ($i = 0; $i < count($dataArr); $i++) {
+            $data = $dataArr[$i];
+            $id = $data['id'];
+            $arr[$id]["room_name"] = $data['room_name'];
+            $arr[$id]["id"] = $data['id'];
+            $arr[$id]["desc"] = $data['desc'];
+        }
+        return $arr;
+    }
+
+    public function getMeetingRoomInfoByDeviceId($devId) {
+        return $this->getone(" mac = '$devId'");
+    }
+
+
 }

+ 21 - 18
webmain/task/openapi/openmeetAction.php

@@ -20,9 +20,10 @@ class openmeetClassAction extends openapiAction
             $this->showreturn([], "参数错误", 201);
         }
 
-        $rawData = m('meeting_room')->getone(" mac = '{$rawArr['device_id']}'");
+//        $rawData = m('meeting_room')->getone(" mac = '{$rawArr['device_id']}'");
+        $rawData = m("meeting_room")->getMeetingRoomInfoByDeviceId($rawArr['device_id']);
 
-        if (!isset($rawData['room_name'])) {
+        if (!isset($rawData['id'])) {
             $this->showreturn([], "未找到会议室", 202);
         }
 
@@ -32,13 +33,13 @@ class openmeetClassAction extends openapiAction
               where start_time REGEXP '".date("Y-m-d")."'
                 and end_time > now()
                 and status = 1
-                and meeting_room = '".$rawData['room_name']."'
+                and room_id = '".$rawData['id']."'
              union all
              SELECT 2 as type, id, title, start_time, end_time, compere, meet_state, is_hand 
                FROM `[Q]meeting_key` 
               where start_time REGEXP '".date("Y-m-d")."' 
                 and end_time > now()
-                and meeting_room = '".$rawData['room_name']."'";
+                and room_id = '".$rawData['id']."'";
 
         $meetData = $this->db->getall($sqlStr);
 
@@ -85,7 +86,7 @@ class openmeetClassAction extends openapiAction
                 } else {
                     m("meeting_key")->update(["meet_state"=>0], "id=".$meeting['id']);
                 }
-            } else if (strtotime($meeting['start_time']) < strtotime(date("Y-m-d H:i:s")) && $meeting['is_hand'] != 2) {
+            } else if (strtotime($meeting['start_time']) < strtotime(date("Y-m-d H:i:s")) && $meeting['is_hand'] != 1) {
                 if ($meeting['type'] == 1) {
                     m("meeting")->update(["meet_state"=>1], "id=".$meeting['id']);
                 } else {
@@ -95,19 +96,21 @@ class openmeetClassAction extends openapiAction
         }
 
         $nowMeetingSql = /** @lang text */
-            "select * from (
-            SELECT 1 as type, id, title, start_time, end_time, null as compere, meet_state, meeting_room, attendees, null as attends
-                    ,`bfp`, `lunp`, `dnp`, `hotel`, `stay_day`, `stay_man`, `stay_lady`, `guset_well`
-               FROM `[Q]meeting` 
-              where status = 1 
-                and start_time < now() 
-                and end_time > now() 
-                and meeting_room = '".$rawData['room_name']."'
-             union all
-             SELECT 2 as type, id, title, start_time, end_time, compere, meet_state, meeting_room, attendees, attends
-                    ,0 `bfp`, 0 `lunp`, 0 `dnp`, 0 `hotel`, 0 `stay_day`, 0 `stay_man`, 0 `stay_lady`, 0 `guset_well`
-               FROM `[Q]meeting_key` 
-              where start_time < now() and end_time > now() and meeting_room = '".$rawData['room_name']."'
+            "select * 
+              from (
+                SELECT 1 as type, id, title, start_time, end_time, null as compere, meet_state, meeting_room, attendees, null as attends
+                        ,`bfp`, `lunp`, `dnp`, `hotel`, `stay_day`, `stay_man`, `stay_lady`, `guset_well`
+                   FROM `[Q]meeting` 
+                  where status = 1 
+                    and start_time < now() 
+                    and end_time > now() 
+                    and room_id = '".$rawData['id']."'
+                 union all
+                 SELECT 2 as type, id, title, start_time, end_time, compere, meet_state, meeting_room, attendees, attends
+                        ,0 `bfp`, 0 `lunp`, 0 `dnp`, 0 `hotel`, 0 `stay_day`, 0 `stay_man`, 0 `stay_lady`, 0 `guset_well`
+                   FROM `[Q]meeting_key` 
+                  where start_time < now() and end_time > now()
+                    and room_id = '".$rawData['id']."'
               ) as t order by start_time";
         $nowMeetingData = $this->db->getall($nowMeetingSql);