<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改培训/活动信息')" />
    <link th:href="@{/css/use/css1.css}" rel="stylesheet"/>
    <link th:href="@{/ruoyi/css/meeting.css}" rel="stylesheet"/>
    <th:block th:include="include :: bootstrap-duallistbox-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-meeting-edit" th:object="${rwkMeeting}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="col-md-12">
            <div class="col-md-6">
                <div class="daj_middle">
                    <label class="daj_left control-label" style="text-align: left;"><span class="specialSign">*</span>活动标题</label>
                    <div class="daj_right">
                        <input name="meetingName" class="form-control daj_frame" th:field="*{meetingName}" placeholder="请填写培训活动标题" required>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="daj_middle">
                    <label class="daj_left control-label" style="text-align: right;">培训日期</label>
                    <div class="daj_right">
                        <input name="meetingDate" type="text" th:field="*{meetingDate}" class="form-control daj_frame time-input" placeholder="请选择培训日期"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12"><div class="black_line"></div></div>
        <div class="col-md-12">
            <div class="daj_middle">
                <label class="daj_left_two control-label">活动信息简介填写：</label>
                <div class="daj_right_two">
                    <textarea name="meetingContent" class="form-control" rows="5" style="resize: none;" placeholder="请填写培训活动简介">[[*{meetingContent}]]</textarea>
                </div>
            </div>
        </div>
        <div class="col-md-12"><div class="black_line"></div></div>
        <div class="col-md-12">
            <div class="daj_middle">
                <label class="daj_left_two control-label">附件</label>
                <div class="daj_right_two fj_box1">
                    <div style="height: 43px;width: 100%;margin-top: 3px;">
                        <input name="fj" type="button"  class="fj_btn" onclick="">
                        <input type="file" name="fileUpload_l" id="fileUpload_l" onchange="" style="display:none;" accept=".pdf,.ofd,.txt,.wps,.xlsx,.xls,.pub,.docx,.doc,.xml,.jpg,.png">
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <div class="daj_middle">
                <label class="daj_left_two control-label"></label>
                <div class="daj_right_two fj_box1" style="min-height:47px;height: auto;">
                    <table id="table-show" class="table table-hover"  style="margin-bottom: 10px;">
                        <tbody>
                        <tr>
                            <td class="width-40"><img src="/img/use/filelook.png" />厨房零配件维修清单及报价(三月至五月).docx</td>
                            <td class="width-8">非密</td>
                            <td class="width-20"></td>
                            <td>
                                <a style='margin-right: 10px;'><img src="/img/use/xiazai.png"/></a>
                                <a data-id =""><img src="/img/use/delete.png"/></a>
                            </td>
                        </tr>
                        <tr>
                            <td class="width-40"><img src="/img/use/filelook.png" />厨房零配件维修清单及报价(二月).docx</td>
                            <td class="width-8">机密</td>
                            <td class="width-20">保密期限:2025-01-14</td>
                            <td>
                                <a style='margin-right: 10px;'><img src="/img/use/xiazai.png"/></a>
                                <a data-id =""><img src="/img/use/delete.png"/></a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-12"><div class="black_line"></div></div>
        <div class="col-md-12">
            <div class="daj_middle">
                <label class="daj_left_two control-label">人员情况</label>
                <div class="daj_right_two" style="display: flex;">
                    <div id="invite" style="width: 50%;"></div>
                    <div style="width: 50%;"><a class="btn btn-unite" onclick="meetManUpdate()"><i class="fa fa-user-o"></i>  修改</a></div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-duallistbox-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/meeting";
    var userList = [[${rwkMeeting.rwkMeetingStaffList}]];
    showByUser();
    $("#form-meeting-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            if (userList.length === 0) {
                $.modal.alertWarning("请至少选择一个参与人员");
                return;
            }
            var array = $('#form-meeting-edit').serializeArray();
            var obj = {};
            array.forEach(function(item) {
                obj[item.name] = item.value;
            });
            userList.forEach(function (item,index){
                for (var key in item){
                    obj["rwkMeetingStaffList["+index+"]."+key] = item[key];
                }
            })
            $.operate.save(prefix + "/edit", $.param(obj));
        }
    }

    function meetManUpdate(){
        var options = {
            title: '人员选择',
            url: prefix + "/userSelect",
            skin: 'layui-layer-blue',
            btn: ['保存','取消'],
            width: Math.floor(window.innerWidth),
            height: Math.floor(window.innerHeight)+110,
            maxmin: false,
            full: false,
            yes: function(index, layero) {
                var iframeWin = layero.find('iframe')[0];
                userList = iframeWin.contentWindow.getSelectedItems();
                $.modal.close(index);
                showByUser();
            }
        };
        $.modal.openOptions(options);
    }

    //根据用户数据集合进行回显
    function showByUser(){
        var html = "";
        if (userList && userList.length>0){
            html = userList.map(item => item.personnelName).join('，');
        }
        $("#invite").html(html);
    }
</script>
</body>
</html>