* finish task#1649.
This commit is contained in:
@@ -256,6 +256,7 @@ class deptModel extends model
|
||||
$parentPath = ',';
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach($childs as $deptID => $deptName)
|
||||
{
|
||||
if(empty($deptName)) continue;
|
||||
@@ -264,10 +265,12 @@ class deptModel extends model
|
||||
$dept->name = strip_tags($deptName);
|
||||
$dept->parent = $parentDeptID;
|
||||
$dept->grade = $grade;
|
||||
$dept->order = $this->post->maxOrder + $i * 10;
|
||||
$this->dao->insert(TABLE_DEPT)->data($dept)->exec();
|
||||
$deptID = $this->dao->lastInsertID();
|
||||
$childPath = $parentPath . "$deptID,";
|
||||
$this->dao->update(TABLE_DEPT)->set('path')->eq($childPath)->where('id')->eq($deptID)->exec();
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -48,7 +48,12 @@
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
foreach($sons as $sonDept) echo html::input("depts[id$sonDept->id]", $sonDept->name) . '<br />';
|
||||
$maxOrder = 0;
|
||||
foreach($sons as $sonDept)
|
||||
{
|
||||
if($sonDept->order > $maxOrder) $maxOrder = $sonDept->order;
|
||||
echo html::input("depts[id$sonDept->id]", $sonDept->name) . '<br />';
|
||||
}
|
||||
for($i = 0; $i < DEPT::NEW_CHILD_COUNT ; $i ++) echo html::input("depts[]") . '<br />';
|
||||
?>
|
||||
</td>
|
||||
@@ -56,7 +61,7 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php echo html::submitButton() . html::backButton();?>
|
||||
<?php echo html::submitButton() . html::backButton() . html::hidden('maxOrder', $maxOrder);?>
|
||||
<input type='hidden' value='<?php echo $deptID;?>' name='parentDeptID' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user