💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 属性 `$submittedCalls array 提交后回调 默认: 空,代表不回调` ## 方法 设置提交后回调: ```php @var $params array 表单自动提交后的回调,空数组代表不回调 - key 回调窗口 self: 当前窗口 parent: 父级窗口 - value 表单提交后的回调ID(构建器ID或自定义回调方法名称) 构建器ID: 指定回调;如:表格行操作和工具栏操作中的modal表单, 如果回调, 则需要传入该表格的ID 自定义回调方法名称: 指定回调;window.ym2CbkExport对象中的调用方法名称 value为空数组: 回调所有;代表回调window.ym2CbkExport中的所有方法 ``` ```php $formBuilder->setSubmittedCalls($params); // $this ``` 获取提交后回调: ```php $formBuilder->getSubmittedCalls(); // array ``` ## 示例 ~~~ /** * 编辑目录 * @param int $id * @return string * @throws \Throwable * @throws \yii\base\InvalidConfigException * @throws \yii\db\Exception */ public function actionClassifyEdit($id) { $uploadManager = $this->uploadManager; $classifyData = $uploadManager->query->from($uploadManager->fileClassifyTable) ->where(['id' => $id]) ->one(); if ($this->isPost) { if (empty($classifyData)) { return $this->asFail('id错误!'); } $bodyParam = $this->filteredPost; $dynamic = new DynamicModel($bodyParam); $boolean = $dynamic->addRule(['id', 'name'], 'required') ->addRule('id', 'integer') ->addRule('name', 'string', ['max' => 10]) ->setAttributeLabels([ 'name' => '目录名称', 'id' => 'ID', ]) ->validate(); if (!$boolean) { return $this->asFail(reset($dynamic->firstErrors)); } $uploadManager->db ->createCommand() ->update($uploadManager->fileClassifyTable, ['name' => $bodyParam['name']], ['id' => $bodyParam['id']]) ->execute(); return $this->asOk('编辑成功!'); } else { if (empty($classifyData)) { return $this->renderContentX(H5::alert('禁止编辑该目录', 'info')); } $formBuilder = FormBuilder::instance(); $formBuilder->setTitle('编辑名称') ->setPartial() ->setRequiredStyle() ->setAutoClose() ->setSubmittedCalls([ 'parent' => ['classifyView'], ]) ->setCloseBtn() ->setSubmitBtn('确定') ->setFormControl([ 'id' => $this->formControl->hidden()->defaultValue($id), 'name' => $this->formControl->text()->label('名称')->required()->placeholder('请填写目录名称')->defaultValue($classifyData['name']), ]); return $formBuilder->render(); } } ~~~