693 lines
32 KiB
PHP
693 lines
32 KiB
PHP
<?php
|
||
|
||
/*
|
||
* 表格列表的结果处理
|
||
*/
|
||
|
||
trait tlist {
|
||
|
||
//按钮组
|
||
protected $btn = [];
|
||
//禁用最后的按钮
|
||
protected $banbtn = false;
|
||
//相关参数缓存
|
||
protected static $para = [];
|
||
//相关公司缓存
|
||
protected static $customer = [];
|
||
//相关联系人缓存
|
||
protected static $workers = [];
|
||
//场所缓存
|
||
protected static $village = [];
|
||
|
||
//公用删除
|
||
//$query 主要用来替换删除按钮的值
|
||
protected function btn_group($val,$checked,$query = []) {
|
||
global $_M,$_YW;
|
||
if(empty($checked)){
|
||
if($query !== false){
|
||
$para = [
|
||
'c' => 'table_off',
|
||
'a' => 'doindex',
|
||
'submit_type' => 'delet',
|
||
'all_id' => $val['id'],
|
||
'tname' => $this->tname,
|
||
];
|
||
$query = array_merge($para,$query);
|
||
$href = parent::http_build_query($_M['url']['own_name'],$query);
|
||
$this->btn[] = '<a
|
||
class="btn btn-danger btn-sm"
|
||
table-delet
|
||
data-plugin="alertify"
|
||
data-type="confirm"
|
||
data-label-ok="确定"
|
||
data-label-cancel="取消"
|
||
data-confirm-title="确定要删除选中的信息吗?一旦删除将不能恢复!"
|
||
href="'.$href.'"
|
||
>删除</a>';
|
||
}
|
||
}else{
|
||
$this->btn[] = '<button type="button" class="btn btn-default btn-outline m-l-5" table-cancel>撤销</button>';
|
||
|
||
}
|
||
if(count($this->btn) > 0){
|
||
$btnstr = arrayto_string($this->btn,'');
|
||
unset($this->btn);
|
||
return '<div class="btn-group" role="group" >'.$btnstr.'</div>';
|
||
}
|
||
}
|
||
|
||
//整合
|
||
private function assemble($key,$base,$val,$checked,$query = []) {
|
||
global $_M,$_YW;
|
||
//搜索处理
|
||
foreach ($this->search_input as $vs){
|
||
if(in_array($vs, $this->skip_field,true)) continue;
|
||
$search = trim(strtoupper($this->form[$vs]));
|
||
if($search != null) $val[$vs] = str_ireplace($search, '<font color="#FF0000">'.$search.'</font>', $val[$vs]);
|
||
}
|
||
//按钮组处理
|
||
$operation = [];
|
||
if($this->banbtn == false) $operation['__operation'] = self::btn_group($val,$checked,$query);
|
||
//结果整合处理
|
||
return array_merge($base,$key,array_intersect_key($val,$key),$operation);
|
||
}
|
||
|
||
//广告位详细地址转换
|
||
protected function eaddress(&$val,$_address = 'e_address',$sign = false){
|
||
global $_M,$_YW;
|
||
//门口方位
|
||
if(empty(self::$para['e_bno'])) self::$para['e_bno'] = parent::translate(3);
|
||
//广告位置
|
||
if(empty(self::$para['e_aps'])) self::$para['e_aps'] = parent::translate();
|
||
//场所
|
||
if(empty(self::$village[$val['e_vid']])) self::$village[$val['e_vid']] = parent::villagelist($val['e_vid']);
|
||
|
||
if($sign){
|
||
$val['e_vid'] = self::$village[$val['e_vid']];
|
||
$val['e_bno'] = self::$para['e_bno'][$val['e_bno']];
|
||
$val['e_aps'] = self::$para['e_aps'][$val['e_aps']];
|
||
}else{
|
||
$villages = [
|
||
self::$village[$val['e_vid']],
|
||
self::$para['e_bno'][$val['e_bno']],
|
||
self::$para['e_aps'][$val['e_aps']]
|
||
];
|
||
$val[$_address] = arrayto_string($villages,' ');
|
||
}
|
||
|
||
}
|
||
|
||
|
||
// +----------------------------------------------------------------------
|
||
// | 各表处理
|
||
// +----------------------------------------------------------------------
|
||
|
||
//广告位统计
|
||
protected function elevator($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_elevator();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
//门口方位
|
||
if(empty(self::$para['e_bno'])) self::$para['e_bno'] = parent::translate(3);
|
||
//广告位置
|
||
if(empty(self::$para['e_aps'])) self::$para['e_aps'] = parent::translate();
|
||
//场所
|
||
if(empty(self::$village[$val['e_vid']])) self::$village[$val['e_vid']] = parent::villagelist($val['e_vid']);
|
||
|
||
$scheduleurl = $this->own_name_table.'elevators&e_number='.$val['e_number'];
|
||
|
||
$val['e_number'] = '<a href="'.$scheduleurl.'"> '.$val['e_number'].'</a>';
|
||
$val['e_enable'] = parent::type_onoff('e_enable',$val['e_enable'],$val['id'],['禁用','启用']);
|
||
|
||
$val['e_vid'] = self::$village[$val['e_vid']];
|
||
$val['e_bno'] = self::$para['e_bno'][$val['e_bno']];
|
||
$val['e_aps'] = self::$para['e_aps'][$val['e_aps']];
|
||
$val['e_state'] = parent::e_state();
|
||
$val['e_label'] = parent::tab_tokenfield($val['e_label'],2);
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
//跳过标记突出处理
|
||
$this->skip_field = ['e_number'];
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//场所统计
|
||
protected function village($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_village();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
|
||
|
||
//场所分类
|
||
if(empty(self::$para['v_type'])) self::$para['v_type'] = parent::translate(6);
|
||
|
||
$vnameurl = $this->own_name_table.'elevator&e_vid='.$val['id'];
|
||
$totalstr = arrayto_string([$val['total'],$val['noban'],$val['normal']],' / ');
|
||
|
||
$val['v_name'] = '<a href="'.$vnameurl.'"> '.$val['v_name'].'</a>';
|
||
$val['v_type'] = self::$para['v_type'][$val['v_type']];
|
||
$val['v_tel'] = parent::tab_tokenfield($val['v_tel'],1);
|
||
$val['v_address'] = $val['v_province'].$val['v_city'].$val['v_district'].$val['v_address'];
|
||
|
||
$val['v_totalstr'] = $val['noban'] > 0?parent::str_color(0,$totalstr,600):$totalstr;
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$this->btn[] = '<a href="'.$vnameurl.'" class="btn btn-primary btn-sm">查看广告位</a>';
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//广告合同关联表
|
||
protected function schedule($val,$checked = '',$base = []) {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_schedule();
|
||
//对字段处理
|
||
//公司名称
|
||
if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']);
|
||
|
||
$s_type = strtotime($val['l_endtime']) >= strtotime(date('Y-m-d',time()))?1:0;
|
||
if(empty(self::$para['ltype']) && $s_type) self::$para['ltype'] = parent::translate(2);
|
||
|
||
$val['ltype'] = parent::state_color($s_type,['已经结束',self::$para['ltype'][$val['l_schedule']]]);
|
||
$val['h_cid'] = self::$customer[$val['h_cid']];
|
||
$val['e_enable'] = $val['e_enable'] == 0 || $this->bsign == false?parent::state_color($val['e_enable'],['禁用','启用']):'';
|
||
self::eaddress($val,'l_address',$this->bsign);
|
||
return self::assemble($key,$base,$val,$checked,false);
|
||
}
|
||
|
||
//合同归档
|
||
protected function contract($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_contract();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
//公司名称
|
||
if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']);
|
||
//投放媒介
|
||
if(empty(self::$para['h_medium'])) self::$para['h_medium'] = parent::translate(4);
|
||
$h_mediumid = stringto_array($val['h_medium'],'#@met@#');
|
||
foreach ($h_mediumid as $hmid) {
|
||
$hmediumid[] = self::$para['h_medium'][$hmid];
|
||
}
|
||
|
||
//相关人员
|
||
$workerswid = stringto_array($val['h_wid'],',');
|
||
foreach ($workerswid as $hwid) {
|
||
if(empty(self::$workers[$hwid])) self::$workers[$hwid] = parent::workerslist($hwid);
|
||
$workersstr[] = self::$workers[$hwid];
|
||
}
|
||
|
||
//内连接
|
||
$h_number = $val['h_number']; //避免后面采用
|
||
$launchurl = $this->own_name_table.'launch&l_hnumber='.$h_number;
|
||
$curdate = date('Y-m-d',time());
|
||
|
||
$val['h_number'] = '<a href="'.$launchurl.'"> '.$h_number.'</a>';
|
||
$val['h_cid'] = self::$customer[$val['h_cid']];
|
||
$val['h_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1);
|
||
$val['h_noticeday'] = parent::tab_tokenfield($val['h_noticeday'],2);
|
||
$val['h_medium'] = parent::tab_tokenfield(arrayto_string($hmediumid,','));
|
||
$val['h_starttime'] = strtotime($val['h_starttime']) > strtotime($curdate)?parent::str_color(2,$val['h_starttime'],600):$val['h_starttime'];
|
||
$val['h_endtime'] = strtotime($val['h_endtime']) < strtotime($curdate)?parent::str_color(0,$val['h_endtime'],600):$val['h_endtime'];
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_info.'launch&cid='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-primary btn-sm">新增投放</a>';
|
||
$this->btn[] = '<a href="'.$launchurl.'" class="btn btn-info btn-sm">查看投放</a>';
|
||
$addtourl = $_M['url']['own_name'].'c=backups&a=doindex&tname=schedule&l_hnumber='.$h_number;
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-warning btn-sm">导出排期</a>';
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
//跳过标记突出处理
|
||
$this->skip_field = ['h_number'];
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//公司资料
|
||
protected function customer($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_customer();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
|
||
$hcidurl = $this->own_name_table.'contract&h_cid='.$val['id'];
|
||
$val['c_allname'] = '<a href="'.$hcidurl.'"> '.$val['c_allname'].'</a>';
|
||
$val['c_tel'] = parent::tab_tokenfield($val['c_tel'],1);
|
||
$val['c_address'] = $val['c_province'].$val['c_city'].$val['c_district'].$val['c_address'];
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//企业联系人
|
||
protected function workers($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_workers();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
|
||
//拿到对应的ID
|
||
//职务
|
||
if(empty(self::$para)) self::$para = parent::translate(1);
|
||
|
||
//对字段处理
|
||
$val['w_jid'] = self::$para[$val['w_jid']];
|
||
$val['w_tel'] = parent::tab_tokenfield($val['w_tel'],1);
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//参数统计
|
||
protected function para($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_para();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'" '.$checked.'>
|
||
<label></label>
|
||
</span>';
|
||
|
||
//对字段处理
|
||
//优先计算
|
||
switch ($val['p_type']) {
|
||
case 0:
|
||
$p_num = $this->tsql->table('elevator')->where(['e_aps' => $val['p_value']])->count();
|
||
break;
|
||
case 1:
|
||
$p_num = $this->tsql->table('workers')->where(['w_jid' => $val['p_value']])->count();
|
||
break;
|
||
case 2:
|
||
$p_num = $this->tsql->table('launch')->where(['l_schedule' => $val['p_value']])->count();
|
||
break;
|
||
case 3:
|
||
$p_num = $this->tsql->table('elevator')->where(['e_bno' => $val['p_value']])->count();
|
||
break;
|
||
case 6:
|
||
$p_num = $this->tsql->table('village')->where(['v_type' => $val['p_value']])->count();
|
||
break;
|
||
case 7:
|
||
$p_num = $this->tsql->table('launch')->where(['l_type' => $val['p_value']])->count();
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//有数据后不允许再修改参数值,可修改参数名,且不是在新增情况下
|
||
if($p_num > 0 && empty($checked)){
|
||
$readonly = ' readonly="readonly" ';
|
||
}
|
||
|
||
$inputp_num = '<input type="hidden" name="p_num-'.$val['id'].'" value="'.$p_num.'">';
|
||
$val['p_num'] = $checked?$inputp_num:$p_num.' 条'.$inputp_num;
|
||
$val['p_type'] = '<div class="form-group">
|
||
<select class="form-control" name="p_type-'.$val['id'].'" data-checked="'.$val['p_type'].'" required >
|
||
<option value="0">广告位置</option>
|
||
<option value="1">企业职位</option>
|
||
<option value="2">投放进度</option>
|
||
<option value="3">门口方位</option>
|
||
<option value="4">投放媒介</option>
|
||
<option value="6">场所分类</option>
|
||
<option value="7">广告类型</option>
|
||
</select>
|
||
</div>';
|
||
$val['p_order'] = '<div class="form-group">
|
||
<input type="text" name="p_order-'.$val['id'].'" value="'.$val['p_order'].'" placeholder="仅支持数字" data-fv-integer="true" data-fv-integer-message="请输入有效的整数数字" class="form-control">
|
||
</div>';
|
||
$val['p_name'] = '<div class="form-group">
|
||
<input type="text" name="p_name-'.$val['id'].'" value="'.$val['p_name'].'" required class="form-control">
|
||
</div>';
|
||
$val['p_value'] = '<div class="form-group">
|
||
<input type="text" name="p_value-'.$val['id'].'" value="'.$val['p_value'].'" placeholder="仅支持数字" data-fv-integer="true" data-fv-integer-message="请输入有效的整数数字" class="form-control" '.$readonly.'>
|
||
</div>';
|
||
$val['p_text'] = '<input type="text" name="p_text-'.$val['id'].'" value="'.$val['p_text'].'" class="form-control">';
|
||
|
||
//执行操作按钮
|
||
return self::assemble($key,$base,$val,$checked,$p_num > 0?false:[]);
|
||
}
|
||
|
||
//投放计划
|
||
protected function launch($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_launch();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary ap-one">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'" '.$checked.'>
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
if(empty(self::$para['l_schedule'])) self::$para['l_schedule'] = parent::translate(2);
|
||
if(empty(self::$para['l_type'])) self::$para['l_type'] = parent::translate(7);
|
||
$enum = count(array_filter(stringto_array($val['l_enumber'],',')));
|
||
$snum = count(array_filter(stringto_array($val['l_selectenum'],',')));
|
||
$esstr = " {$enum} / {$snum} ";
|
||
$curdate = date('Y-m-d',time());
|
||
|
||
$l_titleurl = $this->own_name_table.'schedule&l_id='.$val['id'];
|
||
$val['l_totalnum'] = $enum == $snum?$esstr:parent::state_color(0,[$esstr]); //放在最前面,防止后面对l_enumber 字段的处理
|
||
$val['l_title'] = '<a href="'.$l_titleurl.'"> '.$val['l_title'].'</a>';
|
||
$val['l_enumber'] = parent::tab_tokenfield($val['l_enumber'],1,',',6);
|
||
$val['l_schedule'] = parent::tab_tokenfield(self::$para['l_schedule'][$val['l_schedule']],1);
|
||
$val['l_type'] = self::$para['l_type'][$val['l_type']];
|
||
|
||
$val['l_starttime'] = strtotime($val['l_starttime']) > strtotime($curdate)?parent::str_color(2,$val['l_starttime'],600):$val['l_starttime'];
|
||
$val['l_endtime'] = strtotime($val['l_endtime']) < strtotime($curdate)?parent::str_color(0,$val['l_endtime'],600):$val['l_endtime'];
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$this->btn[] = '<a href="'.$l_titleurl.'" class="btn btn-info btn-sm">查看排期</a>';
|
||
$addtourl = $_M['url']['own_name'].'c=backups&a=doindex&tname=schedule&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-warning btn-sm">导出排期</a>';
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&slid='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
//广告位统计
|
||
protected function applan($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_applan();
|
||
|
||
//列表前段
|
||
$e_number = $val['e_number'];
|
||
//判断之前是否已经选中
|
||
$ebool = in_array($e_number, array_filter(stringto_array($this->form['l_selectenum'],',')),true);
|
||
//给予选中标识
|
||
$class = ' checkbox-primary '; //刚选择默认颜色
|
||
//$val['lanum'] 大于0 说明重复,不可投放
|
||
if($ebool) {
|
||
$apchecked = ' checked ';
|
||
$slid = $this->form['slid'];
|
||
//判断排期表内是否存在
|
||
if(!empty($this->form['slid'])){
|
||
if(empty(self::$para[$slid])) self::$para[$slid] = $this->tsql->table('launch')->where(['id' => $slid])->one();
|
||
$l_hnumber = stringto_array(self::$para[$slid]['l_enumber'],',');
|
||
$class = in_array($e_number,$l_hnumber,true)?' checkbox-success ':' checkbox-danger '; //刚选择默认颜色
|
||
}
|
||
}
|
||
|
||
// 判断广告位是否可排期
|
||
if(empty($val['e_enable'])){
|
||
$e_types = parent::str_color(0,'禁止投放');
|
||
if($apchecked) {
|
||
$class .= ' ap-one-disabled ';
|
||
}else{
|
||
$disabled = ' disabled ';
|
||
}
|
||
}else{
|
||
$s_starttime = $_M['form']['l_starttime'];
|
||
$s_endtime = $_M['form']['l_endtime'];
|
||
if($s_starttime && $s_endtime && strtotime($s_starttime) <= strtotime($s_endtime)){
|
||
//判断是否可排期成功
|
||
if($val['lanum'] > 0){
|
||
$e_types = parent::str_color(0,'禁止投放');
|
||
if($apchecked) {
|
||
$class .= ' ap-one-disabled ';
|
||
}else{
|
||
$disabled = ' disabled ';
|
||
}
|
||
}else{
|
||
$e_types = parent::str_color(1,'可投放');
|
||
}
|
||
}else{
|
||
$e_types = parent::str_color(3,'无法判断');
|
||
}
|
||
}
|
||
|
||
// checkbox-danger 没有在排期库的显示为红色 checkbox-primary 正常的显示蓝色 checkbox-success 绿色
|
||
$base[] = '<span class="checkbox-custom '.$class.' ap-one">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$e_number.'" '.$apchecked.$disabled.'>
|
||
<label></label>
|
||
</span>';
|
||
|
||
//对字段处理
|
||
$curtime = strtotime(date('Y-m-d',time()));
|
||
//上个排期
|
||
if(strtotime($val['endetime']) < $curtime){
|
||
$val['endtitle'] = '<span class="blue-grey-400">'.$val['endtitle'].'</span>';
|
||
$val['endstime'] = '<span class="blue-grey-400">'.$val['endstime'].'</span>';
|
||
$val['endetime'] = '<span class="blue-grey-400">'.$val['endetime'].'</span>';
|
||
}
|
||
|
||
$val['endtime'] = strtotime($val['endtime']) < $curtime
|
||
?'<span class="line_through blue-grey-400">'.$val['endtime'].'</span>'
|
||
:$val['endtime'];
|
||
$val['e_types'] = $e_types;
|
||
$val['e_enable'] = parent::state_color($val['e_enable'],['禁用','启用']);
|
||
self::eaddress($val,'e_address');
|
||
//比较每个广告位的结束时间 和 现在设置的投放订单的开始时间 大小
|
||
|
||
//禁用最后的按钮
|
||
$this->banbtn = true;
|
||
return self::assemble($key,$base,$val,$checked,false);
|
||
}
|
||
|
||
//广告位统计
|
||
protected function elevators($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_elevators();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary ap-one">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['e_number'].'" '.$checked.'>
|
||
<label></label>
|
||
</span>';
|
||
//对字段处理
|
||
$curtime = strtotime(date('Y-m-d',time()));
|
||
$scheduleurl = $this->own_name_table.'schedule&e_number='.$val['e_number'];
|
||
$uplaunchurl = $this->own_name_info.'uplaunch&e_number='.$val['e_number'];
|
||
|
||
$val['e_number'] = '<a href="'.$scheduleurl.'"> '.$val['e_number'].'</a>';
|
||
$val['etypes'] = parent::state_color($val['etypes'],[$val['e_enable']?'空位':'已禁用','排期中']);
|
||
$val['e_enable'] = parent::state_color($val['e_enable'],['禁用','启用']);
|
||
|
||
$scheduleurlid = $this->own_name_table.'schedule&l_id=';
|
||
$val['endtitle'] = $val['endtitle']?'<a href="'.$scheduleurlid.$val['endid'].'">'.$val['endtitle'].'</a>':'';
|
||
$val['nowtitle'] = $val['nowtitle']?'<a href="'.$scheduleurlid.$val['nowid'].'">'.$val['nowtitle'].'</a>':'';
|
||
$val['nexttitle'] = $val['nexttitle']?'<a href="'.$scheduleurlid.$val['nextid'].'">'.$val['nexttitle'].'</a>':'';
|
||
self::eaddress($val,'e_address');
|
||
|
||
$val['endtime'] = strtotime($val['endtime']) < $curtime
|
||
?'<span class="line_through blue-grey-400">'.$val['endtime'].'</span>'
|
||
:$val['endtime'];
|
||
//上个排期
|
||
if(strtotime($val['endetime']) < $curtime){
|
||
$val['endstime'] = '<span class="blue-grey-400">'.$val['endstime'].'</span>';
|
||
$val['endetime'] = '<span class="blue-grey-400">'.$val['endetime'].'</span>';
|
||
}
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
// $this->btn[] = '<a href="'.$uplaunchurl.'" class="btn btn-success btn-sm">调整排期</a>';
|
||
$this->btn[] = '<a href="'.$scheduleurl.'" class="btn btn-primary btn-sm">查看排期</a>';
|
||
}
|
||
//跳过标记突出处理
|
||
$this->skip_field = ['e_number'];
|
||
return self::assemble($key,$base,$val,$checked,false);
|
||
}
|
||
|
||
//场所统计展示
|
||
protected function villages($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_villages();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'">
|
||
<label></label>
|
||
</span>';
|
||
|
||
//场所分类
|
||
if(empty(self::$para['v_type'])) self::$para['v_type'] = parent::translate(6);
|
||
//对字段处理
|
||
$scheduleurl = $this->own_name_table.'schedule&e_vid='.$val['id'];
|
||
|
||
$val['v_name'] = '<a href="'.$scheduleurl.'" title="查看排期"> '.$val['v_name'].'</a>';
|
||
$val['v_type'] = self::$para['v_type'][$val['v_type']];
|
||
$val['v_free'] = $val['v_free']?'<span class="tag tag-sm tag-pill tag-info">'.$val['v_free'].'</span>':$val['v_free'];
|
||
$val['v_lease'] = $val['v_lease']?'<span class="tag tag-sm tag-pill tag-warning">'.$val['v_lease'].'</span>':$val['v_lease'];
|
||
$val['v_endday'] = $val['v_endday']?'<span class="tag tag-sm tag-pill tag-success">'.$val['v_endday'].'</span>':$val['v_endday'];
|
||
$val['v_prerow'] = $val['v_prerow']?'<span class="tag tag-sm tag-pill tag-primary">'.$val['v_prerow'].'</span>':$val['v_prerow'];
|
||
if($val['noban'] > 0){
|
||
$val['v_enum'] = '<span class="tag tag-sm tag-pill tag-dark">'.$val['v_enum'].'</span>';
|
||
if($this->bsign) $val['v_enum'] .= ' -- ';
|
||
$val['v_enum'] .= '<span class="tag tag-sm tag-pill tag-danger m-l-10">'.$val['noban'].'</span>';
|
||
}else{
|
||
$val['v_enum'] = $val['v_enum']?:'<span class="tag tag-sm tag-pill tag-danger">'.$val['v_enum'].'</span>';
|
||
}
|
||
// $val['v_province'].$val['v_city'] 去掉省市
|
||
if(!$this->bsign) $val['v_address'] = $val['v_district'].' '.$val['v_address'];
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_table.'elevators&e_vid='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-primary btn-sm">广告位统计</a>';
|
||
}
|
||
return self::assemble($key,$base,$val,$checked,false);
|
||
}
|
||
|
||
//场所统计展示
|
||
protected function noticeday($val,$checked = '',$base = []) {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_noticeday();
|
||
|
||
//列表前段
|
||
|
||
//对字段处理
|
||
//公司
|
||
if(empty(self::$customer[$val['h_cid']])) self::$customer[$val['h_cid']] = parent::customerlist($val['h_cid']);
|
||
|
||
//相关人员
|
||
$workerswid = stringto_array($val['h_wid'],',');
|
||
foreach ($workerswid as $hwid) {
|
||
if(empty(self::$workers[$hwid])) self::$workers[$hwid] = parent::workerslist($hwid);
|
||
$workersstr[] = self::$workers[$hwid];
|
||
}
|
||
|
||
$h_endtime = strtotime($val['h_endtime']);
|
||
$curdate = strtotime(date('Y-m-d',time()));
|
||
//首先判断当前这条信息是属于到期前台3天的 还是属于设置的提醒
|
||
//那就是判断订单结束时间和今天的相差天数
|
||
$day = abs(($h_endtime - $curdate) / 86400);
|
||
if($day > 3){
|
||
//按照设置的提醒来计算
|
||
$str = parent::str_color(0,$val['noticeday'],800);
|
||
$htypes = "{$str} 天后到期提醒";
|
||
}else{
|
||
//按照前后3天来设置
|
||
if($h_endtime > $curdate){
|
||
$str = parent::str_color(0,$day,800);
|
||
//说明还没到期
|
||
$htypes = "{$str} 天后到期";
|
||
}else{
|
||
//说明已经到期或者过期
|
||
$htypes = $day == 0?parent::str_color(0,'今天到期',800):parent::str_color(0,"已过期 {$day} 天",800);
|
||
}
|
||
}
|
||
|
||
//设置的到期提醒
|
||
//订单到期前后3天提醒
|
||
|
||
$val['h_cid'] = self::$customer[$val['h_cid']];
|
||
$val['h_wid'] = parent::tab_tokenfield(arrayto_string($workersstr),1);
|
||
$val['htypes'] = $htypes;
|
||
|
||
$numberurl = $this->own_name_table.'contract&h_number='.$val['h_number'];
|
||
$val['h_number'] = '<a href="'.$numberurl.'" title="查看排期"> '.$val['h_number'].'</a>';
|
||
|
||
return self::assemble($key,$base,$val,$checked,false);
|
||
}
|
||
|
||
//前台巡查
|
||
protected function patrol($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_patrol();
|
||
|
||
//列表前段
|
||
//对字段处理
|
||
//计算剩余时间
|
||
$nowetime = strtotime($val['nowetime']);
|
||
$curdate = strtotime(date('Y-m-d',time()));
|
||
$day = $val['nowetime']?abs(($nowetime - $curdate) / 86400):0;
|
||
|
||
$val['e_number'] = parent::state_color($val['e_enable'],[$val['e_number'],$val['e_number']]);
|
||
self::eaddress($val,'e_address');
|
||
$val['nowtitle'] = parent::state_color($curdate > $nowetime ?0:($day > 2?1:2),[$val['nowtitle'],$val['nowtitle'],$val['nowtitle']]);
|
||
|
||
return self::assemble($key,[],$val,$checked,false);
|
||
}
|
||
|
||
//参数统计
|
||
protected function keylist($val,$checked = '') {
|
||
global $_M,$_YW;
|
||
//获取字段
|
||
$key = self::tf_keylist();
|
||
|
||
//列表前段
|
||
$base[] = '<span class="checkbox-custom checkbox-primary">
|
||
<input class="selectable-item" type="checkbox" name="id" value="'.$val['id'].'" '.$checked.'>
|
||
<label></label>
|
||
</span>';
|
||
|
||
//对字段处理
|
||
if(empty(self::$workers[$val['k_wid']])) {
|
||
$k_wid = parent::workerslist($val['k_wid'],false);
|
||
self::$workers[$val['k_wid']] = $k_wid['w_name'].','.$k_wid['w_tel'];
|
||
}
|
||
|
||
$val['k_basekey'] = base64_decode($val['k_basekey']);
|
||
$val['k_state'] = parent::state_color($val['k_state'],['禁用','启用']);
|
||
$val['k_wid'] = parent::tab_tokenfield(self::$workers[$val['k_wid']],1);
|
||
|
||
//执行操作按钮
|
||
if(empty($checked)){
|
||
$addtourl = $this->own_name_info.__FUNCTION__.'&id='.$val['id'];
|
||
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-success btn-sm">编辑</a>';
|
||
}
|
||
//执行操作按钮
|
||
return self::assemble($key,$base,$val,$checked);
|
||
}
|
||
|
||
}
|