123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <!--弹出添加账号-->
- <div class="modal fade" id="add-user" data-backdrop="static">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">添加账号</h5>
- </div>
- <form method="post" action="/setting/user/add?_csrf_j=<%= ctx.csrf %>" onsubmit="return checkUserForm('add');">
- <div class="modal-body">
- <!--<div class="form-group">-->
- <!--<label><b class="text-danger">*</b>账号组</label>-->
- <!--<select class="form-control form-control-sm" name="account_group">-->
- <!--<option value="0">请选择</option>-->
- <!--<% for (const dw in accountGroup) { %>-->
- <!--<option value="<%= dw %>"><%= accountGroup[dw] %></option>-->
- <!--<% } %>-->
- <!--</select>-->
- <!--</div>-->
- <div class="form-group">
- <label>登录账号<b class="text-danger">*</b></label>
- <input class="form-control form-control-sm" name="account" placeholder="支持英文数字组合" type="text">
- <input value="" class="account-check" type="hidden">
- <div class="invalid-feedback">
- 该账号已存在。
- </div>
- </div>
- <div class="form-group">
- <label>登录密码<b class="text-danger">*</b></label>
- <div class="input-group">
- <input type="text" name="password" class="form-control form-control-sm" placeholder="密码支持英文数字及符号">
- <div class="input-group-append">
- <button id="rand-password" class="btn btn-outline-secondary btn-sm" type="button">随机密码</button>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label>姓名<b class="text-danger">*</b></label>
- <input class="form-control form-control-sm" name="name" value="" type="text">
- </div>
- <div class="form-group">
- <label>单位名称<b class="text-danger">*</b></label>
- <input value="7" name="account_group" type="hidden">
- <select class="form-control form-control-sm" name="company">
- <option>请选择</option>
- <% for (const u of unitList) { %>
- <option <% if (company && company === u.name) { %>selected<% } %>><%- u.name %></option>
- <% } %>
- </select>
- </div>
- <div class="form-group">
- <label>职位<b class="text-danger">*</b></label>
- <input class="form-control form-control-sm" name="role" value="" type="text">
- </div>
- <div class="form-group">
- <label>手机<b class="text-danger">*</b></label>
- <input class="form-control form-control-sm" name="mobile" value="" type="number">
- </div>
- <div class="form-group">
- <label>电话</label>
- <input class="form-control form-control-sm" name="telephone" placeholder="格式000-0000000" type="text">
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
- <button type="submit" class="btn btn-primary btn-sm">确定添加</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <!--弹出账号受限-->
- <div class="modal" tabindex="-1" role="dialog" id="add-unpass">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">无法添加账号</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <p>账号已超过最大账号数,无法添加新账号。</p>
- <p>当前限制账号总数:<b><%= projectData.max_user %></b></p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
- </div>
- </div>
- </div>
- </div>
- <section class="drawer" id="edit-user2" data-drawer-target="">
- <div class="drawer__overlay" tabindex="-1"></div>
- <form class="drawer__wrapper" method="post" action="/setting/user/permission?_csrf_j=<%= ctx.csrf %>">
- <div class="modal-header">
- <h5 class="modal-title">
- 编辑权限
- </h5>
- <!-- <button type="button" class="close" data-drawer-close="" aria-label="Close Drawer">-->
- <!-- <span aria-hidden="true">×</span>-->
- <!-- </button>-->
- <!-- <button class="drawer__close" data-drawer-close="" aria-label="Close Drawer"></button>-->
- </div>
- <div class="drawer__content">
- <% for (const pm in permission) { %>
- <div class="form-group permission-div">
- <h6 class="modal-title permission-title"><%= permission[pm].title %></h6>
- <div>
- <% for (const ip of permission[pm].children) { %>
- <% if (ip.show === undefined && ip.show !== false) { %>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="<%= permission[pm].type %>" id="<%= pm %>_<%= ip.value %>" name="<%= pm %><% if (permission[pm].type === 'checkbox') { %>[]<% } %>" value="<%= ip.value %>">
- <label class="form-check-label" for="<%= pm %>_<%= ip.value %>"><%= ip.title %></label>
- <% if (ip.hint && ip.hintIcon) { %>
- <a href="" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="<%- ip.hint%>"><i class="fa <%- ip.hintIcon%>"></i></a>
- <% } %>
- </div>
- <% } %>
- <% } %>
- </div>
- <% if (permission[pm].tips) { %>
- <!--需要勾选 创建标段 ,协作办公才能勾选-->
- <div class="alert alert-secondary" style="margin: .5rem 0 0 0;">
- <p class="mb-0"><%- permission[pm].tips %></p>
- </div>
- <% } %>
- </div>
- <% } %>
- <div class="form-group permission-div">
- <h6 class="modal-title permission-title">微信通知<a href="#wx-setting" data-toggle="modal" data-target="#wx-setting" class="pull-right"><i style="font-size: 16px" class="fa fa-cog"></i></a></h6>
- <div class="form-check form-check-inline">
- <span style="margin:0 .5rem 0 1rem; font-weight: bold;">重新发送</span>
- <div class="custom-control custom-switch">
- <input type="checkbox" class="custom-control-input" id="again_all" name="again_all" value="1">
- <label class="custom-control-label" for="again_all"></label>
- </div>
- </div>
- <div style="margin: .5rem 0 0 2rem">
- <div class="row">
- <% for (const sp in noticeAgainConst.sp) { %>
- <div class="col-2 form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="again_<%- sp %>" name="again_<%- sp %>" value="1">
- <label class="form-check-label" for="again_<%- sp %>"><%- noticeAgainConst.sp[sp].name %></label>
- </div>
- <% } %>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <input type="hidden" name="id" value="">
- <button type="button" class="btn btn-secondary btn-sm" data-drawer-close="">关闭</button>
- <button type="submit" class="btn btn-primary btn-sm">提交修改</button>
- </div>
- </form>
- </section>
- <div class="modal fade" data-backdrop="static" id="wx-setting">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">微信通知设置(所有人共用)</h5>
- </div>
- <div class="modal-body">
- <div style="margin: 0 0 .5rem .5rem">消息重新发送间隔</div>
- <div style="margin-left: 1rem;margin-bottom: .5rem">
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="radio" id="wx_send_type_1" name="wx_send_type" value="fixed" <% if (noticeSet.mode === 'fixed') { %>checked<% } %>>
- <label class="form-check-label" for="wx_send_type_1">固定间隔</label>
- </div>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="radio" id="wx_send_type_2" name="wx_send_type" value="activity" <% if (noticeSet.mode === 'activity') { %>checked<% } %>>
- <label class="form-check-label" for="wx_send_type_2">活动间隔</label>
- </div>
- </div>
- <div style="margin-left: 1.5rem;margin-top: .25rem; <% if (noticeSet.mode === 'activity') { %>display: none;<% } %>" id="wx_type_1">
- <div class="w-100 d-inline-flex"><label class="right-duiqi">每间隔:</label>
- <input id="fixed_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.fixed %>">
- <div class="dropdown-menu">
- <% for (let i = 1; i <= 24;i++) { %>
- <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
- <% } %>
- </div><label style="line-height: 25px;"> 小时</label>
- </div>
- </div>
- <div style="margin-left: 1.5rem;margin-top: .25rem; <% if (noticeSet.mode === 'fixed') { %>display: none;<% } %>" id="wx_type_2">
- <div class="w-100 d-inline-flex"><label class="right-duiqi">第1次间隔:</label>
- <input id="activity_first_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.first %>">
- <div class="dropdown-menu">
- <% for (let i = 1; i <= 24;i++) { %>
- <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
- <% } %>
- </div><label style="line-height: 25px;"> 小时</label>
- </div>
- <div class="w-100 d-inline-flex"><label class="right-duiqi">第2次间隔:</label>
- <input id="activity_second_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.second %>">
- <div class="dropdown-menu">
- <% for (let i = 1; i <= 24;i++) { %>
- <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
- <% } %>
- </div><label style="line-height: 25px;"> 小时</label>
- </div>
- <div class="w-100 d-inline-flex"><label class="right-duiqi">往后间隔:</label>
- <input id="activity_later_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.later %>">
- <div class="dropdown-menu">
- <% for (let i = 1; i <= 24;i++) { %>
- <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
- <% } %>
- </div><label style="line-height: 25px;"> 小时</label>
- </div>
- </div>
- <div style="margin: .5rem 0 .5rem .5rem">消息屏蔽时段</div>
- <div style="margin-left: 1rem;margin-bottom: .5rem">
- <div class="input-group input-group-sm mb-2">
- <div class="input-group-prepend">
- <span class="input-group-text">开始时间:</span>
- </div>
- <select class="form-control form-control-sm" id="shield_start_time" style="width: 90px!important;flex: none;">
- <option value="">不限制</option>
- <% for (let i = 0; i <= 23;i++) { %>
- <option value="<%- i %>" <% if (noticeSet.shield_times.start === i) { %>selected<% } %>><%- (i < 10 ? '0' + i : i) + ':00' %></option>
- <% } %>
- </select>
- <span class="text-danger mx-2"></span>
- </div>
- <div class="input-group input-group-sm mb-2">
- <div class="input-group-prepend">
- <span class="input-group-text">截止时间:</span>
- </div>
- <select class="form-control form-control-sm" id="shield_end_time" style="width: 90px!important;flex: none;">
- <option value="">不限制</option>
- <% for (let i = 0; i <= 23;i++) { %>
- <option value="<%- i %>" <% if (noticeSet.shield_times.end === i) { %>selected<% } %>><%- (i < 10 ? '0' + i : i) + ':00' %></option>
- <% } %>
- </select>
- <span class="text-danger mx-2"></span>
- </div>
- </div>
- <!-- <div style="margin-left: 1rem;margin-bottom: .5rem">开始时间:<input style="width: 130px" type="time" placeholder="00:00~07:00" /></div>-->
- <!-- <div style="margin-left: 1rem;margin-bottom: .5rem">截止时间:<input style="width: 130px" type="time" placeholder="00:00~07:00" /></div>-->
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
- <button type="button" class="btn btn-primary btn-sm" id="set_wx_button">确定</button>
- </div>
- </div>
- </div>
- </div>
- <script>
- $(function (){
- $('input[name="wx_send_type"]').on('click', function () {
- const type = $(this).val();
- if (type === 'fixed') {
- $('#wx_type_1').show();
- $('#wx_type_2').hide();
- } else {
- $('#wx_type_1').hide();
- $('#wx_type_2').show();
- }
- });
- $('.change_time').on('click', function () {
- $(this).parents('.dropdown-menu').siblings('input').val(parseInt($(this).data('value')));
- $(this).parents('.dropdown-menu').hide();
- });
- $('.time-input').on('click', function () {
- $(this).siblings('.dropdown-menu').show();
- });
- // 回车提交
- $('.time-input').on('keypress', function () {
- if(window.event.keyCode === 13) {
- $(this).blur();
- }
- });
- $('.time-input').blur(function () {
- const _self = $(this);
- setTimeout(function () {
- _self.siblings('.dropdown-menu').hide();
- let rate = parseFloat(_self.val());
- if (_.isNaN(rate)) {
- toastr.error('请输入1-24之前的整数值');
- _self.val(6);
- return;
- }
- rate = _.round(rate);
- if(rate < 1 || rate > 24) {
- toastr.error('请输入1-24之前的整数值');
- _self.val(6);
- return;
- }
- }, 500);
- });
- $('#set_wx_button').click(function () {
- let flag = false;
- // 判断屏蔽时段是否合理
- const start_time = $('#shield_start_time').val() !== '' ? parseInt($('#shield_start_time').val()) : null;
- const end_time = $('#shield_end_time').val() !== '' ? parseInt($('#shield_end_time').val()) : null;
- if ((start_time === null && end_time !== null) || (start_time !== null && end_time === null)) {
- toastr.error('屏蔽时段必须配置开始和截止时间,要么都为不限制');
- flag = true;
- } else if (start_time !== null && end_time !== null && start_time === end_time) {
- toastr.error('屏蔽时间段开始和截止时间不能相同');
- flag = true;
- }
- if (flag) {
- return false;
- }
- const pData = {
- mode: $('#wx-setting input[name="wx_send_type"]:checked').val(),
- fixed: parseInt($('#fixed_time').val()),
- activity: {
- first: parseInt($('#activity_first_time').val()),
- second: parseInt($('#activity_second_time').val()),
- later: parseInt($('#activity_later_time').val()),
- },
- shield_times: {
- start: start_time,
- end: end_time,
- }
- };
- console.log(pData);
- postData('/setting/update/projectset', { field: 'notice_setting', pData }, function (result) {
- toastr.success('设置成功');
- $('#wx-setting').modal('hide');
- });
- });
- });
- </script>
|