guhongwei 3 jaren geleden
bovenliggende
commit
1b2b8845de
1 gewijzigde bestanden met toevoegingen van 56 en 1 verwijderingen
  1. 56 1
      src/views/test.vue

+ 56 - 1
src/views/test.vue

@@ -16,6 +16,9 @@ const { textname } = require('@frame/src/layout/test');
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: statistics } = createNamespacedHelpers('statistics');
+const { mapActions: personal } = createNamespacedHelpers('personal');
+const { mapActions: patentearly } = createNamespacedHelpers('patentearly');
+
 const moment = require('moment');
 export default {
   name: 'test',
@@ -35,13 +38,65 @@ export default {
       },
     };
   },
-  created() {},
+  created() {
+    this.oneSearch();
+    // this.twoSearch();
+  },
   methods: {
     ...statistics(['patentInfoByApplyPerson']),
+    ...personal({ personalQuery: 'query' }),
+    ...patentearly({ patentearlyQuery: 'query' }),
     // 添加用户
     async toAdd() {
       console.log(this.textname);
     },
+    oneSearch() {
+      const limitMonth = 3;
+      const create_date = '2015-12-24';
+      // 当前年份
+      const now_year = moment(new Date()).format('YYYY');
+      // 专利日期
+      const patent_month = moment(create_date).format('MM-DD');
+      // 专利到期日期
+      const end = now_year + '-' + patent_month;
+      // 专利到期前一天
+      const endbeforeone = moment(end).subtract(1, 'd').format('YYYY-MM-DD');
+      // 专利到期日期减去三个月
+      const start = moment(end).subtract(limitMonth, 'months').format('YYYY-MM-DD');
+      const r = moment().isBetween(start, end, null, '[]');
+      console.log(r);
+      // // 专利月日减去三个月
+      // const start = moment(end).subtract(limitMonth, 'months').format('MM-DD');
+      // // 专利月日减去一天
+      // const endbeforeone = moment(end).subtract(1, 'd').format('MM-DD');
+      // // 取得当前月份
+      // const month_now = moment(new Date()).format('MM-DD');
+      // const r = moment('02-01').isBetween(start, end, null, '[]');
+      // console.log(r);
+      // // // 取得当前年份
+      //
+      // // // 当前年份+一年
+      // const afterYear = moment(nowYear).add(1, 'year').format('YYYY');
+      // // // 开始时间(先组合日期,减去三个月)
+      // const nowDate = nowYear + '-' + month;
+      // const start = moment(nowDate).subtract(limitMonth, 'months').format('YYYY-MM-DD');
+      // console.log(start + '----------5');
+      // // 结束时间
+      // const end = nowYear + '-' + month;
+      // console.log(end + '----------6');
+      // const endbeforeone = moment(end).subtract(1, 'd').format('YYYY-MM-DD');
+      // const r = moment().isBetween(start, end, null, '[]');
+      // console.log(r);
+    },
+    // async twoSearch() {
+    //   let res = await this.personalQuery({ code: 'XQGQ' });
+    //   if (this.$checkRes(res)) {
+    //     for (const val of res.data) {
+    //       let arr = await this.patentearlyQuery({ user_id: val._id });
+    //       console.log(arr);
+    //     }
+    //   }
+    // },
   },
   computed: {
     ...mapState(['user']),