|
@@ -246,5 +246,43 @@ $(function () {
|
|
|
}
|
|
|
$(this).text('正在生成新一期数据中,请勿刷新本页!...');
|
|
|
$(this).parents('form').submit();
|
|
|
- })
|
|
|
+ });
|
|
|
+ let editPeriod = null;
|
|
|
+ $('.edit-material').on('click', function () {
|
|
|
+ const order = parseInt($(this).data('order'));
|
|
|
+ const mid = parseInt($(this).data('mid'));
|
|
|
+ $('#edit-period').val('');
|
|
|
+ $('#edit-name').val('第 ' + order + ' 期');
|
|
|
+ $('#edit-mid').val(mid);
|
|
|
+ const m_period = $(this).data('period');
|
|
|
+ const period = [];
|
|
|
+ for (const p of m_period.split('~')) {
|
|
|
+ if (p && p !== '') {
|
|
|
+ period.push(new Date(p));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#edit-period').val(m_period);
|
|
|
+ editPeriod = !editPeriod ? $('#edit-period').datepicker().data('datepicker') : editPeriod;
|
|
|
+ editPeriod.clear();
|
|
|
+ if (period.length > 0) {
|
|
|
+ editPeriod.selectDate(period);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
});
|
|
|
+function checkForm () {
|
|
|
+ if ($('#edit-period').val() == '') {
|
|
|
+ toastr.error('请选择调差周期');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // const date = $('#edit-date').val();
|
|
|
+ // const period = $('#edit-period').val();
|
|
|
+ // const startDate = period.split('~')[0];
|
|
|
+ // const endDate = period.split('~')[1];
|
|
|
+ // if (startDate.indexOf(date) === -1 && endDate.indexOf(date) === -1) {
|
|
|
+ // toastr.error('所选日期与当前月份不匹配,请重新选择');
|
|
|
+ // $('#edit-period').parents('.form-group').find('.text-danger').remove();
|
|
|
+ // $('#edit-period').parents('.form-group').append('<small class="text-danger">所选日期与当前月份不匹配,请重新选择</small>');
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+};
|