Browse Source

项目新一版

guhongwei 3 years ago
parent
commit
14300a4471

+ 1 - 1
src/layout/analysis/form-1.vue

@@ -84,7 +84,7 @@ export default {
   methods: {
     ...adminLogin(['query']),
     async search() {
-      let res = await this.query({ code: this.user.code });
+      let res = await this.query({ code: 'JLKJQY' });
       if (this.$checkRes(res)) {
         this.$set(this, `adminInfo`, res.data[0]);
         this.$set(this.form, `admin_id`, this.adminInfo._id);

+ 7 - 5
src/layout/apply/form-1.vue

@@ -195,11 +195,13 @@ export default {
       let res = await this.adminQuery({ role: '2' });
       if (this.$checkRes(res)) {
         let admin = res.data.filter((i) => i.code == 'JLKJQYCGD');
-        if (admin) {
-          this.$set(this, `mechanismList`, admin);
-          this.$set(this, `adminInfo`, admin[0]);
-          this.$set(this.form, `admin_id`, this.adminInfo._id);
-        }
+        if (admin) this.$set(this, `mechanismList`, admin);
+      }
+      // 查询管理员信息
+      res = await this.adminQuery({ code: 'JLKJQY' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `adminInfo`, res.data[0]);
+        this.$set(this.form, `admin_id`, this.adminInfo._id);
       }
     },
     // 查询用户

+ 2 - 0
src/layout/assessment/form-1.vue

@@ -4,6 +4,7 @@
       <van-col span="24" class="main">
         <van-col span="24" class="one">
           <van-form @submit="onSubmit">
+            <van-field v-model="form.admin_id" name="admin_id" label="管理员id" style="display: none" />
             <van-field v-model="form.user_id" name="user_id" label="用户id" style="display: none" />
             <van-field v-model="form.patent_id" name="patent_id" label="专利id" style="display: none" />
             <van-field v-model="form.create_number" name="create_number" label="申请号" readonly />
@@ -28,6 +29,7 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
+
 export default {
   name: 'form-1',
   props: {

+ 0 - 5
src/router/index.js

@@ -228,11 +228,6 @@ const patent = [
     component: () => import('../views/patent/user/patent/information/trans_create.vue'),
   },
   // 专利维权
-  {
-    path: '/patent/user/patent/safe/detail',
-    meta: { title: '专利维权-维权委托书' },
-    component: () => import('../views/patent/user/patent/safe/detail.vue'),
-  },
   {
     path: '/patent/user/patent/safe',
     meta: { title: '专利维权' },

+ 3 - 1
src/views/patent/user/apply/analysis/index.vue

@@ -109,6 +109,8 @@ export default {
         status: '0',
         inventor: this.user.name,
         contact: this.user.name,
+        phone: this.user.phone,
+        email: this.user.email,
         questions: {},
       };
       this.$set(this, `form`, data);
@@ -133,7 +135,7 @@ export default {
 <style lang="less" scoped>
 .dialog {
   /deep/.van-dialog__content {
-    height: 350px;
+    max-height: 350px;
     overflow-y: auto;
   }
 }

+ 18 - 9
src/views/patent/user/apply/assessment/index.vue

@@ -44,7 +44,7 @@ import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: patentassess } = createNamespacedHelpers('patentassess');
 const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
-
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
 export default {
   name: 'index',
   props: {},
@@ -58,6 +58,8 @@ export default {
   },
   data: function () {
     return {
+      // 管理员信息
+      adminInfo: {},
       active: 0,
       // 列表
       list: [],
@@ -80,6 +82,7 @@ export default {
   methods: {
     ...patentassess(['query', 'fetch', 'create', 'update']),
     ...patentinfo({ patentFetch: 'fetch' }),
+    ...adminLogin({ adminQuery: 'query' }),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
       let res = await this.query({ skip, limit, user_id: this.user._id, ...info });
       if (this.$checkRes(res)) {
@@ -103,14 +106,19 @@ export default {
       this.$router.push({ path: '/patent/index' });
     },
     // 查询用户
-    searchOther() {
-      let data = {
-        user_id: this.user.id,
-        contact: this.user.name,
-        phone: this.user.phone,
-        email: this.user.email,
-      };
-      this.$set(this, `form`, data);
+    async searchOther() {
+      let res = await this.adminQuery({ code: 'JLKJQY' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `adminInfo`, res.data[0]);
+        let data = {
+          admin_id: this.adminInfo._id,
+          user_id: this.user.id,
+          contact: this.user.name,
+          phone: this.user.phone,
+          email: this.user.email,
+        };
+        this.$set(this, `form`, data);
+      }
     },
     // 查询专利
     searchPatent() {
@@ -126,6 +134,7 @@ export default {
     conPatent(data) {
       this.$set(this, `patentInfo`, data);
       let arr = {
+        admin_id: this.adminInfo._id,
         user_id: this.user.id,
         patent_id: data.id,
         create_number: data.create_number,

+ 0 - 144
src/views/patent/user/patent/safe/detail.vue

@@ -1,144 +0,0 @@
-<template>
-  <div id="detail">
-    <admin-frame topType="2" @back="back" :rightArrow="false" :usePage="false" :useNav="false">
-      <template v-slot:info>
-        <van-col span="24" class="one">
-          <van-button type="info" size="small" @click="searchPatent()">查询专利</van-button>
-        </van-col>
-        <van-col span="24" class="two">
-          <form-1 :form="form" @onSubmit="onSubmit"></form-1>
-        </van-col>
-      </template>
-    </admin-frame>
-    <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button>
-      <search-1 v-if="dialog.type == '1'" @conPatent="conPatent"></search-1>
-    </van-dialog>
-  </div>
-</template>
-
-<script>
-import form1 from '@/layout/safe/form-1.vue';
-import search1 from '@/layout/assessment/search-1.vue';
-import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: patentsafeg } = createNamespacedHelpers('patentsafeg');
-const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
-const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
-export default {
-  name: 'detail',
-  props: {},
-  components: {
-    adminFrame,
-    form1,
-    search1,
-  },
-  data: function () {
-    return {
-      // 管理员信息
-      adminInfo: {},
-      form: { questions: {} },
-      // 专利信息
-      patentInfo: {},
-      // 弹框
-      dialog: { show: false, title: '查询专利', type: '1' },
-    };
-  },
-  async created() {
-    await this.searchOther();
-  },
-  methods: {
-    ...patentsafeg(['create']),
-    ...patentinfo({ patentFetch: 'fetch' }),
-    ...adminLogin({ adminQuery: 'query' }),
-    // 查询用户
-    async searchOther() {
-      let res = await this.adminQuery({ code: this.user.code });
-      if (this.$checkRes(res)) {
-        this.$set(this, `adminInfo`, res.data[0]);
-      }
-      let data = { user_id: this.user.id, contact: this.user.name, phone: this.user.phone, email: this.user.email, questions: {}, admin_id: this.adminInfo.id };
-      this.$set(this, `form`, data);
-    },
-    // 查询专利
-    searchPatent() {
-      let dialog = { show: true, title: '查询专利', type: '1' };
-      this.$set(this, `dialog`, dialog);
-    },
-    // 已有專利,使用id查詢專利
-    async searchInfo(id) {
-      let res = await this.patentFetch(id);
-      if (this.$checkRes(res)) this.conPatent(res.data);
-    },
-    // 确认选择
-    conPatent(data) {
-      this.$set(this, `patentInfo`, data);
-      let arr = {
-        user_id: this.user.id,
-        admin_id: this.adminInfo.id,
-        create_number: data.create_number,
-        name: data.name,
-        apply_personal: data.apply_personal,
-        type: data.type,
-        inventor: data.inventor,
-        inventors: JSON.stringify(data.inventor.map((i) => i.name)),
-        contact: this.user.name,
-        phone: this.user.phone,
-        email: this.user.email,
-        questions: {},
-      };
-      this.$set(this, `form`, arr);
-      let dialog = { show: false, title: '查询专利', type: '1' };
-      this.$set(this, `dialog`, dialog);
-    },
-    // 提交
-    async onSubmit({ data }) {
-      let res = await this.create(data);
-      if (this.$checkRes(res)) {
-        this.$toast({ type: `success`, message: `专利维权申报成功` });
-        this.back();
-      } else {
-        this.$toast({ type: `error`, message: `${res.errmsg}` });
-      }
-    },
-    // 返回
-    back() {
-      this.$router.push({ path: '/patent/user/patent/safe' });
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-    id() {
-      return this.$route.query.id;
-    },
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  watch: {
-    id: {
-      deep: true,
-      immediate: true,
-      handler(val) {
-        if (val) {
-          this.searchInfo(val);
-        }
-      },
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.one {
-  background-color: #fff;
-  text-align: center;
-  padding: 5px 0;
-  border-bottom: 1px solid #cccccc;
-}
-.dialog {
-  /deep/.van-dialog__content {
-    max-height: 350px;
-    overflow-y: auto;
-  }
-}
-</style>

+ 129 - 21
src/views/patent/user/patent/safe/index.vue

@@ -1,98 +1,206 @@
 <template>
   <div id="index">
-    <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" @add="toAdd" :useNav="false">
+    <admin-frame
+      @search="search"
+      :limit="limit"
+      :total="total"
+      topType="2"
+      :usePage="active == '0' ? false : true"
+      @back="back"
+      :rightArrow="false"
+      :useNav="false"
+    >
       <template v-slot:info>
-        <list-1 :list="list" @toView="toView" @toResult="toResult"></list-1>
+        <van-tabs v-model="active">
+          <van-tab title="维权委托书">
+            <van-col span="24" class="one">
+              <van-button type="info" size="small" @click="searchPatent()">查询专利</van-button>
+            </van-col>
+            <van-col span="24" class="two">
+              <form-1 :form="form" @onSubmit="onSubmit"></form-1>
+            </van-col>
+          </van-tab>
+          <van-tab title="已委托">
+            <list-1 :list="list" @toView="toView" @toResult="toResult"></list-1>
+          </van-tab>
+        </van-tabs>
       </template>
     </admin-frame>
     <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button>
-      <info-1 v-if="dialog.type == '1'" :info="info"></info-1>
-      <result-1 v-else-if="dialog.type == '2'" :info="info"></result-1>
+      <search-1 v-if="dialog.type == '1'" @conPatent="conPatent"></search-1>
+      <info-1 v-else-if="dialog.type == '2'" :info="info"></info-1>
+      <result-1 v-else-if="dialog.type == '3'" :info="info"></result-1>
     </van-dialog>
   </div>
 </template>
 
 <script>
+import form1 from '@/layout/safe/form-1.vue';
+import search1 from '@/layout/assessment/search-1.vue';
 import list1 from '@/layout/safe/list-1.vue';
 import info1 from '@/layout/safe/info-1.vue';
 import result1 from '@/layout/safe/result-1.vue';
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: patentsafeg } = createNamespacedHelpers('patentsafeg');
+const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
 export default {
   name: 'index',
   props: {},
   components: {
     adminFrame,
+    form1,
+    search1,
     list1,
     info1,
     result1,
   },
   data: function () {
     return {
+      // 管理员信息
+      adminInfo: {},
+      active: 0,
+      // 列表
       list: [],
-      limit: 5,
       total: 0,
+      limit: 5,
+      // 表单
+      form: {
+        questions: {},
+      },
+      // 专利信息
+      patentInfo: {},
       // 弹框
-      dialog: { show: false, title: '详细信息', type: '1' },
-      // 信息详情
+      dialog: { show: false, title: '查询专利', type: '1' },
+      // 详细信息
       info: {},
     };
   },
   async created() {
+    await this.searchOther();
     await this.search();
   },
   methods: {
-    ...patentsafeg(['query']),
+    ...patentsafeg(['query', 'fetch', 'create', 'update']),
+    ...patentinfo({ patentFetch: 'fetch' }),
+    ...adminLogin({ adminQuery: 'query' }),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
-      let res = await this.query({ skip, limit, user_id: this.user.id, ...info });
+      let res = await this.query({ skip, limit, user_id: this.user._id, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
       }
     },
-    // 添加
-    toAdd() {
-      this.$router.push({ path: '/patent/user/patent/safe/detail' });
+    // 提交
+    async onSubmit({ data }) {
+      let res = await this.create(data);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: `success`, message: `专利维权申报成功` });
+        this.search();
+        this.searchOther();
+      } else {
+        this.$toast({ type: `error`, message: `${res.errmsg}` });
+      }
+    },
+    // 返回
+    back() {
+      this.$router.push({ path: '/patent/index' });
+    },
+    // 查询用户
+    async searchOther() {
+      let res = await this.adminQuery({ code: 'JLKJQY' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `adminInfo`, res.data[0]);
+        let data = {
+          admin_id: this.adminInfo.id,
+          user_id: this.user.id,
+          contact: this.user.name,
+          phone: this.user.phone,
+          email: this.user.email,
+          questions: {},
+        };
+        this.$set(this, `form`, data);
+      }
+    },
+    // 查询专利
+    searchPatent() {
+      let dialog = { show: true, title: '查询专利', type: '1' };
+      this.$set(this, `dialog`, dialog);
+    },
+    // 已有專利,使用id查詢專利
+    async searchInfo(id) {
+      let res = await this.patentFetch(id);
+      if (this.$checkRes(res)) this.conPatent(res.data);
+    },
+    // 确认选择
+    conPatent(data) {
+      this.$set(this, `patentInfo`, data);
+      let arr = {
+        user_id: this.user.id,
+        admin_id: this.adminInfo.id,
+        create_number: data.create_number,
+        name: data.name,
+        apply_personal: data.apply_personal,
+        type: data.type,
+        inventor: data.inventor,
+        inventors: JSON.stringify(data.inventor.map((i) => i.name)),
+        contact: this.user.name,
+        phone: this.user.phone,
+        email: this.user.email,
+        questions: {},
+      };
+      this.$set(this, `form`, arr);
+      let dialog = { show: false, title: '查询专利', type: '1' };
+      this.$set(this, `dialog`, dialog);
     },
     // 查看信息
     toView(data) {
       data.inventor = JSON.stringify(data.inventor.map((i) => i.name));
       this.$set(this, `info`, data);
-      let dialog = { show: true, title: '详细信息', type: '1' };
+      let dialog = { show: true, title: '详细信息', type: '2' };
       this.$set(this, `dialog`, dialog);
     },
     // 查看结果
     toResult(data) {
       this.$set(this, `info`, data);
-      let dialog = { show: true, title: '审核结果', type: '2' };
+      let dialog = { show: true, title: '审核结果', type: '3' };
       this.$set(this, `dialog`, dialog);
     },
-    // 返回
-    back() {
-      this.$router.push({ path: '/patent/index' });
-    },
   },
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   watch: {
-    test: {
+    id: {
       deep: true,
       immediate: true,
-      handler(val) {},
+      handler(val) {
+        if (val) {
+          this.searchInfo(val);
+        }
+      },
     },
   },
 };
 </script>
 
 <style lang="less" scoped>
+.one {
+  background-color: #fff;
+  text-align: center;
+  padding: 5px 0;
+  border-bottom: 1px solid #cccccc;
+}
 .dialog {
   /deep/.van-dialog__content {
-    height: 350px;
+    max-height: 350px;
     overflow-y: auto;
   }
 }

+ 2 - 3
src/views/patent/user/transaction/index.vue

@@ -46,7 +46,7 @@ export default {
     await this.search();
   },
   methods: {
-    ...patenttrans(['query', 'update', 'check']),
+    ...patenttrans(['query', 'update', 'check', 'delete']),
     ...patentinfo({ infoUpdate: 'update' }),
     async search({ skip = 0, limit = this.limit, searchNamem, ...info } = {}) {
       let res = await this.query({ skip, limit, type: this.type, user_id: this.user.id, ...info });
@@ -63,8 +63,7 @@ export default {
     },
     // 撤回交易
     async toRevoke(data) {
-      data.isdel = '1';
-      let res = await this.update(data);
+      let res = await this.delete(data.id);
       if (this.$checkRes(res)) {
         this.$toast({ type: `success`, message: `撤销交易成功` });
         this.search();

+ 1 - 1
src/views/patent/user/userBtn.vue

@@ -156,7 +156,7 @@ export default {
       // 查询聊天未读数
       res = await this.query({ id: this.user.id });
       if (this.$checkRes(res)) {
-        let data = res.data.filter((i) => i.is_read == false);
+        let data = res.data.filter((i) => i.is_read == false && i.receiver_id == this.user.id);
         if (data) {
           this.$set(this, `unList`, data);
           this.$set(this, `unTotal`, data.length);