update Area + Device
This commit is contained in:
22
widgets/Department.php
Normal file
22
widgets/Department.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\widgets;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class Department extends Widget {
|
||||
|
||||
public $pid;
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function run() {
|
||||
|
||||
return $this->render("department", [
|
||||
"lists" => \app\models\Department::find()->andWhere(['pid' => $this->pid])->all()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
9
widgets/views/department.tpl
Normal file
9
widgets/views/department.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
{foreach from=$lists item=l}
|
||||
<div style="cursor: pointer;">
|
||||
<i class="fa fa-minus-square-o" onclick="common.tree(this);" data="{$l->code}" data-stt="true"></i>
|
||||
<span class="tree-drop">{$l->code}-{$l->name}</span>
|
||||
<div id="sub-tree-{$l->code}" style="padding-left: 20px;">
|
||||
{\app\widgets\Department::widget(["pid"=>$l->code])}
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
Reference in New Issue
Block a user