<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改涉密文件接收')" />
    <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-filereceive-edit" th:object="${tdFileProvide}">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">所属地市：</label>
                    <div class="col-sm-8">
                        <select id="City" name="frameworkId" disabled required @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-3 control-label is-required">所属区县：</label>
                    <div class="col-sm-8">
                        <select id="Area" name="areaid" disabled required 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-3 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-3 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-3 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-3 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 value="">所有</option>
                            <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-3 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-8">
                <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>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
        <div style="float: right">
            <span>销毁人：[[${tdFileReceive.destoryUsername}]]</span>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/filedestory";
    $(function() {
        var options = {
            url: prefix + "/list",
            modalName: "涉密文件接收",
            pagination:false,
            showSearch: false,
            showPageGo: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            columns: [
                {
                    field: 'fileId',
                    title: '文件编号',
                },
                {
                    field: 'destoryDepart',
                    title: '销毁单位'
                },
                {
                    field: 'destoryCount',
                    title: '销毁份数'
                },
                {
                    field: 'destoryUsername',
                    title: '销毁人签字'
                },
                {
                    field: 'destoryDate',
                    title: '销毁时间'
                }]
        };
        $.table.init(options);
    });
    var prefix = ctx + "system/filereceive";
    $("#form-filereceive-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
                    }) ,
                });
            }
        }
    })
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-filereceive-edit').serialize());
        }
    }

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

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

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

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