guhongwei 3 éve
szülő
commit
69919ea5bf

+ 1 - 1
src/views/patent/admin/adminBtn.vue

@@ -24,7 +24,7 @@
           <van-divider content-position="left" :style="{ color: '#1989fa', borderColor: '#1989fa' }">专利管理</van-divider>
           <van-col span="24" class="one_1">
             <van-cell title="专利信息" @click="pathBtn('admin/patent', 'info')" is-link />
-            <van-cell title="专利信息批量分配" @click="pathBtn('admin/patent', 'distribute')" is-link />
+            <van-cell title="专利信息批量处理" @click="pathBtn('admin/patent', 'distribute')" is-link />
             <van-cell title="价值评估" @click="pathBtn('admin/patent', 'assessment')" is-link />
             <van-cell title="专利交易" @click="pathBtn('admin/patent', 'trans')" is-link />
             <van-cell title="专利维权" @click="pathBtn('admin/patent', 'safeg')" is-link />

+ 71 - 32
src/views/patent/admin/patent/distribute.vue

@@ -1,10 +1,15 @@
 <template>
-  <div id="index">
+  <div id="distribute">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
         <van-col span="24" class="one">
-          <van-button type="info" size="small" @click="selectUser">选择用户</van-button>
-          <van-button type="info" size="small" @click="onSubmit">确认分配</van-button>
+          <van-button type="info" size="small" @click="toSearch()">查询条件</van-button>
+          <van-button type="danger" size="small" @click="selectDel()">批量删除</van-button>
+          <van-button type="info" size="small" @click="selectUser()">选择用户</van-button>
+          <van-button type="info" size="small" @click="selectSubmit()">确认批量分配</van-button>
+          <p>
+            专利总数:<span class="total">({{ total }})</span>
+          </p>
         </van-col>
         <van-col span="24" class="two">
           <van-form>
@@ -36,32 +41,33 @@
       </template>
     </admin-frame>
     <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
-      <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
-      <searchuser-1 v-else-if="dialog.type == '2'" @userSubmit="userSubmit"></searchuser-1>
+      <search-1 v-if="dialog.type == '1'" :searchForm="searchForm" @reseat="reseat" @onSubmit="onSubmit"></search-1>
+      <searchuser-1 v-if="dialog.type == '2'" @userSubmit="userSubmit"></searchuser-1>
     </van-dialog>
   </div>
 </template>
 
 <script>
