|
@@ -83,7 +83,7 @@
|
|
|
<div class="modal-body">
|
|
|
<div class="form-group">
|
|
|
<label>期</label>
|
|
|
- <input class="form-control form-control-sm" value="第 <%- stages[0].order %> 期" type="text" readonly="" name="name">
|
|
|
+ <input class="form-control form-control-sm" id="edit-name" value="第 <%- stages[0].order %> 期" type="text" readonly="" name="name">
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label>计量年月<b class="text-danger">*</b></label>
|
|
@@ -96,7 +96,7 @@
|
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
|
<input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
|
|
|
- <input type="hidden" name="order" value="<%- stages[0].order %>">
|
|
|
+ <input type="hidden" name="order" id="edit-order" value="<%- stages[0].order %>">
|
|
|
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
|
|
|
<button type="submit" class="btn btn-primary btn-sm" id="edit-ok" >确定修改</button>
|
|
|
</div>
|
|
@@ -108,20 +108,27 @@
|
|
|
<script src="/public/js/datepicker/datepicker.zh.js"></script>
|
|
|
<script>
|
|
|
<% if (stages.length > 0 && stages[0].status !== auditConst.status.checked && stages[0].user_id === ctx.session.sessionUser.accountId) { %>
|
|
|
- const editDate = $('#edit-date').datepicker().data('datepicker');
|
|
|
- if ('<%- stages[0].s_time %>' && '<%- stages[0].s_time %>' !== '') {
|
|
|
- editDate.selectDate(new Date('<%- stages[0].s_time %>'));
|
|
|
- }
|
|
|
- const period = [];
|
|
|
- for (const p of'<%- stages[0].period %>'.split('~')) {
|
|
|
- if (p && p !== '') {
|
|
|
- period.push(new Date(p));
|
|
|
- }
|
|
|
- }
|
|
|
- const editPeriod = $('#edit-period').datepicker().data('datepicker');
|
|
|
- if (period.length > 0) {
|
|
|
- editPeriod.selectDate(period);
|
|
|
- }
|
|
|
+ $(function () {
|
|
|
+ $('.edit-stage').on('click', function () {
|
|
|
+ const index = parseInt($(this).data('index'));
|
|
|
+ const editDate = $('#edit-date').datepicker().data('datepicker');
|
|
|
+ $('#edit-name').val('第 ' + stages[index].order + ' 期');
|
|
|
+ $('#edit-order').val(stages[index].order);
|
|
|
+ if (stages[index].s_time && stages[index].s_time !== '') {
|
|
|
+ editDate.selectDate(new Date(stages[index].s_time));
|
|
|
+ }
|
|
|
+ const period = [];
|
|
|
+ for (const p of stages[index].period.split('~')) {
|
|
|
+ if (p && p !== '') {
|
|
|
+ period.push(new Date(p));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const editPeriod = $('#edit-period').datepicker().data('datepicker');
|
|
|
+ if (period.length > 0) {
|
|
|
+ editPeriod.selectDate(period);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
|
|
|
function checkForm () {
|
|
|
if ($('#edit-date').val() == '') {
|