index.php 5.78 KB
<?php

use yii\helpers\Url;
use app\ht\widgets\LinkPager;


$this->title = '故障维修方案管理';
$this->params['breadcrumbs'][] = '设备管理';
$this->params['breadcrumbs'][] = ['label' => '故障管理', 'url' => ['/device/fault/index']];
$this->params['breadcrumbs'][] =  $this->title;

?>


<div class="panel panel-default">
    <div class="panel-body">
        <?=$deviceCat['name'] ?> &nbsp;&nbsp;>&nbsp;&nbsp;<?=$fault['name'] ?>
    </div>
    <div class="panel-body">
        <form action="" method="get" class="filter-form">
            <table width="100%">
                <tbody>
                <tr>
                    <td class="text-right"><b>方案名称:</b</td>
                    <td colspan="2">
                        <input type="text" name="repairName" id="repairName" value="<?=$repairName ?>">
                        <input type="hidden" name="catId" id="catId" value="<?=$catId ?>">
                        <input type="hidden" name="faultId" id="faultId" value="<?=$faultId ?>">
                    </td>
                    <td colspan="2"  class="text-left">
                        <button type="submit" class="btn btn-primary" id="search"><i class="glyphicon glyphicon-search"></i> 查 询  </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <a href="<?php echo Url::toRoute(['/device/repair/create',"catId"=>$catId,"faultId"=>$faultId]); ?>" class="btn btn-success pull-left">添加维修方案</a>&nbsp;&nbsp;
        <a href="<?php echo Url::toRoute(['/device/repair/batch-create',"catId"=>$catId,"faultId"=>$faultId]); ?>" class="btn btn-success">批量添加维修方案</a>
        <div class="clearfix"></div>
    </div>

    <div  class="panel-body">
        <?php if (!empty($repairList)) : ?>
            <table class="table table-striped table-bordered"  id="brand-table">
                <thead>
                <tr>
                    <th style="width:5%;" class="text-center align-middle hqy-all-select">ID</th>
                    <th style="width:20%;">方案名称</th>
                    <th style="width:20%;">故障原因</th>
                    <!--<th style="width:20%;">标准价格(元)</th>-->
                    <th style="width:35%;">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($repairList as $model) : ?>
                    <tr>
                        <td class="text-center align-middle hqy-row-select"><?= $model['id'] ?></td>
                        <td >
                            <?= $model['name'] ?>
                        </td>
                        <td >
                            <?= $model['reason'] ?>
                        </td>
                        <td >
                            <a href="<?php echo Url::toRoute(['/device/repair/list-price', 'id' => $model['id'],"catId"=>$catId,"faultId"=>$faultId])  ?>">详细定价</a>&nbsp;|&nbsp;
                            <a href="<?php echo Url::toRoute(['/device/repair/update', 'id' => $model['id'],"catId"=>$catId,"faultId"=>$faultId])  ?>">编辑</a> &nbsp;|&nbsp;
                            <a  onclick="confirmRedirect('<?php echo Url::toRoute(['/device/repair/delete-plan', 'id' => $model['id'],"catId"=>$catId,"faultId"=>$faultId])  ?>')" title="删除" href="javascript:void(0)">删除</a>

                        </td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
        <?php else : ?>
            <p class="text-center">
                没有找到数据
            </p>
        <?php endif; ?>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

<script>
    // 全部选中
    seajs.use("base/1.0.0/unit/utils/utils-1.0.0",function  (a) {
        a.hqySelectRow('brand-table', 'warning');
    })

    //关闭
    $("#batch-disable").click(function() {
        var ids = "";
        $("input[name='selection[]']").each(function() {
            if ($(this).prop("checked") == true) {
                var id = $(this).attr("value");
                ids = ids + id + ",";
            }
        });

        if (ids == "") {
            alert('请选择品牌')
            return false;
        }

        var url = "<?php echo Url::toRoute('/device/brand/batch-disable'); ?>?ids=" + ids;
        $('#url4').val(url);//给会话中的隐藏属性URL赋值
        $('#myModal4').modal();
    });

    function batchDisableSubmit(url){
        var url=$.trim($("#url4").val());//获取会话中的隐藏属性URL
        window.location.href=url;

    }
    

</script>



<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel4" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">关闭</button>
                <h4 class="modal-title" id="myModalLabel4">
                    提示
                </h4>
            </div>
            <div class="modal-body">
                确定禁用所选品牌吗?
            </div>
            <div class="modal-footer">
                <input type="hidden" id="url4"/>

                <a  onclick="batchDisableSubmit()" class="btn btn-primary" data-dismiss="modal">确定</a>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>