<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改文件下发')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<style>
    .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice {
        color: #000000;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
    <form class="form-horizontal m" id="form-fileprovide-edit" th:object="${tdFileProvide}">
        <input name="fileId" th:field="*{fileId}" type="hidden">
        <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">
                        <input name="fileId" readonly th:field="*{fileId}" 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 id="City" name="frameworkId" disabled @change="getAreaList()" v-model="City" class="form-control m-b">
                            <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="areaid" disabled v-model="Area" class="form-control m-b">
                            <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="provideDepart" readonly th:field="*{provideDepart}" 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="provideUserid" readonly th:field="*{provideUserid}" 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">
                        <div class="input-group date">
                            <input name="provideDate" readonly th:value="${#dates.format(tdFileProvide.provideDate, '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 class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">发文份数：</label>
                    <div class="col-sm-8">
                        <input name="provideCount" readonly th:field="*{provideCount}" 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">
                        <input name="provideCount" readonly th:field="*{targetDepart}" 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">
                        <select name="instancyExtent" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_file_jinjichengdu')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{instancyExtent}"></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="fileName" readonly th:field="*{fileName}" 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="fileNum" readonly th:field="*{fileNum}" 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="fileSecret" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_file_miji')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fileSecret}"></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="allianceFile" readonly th:field="*{allianceFile}" 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">
                        <input name="releaseSecretid" readonly th:field="*{releaseSecretid}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">

            </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="remark" readonly th:field="*{remark}" class="form-control" type="text"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/fileprovide";
    $("#form-fileprovide-edit").validate({
        focusCleanup: true
    });
    var app = new Vue({
        el: '#app',
        data: {
            CityList: [],
            AreaList:[],
            City:[[${tdFileProvide.frameworkId}]],
            Area:[[${tdFileProvide.areaid}]],
            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
                    }) ,
                });
            }
        }
    })
    var updateDate = document.querySelector('#updateDate').value;
    var provideDate = document.querySelector('#provideDate').value;
    if (updateDate != null && updateDate !== ''){
        document.querySelector('#updateDate').value = $.common.dateFormat(updateDate,"yyyy-MM-dd")
    }
    if (provideDate != null && provideDate !== ''){
        document.querySelector('#provideDate').value = $.common.dateFormat(provideDate,"yyyy-MM-dd")
    }
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-fileprovide-edit').serialize());
        }
    }
    $("input[name='provideDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>
