<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('涉密人员培训详情')" />
    <th:block th:include="include :: jsonview-css" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
    <form class="form-horizontal m" id="form-train-edit" th:object="${tdTrain}">
        <input name="ID" th:field="*{ID}" type="hidden">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">所属地市：</label>
                    <div class="col-sm-8">
                        <select id="City" name="AREAID" disabled required @change="getAreaList()" v-model="City" class="form-control  ">
                            <option value="">请选择</option>
                            <option v-for="option in CityList" :value="option.id" :key="option.id">
                                {{ option.name }}
                            </option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所属区县：</label>
                    <div class="col-sm-8">
                        <select id="Area" name="FRAMEWORK" disabled v-model="Area" class="form-control  ">
                            <option value="">请选择</option>
                            <option v-for="option in AreaList" :value="option.id" :key="option.id">
                                {{ option.name }}
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">人员名称：</label>
                    <div class="col-sm-8">
                        <input name="USERNAME" disabled th:field="*{USERNAME}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">所属单位：</label>
                    <div class="col-sm-8">
                        <input name="deptName" disabled th:field="*{deptName}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训类型：</label>
                    <div class="col-sm-8">
                        <select name="trainType" disabled class="form-control  " th:with="type=${@dict.getType('sys_usertrain_typer')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训对象：</label>
                    <div class="col-sm-8">
                        <select name="trainSubject" disabled class="form-control  " th:with="type=${@dict.getType('sys_usertrain_obj')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainSubject}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训地点：</label>
                    <div class="col-sm-8">
                        <input name="trainAddress" th:field="*{trainAddress}" disabled class="form-control">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训开始日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="trainDate" disabled th:value="${#dates.format(tdTrain.trainDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训人员：</label>
                    <div class="col-sm-8">
                        <input name="trainName" disabled th:field="*{trainName}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训结束时间：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="trainTimeend" disabled th:value="${#dates.format(tdTrain.trainTimeend, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">培训状态：</label>
                    <div class="col-sm-8">
                        <select name="trainState" disabled required class="form-control  " th:with="type=${@dict.getType('sys_examine_state')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainState}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">审核人员：</label>
                    <div class="col-sm-8">
                        <input name="updateStaffid" disabled th:field="*{updateStaffid}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-2 control-label">培训评价：</label>
                    <div class="col-sm-10">
                        <textarea name="TRAININFO" disabled class="form-control">[[*{TRAININFO}]]</textarea>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: datetimepicker-css" />
<script th:inline="javascript">
    var trainStateDatas = [[${@dict.getType('sys_examine_state')}]];
    var trainStateText = $("input[name='trainState']").val()
    trainStateDatas.forEach((item)=>{
        if(trainStateText === item.dictValue){
            $("input[name='trainState']").val(item.dictLabel);
        }
    })
    var app = new Vue({
        el: '#app',
        data: {
            CityList: [],
            AreaList:[],
            City:[[${tdTrain.AREAID}]],
            Area:[[${tdTrain.FRAMEWORK}]],
            params:{
                parentId:'',
            }
        },
        mounted(){
            // 初始化地市列表
            this.getCityList();
            if (this.City){
                this.getAreaList()
            }
        },
        methods:{

            getCityList(){
                $.ajax({
                    url: ctx + "system/area/getSysAreaList",
                    type: 'GET',
                    data:this.params ,
                    success:((res)=>{
                        this.CityList = res.data
                    }) ,
                });
            },
            getAreaList(){
                this.params.parentId = this.City
                $.ajax({
                    url: ctx + "system/area/getSysAreaList",
                    type: 'GET',
                    data:this.params,
                    success:((res)=>{
                        this.AreaList = res.data
                    }) ,
                });
            }
        }
    })

    $("input[name='trainDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='createDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='updateDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='trainTimeend']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>
