subsubdatastyle = "custom:min-width:60px; padding: 15px; vertical-align:top;"; $this->meeting_room = m("meeting_room")->meetingRoomIdList(); } //删除单据时调用 public function flowdeletebill($sm) { } //流程全部完成后调用 public function flowcheckfinsh($sm) { } //提交时调用 protected function flowsubmit($na, $sm) { // if ($na != '编辑') { // 提交时初始化为0 // m('meeting_topics')->update(["topic_state"=>0], 'mid='.$this->id); // m('meeting_key')->update(["meet_state"=>1], 'id='.$this->id); // } // $meet = m('meeting')->getone("id={$this->id}",'start_time'); // // if (isset($meet['start_time']) && strtotime($meet['start_time']) > time()) { // $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state', 'sort'); // if (isset($topic['id']) && $topic['topic_state'] < 2) { // m('meeting')->firstMeetingTopicStart($this->id); // } // } else { // $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state', 'sort'); // if (isset($topic['id']) && $topic['topic_state'] < 2) { // m('meeting')->update(["meet_state"=>1], "id=".$topic['id']); // } // } } // 初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示,3打印页,4外部详情页 public function flowrsreplace($rs, $lx=0) { // m('log')->addlog('会议单据', json_encode($rs, true)); $this->id = $rs['id']; $zt = $rs['meet_state']; $is_hand = $rs['is_hand'] ?? 0; $room_id = $rs['room_id']; $nzt = $zt; $time = time(); $stime = strtotime($rs['start_time']); $etime = strtotime($rs['end_time']); $tzone = m('meeting_key')->tp[$rs['tzone']]['name']; if (isset($tzone) && !empty($tzone)) { $rs['tzone'] = $tzone; } // 会议状态 // 有会议开始、结束时间时开启↓↓↓↓↓↓↓↓↓ // if($is_hand != 1){ // if($etime < $time){ // $nzt = 2; // } else if ($stime > $time){ // $nzt = 0; // } // } // 会议开始时的处理 // if (($stime <= $time && $etime > $time) || ($is_hand == 1 && $zt == 1)) { // $nzt = 1; // // 会议开始,议题自动调整开始第一项 // $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state, topic_title', 'sort'); // if (isset($topic['id']) && $topic['topic_state'] < 2) { // m('meeting')->firstMeetingTopicStart($this->id); // // 当前议题 // } // // // 展示近几个议题状态 // $topics = m('meeting_topics')->getall("mid={$this->id}",'id, topic_state, topic_title', 'sort'); // for ($i = 0; $i < count($topics); $i++) { // $topic = $topics[$i]; // if ($topic['topic_state'] == 3) { // $rs['topic'] = $this->getTopicInfoState($topic); // } // if ($topic['topic_state'] == 1) { // $rs['topic'] .= $this->getTopicInfoState($topic); // } // if ($topic['topic_state'] == 2) { // $rs['topic'] .= $this->getTopicInfoState($topic); // } // } // // } else if ($stime > $time) { // $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state, topic_title', 'sort asc'); // $rs['topic'] = $this->getTopicInfoState($topic); // } else { // $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state, topic_title', 'sort desc'); // $rs['topic'] = $this->getTopicState($topic['topic_state']); // } // // // 更新数据状态 // if($zt != $nzt) { // $this->update('meet_state='.$nzt.'', $rs['id']); // $zt = $nzt; // } // 有会议开始、结束时间时开启↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state, topic_title', 'sort desc'); $rs['topic'] = $this->getTopicState($topic['topic_state']); if ($zt == 0) { $topic = m('meeting_topics')->getone("mid={$this->id}",'id, topic_state, topic_title', 'sort asc'); $rs['topic'] = $this->getTopicInfoState($topic); } else if ($zt == 1) { // 展示近几个议题状态 $topics = m('meeting_topics')->getall("mid={$this->id}",'id, topic_state, topic_title', 'sort'); for ($i = 0; $i < count($topics); $i++) { $topic = $topics[$i]; if ($topic['topic_state'] == 3) { $rs['topic'] = $this->getTopicInfoState($topic); } if ($topic['topic_state'] == 1) { $rs['topic'] .= $this->getTopicInfoState($topic); } if ($topic['topic_state'] == 2) { $rs['topic'] .= $this->getTopicInfoState($topic); } } } else if ($zt == 2) { $rs['topic'] = '已结束.
'; } // 会议状态-将id转换为文字 $rs['meet_state'] = m("meeting")->getstatezt($zt); $rs['room_id'] = $this->meeting_room[$room_id]['room_name']; return $rs; } //单据判断条件从写$lx类型,$uid用户Id protected function flowbillwhere($lx, $uid){ return [ 'order'=>'meet_state, sort' ]; } // $ors当前单据操作信息,$crs提交过来的信息 public function flowoptmenu($ors, $crs) { if ($ors['num'] == 'nextTopic') { // 下一议题 $topics = $this->db->getall("select * from `[Q]meeting_topics` where mid = {$this->id} order by sort"); for ($i = 0; $i < count($topics); $i++) { if ($topics[$i]['topic_state'] == 2) { $id = $topics[$i]['id']; $data = [ 'topic_state' => $topics[$i]['topic_state'] + 1 ]; m('meeting_topics')->update($data, "id={$id}"); // 更新下一个状态 if (isset($topics[$i + 1]['topic_state'])) { $id = $topics[$i + 1]['id']; $data = ['topic_state' => 2]; m('meeting_topics')->update($data, "id={$id}"); } if (isset($topics[$i + 2]['topic_state'])) { $id = $topics[$i + 2]['id']; $data = ['topic_state' => 1]; m('meeting_topics')->update($data, "id={$id}"); } break; } } if (isset($topics[count($topics) - 1]) && $topics[count($topics) - 1]['topic_state'] == 2) { m('meeting_key')->update(['is_hand' => 1, 'meet_state' => 2], "id={$this->id}"); } } else if ($ors['num'] == 'preTopic') { // 上一议题 $topics = $this->db->getall("select * from `[Q]meeting_topics` where mid = {$this->id} order by sort"); $is_end = 1; for ($i = 0; $i < count($topics); $i++) { // 找到结束议题 if ($topics[$i]['topic_state'] == 2) { $id = $topics[$i]['id']; // 恢复到上一状态 $data = [ 'topic_state' => $topics[$i]['topic_state'] - 1 ]; m('meeting_topics')->update($data, "id={$id}"); // 更新上一个状态 if (isset($topics[$i - 1]['topic_state'])) { $id = $topics[$i - 1]['id']; $data = ['topic_state' => 2]; m('meeting_topics')->update($data, "id={$id}"); } // 更新下一个状态 if (isset($topics[$i + 1]['topic_state'])) { $id = $topics[$i + 1]['id']; $data = ['topic_state' => 0]; m('meeting_topics')->update($data, "id={$id}"); } if (isset($topics[$i + 2]['topic_state'])) { $id = $topics[$i + 2]['id']; $data = ['topic_state' => 0]; m('meeting_topics')->update($data, "id={$id}"); } $is_end = 0; break; } } if ($is_end == 1 && isset($topics[$i - 1])) { m('meeting_topics')->update(['topic_state'=>2], "id={$topics[$i-1]['id']}"); } } else if ($ors['num'] == 'enableMeeting') { $time = time(); $stime = strtotime($this->rs['start_time']); $etime = strtotime($this->rs['end_time']); if ($stime < $time){ $data = [ 'meet_state'=>1, 'is_hand'=>1 ]; } else if ($stime >= $time) { $data = [ 'meet_state'=>0, 'is_hand'=>1 ]; } m('meeting_key')->update($data, "id={$this->id}"); // $topic = m('meeting_topics')->getone("mid={$this->id}", "id", 'sort desc'); // if (isset($topic['id'])) { // m('meeting_topics')->update(['topic_state'=>'2'], 'id='.$topic['id']); // } } else if ($ors['num'] == 'disenableMeeting') { // $data = [ // 'meet_state'=>2, // 'is_hand'=>1 // ]; // // m('meeting_key')->update($data, "id={$this->id}"); } } // 子表数据替换处理$lx=0编辑时,1展示时 protected function flowsubdata($rows, $lx=0){ if ($lx == 1) { for ($i = 0; $i < count($rows); $i++) { $index = $rows[$i]['topic_state'] ?? 0; $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 { //// $id = $rows[$i]['id']; //// m('meeting_topics')->update(['topic_state'=>1], "id={$id}"); // } } } return $rows; } public function getTopicState($zt) { $colors = ["#ff83ec", "#ff8b1a", "#00c959", "#ff4974"]; if (isset(m('meeting')->hyarrb[$zt])) { $html = ''.m('meeting')->ytarra[$zt].''; return $html; } else { return null; } } public function getTopicInfoState($topic) { $zt = $topic['topic_state']; $colors = ["#ff83ec", "#ff8b1a", "#00c959", "#ff4974"]; $title = ["【等待议题】", "【下一议题】", "【当前议题】", "【上一议题】"]; $info = str_replace("\n", "", $title[$zt].":".$topic['topic_title']); if (isset(m('meeting')->hyarrb[$zt])) { $html = ''.$info.'.
'; return $html; } else { return null; } } // 固定会议 public function fixedMeetings($mid='') { $meets = $this->getall('sort = 5'); for ($i = 0; $i < count($meets); $i++) { $meet = $meets[$i]; $id = $meet['id']; $st = $meet['start_time']; m('meeting_key')->update([ 'start_time'=>date("Y-m-d"), 'meet_state'=>0 ], "id={$id}"); } } }