diff --git a/module/programplan/model.php b/module/programplan/model.php index acc1506e53..3ffe74188b 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -1589,13 +1589,14 @@ class programplanModel extends model } /** + * 获取阶段当前和子集信息。 * Get plan and its children. * - * @param string|int|array $planIdList + * @param string|int|array $planIdList * @access public * @return array */ - public function getSelfAndChildrenList($planIdList) + public function getSelfAndChildrenList(string|int|array $planIdList) { if(is_numeric($planIdList)) $planIdList = (array)$planIdList; diff --git a/module/programplan/test/model/getselfandchildrenlist.php b/module/programplan/test/model/getselfandchildrenlist.php index 110050916f..991c2cea60 100755 --- a/module/programplan/test/model/getselfandchildrenlist.php +++ b/module/programplan/test/model/getselfandchildrenlist.php @@ -2,23 +2,9 @@ gen(5); su('admin'); -$execution = zdTable('project'); -$execution->id->range('1-5'); -$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b'); -$execution->type->range('project,stage{4}'); -$execution->project->range('0,1{4}'); -$execution->parent->range('0,1,2,3,1'); -$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`"); -$execution->status->range('doing,doing,doing,closed,suspended'); -$execution->openedBy->range('admin,user1'); -$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->gen(5); - +zdTable('project')->config('getselfandchildrenlist')->gen(6); /** title=测试programplanModel->getSelfAndChildrenList(); @@ -32,7 +18,8 @@ pid=1 $plan = new programplanTest(); $topPlan = $plan->getSelfAndChildrenListTest(2); + $topPlanCount = count($topPlan[2]); r($topPlan[2][2]) && p('status') && e('doing'); // 测试id为2时获取自己的状态 -r($topPlanCount - 1) && p('') && e(2); // 测试id为2时获取自己后代的个数 +r($topPlanCount - 1) && p('') && e(3); // 测试id为2时获取自己后代的个数 diff --git a/module/programplan/test/model/yaml/getselfandchildrenlist/getselfandchildrenlist.yaml b/module/programplan/test/model/yaml/getselfandchildrenlist/getselfandchildrenlist.yaml new file mode 100644 index 0000000000..04098da817 --- /dev/null +++ b/module/programplan/test/model/yaml/getselfandchildrenlist/getselfandchildrenlist.yaml @@ -0,0 +1,25 @@ +title: zt_getselfandchildrenlist +author: jukui +version: '1.0' +fields: + - field: id + range: 1-6 + - field: project + range: '0,1{4}' + - field: name + range: '瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b,阶段a子1子1子1' + - field: parent + range: '0,1,2,3,1,4' + - field: type + range: 'project,stage{4}' + - field: grade + range: 1 + - field: days + range: 1 + - field: status + range: 'doing,doing,doing,closed,suspended' + - field: desc + range: 1-6 + prefix: '项目描述' + - field: path + range: "`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`,`,1,2,3,4,6,`"