|  | @@ -34,7 +34,7 @@ $(function () {
 | 
												
													
														
															|  |          const codeDate = $('#code-date').datepicker({
 |  |          const codeDate = $('#code-date').datepicker({
 | 
												
													
														
															|  |              onSelect: function (formattedDate, date, inst) {
 |  |              onSelect: function (formattedDate, date, inst) {
 | 
												
													
														
															|  |                  const showDate = date ? moment(date[date.length - 1]).format('YYYYMMDD') : '';
 |  |                  const showDate = date ? moment(date[date.length - 1]).format('YYYYMMDD') : '';
 | 
												
													
														
															|  | -                const showCode = showDate ? showDate + getCodeByDate(showDate) : '';
 |  | 
 | 
												
													
														
															|  | 
 |  | +                const showCode = showDate ? showDate + getCodeByDate(showDate, getDatesFromStringAndConvert(formattedDate)) : '';
 | 
												
													
														
															|  |                  if (!showCode) {
 |  |                  if (!showCode) {
 | 
												
													
														
															|  |                      $('#existMsg').hide();
 |  |                      $('#existMsg').hide();
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
											
												
													
														
															|  | @@ -42,7 +42,7 @@ $(function () {
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          }).data('datepicker');
 |  |          }).data('datepicker');
 | 
												
													
														
															|  |          codeDate.selectDate(new Date());
 |  |          codeDate.selectDate(new Date());
 | 
												
													
														
															|  | -        $('#show-code').val(moment().format('YYYYMMDD') + getCodeByDate(moment().format('YYYYMMDD')));
 |  | 
 | 
												
													
														
															|  | 
 |  | +        $('#show-code').val(moment().format('YYYYMMDD') + getCodeByDate(moment().format('YYYYMMDD'), getDatesFromStringAndConvert(moment().format('YYYY-MM-DD'))));
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |          $('#add-log input[name="log-type"]').on('click', function () {
 |  |          $('#add-log input[name="log-type"]').on('click', function () {
 | 
												
													
														
															|  |              const type = parseInt($(this).val());
 |  |              const type = parseInt($(this).val());
 | 
												
											
												
													
														
															|  | @@ -55,7 +55,7 @@ $(function () {
 | 
												
													
														
															|  |                  codeDate.clear();
 |  |                  codeDate.clear();
 | 
												
													
														
															|  |                  $('#code-date').val(moment().format('YYYY-MM-DD'));
 |  |                  $('#code-date').val(moment().format('YYYY-MM-DD'));
 | 
												
													
														
															|  |                  codeDate.selectDate(new Date());
 |  |                  codeDate.selectDate(new Date());
 | 
												
													
														
															|  | -                $('#show-code').val(moment().format('YYYYMMDD') + getCodeByDate(moment().format('YYYYMMDD')));
 |  | 
 | 
												
													
														
															|  | 
 |  | +                $('#show-code').val(moment().format('YYYYMMDD') + getCodeByDate(moment().format('YYYYMMDD'), getDatesFromStringAndConvert(moment().format('YYYY-MM-DD'))));
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          });
 |  |          });
 | 
												
													
														
															|  |  
 |  |  
 | 
												
											
												
													
														
															|  | @@ -108,12 +108,14 @@ $(function () {
 | 
												
													
														
															|  |              })
 |  |              })
 | 
												
													
														
															|  |          });
 |  |          });
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -        function getCodeByDate(date) {
 |  | 
 | 
												
													
														
															|  | 
 |  | +        function getCodeByDate(date, dates) {
 | 
												
													
														
															|  |              let num = '001';
 |  |              let num = '001';
 | 
												
													
														
															|  |              if (date) {
 |  |              if (date) {
 | 
												
													
														
															|  |                  const dateInfo = _.find(dateCodeList, { date_code: date });
 |  |                  const dateInfo = _.find(dateCodeList, { date_code: date });
 | 
												
													
														
															|  |                  if (dateInfo) {
 |  |                  if (dateInfo) {
 | 
												
													
														
															|  |                      num = convertToThreeDigits(dateInfo.num + 1);
 |  |                      num = convertToThreeDigits(dateInfo.num + 1);
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if (_.intersection(_.map(dateCodeList, 'date_code'), dates).length !== 0) {
 | 
												
													
														
															|  |                      $('#existMsg').show();
 |  |                      $('#existMsg').show();
 | 
												
													
														
															|  |                  } else {
 |  |                  } else {
 | 
												
													
														
															|  |                      $('#existMsg').hide();
 |  |                      $('#existMsg').hide();
 | 
												
											
												
													
														
															|  | @@ -124,6 +126,38 @@ $(function () {
 | 
												
													
														
															|  |              return num;
 |  |              return num;
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | 
 |  | +        function getDatesFromStringAndConvert(dateString) {
 | 
												
													
														
															|  | 
 |  | +            const dates = [];
 | 
												
													
														
															|  | 
 |  | +            const dateParts = dateString.split(' ~ ');
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            dateParts.forEach(datePart => {
 | 
												
													
														
															|  | 
 |  | +                const date = new Date(datePart);
 | 
												
													
														
															|  | 
 |  | +                if (!isNaN(date.getTime())) {
 | 
												
													
														
															|  | 
 |  | +                    dates.push(date);
 | 
												
													
														
															|  | 
 |  | +                } else {
 | 
												
													
														
															|  | 
 |  | +                    console.error('Invalid date format in the input string:', datePart);
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            });
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            if (dates.length === 1) {
 | 
												
													
														
															|  | 
 |  | +                return [dates[0].toISOString().slice(0, 10).replace(/-/g, '')];
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            const startDate = dates[0];
 | 
												
													
														
															|  | 
 |  | +            const endDate = dates[1];
 | 
												
													
														
															|  | 
 |  | +            const currentDate = new Date(startDate);
 | 
												
													
														
															|  | 
 |  | +            const endDatePlusOneDay = new Date(endDate);
 | 
												
													
														
															|  | 
 |  | +            endDatePlusOneDay.setDate(endDatePlusOneDay.getDate() + 1);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            while (currentDate < endDatePlusOneDay) {
 | 
												
													
														
															|  | 
 |  | +                const formattedDate = currentDate.toISOString().slice(0, 10).replace(/-/g, '');
 | 
												
													
														
															|  | 
 |  | +                dates.push(formattedDate);
 | 
												
													
														
															|  | 
 |  | +                currentDate.setDate(currentDate.getDate() + 1);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            return dates.slice(2);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |          function convertToThreeDigits(number) {
 |  |          function convertToThreeDigits(number) {
 | 
												
													
														
															|  |              // 将数字转换为字符串
 |  |              // 将数字转换为字符串
 | 
												
													
														
															|  |              let numStr = String(number);
 |  |              let numStr = String(number);
 |