zoukankan      html  css  js  c++  java
  • 自定义弹窗

    • 按钮

    •   {
                                    field: 'buttons',
                                     "120px",
                                    title: __('按钮组'),
                                    table: table,
                                    events: Table.api.events.operate,
                                    buttons: [
                                        {
                                            name: 'fahuo',
                                            text: __('发货'),
                                            title: __('发货'),
                                            // classname: 'btn btn-xs btn-primary btn-dialog',
                                            classname: 'btn btn-xs btn-warning btn-dialog',
                                            icon: 'fa fa-list',
                                            url: 'jifen/jifenorders/fahuo',
                                            callback: function (data) {
                                                Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
                                            },
                                            visible: function (row) {
                                                //返回true时按钮显示,返回false隐藏
                                                return true;
                                            }
                                        }
                                    ],
                                    formatter: Table.api.formatter.buttons
                                }
      
    • js绑定事件

    •   fahuo: function () {
                    Controller.api.bindevent();
                },
      
    • 控制器

    •   public function fahuo($ids)
            {
                $row = $this->model->get(['id' => $ids]);
                if (!$row) {
                    $this->error(__('No Results were found'));
                }
                if ($this->request->isPost()) {
                    $params = $this->request->post("row/a");
                    if ($params) {
                        $params = $this->preExcludeFields($params);
                        $result = false;
                        Db::startTrans();
                        try {
                            //是否采用模型验证
        //                    if ($this->modelValidate) {
        //                        $name = str_replace("\model\", "\validate\", get_class($this->model));
        //                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.silver' : $name) : $this->modelValidate;
        //                        $row->validateFailException(true)->validate($validate);
        //                    }
                            $result = $row->allowField(true)->save($params);
                            Db::commit();
                        } catch (ValidateException $e) {
                            Db::rollback();
                            $this->error($e->getMessage());
                        } catch (PDOException $e) {
                            Db::rollback();
                            $this->error($e->getMessage());
                        } catch (Exception $e) {
                            Db::rollback();
                            $this->error($e->getMessage());
                        }
                        if ($result !== false) {
                            $this->success();
                        } else {
                            $this->error(__('No rows were updated'));
                        }
                    }
                    $this->error(__('Parameter %s can not be empty', ''));
                }
        
                $res=$row->toArray();
                $this->view->assign("order_id", $res['order_id']);
                $this->view->assign("row", $res);
                return $this->view->fetch();
            }
      
    • 页面

    •   <form id="silver-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
        
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('kuaidi')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-kuaidi" class="form-control" name="row[kuaidi]" type="text" value="{$row.kuaidi|htmlentities}">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('danhao')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-danhao" class="form-control" name="row[danhao]" type="text" value="{$row.danhao|htmlentities}">
                </div>
            </div>
        
            <div class="form-group layer-footer">
                <label class="control-label col-xs-12 col-sm-2"></label>
                <div class="col-xs-12 col-sm-8">
                    <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                    <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                </div>
            </div>
        </form>
      
  • 相关阅读:
    yaml文件执行后常见错误解决
    动态存储管理实战:GlusterFS
    Kubernetes角色访问控制RBAC和权限规则(Role+ClusterRole)
    Kubernetes 存储系统 Storage 介绍:PV,PVC,SC
    在容器中管理数据的两种方式
    k8s 如何关联pvc到特定的pv
    Mysqldump 的 的 6 大使用场景的导出命令
    Docker 容器日志管理
    k8s中节点级别的日志
    k8s中pod的容器日志查看命令
  • 原文地址:https://www.cnblogs.com/bufeetu/p/13968542.html
Copyright © 2011-2022 走看看