guhongwei 3 years ago
parent
commit
c31064769e
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/views/commonData/transaction/index.vue

+ 12 - 0
src/views/commonData/transaction/index.vue

@@ -42,6 +42,7 @@
             </div>
           </van-form>
         </van-col>
+        <!-- <van-button @click="createData">添加</van-button> -->
       </template>
     </admin-frame>
   </div>
@@ -50,6 +51,7 @@
 <script>
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import { Toast } from 'vant';
 const { mapActions: patenttrans } = createNamespacedHelpers('patenttrans');
 var moment = require('moment');
 export default {
@@ -89,6 +91,16 @@ export default {
       this.$set(this.form, this.calendar_type, moment(date).format('YYYY-MM-DD'));
       this.calendarShow = false;
     },
+    // 自动添加数据
+    async createData() {
+      let data = [];
+      for (const val of data) {
+        let res = await this.create(val);
+        if (this.$checkRes(res)) {
+          this.$toast({ type: `success`, message: `操作成功` });
+        }
+      }
+    },
   },
   computed: {
     ...mapState(['user']),