Browse Source

数据库分组及搜索调试,写专利挖掘和报告的分组及搜索

zhuhao 1 year ago
parent
commit
490ded2d72

+ 3 - 3
src/api/newApi/project.js

@@ -38,7 +38,7 @@ export default {
      * @param {*} data 
      * @returns 
      */
-    // deletePatentProject(data) {
-    //     return axios.post("/xiaoshi/patentProject/deletePatentProject", data);
-    // },
+    groupPatentProject(data) {
+        return axios.post("/xiaoshi/patentProject/groupPatentProject", data);
+    },
 };

+ 176 - 76
src/views/patentMining/components/dialog/addAndEditProject.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog :title="title" :visible.sync="dialogVisible" width="850px" :before-close="handleClose">
-      <el-form :model="form" status-icon :rules="rules" ref="form" label-width="120px" class="demo-ruleForm">
+      <el-form :model="form" status-icon :rules="rules" ref="form" label-width="120px" class="demo-form">
         <template>
           <!-- 研发项目 -->
           <el-divider content-position="left">研发项目</el-divider>
@@ -104,33 +104,59 @@
           </el-col>
 
         </el-row>
+        <template v-if="!form.id">
+          <div>
+            <el-row>
+              <el-col :span="24">
+                <el-form-item label="事件:">
+                  <mySelectButton size='large' style="width:100%" @click="addEvent">
+                    <div style="width:100%">
+                      <el-select style="width:100%" v-model="form.eventId" @change="changeEvent" filterable remote
+                        clearable placeholder="请选择" :loading="eventList.loading" v-SelectLazyLoading="loadEvent"
+                        :remote-method="remoteEvent">
+                        <el-option v-for="item in eventList.data" :key="item.id" :label="item.name" :value="item.id">
+                        </el-option>
+                      </el-select>
+                    </div>
+                  </mySelectButton>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row v-if="show == true">
+              <el-col :span="24">
+                <el-form-item label="调查类型:" prop="matterIds">
+                  <el-checkbox-group v-model="form.matterIds">
+                    <template>
+                      <el-checkbox v-for="item in dictAssociates" :key="item.id" :label="parseInt(item.id)">
+                        {{ item.name }}
+                      </el-checkbox>
+                    </template>
+                  </el-checkbox-group>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+
         <el-row>
           <el-col :span="24">
-            <el-form-item label="事件:">
-              <mySelectButton size='large' style="width:100%" @click="addEvent">
-                <div style="width:100%">
-                  <el-select style="width:100%" v-model="form.eventId" @change="changeEvent" filterable remote clearable
-                    placeholder="请选择" :loading="eventList.loading" v-SelectLazyLoading="loadEvent"
-                    :remote-method="remoteEvent">
-                    <el-option v-for="item in eventList.data" :key="item.id" :label="item.name" :value="item.id">
-                    </el-option>
-                  </el-select>
-                </div>
-              </mySelectButton>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row v-if="show == true">
-          <el-col :span="24">
-            <el-form-item label="调查类型:" prop="matterIds">
-              <el-checkbox-group v-model="form.matterIds">
-                <template>
-                  <el-checkbox v-for="item in dictAssociates" :key="item.id" :label="parseInt(item.id)">
-                    {{ item.name }}
-                  </el-checkbox>
-                </template>
-              </el-checkbox-group>
-            </el-form-item>
+            <template>
+              <div>
+                <el-form-item label="委托方" prop="entrustId" v-if="userinfo.tenantType == 1">
+                  <mySelectButton size='large' style="width:100%" @click="handleSelect">
+                    <div style="width:100%">
+                      <el-autocomplete style="width:100%" v-model="form.entrustName" ref="client" value-key="name"
+                        :fetch-suggestions="querySearch" v-SelectLazyLoading="loadClient" @input="input"
+                        placeholder="请输入内容" :trigger-on-focus="false" @select="handleChange">
+                      </el-autocomplete>
+                    </div>
+                  </mySelectButton>
+                </el-form-item>
+                <el-form-item label="委托部门" prop="departmentId" v-else>
+                  <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
+                </el-form-item>
+              </div>
+            </template>
           </el-col>
         </el-row>
         <el-row>
@@ -168,14 +194,22 @@
     </el-dialog>
 
     <choosePerson ref="choosePerson" @getPersonIds="getPersonIds"></choosePerson>
+
+    <el-dialog title="选择委托方" :visible.sync="visible" width="800px" append-to-body destroy-on-close :before-close="close2"
+      top="10vh">
+      <ClientTable :choseClient="true" @getClient="getClient"></ClientTable>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import choosePerson from '@/views/components/dialog/person.vue'
+import ClientTable from '@/views/client'
 export default {
   components: {
     choosePerson,
+    ClientTable,
   },
   props: {},
   data() {
@@ -217,6 +251,18 @@ export default {
         },
         data: []
       },
+      /**
+       * 委托方
+       */
+      clientList: {
+        queryParams: {
+          current: 1,
+          size: 10
+        },
+        data: [],
+        cb: null
+      },
+      visible: false,
       // 控制调查类型是否显示
       show: false,
       //调查类型列表
@@ -224,13 +270,74 @@ export default {
     };
   },
   watch: {},
