{extend name="common/common2" /}
{block name="main"}
<style>
    .custom-table th,td{
        padding: 10px;
    }
    .custom-table th{
        width: 120px;
        text-align: left;
    }

</style>
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">

            <div class="ibox-content" id="printer">
                <table class="table custom-table table-bordered">
                    <tbody>
                    <tr>
                        <th>类型</th><td>{$info['work_type_mode_text']}</td>
                    </tr>
                    {if $info['real_name'] != null || $info['real_name'] != ''}
                    <tr>
                        <th>申请人</th><td>{$info['real_name']}</td>
                    </tr>
                    {/if}
                    <tr>
                        <th>联系方式</th><td>{$info['mobile']}</td>
                    </tr>
                    <tr>
                        <th>申请时间</th><td>{$info['create_time']}</td>
                    </tr>
                    {if $info['dep'] != null || $info['dep'] != ''}
                    <tr>
                        <th>所在科室/部门</th><td>{$info['dep']}</td>
                    </tr>
                    {/if}
                    {if $info['schedulContent']}
                    <tr>
                        <th>一级调度附言</th><td>{$info['schedulContent']}</td>
                    </tr>
                    {/if}
                    {if $info['work_type_mode']==1}
                    <tr>
                        <th>报修类型</th><td>{$info['order_type']}</td>
                    </tr>
                    <tr>
                        <th>报修事项</th><td>{$info['order_type_matter']}</td>
                    </tr>
                    <tr>
                        <th>报修地点</th><td>{$info['address_title']}</td>
                    </tr>
                    <tr>
                        <th>报修紧急程度</th><td>{$info['repair_priority']}</td>
                    </tr>
                    {/if}
                    <tr>
                        <th>任务内容</th><td><div>{$info['content']}</div></td>
                    </tr>
                    {if $info['work_type_mode'] == 3}
                    <tr>
                        <th>开始地点</th><td><div>{$info['oc']['start_name']}</div></td>
                    </tr>
                    <tr>
                        <th>运送类型</th>
                        <td>
                            {$info['oc']['type_name']}
                        </td>
                    </tr>
                    <tr>
                        <th>结束地点</th><td><div>{$info['oc']['end_name']}</div></td>
                    </tr>
                    <tr>
                        <th>优先级</th>
                        <td>
                            {if $info['oc']['priority'] == 1}可延缓的{/if}
                            {if $info['oc']['priority'] == 2}常规{/if}
                            {if $info['oc']['priority'] == 3}紧急{/if}
                            {if $info['oc']['priority'] == 4}预约{/if}
                        </td>
                    </tr>
                    <tr>
                        <th>运送工具</th><td><div>{$info['oc']['device_name']}</div></td>
                    </tr>
                    <tr>
                        <th>需求时间</th><td><div>{$info['oc']['xq_time']}</div></td>
                    </tr>
                    <tr>
                        <th>应完成时间</th><td><div>{$info['oc']['ywc_time']}</div></td>
                    </tr>
                    <tr>
                        <th>联系人</th><td><div>{$info['oc']['name']}</div></td>
                    </tr>
                    <tr>
                        <th>联系电话</th><td><div>{$info['oc']['phone']}</div></td>
                    </tr>

                    {if !empty($info['ocp'])}
                    <tr>
                        <th>床号</th><td>{$info['ocp']['bed_number']}</td>
                    </tr>
                    <tr>
                        <th>姓名</th><td>{$info['ocp']['name']}</td>
                    </tr>
                    <tr>
                        <th>病案号</th><td>{$info['ocp']['ba_number']}</td>
                    </tr>

                    <tr>
                        <th>性别</th>
                        <td>
                            {if $info['ocp']['gender'] == 0}未知{/if}
                            {if $info['ocp']['gender'] == 1}男{/if}
                            {if $info['ocp']['gender'] == 2}女{/if}
                        </td>
                    </tr>
                    <tr>
                        <th>往返</th>
                        <td>
                            {if $info['ocp']['back'] == 0}否{/if}
                            {if $info['ocp']['back'] == 1}是{/if}
                        </td>
                    </tr>
                    {/if}
                    {/if}
                    {if !empty($info['voices'])}
                    <tr>
                        <th>语音</th><td><audio src="{$info['voices']}" controls></audio></td>
                    </tr>
                    {/if}
                    {if !empty($info['images'])}
                    <tr>
                        <th>图片</th>
                        <td>
                            <p>
                                {foreach $info['images'] as $key=>$val}
                                <img onclick="open_img(this)" src="{$val}"  width="60" height="60">
                                {/foreach}
                            </p>
                        </td>
                    </tr>
                    {/if}

                    {if !empty($info['videos'])}
                    <tr>
                        <th>视频</th>
                        <td  style="width: 200px!important;height: 200px;!important;">

                            <video style="width: 200px!important;height: 200px;!important;" src="{$info['videos']}" controls="controls">
                            </video>
                        </td>
                    </tr>
                    {/if}

                    {if $info['is_deal']==1 && $info['order_mode']==1 && $turnoff && $level1}
                    <tr>
                        <th>状态</th>
                        <td>
                            已处理
                        </td>
                    </tr>
                    {else}
                    <tr>
                        <th>状态</th><td><div>{$info['order_mode_text']}</div></td>
                    </tr>

                    {/if}

                    {if $info['is_deal']==1 && $info['order_mode']==1 && $turnoff}
                    <tr>
                        <th>派单类型</th>
                        <td>
                           二级调度
                        </td>
                    </tr>
                    {/if}
                    {if $info['is_deal']==0 && $info['order_mode']==4 && $turnoff}
                    <tr>
                        <th>派单类型</th>
                        <td>
                            员工
                        </td>
                    </tr>
                    {/if}
                    {if !empty($info['reason'])}
                    <tr>
                        <th>原因</th>
                        <td>
                            {$info['reason']}
                        </td>
                    </tr>
                    {/if}
                    {if $info['order_mode'] == 6 && !empty($info['comment'])}
                    <tr>
                        <th>评价</th>
                        <td>
                            <link rel="stylesheet" href="/static/bootstrap-star-rating/css/star-rating.css">
                            <script src="/static/bootstrap-star-rating/js/star-rating.js"></script>
                            <div class="atar_show">
                                <input id="input-id" type="hidden" class="rating" value="{$info['comment']['score']}" disabled data-size="xs" >
                            </div>
                            <script>
                                $("#input-id").rating({
                                    showclear:false,
                                    showcaption: false,
                                });
                            </script>
                            <div>
                                {$info['comment']['content']}
                            </div>
                        </td>
                    </tr>
                    {/if}

                    {if !empty($info['todo_list'])}
                    <tr>
                        <th>工单信息</th>
                        <td>
                            <table class="table table-bordered">
                                <tr>
                                    <td style="width: 12.5%">执行人</td>
                                    <td style="width: 12.5%">分派时间</td>
                                    <td style="width: 12.5%">接单时间</td>
                                    <td style="width: 12.5%">完成时间</td>
                                    {if $info['work_type_mode']==1}
                                    <td style="width: 12.5%">签名图</td>
                                    {/if}
                                    <td style="width: 12.5%">完成图片</td>
                                    <td style="width: 12.5%">备注</td>
                                    <td style="width: 12.5%">状态</td>
                                </tr>
                                {foreach $info['todo_list'] as $k=>$v}
                                <tr>
                                    <td>{$v['to_real_name']}</td>
                                    <td>{$v['create_time']}</td>
                                    <td>{$v['confirm_time']}</td>
                                    <td>{$v['done_time']}</td>
                                    {if $info['work_type_mode']==1}
                                    <td>{if !empty($v['sign'])}
                                        <img onclick="open_img(this)" src="{$v['sign']}"  width="60" height="60">
                                        {/if}
                                    </td>
                                    {/if}
                                    <td>{if !empty($v['to_ok_images'])}
                                        {foreach $v['to_ok_images'] as $key=>$val}
                                        <img onclick="open_img(this)" src="{$val}"  width="60" height="60">
                                        {/foreach}
                                        {/if}
                                    </td>
                                    <td>{$v['nodo_reason']}</td>
                                    <td>
                                        {if condition="$v['work_type_mode'] eq 1 and $v['todo_mode'] eq 2 and $v['pause'] == 1"}
                                        已挂起 <br>
                                        <div>挂起原因:{$v['pause_reason']}</div>
                                        <div>挂起时间:{$v['pause_time']}</div>
                                        {else /}
                                        {$v['todo_mode_text']}
                                        {/if}
                                    </td>
                                </tr>
                                {/foreach}
                            </table>
                        </td>
                    </tr>
                    {/if}
                    {if !empty($info['cons'])}
                    <tr>
                        <th>耗材信息</th>
                        <td>
                            <table class="table table-bordered">
                                <tr>
                                    <td style="width: 12.5%">名称</td>
                                    <td style="width: 12.5%">数量</td>
                                    <td style="width: 12.5%">单价</td>
                                    <td style="width: 12.5%">总价</td>
                                    <td style="width: 12.5%">使用人</td>
                                </tr>
                                {foreach $info['cons'] as $k=>$v}
                                <tr>
                                    <td>{$v['title']}</td>
                                    <td>{$v['total']}</td>
                                    <td>{$v['money']}</td>
                                    <td>{$v['total_money']}</td>
                                    <td>{$v['realName']}</td>
                                </tr>
                                {/foreach}
                            </table>
                        </td>
                    </tr>
                    {/if}
                    {if in_array($info['order_mode'],[1,4])}
                    <tr>
                        <th>操作</th><td>
                        <a onclick="printer()" href="javascript:;" ><span class="btn btn-sm btn-primary">打印</span></a> &nbsp;

                    </td>
                    </tr>
                    {/if}
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script src="/static/browser.js"></script>
<script src="/static/jquery.jqprint-0.3.js"></script>
<script>
    function printer(){
        $('#printer').jqprint();
    }
    function comment(_self) {
        var flag = $(_self).attr('data-flag');
        if (flag == 1) {
            return false;
        }
        $(_self).attr('data-flag', 1);
        var score = $('#create-input-id').val();
        var content = $('#content').val();
        var id = "{$info.id}";
        $.ajax({
            url: '{:url("comment")}',
            type: "POST",
            data: {'id': id, 'score': score, 'content': content},
            success: function (result) {
                $(_self).attr('data-flag', 0);
                if (result.code == 1) {
                    layer.alert(result.msg, {icon: 1, skin: 'layer-ext-moon'}, function () {
                        window.location.reload();
                    });
                } else {
                    layer.alert(result.msg, {icon: 2, skin: 'layer-ext-moon'});
                }
            },
            error: function (result) {
                layer.alert('网络请求失败', {icon: 2, skin: 'layer-ext-moon'});
                $(_self).attr('data-flag', 0);
            }
        });
    }
</script>
{/block}