Browse Source

feat: 信息价库支持创建季度价信息价库

vian 11 months ago
parent
commit
37e490b18f
2 changed files with 6 additions and 12 deletions
  1. 2 2
      web/maintain/price_info_lib/html/main.html
  2. 4 10
      web/maintain/price_info_lib/js/main.js

+ 2 - 2
web/maintain/price_info_lib/html/main.html

@@ -112,7 +112,7 @@
                         <label>期数</label>
                         <input id="period" name="period" class="form-control" placeholder="请输入期数" type="text">
                         <small class="form-text text-danger" id="period-error" style="display: none">请输入有效期数(eg:
-                            2020-01)。</small>
+                            2020-01、2020年-一季度)。</small>
                     </div>
                     <input type="hidden" name="userAccount" value="<%= userAccount%>">
                 </form>
@@ -177,7 +177,7 @@
                     </div>
                 </div>
                 <small class="form-text text-danger" id="crawl-error" style="display: none">请输入有效期数。</small>
-                <small>期数格式:2020-01</label>
+                <small>期数格式:2020-01、2020年-一季度</label>
             </div>
             <div class="modal-footer">
                 <a id="crawl-confirm" href="javascript: void(0);" class="btn btn-primary">确定</a>

+ 4 - 10
web/maintain/price_info_lib/js/main.js

@@ -20,6 +20,7 @@ function throttle(fn, time) {
 }
 
 const periodReg = /\d{4}-((0[1-9])|(1[0-2]))$/;
+const quaterReg = /\d{4}年-[一二三四]{1}季度$/;
 function createLib() {
     const name = $('#name').val();
     if (!name) {
@@ -27,7 +28,7 @@ function createLib() {
         return false;
     }
     const period = $('#period').val();
-    if (!period || !periodReg.test(period)) {
+    if (!period || (!periodReg.test(period) && !quaterReg.test(period))) {
         $('#period-error').show();
         return false;
     }
@@ -323,7 +324,7 @@ function processChecking(key, cb) {
 function handleCrawlConfirm() {
     const from = $('#period-start').val();
     const to = $('#period-end').val();
-    if (!periodReg.test(from) || !periodReg.test(to)) {
+    if (!(periodReg.test(from) && periodReg.test(to)) && !(quaterReg.test(from) && quaterReg.test(to))) {
         $('#crawl-error').show();
         return false;
     }
@@ -387,11 +388,4 @@ $(document).ready(function () {
     $('#export-compilation-price').click(() => {
         handleExportInfoPriceByCompilation();
     })
-});
-
-$.ajax({
-    url: 'http://api.zjtcn.com/user/dyn_code',
-    type: 'post',
-    data: { service_id: '2020090003' },
-    contentType: 'application/x-www-form-urlencoded',
-})
+});