-  computed: {},
+  computed: {
+    ...mapGetters(['webSocket', 'userinfo']),
+  },
   created() { },
   mounted() {
     // 获取人员列表
     this.getPermissionPersonnel();
   },
   methods: {
+    /**
+     * 客户/委托方
+     * @param {*} query 
+     */
+    //远程搜索委托方(建议调取接口获取)
+    async querySearch(queryString, cb) {
+      this.clientList.queryParams.current = 1
+      this.clientList.queryParams.name = queryString
+      this.clientList.data = []
+      this.clientList.cb = cb
+      await this.getClientList()
+      // 调用 callback 返回建议列表的数据
+      // cb(this.clientList.data);
+    },
+    loadClient() {
+      if (this.clientList.queryParams.current * this.clientList.queryParams.size >= this.clientList.queryParams.total) {
+        return false
+      }
+      this.clientList.queryParams.current += 1
+      this.getClientList()
+    },
+    //获取委托方
+    async getClientList() {
+      await this.$api.getAdminClientList(this.clientList.queryParams).then(res => {
+        if (res.code == 200) {
+          this.clientList.data.push(...res.data.records)
+          this.clientList.queryParams.total = res.data.total
+          this.clientList.cb(this.clientList.data);
+        }
+      })
+    },
+    //输入框输入事件(委托方)
+    input() {
+      this.$set(this.form, 'entrustId', -1)
+    },
+    //切换选择委托方
+    handleChange(row) {
+      this.$set(this.form, 'entrustId', row.id)
+      this.$set(this.form, 'entrustName', row.name)
+      this.close2()
+    },
+    //打开选择委托方弹窗
+    handleSelect() {
+      this.visible = true
+    },
+    //获取委托方信息
+    getClient(row) {
+      this.$set(this.form, 'entrustId', row.id)
+      this.$set(this.form, 'entrustName', row.name)
+      this.close2()
+    },
+    //关闭委托方弹窗
+    close2() {
+      this.visible = false
+    },
+
+    /*
+    * 事件
+    */
     //打开事件弹窗
     addEvent() {
 
@@ -294,6 +401,7 @@ export default {
         await this.onChange()
       }
     },
+
     //调查类型选择切换
     async onChange() {
       if (this.form.scenarioIds.length != 0) {
@@ -330,6 +438,10 @@ export default {
       })
       return arr.join('、')
     },
+
+    /**
+     * 研发编号
+     */
     // 研发编号懒加载方法
     load() {
       if (this.rdNumberArr.queryParams.current * this.rdNumberArr.queryParams.size >= this.rdNumberArr.queryParams.total) {
@@ -361,6 +473,11 @@ export default {
       this.rdNumberArr.cb = cb
       await this.getRdProjectByNumber()
     },
+
+    /**
+     * 人员列表
+     * @param {*} query 
+     */
     // 人员列表远程搜索
     remoteMethodPerson(query) {
       this.personnelList.data = []
@@ -398,6 +515,10 @@ export default {
         }
       })
     },
+
+    /**
+     * 上传文件处理
+     *  */
     // 上传的文件监听
     onchangeFile(file, fileList) {
       if (file.guid) {
@@ -406,7 +527,6 @@ export default {
         })
         if (index != -1) {
           this.form.systemFileList.splice(index, 1, file)
-          this.form.fileGuids.push(file.guid)
         }
       } else {
         this.form.systemFileList.push(file.raw)
@@ -415,50 +535,19 @@ export default {
     },
     // 删除上传的文件
     onRemove(file, fileList) {
-      if (file.guid) {
-        let index = this.form.systemFileList.findIndex(item => {
-          return item.guid == file.guid
-        })
-        if (index!=-1) {
-          this.form.systemFileList.splice(index, 1)
-        }
-        let index2 = this.form.fileGuids.findIndex(item => {
-            return item == file.guid
-        })
-        if (index2 != -1) {
-            this.form.fileGuids.splice(index2, 1)
-        }
-      } else {
-        let index3 = this.form.systemFileList.findIndex(item => {
-          return item.uid == file.uid
-        })
-        if (index3 != -1) { 
-          this.form.fileGuids.splice(index3, 1)
-        }
+      let index = this.form.systemFileList.findIndex(item => {
+        return item.uid == file.uid
+      })
+      if (index != -1) {
+        this.form.systemFileList.splice(index, 1)
       }
     },
+
+
     //打开弹窗
     async open(form) {
       if (form && form.id) {
         this.form = JSON.parse(JSON.stringify(form))
-        // 事件
-        if (this.form.eventIds && this.form.eventIds.length > 0) {
-          this.form.eventId = this.form.eventIds[0]
-          this.onChange()
-          this.eventList.queryParams.id = this.form.eventId[0]
-          await this.getEventList(1)
-          this.eventList.queryParams.id = null
-          this.show = true
-        } else {
-          this.show = false
-        }
-        // 文件
-        if (this.form.systemFileList && this.form.systemFileList.length > 0) {
-          this.$set(this.form, 'fileGuids', [])
-          this.form.systemFileList.forEach(item => {
-            this.form.fileGuids.push(item.guid)
-          })
-        }
         // 负责人
         if (this.form.headId) {
           this.personnelList.queryParams.id = this.form.headId
@@ -483,7 +572,7 @@ export default {
         this.title = '新增专利挖掘项目'
       }
       this.getPermissionPersonnel()
-      this.getEventList()
+      // this.getEventList()
       this.dialogVisible = true
     },
     //关闭弹窗
@@ -501,12 +590,19 @@ export default {
     submit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
-          // 判断文件是否全部上传完毕
-          if ((this.form.fileGuids && this.form.fileGuids.length) != (this.form.systemFileList && this.form.systemFileList.length)) {
-            this.$message.error('您有文件未上传完毕,请您稍等片刻~~~')
-            return false
+          // 判断文件是否都上传完毕
+          if (this.form.systemFileList && this.form.systemFileList.length > 0) {
+            this.form.fileGuids = []
+            for (let i = 0; i < this.form.systemFileList.length; i++) {
+              if (this.form.systemFileList[i].guid) {
+                this.form.fileGuids.push(this.form.systemFileList[i].guid)
+              } else {
+                this.$message.error('文件未全部上传,请耐心等待')
+                return false
+              }
+            }
           }
-          if (this.form.scenarioIds && this.form.scenarioIds.length>0) {
+          if (this.form.scenarioIds && this.form.scenarioIds.length > 0) {
             var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
           }
           if (this.form.eventId) {
@@ -532,9 +628,13 @@ export default {
               this.$api.addPatentDigProject(this.form).then(res => {
                 if (res.code == 200) {
                   this.$message.success('新增专利挖掘项目成功')
-                  this.$emit('isSuccess', true)
+                  this.$emit('isSuccess', '新增成功')
                   this.handleClose()
                 }
+              }).catch(error => {
+                // 如果报告未创建成功,则赋值
+                this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
+                this.show = true
               })
             }
 
@@ -542,7 +642,7 @@ export default {
             this.$api.updatePatentDigProject(this.form).then(res => {
               if (res.code == 200) {
                 this.$message.success('更新专利挖掘项目成功')
-                this.$emit('isSuccess', true)
+                this.$emit('isSuccess', '更新成功')
                 this.handleClose()
               }
             })
@@ -570,13 +670,13 @@ export default {
   destroyed() {
     // 清空事件相关
     this.form.eventIds = []
-    this.eventList.queryParams.current=1
+    this.eventList.queryParams.current = 1
     // 清空负责人相关
     this.form.involvedPersons = []
     this.form.adminIds = []
     this.form.adminPersons = []
     this.personnelList.data = []
-    this.personnelList.queryParams.current=1
+    this.personnelList.queryParams.current = 1
   },
 };
 </script>

+ 17 - 1
src/views/patentMining/components/mixins/index.js

@@ -38,7 +38,23 @@ export default {
     },
     //操作列事件
     handleCommand(option, row) {
-      this.$emit('option', { option, row })
+      if (option == 'e') {//编辑
+        this.action={
+          type:'2',
+          id:row.id
+        } 
+      }
+      var isLast = false
+      if(option == 10){//删除
+        this.action={
+          type:'1',
+          id:row.id
+        } 
+        if(this.tableData.length == 1){
+          isLast = true
+        }
+      }
+      this.$emit('option', { option, row ,isLast:isLast})
     },
   },
 }

+ 105 - 0
src/views/patentMining/components/view/MergeTable.vue

@@ -0,0 +1,105 @@
+<template>
+  <div class="workspace-merge-table height_100" v-DivHeight="getDivHeight">
+    <el-table :data="commandData" border header-row-class-name="custom-table-header" @expand-change="expandChange"
+      @sort-change="sortChange">
+      <el-table-column type="expand">
+        <template slot-scope="props">
+          <div style="padding: 10px;height: 340px;">
+            <Table :column="column" :tableData="props.row.data" @option="handleOption"
+              :row="{ row: props.row, groupBy: groupBy, searchOption: searchOption, }" v-bind="$attrs" v-on="$listeners" />
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column v-for="column in groupingOption.filter(item => { return item.value == groupBy })" :key="column.value"
+        :label="column.name" :prop="column.value" sortable="custom" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.name ? scope.row.name : '--' }}
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+// import { workspaceOptions } from "../mixins";
+// import { getTableHeight } from '@/views/components/mixins'
+import Table from "./commonTable.vue";
+
+export default {
+  props: {
+    // 分组数据
+    commandData: {
+      type: Array,
+      default: () =>{
+        return []  
+      }
+    },
+    // 检索条件
+    searchOption: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    // 分组的信息数组
+    groupingOption: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    // 分组的值
+    groupBy: String,
+    queryParams: Object,
+    column: {//显示栏位管理数组
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+  },
+  // mixins: [workspaceOptions, getTableHeight],
+  components: {
+    Table
+  },
+  data() {
+    return {
+      // columnList: [],
+      //展开行数组
+      expends: []
+    }
+  },
+  watch: {
+
+  },
+  mounted() {
+  },
+  methods: {
+    // 排序
+    sortChange({ column, prop, order }) {
+      let str = '1'
+      this.$emit('on-sort', { column, prop, order, str })
+    },
+    //操作列事件
+    handleOption(data) {
+      this.$emit('option', data)
+    },
+    //展开行
+    expandChange(row, expandedRows) {
+      var index = this.expends.findIndex(item => {
+        return item == row.id
+      })
+      if (index == -1) {
+        this.expends.push(row.id)
+      } else {
+        this.expends.splice(index, 1)
+      }
+    },
+
+  }
+}
+</script>
+
+<style lang="scss">.workspace-merge-table {}</style>

+ 156 - 35
src/views/patentMining/components/view/commonTable.vue

@@ -15,7 +15,7 @@
           <div v-if="['name'].includes(item.value)">
             <el-link @click="handleItem(scope.row, item.value)">{{ scope.row[item.value] }}</el-link>
           </div>
-          <div v-else-if="['state', 'ifSearch'].includes(item.value)" v-html="getColumnData(scope.row, item.value)">
+          <div v-else-if="['state', 'ifSearch'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row, item)">
           </div>
           <div v-else>{{ scope.row[item.value] ? scope.row[item.value] : '--' }}</div>
         </template>
@@ -43,24 +43,15 @@ export default {
   mixins: [mixins],
   components: {},
   props: {
-    //显示栏位管理数组
-    column: {
+    column: {//显示栏位管理数组
       type: Array,
       default: () => {
-        return [
-          {
-            createType: 1,
-            ifHidden: false,
-            ifSearch: true,
-            ifShow: true,
-            name: "挖掘项目名称",
-            order: 0,
-            type: "String",
-            value: "name"
-          }
-        ]
+        return []
       }
     },
+    row: null,
+    //操作信息
+    handleMessage: ''
   },
   data() {
     return {
@@ -70,34 +61,164 @@ export default {
         2: '已完成',
         3: '审核不通过',
       },
+      //正在努力加载中
+      isFlag: false,
+      //没有更多啦!
+      isMore: false,
+      //禁用懒加载
+      disabled: true,
+      params: {
+        size: 5,
+        current: 0
+      },
+      // 排序数组
+      sort: [
+        {
+          "orderBy": "createTime",
+          "orderType": 1
+        }
+      ],
+      //事件类型及所选
+      action: {
+        type: '',//1表示删除,2表示其他,3表示新增
+        id: ''
+      }
     };
   },
-  watch: {},
   computed: {},
-  created() { },
-  mounted() { },
+  watch: {
+    handleMessage(val) {
+      if (val) {
+        this.updateData()
+      }
+    }
+  },
+  mounted() {
+    if (!this.row) {
+      this.disabled = true
+    } else {
+      this.disabled = false
+    }
+  },
   methods: {
-    // 排序
-    sortChange({ column, prop, order }) {
-      this.$emit('sort', { column, prop, order })
+    //更新数据
+    updateData() {
+      if (this.action.type == 1) {
+        if (this.tableData.length == 1) {
+          return false
+        }
+        var startIndex = this.tableData.findIndex(item => {
+          return item.id == this.action.id
+        })
+        this.tableData.splice(startIndex, 1)
+        let params = {
+          ...this.params,
+          searchQuery: this.$commonJS.objectToString(this.row.searchOption),//检索条件
+          orderDTOList: this.sort,//排序
+          groupField: this.row.groupBy,
+          groupFieldValue: this.row.row.value,
+        }
+        this.getList2(params, 1)
+      } else if (this.action.type == 2) {
+
+        let params = {
+          ...this.params,
+          searchQuery: `id=${this.action.id}`,//检索条件
+          groupField: this.row.groupBy,
+          groupFieldValue: this.row.row.value,
+        }
+        this.getList2(params, 2)
+      }
     },
-    // 数据处理
-    getColumnData(row, key) {
-      if (key == 'state') {
-        if (row.state) {
-          return this.statusObj[row.state]
-        } else {
-          return '--'
+
+    getList2(params, type) {
+      this.$api.queryPatentProject(params).then(res => {
+        if (res.code == 200) {
+          if (type == 1) {
+            var startIndex = (params.current - 1) * size
+            var endIndex = this.tableData.length
+            var len = endIndex - startIndex
+            this.tableData.splice(startIndex, len, ...res.data.data)
+            this.params.total = res.data.total
+          } else if (type == 2) {
+            var startIndex = this.tableData.findIndex(item => {
+              return item.id == this.action.id
+            })
+            this.tableData.splice(startIndex, 1, ...res.data.data)
+          }
+
         }
-      } else if (key == 'ifSearch') {
-        if (row.ifSearch == true) {
-          return '是'
-        } else if (row.ifSearch == false) {
-          return '否'
-        } else {
-          return '--'
+      }).catch(err => {
+      })
+    },
+
+
+    getList() {
+      if (!this.row) return;
+      if (this.params.current * this.params.size >= this.params.total) {
+        this.isMore = true
+        this.disabled = true
+        setTimeout(() => {
+          this.isMore = false;
+          this.isFlag = false
+        }, 1000)
+      }
+      if (this.disabled) return;
+      this.params.current += 1
+      let params = {
+        ...this.params,
+        searchQuery: this.$commonJS.objectToString(this.row.searchOption),//检索条件
+        orderDTOList: this.sort,//排序
+        groupField: this.row.groupBy,
+        groupFieldValue: this.row.row.value,
+      }
+      this.isMore = false;
+      this.isFlag = true;
+      this.$api.queryPatentProject(params).then(res => {
+        if (res.code == 200) {
+          this.tableData.push(...res.data.data)
+          this.params.total = res.data.total
         }
+      }).catch(err => {
+      })
+      setTimeout(() => {
+        this.isMore = false;
+        this.isFlag = false
+      }, 1000)
+    },
+
+    // 排序
+    sortChange({ column, prop, order }) {
+      this.handleSort({ column, prop, order })
+      if (!this.row) {
+        this.$emit('on-sort', { column, prop, order })
+      }
+    },
+    // 排序方法
+    handleSort({ column, prop, order }) {
+      this.sort = []//如需要多个字段排序,则不需要清空
+      if (order == null) {
+        return;
+      }
+      var orderType = {
+        ascending: 0,
+        descending: 1
+      }
+      var params = this.sort.find(item => {
+        return item.orderBy == prop
+      })
+      if (params) {
+        params.orderType = orderType[order]
+      } else {
+        params = {}
+        params.orderBy = prop
+        params.orderType = orderType[order]
+        this.sort.push(params)
       }
+      this.params.current = 0
+      this.disabled = false
+      this.tableData.splice(0)
+      this.getList()
     },
   },
 };

+ 101 - 42
src/views/patentMining/components/viewIndex.vue

@@ -7,6 +7,14 @@
             :disabled="!$permission('/workspace/project/check')"></mySearch>
         </div>
         <div style="display:flex;margin-right:10px">
+          <div>
+            <span>分组查询:</span>
+            <el-select v-model="group" :disabled="!$permission('/workspace/project/check')" clearable size="small"
+              @change="onChange" style="width:200px">
+              <el-option v-for="item in groupingOption" :key="item.value" :label="item.name" :value="item.value">
+              </el-option>
+            </el-select>
+          </div>
           <el-button-group class="margin-left_10" v-if="[2].indexOf(isOperate) == -1">
             <el-button :type="viewType === 'commonTable' ? 'primary' : ''" @click="onChange2('commonTable')"
               size="small">列表</el-button>
@@ -22,8 +30,10 @@
         </div>
       </el-header>
       <el-main>
-        <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList" :column="columnList"
-          :group="group" :queryParams="queryParams" @option="handleOption" @sort="handleSort"></component>
+        <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
+          :column="columnList" :group="group" :queryParams="queryParams" @option="handleOption" @on-sort="handleSort"
+          :commandData="commandData" :searchOption="searchOption" :handleMessage="handleMessage">
+        </component>
       </el-main>
       <el-footer class="pagination">
         <div>
@@ -42,11 +52,13 @@
 import commonTable from './view/commonTable.vue';
 import addAndEditProject from './dialog/addAndEditProject.vue';
 import fields from '@/views/components/dialog/fields.vue';
+import mergeTable from '../components/view/MergeTable.vue'
 export default {
   components: {
     commonTable,
     addAndEditProject,
     fields,
+    mergeTable,
   },
   props: {
     isOperate: ''
@@ -55,19 +67,21 @@ export default {
     return {
       //当前组件名称
       viewType: 'commonTable',
-      //专利挖掘项目数据集合
+      //专利挖掘项目table数据集合
       dataList: [],
+      // 专利挖掘分组项目数据数组
+      commandData:[],
       //分页
       queryParams: {
         size: 10,
-        current: 0,
+        current: 1,
       },
       //当前分组的值
       group: '',
       // 分组字段数组
-      groupingOption:[],
+      groupingOption: [],
       //排序
-      sort: [ { "orderBy": "createTime", "orderType": 1 } ],
+      sort: [{ "orderBy": "createTime", "orderType": 1 }],
       //总数
       total: 0,
       //检索字段
@@ -89,7 +103,8 @@ export default {
       searchOption: {},
       // table栏位信息
       columnList: [],
-      // 获取
+      // 子组件添加/更新项目返回的值
+      handleMessage:'',
     };
   },
   watch: {},
@@ -105,7 +120,7 @@ export default {
   },
   methods: {
     //显示栏位管理
-    getFieldList(data){
+    getFieldList(data) {
       this.columnList = data
     },
     // 获取检索及分组栏位
@@ -125,16 +140,6 @@ export default {
             value: 'value',
             type: 'type',
           })
-          //为array类型添加选项
-          // var obj = this.searchFiled.find(item => { return item.label == '应用场景' })
-          // if (obj) {
-          //   obj.options = this.scene.map(item => {
-          //     return {
-          //       label: item.name,
-          //       value: item.id
-          //     }
-          //   })
-          // }
         }
       })
       this.showView = false
@@ -144,35 +149,44 @@ export default {
     },
     // 新增、编辑成功信息
     isSuccess(val) {
-      this.getList()
+      this.handleMessage = val
+      this.queryParams.current = 1
+      this.searchOption={}
+      this.isGrouping()
+      this.clearMessage()
+    },
+    clearMessage() {
+      this.$nextTick(() => {
+        this.handleMessage = ''
+      })
     },
     //获取检索组件传过来的数据
     search(val) {
       let params = {}
       val.forEach(item => {
         if (item.type == 3) {
-          params[item.value]=item.searchValue.map(itemValue => {
+          params[item.value] = item.searchValue.map(itemValue => {
             return itemValue.value
           })
         } else {
-          params[item.value]=item.searchValue.label
+          params[item.value] = item.searchValue.label
         }
       })
       // 返回条件对象
-      this.searchOption.searchQuery=params
+      this.searchOption = params
       // 调用查询接口
       this.queryParams.current = 1
       this.getList()
     },
     //排序
-    handleSort({ column, prop, order }) {
-      this.sort=[]//如需要多个字段排序,则不需要清空
+    handleSort({ column, prop, order, str }) {
+      this.sort = []//如需要多个字段排序,则不需要清空
       if (order == null) {
         return;
       }
       var orderType = {
         ascending: 0,
-        descending:1
+        descending: 1
       }
       var params = this.sort.find(item => {
         return item.orderBy == prop
@@ -186,18 +200,23 @@ export default {
         this.sort.push(params)
       }
       this.queryParams.current = 1
-      this.getList()
+      //1表示展开行2表示基础表格
+      if (str == '1') {
+        this.getGrouping()
+      } else {//table排序
+        this.getList()
+      }
     },
     //分页
     handleCurrentChange(val) {
       this.queryParams.current = val;
-      this.getList();
+      this.isGrouping();
     },
     //获取专利挖掘项目数据列表
     getList() {
       let params = {
         ...this.queryParams,//分页信息
-        searchQuery: this.$commonJS.objectToString(this.searchOption.searchQuery || {}),//检索条件
+        searchQuery: this.$commonJS.objectToString(this.searchOption || {}),//检索条件
         orderDTOList: this.sort,//排序
       }
       this.$api.queryPatentDigProject(params).then(res => {
@@ -211,6 +230,25 @@ export default {
         this.$message.error(error.message)
       })
     },
+    // 获取分组数据
+    getGrouping() {
+      let params = {
+        ...this.queryParams,//分页信息
+        searchQuery: this.$commonJS.objectToString(this.searchOption || {}),//检索条件
+        orderDTOList: this.sort,//排序
+        groupBy: this.group,//分组的值
+      }
+      this.loading = true
+      this.$api.groupPatentProject(params).then(response => {
+        this.commandData = response.data.data.values
+        this.total = response.data.total
+        this.loading = false
+      }).catch(error => {
+        this.commandData = []
+        this.total = 0
+        this.loading = false
+      })
+    },
     //创建项目按钮,添加其他企业专利数据库
     handleAdd() {
       this.$refs.addAndEditProject.open()
@@ -221,25 +259,46 @@ export default {
         case '0'://显示栏位管理
           this.$refs.field.open(this.columnList)
           break;
-      
+
         default:
           break;
       }
     },
+    //切换到分组
+    onChange(val) {
+      if (val != '') {
+        this.viewType = 'mergeTable'
+      } else {
+        this.viewType = 'commonTable'
+      }
+      this.group = val
+      this.queryParams.current = 1
+      this.queryParams.size = 10
+      this.isGrouping()//区分是否分组,调用不同请求数据
+    },
+    // 区分是否为分组
+    isGrouping() {
+      if (this.group != '') {//分组
+        this.getGrouping()
+      } else {//不分组
+        this.getList()
+      }
+    },
     //切换视图
     onChange2(val) {
       this.viewType = val
-      this.queryParams.current=1
+      this.group=''
+      this.queryParams.current = 1
       this.getList()
     },
     //操作列
-    handleOption({ option, row }) {
+    handleOption({ option, row ,isLast}) {
       switch (option) {
         case '0'://设置定时任务
           // this.$refs.addAndEditDB.open(row, true)
           break;
         case '1'://删除
-          this.projectDelete(row)
+          this.projectDelete(row,isLast)
           break;
         case 'e'://编辑
           this.$refs.addAndEditProject.open(row)
@@ -247,11 +306,11 @@ export default {
       }
     },
     // 删除项目
-    projectDelete(row) {
-      this.projectDeletes([row.id])
+    projectDelete(row,isLast) {
+      this.projectDeletes([row.id],isLast)
     },
     // 删除项目
-    projectDeletes(ids,isLast) {
+    projectDeletes(ids, isLast) {
       this.$confirm('此操作将删除该项目, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -259,13 +318,13 @@ export default {
       }).then(() => {
         this.$api.deletePatentDigProject(ids).then(res => {
           if (res.code == 200) {
-            // if(isLast){
-            //   this.isGrouping()
-            // }else{
-            this.getList()
-          // }
-            // this.handleMessage = '删除成功'
-            // this.clearMessage()
+            this.handleMessage = '删除成功'
+            if(isLast){
+              this.isGrouping()
+            }else{
+              this.getList()
+            }
+            this.clearMessage()
             this.$message.success('删除成功!');
           }
         })

+ 1 - 1
src/views/project/components/mixins/index.js

@@ -48,7 +48,7 @@ export const workspaceOptions = {
         } 
       }
 
-      this.$emit('option', { option: event, row })
+      this.$emit('option', { option: event, row ,isLast:isLast})
     },
   },
 }

+ 64 - 14
src/views/project/components/view/MergeTable.vue

@@ -1,15 +1,41 @@
 <template>
   <div class="workspace-merge-table height_100" v-DivHeight="getDivHeight">
-    <el-table :data="tableData" style="width: 100%" border header-row-class-name="custom-table-header" row-key="id" v-if="showTable" :maxHeight="tableHeight" :expand-row-keys="expends" @expand-change="expandChange" @sort-change="sortChange">
+    <el-table :data="tableData" border header-row-class-name="custom-table-header" @expand-change="expandChange"
+      @sort-change="sortChange">
       <el-table-column type="expand">
         <template slot-scope="props">
-          <Table :row="scope.row" v-on="$attrs"/>
+          <div style="padding: 10px;height: 340px;">
+            <Table :column="column" :tableData="props.row.data" @option="handleOption"
+              :row="{ row: props.row, groupBy: groupBy, searchOption: searchOption, }" v-bind="$attrs" v-on="$listeners" />
+          </div>
         </template>
       </el-table-column>
-      <el-table-column v-for="column in columnList" :label="column.label" :prop="column.prop" sortable="custom"
-        show-overflow-tooltip>
+      <el-table-column v-for="column in groupingOption.filter(item => { return item.value == groupBy })" :key="column.value"
+        :label="column.name" :prop="column.value" sortable="custom" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.name ? scope.row.name : '--' }}
+          </div>
+        </template>
       </el-table-column>
     </el-table>
+    <!-- <el-table :data="tableData" style="width: 100%" border header-row-class-name="custom-table-header" row-key="id"
+      v-if="showTable" :maxHeight="tableHeight" :expand-row-keys="expends" @expand-change="expandChange"
+      @sort-change="sortChange">
+      <el-table-column type="expand">
+        <template slot-scope="props">
+          <Table :column="column" :tableData="props.row.data"  @option="handleOption" :row="{row:props.row,groupBy:groupBy,searchOption:searchOption,}" v-bind="$attrs" v-on="$listeners" />
+        </template>
+      </el-table-column>
+      <el-table-column v-for="column in groupingOption.filter(item => { return item.value == groupBy })" :key="column.value"
+        :label="column.name" :prop="column.value" sortable="custom" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.name?scope.row.name:'--' }}
+          </div>
+        </template>
+      </el-table-column>
+    </el-table> -->
   </div>
 </template>
 
@@ -20,17 +46,39 @@ import Table from "./table";
 
 export default {
   props: {
+    // 检索条件
+    searchOption: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    // 分组的信息数组
+    groupingOption: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    // 分组的值
+    groupBy: String,
     queryParams: Object,
+    column: {//显示栏位管理数组
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
   },
-  mixins: [workspaceOptions,getTableHeight],
+  mixins: [workspaceOptions, getTableHeight],
   components: {
     Table
   },
   data() {
     return {
-      columnList: [],
+      // columnList: [],
       //展开行数组
-      expends:[]
+      expends: []
     }
   },
   watch: {
@@ -44,15 +92,19 @@ export default {
       let str = '1'
       this.$emit('on-sort', { column, prop, order, str })
     },
+    //操作列事件
+    handleOption(data) {
+      this.$emit('option', data)
+    },
     //展开行
     expandChange(row, expandedRows) {
-      var index = this.expends.findIndex(item=>{
+      var index = this.expends.findIndex(item => {
         return item == row.id
       })
-      if(index==-1){
+      if (index == -1) {
         this.expends.push(row.id)
-      }else{
-        this.expends.splice(index,1)
+      } else {
+        this.expends.splice(index, 1)
       }
     },
 
@@ -60,6 +112,4 @@ export default {
 }
 </script>
 
-<style lang="scss">
-.workspace-merge-table {}
-</style>
+<style lang="scss">.workspace-merge-table {}</style>

+ 5 - 62
src/views/project/components/view/table.vue

@@ -65,64 +65,7 @@ export default {
     column: {//显示栏位管理数组
       type: Array,
       default: () => {
-        return [
-          {
-            "key": "name",
-            "name": "名称",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "eventNumber",
-            "name": "相关报告数量",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "projectNumber",
-            "name": "事件",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "projectNumber1",
-            "name": "应用场景",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "projectNumber2",
-            "name": "调查类型",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "projectNumber3",
-            "name": "委托方",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "projectNumber4",
-            "name": "创建人",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-          {
-            "key": "time",
-            "name": "创建时间",
-            "type": "list",
-            "order": 0,
-            "hidden": true
-          },
-        ]
+        return []
       }
     },
     row: null,
@@ -183,13 +126,14 @@ export default {
           this.tableData.splice(startIndex,1)
         let params = {
           ...this.params,
-          ...this.row.searchOption,//检索条件
+          searchQuery: this.$commonJS.objectToString(this.row.searchOption),//检索条件
           orderDTOList: this.sort,//排序
           groupField: this.row.groupBy,
           groupFieldValue: this.row.row.value,
         }
         this.getList2(params,1)
-      }else if(this.action.type == 2){
+      } else if (this.action.type == 2) {
+        
         let params = {
           ...this.params,
           searchQuery:`id=${this.action.id}`,//检索条件
@@ -201,7 +145,6 @@ export default {
     },
 
     getList2(params,type){
-      
       this.$api.queryPatentProject(params).then(res => {
         if (res.code == 200) {
           if(type == 1){
@@ -237,7 +180,7 @@ export default {
       this.params.current += 1
       let params = {
         ...this.params,
-        ...this.row.searchOption,//检索条件
+        searchQuery: this.$commonJS.objectToString(this.row.searchOption),//检索条件
         orderDTOList: this.sort,//排序
         groupField: this.row.groupBy,
         groupFieldValue: this.row.row.value,

+ 60 - 51
src/views/project/index.vue

@@ -22,8 +22,7 @@
                 <span>分组查询:</span>
                 <el-select v-model="group" :disabled="!$permission('/workspace/project/check')" clearable size="small"
                   @change="onChange" style="width:200px">
-                  <el-option v-for="item in groupingOption" :key="item.value" :label="item.name"
-                    :value="parseInt(item.value)">
+                  <el-option v-for="item in groupingOption" :key="item.value" :label="item.name" :value="item.value">
                   </el-option>
                 </el-select>
               </div>
@@ -50,8 +49,9 @@
           </el-header>
           <el-main class="workspace-main">
             <div v-loading="loading">
-              <component v-if="showView" :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList" :group="group" :queryParams="queryParams" :column="fieldList" @option="handleOption"
-                @on-sort="handleSort"></component>
+              <component v-if="showView" :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate"
+                :tableData="dataList" :groupBy="group" :groupingOption="groupingOption" :searchOption="searchOption"
+                :queryParams="queryParams" :column="fieldList" @option="handleOption" @on-sort="handleSort" :handleMessage="handleMessage"></component>
             </div>
             <div class="pagination" v-if="[2].indexOf(isOperate) == -1">
               <el-pagination backgroundx layout="total, prev, pager, next, jumper"
@@ -71,7 +71,7 @@
     </div>
     <project-form-drawer @submit="getMessage" :common-data="commonData" ref="projectFormDrawer" />
     <field ref="field" type="patentProject" @getFieldList="getFieldList"></field>
-    
+
   </div>
 </template>
 
@@ -94,7 +94,7 @@ export default {
     ProjectFormDrawer,
     field,
     mergeTable,
-    
+
   },
   props: {
     isOperate: ''
@@ -147,7 +147,7 @@ export default {
         }
       ],
       //分组集合
-      groupingOption:[],
+      groupingOption: [],
       //分组
       group: '',
       //展示的视图
@@ -161,7 +161,7 @@ export default {
       //栏位集合
       fieldList: [],
       //接受子组件消息
-      handleMessage:'',
+      handleMessage: '',
       //显示视图
       showView: false,
     };
@@ -169,15 +169,15 @@ export default {
   watch: {},
   computed: {
     ...mapGetters(['userinfo']),
-    commonData(){
-      var a = this.$store.state.dictMessage.scenario.map(item=>{
+    commonData() {
+      var a = this.$store.state.dictMessage.scenario.map(item => {
         return {
-          label:item.name,
-          value:item.id
+          label: item.name,
+          value: item.id
         }
       })
-      var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
-      if(obj){
+      var obj = this.searchFiled.find(item => { return item.label == '应用场景' })
+      if (obj) {
         obj.options = a
       }
       return this.$store.state.dictMessage.scenario || []
@@ -206,8 +206,8 @@ export default {
       })
     },
     //获取自定义栏位
-    getFieldList(data){
-      this.fieldList  = data
+    getFieldList(data) {
+      this.fieldList = data
     },
     //获取检索字段和分组字段
     async getColumn() {
@@ -215,24 +215,26 @@ export default {
       await this.$api.getParamsCommon(params).then(res => {
         if (res.code == 200) {
           // 分组字段
-          let conditionDTOList= JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
-          this.groupingOption = this.$commonJS.getField(conditionDTOList,(u)=> u.ifGroup == true,{
+          let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
+          this.groupingOption = this.$commonJS.getField(conditionDTOList, (u) => u.ifGroup == true, {
             name: 'name',
             value: 'value',
           })
           // 搜索字段
-          this.searchFiled = this.$commonJS.getField(conditionDTOList,(u)=> u.ifSearch == true ,{
+          this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
             label: 'name',
             value: 'value',
-            type:'type',
+            type: 'type',
           })
-          var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
-          if(obj){
-            obj.options = this.commonData.map(item=>{
-              return {
-                label:item.name,
-                value:item.id
-              }
+          var obj = this.searchFiled.find(item=>{return item.label == '调查类型'})
+          if (obj) {
+            this.$api.getMatter([]).then(response => {
+              obj.options = response.data.data.map(item=>{
+                return {
+                  label:item.name,
+                  value:item.id
+                }
+              })
             })
           }
         }
@@ -272,8 +274,8 @@ export default {
       var params = this.queryParams
       params = {
         ...this.queryParams,//分页信息
-        searchQuery:this.$commonJS.objectToString(this.searchOption),//检索条件
-        orderDTOList:this.sort,//排序
+        searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
+        orderDTOList: this.sort,//排序
       }
       this.loading = true
       this.$api.queryPatentProject(params).then(response => {
@@ -291,12 +293,12 @@ export default {
       let params = {
         ...this.queryParams,//分页信息
         ...this.searchOption,//检索条件
-        orderDTOList:this.sort,//排序
-        group: this.group,//分组的值
+        orderDTOList: this.sort,//排序
+        groupBy: this.group,//分组的值
       }
       this.loading = true
-      this.$api.getProjectListV2(params).then(response => {
-        this.dataList = response.data.records
+      this.$api.groupPatentProject(params).then(response => {
+        this.dataList = response.data.data.values
         this.total = response.data.total
         this.loading = false
       }).catch(error => {
@@ -307,13 +309,13 @@ export default {
     },
     //排序
     handleSort({ column, prop, order, str }) {
-      this.sort=[]//如需要多个字段排序,则不需要清空
+      this.sort = []//如需要多个字段排序,则不需要清空
       if (order == null) {
         return;
       }
       var orderType = {
         ascending: 0,
-        descending:1
+        descending: 1
       }
       var params = this.sort.find(item => {
         return item.orderBy == prop
@@ -346,6 +348,7 @@ export default {
       } else {
         this.viewType = 'Table'
       }
+      this.group = val
       this.queryParams.current = 1
       this.queryParams.size = 10
       this.isGrouping()//区分是否分组,调用不同请求数据
@@ -376,7 +379,7 @@ export default {
       this.$refs.projectFormDrawer.open({
         ifUpdate: false,
         updateTime: 'day',
-        crons:'',
+        crons: '',
         status: '0',
         sort: 1,
         matterIds: [],
@@ -386,13 +389,19 @@ export default {
     //确认提交专题库信息
     getMessage(val) {
       this.handleMessage = val
-      this.getList()
-     },
-     clearMessage(){
-      this.$nextTick(()=>{
+      this.queryParams.current = 1
+      this.searchOption.searchQuery=''
+      // this.getList()
+      this.isGrouping()
+      this.clearMessage()
+      // this.handleMessage = val
+      // this.getList()
+    },
+    clearMessage() {
+      this.$nextTick(() => {
         this.handleMessage = ''
       })
-     },
+    },
     //导出列表
     handleExport() {
       this.btnLoading = true
@@ -412,7 +421,7 @@ export default {
       this.$refs.field.open(this.fieldList)
     },
     //操作列
-    handleOption({ option, row }) {
+    handleOption({ option, row ,isLast}) {
       switch (option) {
         case '0'://Excel导入
           this.handleExcelImport(row)
@@ -436,7 +445,7 @@ export default {
         case '9'://项目分享
           break;
         case '10'://删除
-          this.deletes(row)
+          this.deletes(row,isLast)
           break
         case 'e'://编辑
           this.handleEdit(row)
@@ -444,34 +453,34 @@ export default {
       }
     },
     //获取删除的id
-    deletes(row){
-      this.deletePatentProject([row.id])
+    deletes(row,isLast) {
+      this.deletePatentProject([row.id],isLast)
     },
     //删除专题库
-    deletePatentProject(ids){
+    deletePatentProject(ids) {
       this.$confirm('此操作将删除该产品类别, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        this.$api.deletePatentProject(ids).then(response=>{
-          if(response.code == 200){
+        this.$api.deletePatentProject(ids).then(response => {
+          if (response.code == 200) {
             this.handleMessage = '删除成功'
             this.$message.success('删除成功!');
-            if(!this.group){
+            if (!this.group) {
               this.getList()
             }
             this.clearMessage()
           }
         })
       })
-      
+
     },
     //编辑专题库
     handleEdit(row) {
       this.$refs.projectFormDrawer.open(JSON.parse(JSON.stringify(row)), '编辑专题库')
     },
-   
+
   },
 };
 </script>

+ 0 - 329
src/views/report/components/dialog/addAndEditReport1.vue

@@ -1,329 +0,0 @@
-<template>
-  <div>
-    <el-dialog :title="title" :visible.sync="showDialog" width="600px" :close-on-click-modal="false"  @close="handleClose(false)" >
-        <el-form :model="form" :rules="rules" ref="reportForm" label-width="120px" v-loading="loading" :element-loading-text="load_text" element-loading-spinner="el-icon-loading"
-        element-loading-background-color="rgba(0, 0, 0, 0.8)">
-            <el-form-item :label="[3].includes(Number(form.type))?'标的产品':'标的专利'" prop="signPatentNo">
-              <el-input v-model="form.signPatentNo" autocomplete="off" :placeholder="[3].includes(Number(form.type))?'请输入标的产品':'请输入标的专利'" @change="getPatentNo"></el-input>
-              <!-- <p v-if="show==1" class="tips">查不到该专利请
-                  <span @click="importPatentNo()">导入</span>
-                </p>
-              <p v-if="show==2" class="tips" style="color:black"><span @click="toPatentDetails(form.signPatentNo)">查看详情</span></p> -->
-            </el-form-item>
-            <el-form-item label="报告名称" prop="name">
-              <el-input v-model="form.name" autocomplete="off" placeholder="请输入报告名称"></el-input>
-            </el-form-item>
-            <el-form-item label="是否完成" v-if="!form.id"> 
-              <el-switch
-                v-model="form.status"
-                active-color="#13ce66"
-                inactive-color="#ff4949"
-                @change="changeStatus"
-                :active-value="3"
-                :inactive-value="1">
-              </el-switch>
-            </el-form-item> 
-            <template v-if="!form.id && form.status == 3">
-                <div>
-                    <el-form-item label="核心结论">
-                        <el-checkbox-group v-model="form.conclusionIds">
-                            <el-checkbox v-for="item in conclusion" :key="item.dictChildValue" :label="item.dictChildValue">{{ item.dictChildLabel }}</el-checkbox>
-                        </el-checkbox-group>
-                    </el-form-item>
-                    <el-form-item label="结论论述">
-                        <el-input v-model="form.cronConclusion" type="textarea" placeholder="请输入结论论述"></el-input>
-                    </el-form-item>
-                    <el-form-item label="后续跟进事项" v-if="$permission('/rms/matter')">
-                        <span v-if="form.followUps"><span v-for="item in form.followUps" :key="item.followUpName" style="margin-right:10px">{{ item.followUpName}}</span></span> 
-                        <span>
-                            <el-popover
-                            ref="popover"
-                            placement="bottom"
-                            @hide="hidePopover"
-                            @show="showPopover"
-                            trigger="click">
-                            <div>
-                                <addMatter :type="matterType" :sign="matterSign" @value="getMatter"></addMatter>
-                            </div>
-                            <el-button slot="reference">添加后续事项</el-button>
-                        </el-popover>
-                        </span>
-                    </el-form-item>
-                </div>
-            </template>
-            <el-form-item label="承担部门" prop="departmentId">
-                <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
-            </el-form-item>
-            <el-form-item label="负责人" prop="personId">
-              <el-select style="width:100%" v-model="form.personId" placeholder="请选择负责人" filterable  :popper-append-to-body="false">
-                <el-option v-for="item in personnelList" :key="item.id" :label="item.personnelName" :value="item.id"></el-option>
-              </el-select>
-            </el-form-item>
-            <template>
-                <div>
-                    <el-form-item label="委托方" prop="clientId" v-if="userinfo.tenantType == 1">
-                        <el-select style="width:100%" v-model="form.clientId" placeholder="请选择委托方" filterable :popper-append-to-body="false">
-                            <el-option v-for="item in clientList" :key="item.id" :label="item.name" :value="item.id"></el-option>
-                        </el-select>
-                    </el-form-item>
-                    <el-form-item label="委托部门" prop="departmentId" v-else>
-                        <mySelectTree style="width:100%" v-model="form.departmentId" :options="departmentList"></mySelectTree>
-                    </el-form-item>
-                </div>
-            </template>
-            
-            <el-form-item label="产品/技术">
-              <el-input v-model="form.proTec" autocomplete="off" placeholder="请输入产品/技术"></el-input>
-            </el-form-item>
-            <el-form-item label="应用场景">
-              <el-checkbox-group v-model="form.scenarioList">
-                <el-checkbox v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO" :key="item.value" :label="parseInt(item.value)">{{ item.label }}</el-checkbox>
-              </el-checkbox-group>
-            </el-form-item>
-            <el-form-item label="关联报告">
-              <el-input v-model="form.associateReportName" autocomplete="off" placeholder="请输入关联报告"></el-input>
-            </el-form-item>
-            <el-form-item label="需要复制的选项" v-show="form.track">
-              <el-select v-model="form.copyIds" multiple clearable placeholder="请选择需要复制的选项" :popper-append-to-body="false" @change="changeCopyIds">
-                <el-option v-for="item in copyList" :key="item.dictChildValue" :label="item.dictChildLabel" :value="item.dictChildValue"></el-option>
-              </el-select>
-            </el-form-item>
-            <template v-if="form.type==7">
-                <div>
-                    <el-form-item label="案件编号">
-                        <el-input v-model="form.caseNumber" autocomplete="off" placeholder="请输入案件编号"></el-input>
-                    </el-form-item>
-                    <el-form-item label="发文序号">
-                        <el-input v-model="form.issueNumber" autocomplete="off" placeholder="请输入发文序号"></el-input>
-                    </el-form-item>
-                    <el-form-item label="发明创造名称">
-                        <el-input v-model="form.inventionName" autocomplete="off" placeholder="请输入发明创造名称"></el-input>
-                    </el-form-item>
-                    <el-form-item label="专利权人">
-                        <el-input v-model="form.currentApplication" autocomplete="off" placeholder="请输入专利权人"></el-input>
-                    </el-form-item>
-                    <el-form-item label="无效宣告请求人">
-                        <el-input v-model="form.invalidApplication" autocomplete="off" placeholder="请输入无效宣告请求人"></el-input>
-                    </el-form-item>
-                </div>
-            </template>
-            <el-form-item label="卷号" prop="volumeNumber" >
-              <el-input v-model="form.volumeNumber" autocomplete="off" placeholder="请输入卷号"></el-input>
-            </el-form-item>
-            <el-form-item :label="(!form.id &&form.status==3)?'上传报告文档':'上传附件'">
-              <div v-if="form.reportFiles" class="upload-file">
-                <div v-for="item in form.reportFiles" style="margin:0;display:flex;justify-content:space-around;">
-                  <p style="margin:0;width:calc(100% - 40px);overflow: hidden;white-space: nowrap;text-overflow:ellipsis;cursor: pointer">{{item.name?item.name+'.'+item.suffix:item.fileName}}</p> 
-                    <Menu :data="item" @delFile="delFile"></Menu>
-                </div>
-              </div>
-              <el-upload  ref="upload" class="upload-file" drag action="#" :auto-upload="false" :show-file-list="true" :on-change="onChange" multiple  :on-preview="handlePreview" :on-remove="handleRemove">
-                <i :class="!file ? 'el-icon-upload' : 'el-icon-refresh'"></i>
-                <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-                <div class="el-upload__tip" slot="tip"></div>
-              </el-upload>
-            </el-form-item>
-            <el-form-item label="备注" prop="remark" >
-              <el-input type='textarea' v-model="form.remark" autocomplete="off" placeholder="请输入备注"></el-input>
-            </el-form-item>
-        </el-form>
-        <div slot="footer" class="dialog-footer" v-if="$reportPermission(form.id,[0,1])">
-              <el-button @click="handleClose(false)">取 消</el-button>
-              <el-button type="primary" @click="ifNext " v-if="form.type==7 && !form.id">下一步</el-button>
-              <el-button type="primary" @click="submit "  v-else>确 定</el-button>
-        </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { mapGetters } from 'vuex'
-export default {
-  components: {},
-  props: {},
-  data() {
-    return {
-        //弹窗标题
-        title:'',
-        //控制弹窗是否打开
-        showDialog:false,
-        //表单数据
-        form:{},
-        //表单规则
-        rules:{},
-        //加载
-        loading:false,
-        //加载时显示的文字
-        load_text:'加载中',
-        //应用场景
-        commonData:{},
-        //核心结论
-        conclusion:[],
-        //部门数据
-        departmentList:[],
-        //需要复制的选项集合
-        copyList:[],
-        //人员列表
-        personnelList:[],
-        //客户列表
-        clientList:[],
-        //上传文件列表
-        file:[],
-        //核心结论类型字典
-        reportAsDicItem:{
-            "0":"INVALID_ASSESS",
-            "1":"THIRD_ASSESS",
-            "2":"STABILITY_ASSESS",
-            "3":"FTO_ASSESS",
-            "4":"TORT_ASSESS",
-            "5":"AVOID_ASSESS",
-            "7":"REINVALID_ASSESS",
-        },
-        //需要复制的内容字典
-        reportAsDicItemCopy:{
-            "0":"INVALID_COPY",
-            "1":"THIRD_COPY",
-            "2":"STABILITY_COPY",
-            "3":"FTO_COPY",
-            "4":"TORT_COPY",
-            "5":"AVOID_COPY",
-        },
-    };
-  },
-  watch: {},
-  computed: {
-    ...mapGetters(['webSocket','userinfo']),
-    dictMessage() {
-      return this.$store.state.dictMessage.dictMessage
-    },
-  },
-  created() {},
-  mounted() {
-    //获取字典项(接口还是通过字典获取)
-    this.$api.getCommonData({ keys: 'QUERY_GROUP,ENTERPRISE_APPLICATION_SCENARIO,INVESTIGATION_TYPE' }).then(response => {
-      this.commonData = response.data
-    })
-    // console.log(1)
-    //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    this.getAllPersonnelList()
-    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    this.getAllClientList()
-    //获取所有部门列表
-    this.getAllDepartmentList()
-  },
-  methods: {
-    //打开弹窗
-    open(form){
-        this.form = JSON.parse(JSON.stringify(form))
-        var a = ''
-        if (this.form.id) {
-            if (this.$reportPermission(this.form.id,[0,1])) {
-                a = '编辑'
-            } else {
-                a = '查看'
-            }
-        } else {
-            a = '创建'
-        }
-        var reportType = this.dictMessage.REPORT_TYPE.filter(item=>{return item.dictChildValue == this.form.type})[0].dictChildLabel
-        this.title = a + reportType + '报告'
-        this.showDialog = true
-    },
-    //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    getAllPersonnelList(){},
-    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    getAllClientList(){},
-    //获取所有部门列表
-    getAllDepartmentList(){},
-    //关闭弹窗
-    handleClose(){
-        this.showDialog = false
-    },
-    //切换是否完成状态
-    changeStatus(val){
-      
-    },
-    //获取专利号且填入报告名称
-    getPatentNo(){
-      if(!this.form.name){
-        var a = this.dictMessage.REPORT_TYPE.filter(item=>{return item.dictChildValue == this.form.type})[0].dictChildLabel
-        this.$set(this.form,'name',this.form.signPatentNo + a)
-      }
-    },
-     //修改需要复制的选项
-     changeCopyIds(val){
-      if(Object.keys(this.copyIndex).length>0){
-        var index = this.copyList.findIndex(item=>{
-          return item.dictChildLabel == '对比文件'
-        })
-        if(index!=-1){
-          var id = this.copyList[index].dictChildValue
-          var index2 = this.copyList.findIndex(item=>{
-              return item.dictChildLabel == '标引信息'
-            })
-          if(val.indexOf(id)!=-1){
-            if(index2==-1){
-              this.copyList.splice(index+1,0,this.copyIndex)
-            }
-          }else{
-            if(index2!=-1){
-              this.copyList.splice(index2,1)
-              this.form.copyIds.splice(this.form.copyIds.indexOf(this.copyIndex.dictChildValue),1)
-            }
-          }
-        }else{
-
-        }
-      }
-    },
-    //切换上传的文件
-    onChange(file, fileList){
-
-    },
-    //删除未提交的附件
-    handleRemove(file, fileList) {
-      var index = this.file.findIndex(item=>{
-        return item.uid == file.raw.uid
-      })
-      if(index!=-1){
-        this.file.splice(index,1)
-      }
-    },
-    //上传附件时查看附件内容
-    handlePreview(file) {
-          var item={
-              name:file.name,
-              suffix:'',
-              downLoad:true
-            }
-            var index = file.raw.type.lastIndexOf('/')
-            var type = file.raw.type.substring(index+1,file.raw.type.length)
-            var arr = ['png','jpeg','bmp','jpg']
-            if(arr.includes(type)){
-              var FileUrl =  URL.createObjectURL(file.raw)
-              var isPicture = 1
-            }else if(type == 'pdf'){
-              var FileUrl = URL.createObjectURL(file.raw)
-              var isPicture = 0
-            }else{
-              return false
-            }
-            const router = this.$router.resolve({
-                path: '/checkFile',
-                query: {
-                    row: JSON.stringify(item),
-                    FileUrl: FileUrl,
-                    isPicture:isPicture
-                }
-            })
-            window.open(router.href, '_blank');
-    },
-    //创建无效应对报告下一步
-    ifNext(){},
-    //提交填写的信息
-    submit(){},
-  },
-};
-</script>
-<style lang="scss" scoped>
-</style>

File diff suppressed because it is too large
+ 997 - 0
src/views/report/components/dialog/addAndEditReport2.vue


+ 36 - 26
src/views/report/components/index.vue

@@ -36,7 +36,7 @@
       </el-header>
       <el-main id="patent-list-container" class="main" v-loading="loading">
         <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
-          :state="state" :queryParams="queryParams" @option="handleOption" @sort="handleSort" :groupBy='groupingValue'
+          :state="state" :queryParams="queryParams" @option="handleOption" @sort="handleSort" :groupBy="groupingValue"
           :groupingOption="groupingOption" :commonData="commonData" :searchOption="searchOption" :column="columnList"
           @getRow="checkDetails" @params="getParams"></component>
       </el-main>
@@ -57,7 +57,7 @@ import Table from './view/table.vue'
 import Card from './view/card.vue'
 import visual from './view/visual.vue'
 import mergeTable from './view/mergeTable.vue'
-import CreateReport from './dialog/addAndEditReport.vue'
+import CreateReport from './dialog/addAndEditReport2.vue'
 import fields from '@/views/components/dialog/fields.vue';
 export default {
   components: {
@@ -120,8 +120,7 @@ export default {
           options: []
         },
       ],
-      // ???
-      searchFiledDictMessage: [],
+
       //检索条件
       searchOption: {
         name: localStorage.searchContent
@@ -154,6 +153,8 @@ export default {
       commonData: [],
       // 栏位信息数组
       columnList: [],
+      // 子组件新增、编辑报告成功发送的字符串
+      handleMessage:'',
     };
   },
   watch: {},
@@ -243,7 +244,7 @@ export default {
             type: 'type',
           })
           //先获取报告类型,报告状态,相关事件,再为报告类型,报告状态,相关事件添加选项
-          let arr = ['报告类型', '报告状态', '相关事件', '委托方', '负责部门']
+          let arr = ['报告类型', '报告状态']
           arr.forEach(item => {
             let obj=this.searchFiled.find(item2 => { 
               return item2.label == item
@@ -276,15 +277,6 @@ export default {
         case '报告状态':
           obj.options=[]
           break;
-        case '相关事件':
-          obj.options=[]
-          break;
-        case '委托方':
-
-          break;
-        case '负责部门':
-
-          break;
 
         default:
           break;
@@ -303,7 +295,7 @@ export default {
         }
       })
       // 返回字符串
-      this.searchOption.searchQuery = this.$commonJS.objectToString(params)
+      this.searchOption=params
       // 调用查询接口
       this.queryParams.current = 1
       this.getList()
@@ -312,17 +304,20 @@ export default {
     getList() {
       let params = {
         ...this.queryParams,//分页信息
-        ...this.searchOption,//检索条件
+        searchQuery : this.$commonJS.objectToString(this.searchOption),//检索条件
         orderDTOList: this.sort,//排序信息
       }
+      this.loading = true
       this.$api.queryReportProject(params).then(res => {
         if (res.code == 200) {
           this.dataList = res.data.data
           this.total = res.data.total
+          this.loading = false
         }
       }).catch(error => {
         this.dataList = []
         this.data.total = 0
+        this.loading = false
         this.$message.error(error.message)
       })
     },
@@ -432,7 +427,7 @@ export default {
       this.$refs.ReportForm.open(form)
     },
     //操作列
-    handleOption({ option, row }) {
+    handleOption({ option, row ,isLast}) {
       this.$s.setSession('params', row)
       switch (option) {
         case '0'://分享
@@ -457,7 +452,7 @@ export default {
           this.handleImportPatent(row)
           break
         case '7'://删除
-          this.handleDelete(row)
+          this.handleDelete(row,isLast)
           break;
         case '8'://侵权分析技术特征对比
           this.$s.setSession('reportMessage1', row)
@@ -496,11 +491,11 @@ export default {
       }
     },
     // 删除
-    handleDelete(row) {
-      this.handleDeletes([row.id])
+    handleDelete(row,isLast) {
+      this.handleDeletes([row.id],isLast)
     },
     // 批量删除报告
-    handleDeletes(ids) {
+    handleDeletes(ids,isLast) {
       this.$confirm('此操作将永久删除该报告, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -508,8 +503,14 @@ export default {
       }).then(() => {
         this.$api.deleteReportProject(ids).then(res => {
           if (res.code == 200) {
+            if(isLast){
+              this.isGrouping()
+            } else {
+              this.getList()
+            }
+            this.handleMessage = '删除成功'
+            this.clearMessage()
             this.$message.success('删除报告成功')
-            this.getList()
           }
         }).catch(err => {
           this.$message.error(err.message)
@@ -563,6 +564,7 @@ export default {
           break;
       }
     },
+
     //接收可视化的参数
     getParams(params) {
       if (params.conclusionType == '-1') {
@@ -579,10 +581,18 @@ export default {
     },
     //创建报告子组件返回值
     isGetList(val) {
-      if (val) {
-        this.getList()
-      }
-    }
+      this.handleMessage = val
+      this.queryParams.current = 1
+      this.searchOption={}
+      this.isGrouping()
+      this.clearMessage()
+    },
+    //清空信息
+    clearMessage(){
+      this.$nextTick(()=>{
+        this.handleMessage = ''
+      })
+    },
   },
 };
 </script>

+ 34 - 28
src/views/report/components/mixins/index.js

@@ -1,33 +1,39 @@
 import { checkVisual } from "@/views/home/components/mixins";
-export default{
-    mixins:[checkVisual],
-    props:{
-        tableData: {//数据
-            type: Array,
-            default: () => {
-              return [{ name: '123', eventNumber: '手机', projectNumber: '专题库一', projectNumber1: [{ name: '事件一' }]},]
-            }
-          },
-        queryParams: {//分页信息
-            type: Object,
-            default: () => {
-              return {
-                size: 10,
-                current: 1,
-              }
-            }
-        },
-    },  
-    computed:{
+export default {
+  mixins: [checkVisual],
+  props: {
+    tableData: {//数据
+      type: Array,
+      default: () => {
+        return [{ name: '123', eventNumber: '手机', projectNumber: '专题库一', projectNumber1: [{ name: '事件一' }] },]
+      }
+    },
+    queryParams: {//分页信息
+      type: Object,
+      default: () => {
+        return {
+          size: 10,
+          current: 1,
+        }
+      }
+    },
+  },
+  computed: {
 
+  },
+  methods: {
+    // 点击名称等事件
+    handleItem(row, key) {
     },
-    methods: {
-        // 点击名称等事件
-        handleItem(row,key) {
-        },
-        //操作列事件
-        handleCommand(option,row){
-            this.$emit('option', { option, row })
-        },
+    //操作列事件
+    handleCommand(option, row) {
+      var isLast = false
+      if (option == '7') {
+        if(this.tableData.length == 1){
+          isLast = true
+        }
+      }
+      this.$emit('option', { option, row ,isLast:isLast})
     },
+  },
 }

+ 116 - 19
src/views/report/components/view/table.vue

@@ -13,7 +13,7 @@
             <div v-if="['name'].includes(item.value)">
               <el-link @click="handleItem(scope.row,item.value)">{{ scope.row[item.value] }}</el-link>
             </div>
-            <div v-else-if="['reportType','status','eventNames'].includes(item.value)" v-html="getColumnData(scope.row,item.value)"></div>
+            <div v-else-if="['reportType','status','eventNames','cronNames'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></div>
             <div v-else>{{ scope.row[item.value] }}</div>
           </template>
         </el-table-column>
@@ -97,28 +97,125 @@ export default {
     
   },
   methods: {
-    // 排序
-    sortChange({ column, prop, order }) {
-      this.$emit('sort', { column, prop, order })
+     //更新数据
+     updateData(){
+      if(this.action.type == 1){
+        if(this.tableData.length == 1){
+          return false
+        }
+        var startIndex = this.tableData.findIndex(item=>{
+              return item.id == this.action.id
+          })
+          this.tableData.splice(startIndex,1)
+        let params = {
+          ...this.params,
+          // ...this.row.searchOption,//检索条件
+          searchQuery : this.$commonJS.objectToString(this.row.searchOption),//检索条件
+          orderDTOList: this.sort,//排序
+          groupField: this.row.groupBy,
+          groupFieldValue: this.row.row.value,
+        }
+        this.getList2(params,1)
+      }else if(this.action.type == 2){
+        let params = {
+          ...this.params,
+          searchQuery:`id=${this.action.id}`,//检索条件
+          groupField: this.row.groupBy,
+          groupFieldValue: this.row.row.value,
+        }
+        this.getList2(params,2)
+      }
     },
-    // 获取栏位数据
-    getColumnData(row,key) {
-      if (key == 'reportType') {
-        if (row[key]) {
-          return this.reportTypeName[row[key]]
-        } else {
-          return '--'
+
+    getList2(params,type){
+      this.$api.queryPatentProject(params).then(res => {
+        if (res.code == 200) {
+          if(type == 1){
+            var startIndex = (params.current-1)*size
+            var endIndex = this.tableData.length
+            var len = endIndex - startIndex
+            this.tableData.splice(startIndex,len,...res.data.data)
+            this.params.total = res.data.total
+          }else if(type == 2){
+            var startIndex = this.tableData.findIndex(item=>{
+              return item.id == this.action.id
+            })
+            this.tableData.splice(startIndex,1,...res.data.data)
+          }
+          
         }
-      } else if (key =='status') {
-        
-      } else if (key == 'eventNames') {
-        // console.log(row[key].length);
-        if (row[key] && row[key].length>0) {
-          return row[key][0]
-        } else {
-          return '--'
+      }).catch(err => {
+      })
+    },
+
+
+    getList() {
+      if (!this.row) return;
+      if (this.params.current * this.params.size >= this.params.total) {
+        this.isMore = true
+        this.disabled = true
+        setTimeout(() => {
+          this.isMore = false;
+          this.isFlag = false
+        }, 1000)
+      }
+      if (this.disabled) return;
+      this.params.current += 1
+      let params = {
+        ...this.params,
+        // ...this.row.searchOption,//检索条件
+        searchQuery : this.$commonJS.objectToString(this.row.searchOption),//检索条件
+        orderDTOList: this.sort,//排序
+        groupField: this.row.groupBy,
+        groupFieldValue: this.row.row.value,
+      }
+      this.isMore = false;
+      this.isFlag = true;
+      this.$api.queryPatentProject(params).then(res => {
+        if (res.code == 200) {
+          this.tableData.push(...res.data.data)
+          this.params.total = res.data.total
         }
+      }).catch(err => {
+      })
+      setTimeout(() => {
+        this.isMore = false;
+        this.isFlag = false
+      }, 1000)
+    },
+
+    // 排序
+    sortChange({ column, prop, order }) {
+      this.handleSort({ column, prop, order })
+      if (!this.row) {
+        this.$emit('on-sort', { column, prop, order })
+      }
+    },
+    // 排序方法
+    handleSort({ column, prop, order }) {
+      this.sort=[]//如需要多个字段排序,则不需要清空
+      if (order == null) {
+        return;
+      }
+      var orderType = {
+        ascending: 0,
+        descending: 1
+      }
+      var params = this.sort.find(item => {
+        return item.orderBy == prop
+      })
+      if (params) {
+        params.orderType = orderType[order]
+      } else {
+        params = {}
+        params.orderBy = prop
+        params.orderType = orderType[order]
+        this.sort.push(params)
       }
+      this.params.current = 0
+      this.disabled = false
+      this.tableData.splice(0)
+      this.getList()
     },
 
   },