示例#1
0
 private function set_attributes()
 {
     $groups = [];
     $columns = TbColumn::find()->where('fdTableID = :table_id', [':table_id' => $this->table->id])->all();
     $i = 0;
     foreach ($columns as $column) {
         switch ($column->fdDataType) {
             case 1:
                 $this->timeline_column = $column;
                 if ($column->fdSearchType > 0) {
                     $this->search_columns[] = $column;
                 }
                 break;
             case 2:
                 $this->groups[] = $column->fdName;
                 break;
             case 3:
                 $this->search_columns[] = $column;
                 break;
             default:
                 break;
         }
         if ($column->fdChartDisplay && $column->fdDataType == '0') {
             $this->chart_show_arr[] = $column->fdName;
             $this->chart_show_columns[$column->fdName] = $column;
         }
         if ($column->fdTableDisplay) {
             $this->table_show_arr[] = $column->fdName;
             $this->table_show_columns[$column->fdName] = $column;
             $format_key = $i;
             $format_value = $column->fdFormatter;
             $this->format_group[$format_key] = $format_value;
             $i++;
         }
         if ($column->fdOrderType > 0) {
             $this->order_group[$column->fdName] = 1;
             if ($column->fdOrderType > 1) {
                 $this->order_column = $column;
             }
         }
     }
 }
示例#2
0
         <th>数据类型</th>
         <th>搜索类型</th>
         <th>下拉列表</th>
         <th>是否排序</th>
         <th>图表显示</th>
         <th>表格显示</th>
         <th>显示格式</th>
         <th>操作</th>
      </tr>
   </thead>
   <tbody>
   <?php 
foreach ($datas as $data) {
    ?>
   <?php 
    $column = TbColumn::find()->where('fdTableID = :table_id and fdName = :name', [':table_id' => $table->id, ':name' => $data['Field']])->one();
    ?>
   <?php 
    if (!$column) {
        $column = new TbColumn();
        $column->fdName = $data['Field'];
    }
    ?>
	<tr>
		<td class="column_id"><?php 
    echo isset($column->id) ? $column->id : 'null';
    ?>
</td>
		<td class="column_name"><?php 
    echo $column->fdName;
    ?>
示例#3
0
echo Url::base();
?>
/js/echarts/dist/echarts-all.js"></script>
<?php 
foreach ($menu->tables as $table) {
    ?>
<div>
<form class="form-inline" role="form">
<div>
<div style="float: left;">
<?php 
    //生成搜索框组
    echo Html::hiddenInput('table_id', $table->id);
    echo Html::hiddenInput('order_column', '', ['class' => 'order_column']);
    echo Html::hiddenInput('order_type', 'desc', ['class' => 'order_type']);
    $columns = TbColumn::find()->where('fdTableID = :table_id and (fdSearchType > 1 or (fdSearchType = 1 and fdSelectID > 0))', [':table_id' => $table->id])->all();
    foreach ($columns as $column) {
        switch ($column->fdSearchType) {
            case 1:
                echo '<div class="form-group">';
                echo "<label>{$column->fdDesc}</label>&nbsp;";
                echo Html::dropDownList($column->fdName, '', Dictionary::getSelectItem($column->fdSelectID), ['class' => 'form-control', 'style' => 'width: auto;']);
                echo '</div>';
                break;
            case 2:
                echo '<div class="form-group">';
                echo "<label>{$column->fdDesc}</label>&nbsp;";
                echo Html::textInput($column->fdName, '', ['class' => 'form-control', 'style' => 'width: auto;', 'placeholder' => $column->fdDesc]);
                echo '</div>';
                break;
            case 3:
 public function actionDeleteColumn()
 {
     $column_id = 0 + \Yii::$app->request->post('id', '');
     TbColumn::deleteAll("id = {$column_id}");
     echo json_encode(['code' => 0, 'msg' => '请求操作成功']);
 }