-import info1 from '@/layout/patentInfo/info-1.vue';
+import search1 from '@/layout/patentInfo/search-1.vue';
 import searchuser1 from '@/layout/patentInfo/searchuser-1.vue';
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
+import { Dialog } from 'vant';
 export default {
-  name: 'index',
+  name: 'distribute',
   props: {},
-  components: { adminFrame, info1, searchuser1 },
+  components: { adminFrame, search1, searchuser1 },
   data: function () {
     return {
       list: [],
-      limit: 5,
+      limit: 4,
       total: 0,
       // 弹框
-      dialog: { show: false, title: '详细信息', type: '1' },
-      // 详细信息
-      info: {},
-      // 专利分配用户
+      dialog: { show: false, title: '查询条件', type: '1' },
+      // 查询条件
+      searchForm: {},
+      // 批量处理表单
       form: {},
     };
   },
@@ -69,7 +75,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentinfo(['query', 'updateUser']),
+    ...patentinfo(['query', 'updateUser', 'delete']),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
       let res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
@@ -77,23 +83,35 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
-    // 详细信息
-    toView(data) {
-      this.$set(this, `info`, data);
-      this.dialog = { show: true, title: '详细信息', type: '1' };
+    // 查询专利
+    toSearch() {
+      this.dialog = { show: true, title: '查询条件', type: '1' };
     },
-    // 提交
-    async onSubmit() {
-      let data = {
-        patentData: this.form.patentData,
-        user_id: this.form.user_id ? [{ user_id: this.form.user_id, name: this.form.name }] : '',
-      };
-      if (data.patentData && data.user_id) {
-        let res = await this.updateUser(data);
-        if (this.$checkRes(res)) {
-          this.$toast({ type: `success`, message: `操作完成` });
-          this.search();
-        }
+    // 重置条件
+    reseat() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 提交查询
+    onSubmit({ data }) {
+      this.search(data);
+      this.dialog = { show: false, title: '查询条件', type: '1' };
+    },
+    // 批量删除
+    async selectDel() {
+      let data = this.form.patentData;
+      if (data && data.length > 0) {
+        Dialog.confirm({ title: '信息提示', message: '删除操作不可恢复,您确定要继续么?' })
+          .then(async () => {
+            for (const val of data) {
+              let res = await this.delete(val);
+              if (this.$checkRes(res)) {
+                this.$toast({ type: `success`, message: `删除成功` });
+                this.search();
+              }
+            }
+          })
+          .catch(() => {});
       } else {
         this.$toast({ type: `error`, message: `缺少必要信息` });
       }
@@ -108,12 +126,25 @@ export default {
       this.$set(this.form, `name`, data.name);
       this.dialog = { show: false, title: '选择用户', type: '2' };
     },
-
+    // 提交
+    async selectSubmit() {
+      let data = { patentData: this.form.patentData, user_id: this.form.user_id ? [{ user_id: this.form.user_id, name: this.form.name }] : '' };
+      if (data.patentData && data.user_id) {
+        let res = await this.updateUser(data);
+        if (this.$checkRes(res)) {
+          this.$toast({ type: `success`, message: `操作完成` });
+          this.search();
+        }
+      } else {
+        this.$toast({ type: `error`, message: `缺少必要信息` });
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });
     },
   },
+
   computed: {
     ...mapState(['user']),
   },
@@ -135,7 +166,15 @@ export default {
   text-align: center;
   margin: 8px 0;
   .van-button {
-    margin: 0 5px;
+    margin: 0 5px 5px 0;
+  }
+  p {
+    font-size: 16px;
+    margin: 5px 0 0 0;
+    span {
+      color: #000;
+      font-weight: bold;
+    }
   }
 }
 .two {

+ 36 - 7
src/views/patent/admin/patent/index.vue

@@ -3,10 +3,13 @@
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" @add="toAdd" :useNav="false">
       <template v-slot:info>
         <van-col span="24" class="one">
-          <span class="total">({{ total }})</span>
+          <van-button type="info" size="small" @click="toSearch()">查询条件</van-button>
           <van-button type="info" size="small" @click="toImport()">导入专利</van-button>
           <van-button type="info" size="small" @click="downPatent()">下载专利</van-button>
           <van-button type="info" size="small" @click="downSpeed()">下载进度</van-button>
+          <p>
+            专利总数:<span class="total">({{ total }})</span>
+          </p>
         </van-col>
         <van-col span="24" class="two">
           <list-1 :list="list" @toView="toView" @toEdit="toEdit" @toDel="toDel"></list-1>
@@ -16,6 +19,7 @@
     <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
       <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
       <speed-1 :list="speedList" v-if="dialog.type == '2'"></speed-1>
+      <search-1 v-if="dialog.type == '3'" :searchForm="searchForm" @reseat="reseat" @onSubmit="onSubmit"></search-1>
     </van-dialog>
   </div>
 </template>
@@ -24,6 +28,7 @@
 import list1 from '@/layout/patentInfo/list-1.vue';
 import info1 from '@/layout/patentInfo/info-1.vue';
 import speed1 from '@/layout/patentInfo/speed-1.vue';
+import search1 from '@/layout/patentInfo/search-1.vue';
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
@@ -31,7 +36,7 @@ const { mapActions: mission } = createNamespacedHelpers('mission');
 export default {
   name: 'index',
   props: {},
-  components: { adminFrame, list1, info1, speed1 },
+  components: { adminFrame, list1, info1, speed1, search1 },
   data: function () {
     return {
       list: [],
@@ -43,6 +48,8 @@ export default {
       info: {},
       // 下载专利进度
       speedList: [],
+      // 查询条件
+      searchForm: {},
     };
   },
   created() {
@@ -97,6 +104,25 @@ export default {
         this.dialog = { show: true, title: '下载进度', type: '2' };
       }
     },
+    // 查询专利
+    // 查询
+    toSearch() {
+      this.dialog = { show: true, title: '查询条件', type: '3' };
+    },
+    // 重置条件
+    reseat() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 提交查询
+    onSubmit({ data }) {
+      this.search(data);
+      this.dialog = { show: false, title: '查询条件', type: '3' };
+    },
+    // 批量删除
+    selectsDel() {
+      console.log('批量删除');
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });
@@ -123,12 +149,15 @@ export default {
   text-align: center;
   margin: 8px 0;
   .van-button {
-    margin: 0 5px;
+    margin: 0 5px 5px 0;
   }
-  .total {
-    position: relative;
-    padding: 0 8px;
-    top: 5px;
+  p {
+    font-size: 16px;
+    margin: 5px 0 0 0;
+    span {
+      color: #000;
+      font-weight: bold;
+    }
   }
 }
 .dialog {