Sfoglia il codice sorgente

报告及专利挖掘检索分组调试

zhuhao 1 anno fa
parent
commit
ae4e34920d

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

@@ -13,10 +13,10 @@ export default {
     return axios.post("/xiaoshi/patentDigProject/queryPatentDigProject", data);
   },
   /**
-   * 查询研发项目
+   * 查询研发项目编号、名称
    */
-  getRdProjectByNumber(params) {
-    return axios.get("/xiaoshi/patentDigProject/getRdProjectByNumber", {params});
+  getRdProjectByNumber(data) {
+    return axios.post("/xiaoshi/patentDigProject/getRdProjectByNumber", data);
   },
   /**
    * 编辑专利挖掘项目

+ 6 - 0
src/api/newApi/report.js

@@ -25,5 +25,11 @@ export default {
     updateReportProject(data) {
         return axios.post("/xiaoshi/reportProject/updateReportProject", data);
     },
+    /**
+     * 分组查询报告 
+     */
+    groupReportProject(data) {
+        return axios.post("/xiaoshi/reportProject/groupReportProject", data);
+    },
    
 };

+ 2 - 1
src/views/event/components/view/mergeTable.vue

@@ -12,7 +12,8 @@
         show-overflow-tooltip>
         <template slot-scope="scope">
           <div>
-            {{ scope.row.name?scope.row.name:'--' }}
+            <span>{{ scope.row.name?scope.row.name:'--' }}</span>
+            <span>({{ scope.row.count?scope.row.count:'0' }})</span>
           </div>
         </template>
       </el-table-column>

+ 249 - 162
src/views/patentMining/components/dialog/addAndEditProject.vue

@@ -3,189 +3,194 @@
     <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-form">
         <template>
-          <!-- 研发项目 -->
-          <el-divider content-position="left">研发项目</el-divider>
+          <el-divider content-position="left">挖掘项目</el-divider>
           <el-row>
             <el-col :span="12">
-              <el-form-item label="研发编号:">
-                <el-autocomplete class="inline-input" v-model="form.rdnumber" value-key="name" v-SelectLazyLoading="load"
-                  :fetch-suggestions="querySearchQuestion" placeholder="请选择研发项目编号" :trigger-on-focus="false"
-                  style="width: 100%;">
-                </el-autocomplete>
+              <el-form-item label="项目名称:" prop="name">
+                <el-input v-model="form.name" placeholder="请输入项目名称"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="12">
-              <el-form-item label="编号名称:" prop="rdName">
-                <el-input v-model="form.rdName" placeholder="请输入研发项目名称"></el-input>
+              <el-form-item label="技术方向:">
+                <el-input v-model="form.technicalDirection" placeholder="请输入技术方向"></el-input>
               </el-form-item>
             </el-col>
-
           </el-row>
           <el-row>
-            <el-col :span="12">
-              <el-form-item label="产品:" prop="product">
-                <el-input v-model="form.product" placeholder="请输入产品名称"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item label="产品阶段:">
-                <el-input v-model="form.productPhase" placeholder="请输入产品阶段"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </template>
-        <el-divider content-position="left">挖掘项目</el-divider>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="项目名称:" prop="name">
-              <el-input v-model="form.name" placeholder="请输入项目名称"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="技术方向:">
-              <el-input v-model="form.technicalDirection" placeholder="请输入技术方向"></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <!-- <el-col :span="12">
+            <!-- <el-col :span="12">
             <el-form-item label="技术方向:">
               <el-input v-model="form.productPhase" placeholder="请输入产品阶段"></el-input>
             </el-form-item>
           </el-col> -->
-          <!-- <el-col :span="12">
+            <!-- <el-col :span="12">
             <el-form-item label="产出:">
               <el-input v-model="form.output" placeholder="请输入产出"></el-input>
             </el-form-item>
           </el-col> -->
 
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="相关竞争对手:">
-              <el-input v-model="form.relatedCompetitors" placeholder="请输入相关竞争对手"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="技术关键词:">
-              <el-input v-model="form.technicalKeyword" placeholder="请输入技术关键词"></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="产出:">
-              <el-input v-model="form.output" placeholder="请输入产出"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="是否检索:">
-              <el-switch v-model="form.ifSearch" active-color="#13ce66" inactive-color="#ff4949">
-              </el-switch>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <!-- <el-form-item label="是否审核:">
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="相关竞争对手:">
+                <el-input v-model="form.relatedCompetitors" placeholder="请输入相关竞争对手"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="技术关键词:">
+                <el-input v-model="form.technicalKeyword" placeholder="请输入技术关键词"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="预计产出:">
+                <el-input v-model="form.output" placeholder="请输入产出"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="是否检索:">
+                <el-switch v-model="form.ifSearch" active-color="#13ce66" inactive-color="#ff4949">
+                </el-switch>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <!-- <el-form-item label="是否审核:">
               <el-switch v-model="form.examine" active-color="#13ce66" inactive-color="#ff4949">
               </el-switch>
             </el-form-item> -->
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="参与人:">
-              <div class="manage">
-                <el-button size="small" @click="showDialog()">选择</el-button>
-                <div v-html="getNames(form.adminPersons)">
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="24">
+              <el-form-item label="参与人:">
+                <div class="manage">
+                  <el-button size="small" @click="showDialog()">选择</el-button>
+                  <div v-html="getNames(form.adminPersons)">
 
+                  </div>
                 </div>
-              </div>
-            </el-form-item>
-          </el-col>
+              </el-form-item>
+            </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>
+          </el-row>
+          <template>
+            <div v-if="!form.id">
+              <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">
+              <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>
+            <el-col :span="24">
+              <el-form-item label="负责人:">
+                <el-select v-model="form.headId" placeholder="请选择负责人" style="width: 100%;" filterable remote
+                  :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
+                  :loading="personnelList.loading">
+                  <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="24">
+              <el-form-item label="附件:">
+                <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove"
+                  style="height: 180px;" :autoUpload="true"></myUpload>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="24">
+              <el-form-item label="项目备注:">
+                <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="form.description"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
         </template>
+        <!-- 研发项目 -->
+        <template>
+          <el-divider content-position="left">研发项目</el-divider>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="编号:">
+                <el-autocomplete class="inline-input" v-model="form.rdnumber" value-key="number" v-SelectLazyLoading="load"
+                  :fetch-suggestions="querySearchQuestion" placeholder="请选择编号" :trigger-on-focus="false"
+                  @select="handleRdNumber" @change="changeRdNumber" style="width: 100%;">
+                </el-autocomplete>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="项目名称:" prop="rdName">
+                <el-autocomplete class="inline-input" v-model="form.rdName" value-key="name"
+                  v-SelectLazyLoading="loadRdName" :fetch-suggestions="querySearchRdName" placeholder="请输入研发项目名称"
+                  :trigger-on-focus="false" @select="handleRdName" @change="changeRdName" style="width: 100%;">
+                </el-autocomplete>
+              </el-form-item>
+            </el-col>
 
-        <el-row>
-          <el-col :span="24">
-            <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>
-          <el-col :span="24">
-            <el-form-item label="负责人:">
-              <el-select v-model="form.headId" placeholder="请选择负责人" style="width: 100%;" filterable remote
-                :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
-                :loading="personnelList.loading">
-                <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id">
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="附件:">
-              <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove"
-                style="height: 180px;" :autoUpload="true"></myUpload>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="项目备注:">
-              <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="form.description"></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="产品:" prop="product">
+                <el-input v-model="form.product" placeholder="请输入产品名称"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="产品阶段:">
+                <el-input v-model="form.productPhase" placeholder="请输入产品阶段"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleClose">取 消</el-button>
@@ -220,6 +225,7 @@ export default {
         matterIds: [],
         systemFileList: [],
         fileGuids: [],
+        ifSearch: false,
       },
       rules: {
         name: [{ required: true, message: '请输入项目名称', trigger: 'blur' },],
@@ -234,13 +240,22 @@ export default {
         },
         data: []
       },
-      // 研发编号列表懒加载
+      // 研发项目编号列表懒加载
       rdNumberArr: {
         queryParams: {
           current: 1,
           size: 10,
         },
-        eventInput: '',
+        input: '',
+        data: []
+      },
+      // 研发项目名称列表懒加载
+      rdNameArr: {
+        queryParams: {
+          current: 1,
+          size: 10,
+        },
+        input: '',
         data: []
       },
       //事件列表
@@ -452,7 +467,7 @@ export default {
     },
     // 查询研发编号
     async getRdProjectByNumber() {
-      let searchValue = { name: this.rdNumberArr.eventInput }
+      let searchValue = { number: this.rdNumberArr.input }
       let params = {
         ...this.rdNumberArr.queryParams,//分页信息
         searchQuery: this.$commonJS.objectToString(searchValue)//输入的建议
@@ -468,13 +483,86 @@ export default {
     //获取下拉建议研发编号数据
     async querySearchQuestion(queryString, cb) {
       this.rdNumberArr.queryParams.current = 1
-      this.rdNumberArr.eventInput = queryString
+      this.rdNumberArr.input = queryString
       this.rdNumberArr.data = []
       this.rdNumberArr.cb = cb
       await this.getRdProjectByNumber()
     },
+    // 选中的研发编号
+    handleRdNumber(val) {
+      this.$set(this.form,'rdnumber',val.number)
+      this.$set(this.form,'rdName',val.name)
+    },
+    // 监听研发项目编号输入框的值
+    changeRdNumber(val) {
+      if (val) {
+        this.form.rdnumber = val
+        if (this.form.rdName) {
+          let a=this.rdNameArr.data.findIndex(item => {
+            return item.name == this.form.rdName
+          })
+          if (a!=-1) {
+            this.form.rdName = ''
+          }
+        }
+      }
+    },
 
     /**
+     * 研发项目名称rdNameArr
+     */
+    loadRdName() {
+      if (this.rdNameArr.queryParams.current * this.rdNameArr.queryParams.size >= this.rdNameArr.queryParams.total) {
+        return false
+      }
+      this.rdNameArr.queryParams.current++
+      this.getRdProjectRdName()
+    },
+    // 查询研发项目名称
+    async getRdProjectRdName() {
+      let searchValue = { name: this.rdNameArr.input }
+      let params = {
+        ...this.rdNameArr.queryParams,//分页信息
+        searchQuery: this.$commonJS.objectToString(searchValue)//输入的建议
+      }
+      await this.$api.getRdProjectByNumber(params).then(res => {
+        if (res.code == 200) {
+          this.rdNameArr.data.push(...res.data.data)
+          this.rdNameArr.queryParams.total = res.data.total
+          this.rdNameArr.cb(this.rdNameArr.data);
+        }
+      })
+    },
+    //获取下拉建议研发项目名称数据
+    async querySearchRdName(queryString, cb) {
+      this.rdNameArr.queryParams.current = 1
+      this.rdNameArr.input = queryString
+      this.rdNameArr.data = []
+      this.rdNameArr.cb = cb
+      await this.getRdProjectRdName()
+    },
+    // 选中的研发项目名称
+    handleRdName(val) {
+      console.log(val);
+      this.$set(this.form,'rdnumber',val.number)
+      this.$set(this.form,'rdName',val.name)
+    },
+    // 监听研发项目名称输入框的值
+    changeRdName(val) {
+      console.log(val);
+      if (val) {
+        if (this.form.rdnumber) {
+          let a=this.rdNumberArr.data.findIndex(item => {
+            return item.number == this.form.rdnumber
+          })
+          if (a!=-1) {
+            this.form.rdnumber = ''
+          }
+        }
+        this.form.rdName = val
+      }
+    },
+    /**
      * 人员列表
      * @param {*} query 
      */
@@ -572,7 +660,6 @@ export default {
         this.title = '新增专利挖掘项目'
       }
       this.getPermissionPersonnel()
-      // this.getEventList()
       this.dialogVisible = true
     },
     //关闭弹窗

+ 2 - 3
src/views/patentMining/components/view/MergeTable.vue

@@ -14,7 +14,8 @@
         :label="column.name" :prop="column.value" sortable="custom" show-overflow-tooltip>
         <template slot-scope="scope">
           <div>
-            {{ scope.row.name ? scope.row.name : '--' }}
+            <span>{{ scope.row.name ? scope.row.name : '--' }}</span> 
+            <span>({{ scope.row.count?scope.row.count:'0' }})</span>
           </div>
         </template>
       </el-table-column>
@@ -23,8 +24,6 @@
 </template>
 
 <script>
-// import { workspaceOptions } from "../mixins";
-// import { getTableHeight } from '@/views/components/mixins'
 import Table from "./commonTable.vue";
 
 export default {

+ 15 - 5
src/views/patentMining/components/view/commonTable.vue

@@ -16,7 +16,9 @@
           <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="$commonJS.getColumnData(scope.row, item)">
+          <!-- <div v-else-if="['state'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row, item)">
+          </div> -->
+          <div v-else-if="['ifSearch','state'].includes(item.value)" v-html="getColumn(scope.row, item.value)">
           </div>
           <div v-else>{{ scope.row[item.value] ? scope.row[item.value] : '--' }}</div>
         </template>
@@ -96,7 +98,6 @@ export default {
     }
   },
   mounted() {
-    console.log(this.row);
     if (!this.row) {
       this.disabled = true
     } else {
@@ -155,11 +156,8 @@ export default {
       })
     },
 
-
     getList() {
-      console.log(1);
       if (!this.row) return;
-      console.log(2);
       if (this.params.current * this.params.size >= this.params.total) {
         this.isMore = true
         this.disabled = true
@@ -225,6 +223,18 @@ export default {
       this.tableData.splice(0)
       this.getList()
     },
+    // 数据处理
+    getColumn(row, key) {
+      if (key == 'ifSearch') {
+        if (row[key] == true) {
+          return '是'
+        } else {
+          return '否'
+        }
+      }else if (key == 'state') {
+        return this.statusObj[row[key]]
+      }
+    },
   },
 };
 </script>

+ 16 - 3
src/views/patentMining/components/viewIndex.vue

@@ -16,9 +16,9 @@
             </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')"
+            <el-button :type="viewTypeBtn === 'commonTable' ? 'primary' : ''" @click="onChange2('commonTable')"
               size="small">列表</el-button>
-            <el-button :type="viewType === 'commonCard' ? 'primary' : ''" @click="onChange2('commonCard')"
+            <el-button :type="viewTypeBtn === 'commonCard' ? 'primary' : ''" @click="onChange2('commonCard')"
               size="small">卡片</el-button>
           </el-button-group>
           <el-dropdown trigger="click" split-button type="primary" size="small" @command="handleCommand($event)">
@@ -30,7 +30,7 @@
         </div>
       </el-header>
       <el-main>
-        <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
+        <component v-if="showView" :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
           :column="columnList" :groupingOption="groupingOption" :groupBy="group" :queryParams="queryParams" @option="handleOption" @on-sort="handleSort"
           :commandData="commandData" :searchOption="searchOption" :handleMessage="handleMessage">
         </component>
@@ -67,6 +67,8 @@ export default {
     return {
       //当前组件名称
       viewType: 'commonTable',
+      // 当前按钮的底色
+      viewTypeBtn:'commonTable',
       //专利挖掘项目table数据集合
       dataList: [],
       // 专利挖掘分组项目数据数组
@@ -103,6 +105,8 @@ export default {
       searchOption: {},
       // table栏位信息
       columnList: [],
+      //显示视图
+      showView: false,
       // 子组件添加/更新项目返回的值
       handleMessage:'',
     };
@@ -117,8 +121,16 @@ export default {
     await this.getColumn()
     // 获取table数据
     this.getList()
+    this.showViews()
   },
   methods: {
+    //显示视图?
+    showViews() {
+      this.showView = false
+      this.$nextTick(() => {
+        this.showView = true
+      })
+    },
     //显示栏位管理
     getFieldList(data) {
       this.columnList = data
@@ -286,6 +298,7 @@ export default {
     //切换视图
     onChange2(val) {
       this.viewType = val
+      this.viewTypeBtn=val
       this.group=''
       this.queryParams.current = 1
       this.getList()

+ 2 - 18
src/views/project/components/view/MergeTable.vue

@@ -14,28 +14,12 @@
         :label="column.name" :prop="column.value" sortable="custom" show-overflow-tooltip>
         <template slot-scope="scope">
           <div>
-            {{ scope.row.name ? scope.row.name : '--' }}
+            <span>{{ scope.row.name ? scope.row.name : '--' }}</span> 
+            <span>({{ scope.row.count?scope.row.count:'0' }})</span>
           </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>
 

+ 230 - 191
src/views/report/components/dialog/addAndEditReport.vue

@@ -7,24 +7,22 @@
         element-loading-background-color="rgba(0, 0, 0, 0.8)">
         <el-row>
           <el-col :span="12">
-            <!-- <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>
-            </el-form-item> -->
-            <el-form-item v-if="form.reportType == 3" label="标的产品" prop="signPatentNo">
-              <el-select style="width:100%" v-model="form.signProjectId" placeholder="请选择产品" filterable remote
-                :popper-append-to-body="false" :remote-method="remoteMethodProduct"
-                v-SelectLazyLoading="lazyLoadingProduct" :loading="productList.loading">
-                <el-option v-for="item in productList.data" :key="item.id" :label="item.name"
-                  :value="item.id"></el-option>
-              </el-select>
-              <!-- <el-input v-model="form.signProjectId" autocomplete="off"
-                placeholder="请输入标的产品" @change="getPatentNo"></el-input> -->
-            </el-form-item>
-            <el-form-item v-else label="标的专利" prop="signPatentNo">
-              <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利"
-                @change="getPatentNo"></el-input>
-            </el-form-item>
+            <template>
+              <div>
+                <el-form-item v-if="form.reportType == 3" label="标的产品" prop="signProjectId">
+                  <el-select style="width:100%" v-model="form.signProjectId" placeholder="请选择产品" filterable remote
+                    :popper-append-to-body="false" :remote-method="remoteMethodProduct"
+                    v-SelectLazyLoading="lazyLoadingProduct" :loading="productList.loading" @change="getPatentNo">
+                    <el-option v-for="item in productList.data" :key="item.id" :label="item.name"
+                      :value="item.id"></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item v-else label="标的专利" prop="signPatentNo">
+                  <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利"
+                    @change="getPatentNo"></el-input>
+                </el-form-item>
+              </div>
+            </template>
           </el-col>
           <el-col :span="12">
             <el-form-item label="报告名称" prop="name">
@@ -43,8 +41,6 @@
               <el-checkbox-group v-model="form.cronIds">
                 <el-checkbox v-for="item in conclusion" :key="item.value" :label="item.value">{{
                   item.label }}</el-checkbox>
-                <!-- <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="结论论述">
@@ -75,8 +71,8 @@
               <el-select style="width:100%" v-model="form.headId" placeholder="请选择负责人" filterable remote
                 :popper-append-to-body="false" :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
                 :loading="personnelList.loading">
-                <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name"
-                  :value="item.id"></el-option>
+                <el-option v-for="item in personnelList.data" :key="Number(item.id)" :label="item.name"
+                  :value="Number(item.id)"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -86,11 +82,14 @@
             <template>
               <div>
                 <el-form-item label="委托方" prop="entrustId" v-if="userinfo.tenantType == 1">
-                  <el-select style="width:100%" v-model="form.entrustId" placeholder="请选择委托方" filterable remote
-                    :popper-append-to-body="false" :remote-method="remoteMethodClient"
-                    v-SelectLazyLoading="lazyLoadingClient" :loading="clientObj.loading">
-                    <el-option v-for="item in clientList" :key="item.id" :label="item.name" :value="item.id"></el-option>
-                  </el-select>
+                  <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>
@@ -104,13 +103,6 @@
             </el-form-item>
           </el-col>
         </el-row>
-
-        <!-- <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-row>
           <el-col :span="24">
             <el-form-item label="产品/技术">
@@ -134,35 +126,40 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <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>
+        <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>
+
         <template v-if="form.reportType == 7">
           <div>
             <el-row>
@@ -206,7 +203,7 @@
       </div>
     </el-dialog>
 
-    <!-- 审核弹窗 -->
+    <!-- 审核弹窗,做公用组件 -->
     <el-dialog title="添加审核任务" :visible.sync="showTask" width="500px" @close="handleCloseTask">
       <el-form :model="taskForm" :rules="TaskRules" ref="TaskForm" label-width="120px" v-loading="loading">
         <el-form-item label="任务名称:" prop="taskName">
@@ -240,6 +237,11 @@
       </evidenceAndRequest>
     </el-dialog>
 
+    <!-- 委托方弹窗 -->
+    <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>
 
@@ -247,10 +249,12 @@
 import { mapGetters } from 'vuex'
 import evidenceAndRequest from './evidenceAndRequest.vue'
 import addMatter from './addMatter.vue'
+import ClientTable from '@/views/client'
 export default {
   components: {
     evidenceAndRequest,
     addMatter,
+    ClientTable,
   },
   props: {},
   data() {
@@ -296,7 +300,8 @@ export default {
       //表单规则
       rules: {
         name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
-        signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],
+        signProjectId: [{ required: true, validator: isExist, trigger: 'blur' },],//产品
+        signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],//专利
         headId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
         entrustId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
       },
@@ -312,10 +317,6 @@ export default {
       departmentList: [],
       //需要复制的选项集合
       copyList: [],
-      //人员列表
-      // personnelList: [],
-      //客户/委托方列表
-      clientList: [],
       //上传文件列表
       files: [],
       //核心结论类型字典
@@ -337,17 +338,18 @@ export default {
         "4": "TORT_COPY",
         "5": "AVOID_COPY",
       },
-      // 客户懒加载obj
-      clientObj: {
+      /**
+       * 委托方
+       */
+      clientList: {
         queryParams: {
           current: 1,
-          size: 10,
+          size: 10
         },
-        loading: false,
-        //是否懒加载
-        isLazy: true,
-        data:[],
+        data: [],
+        cb: null
       },
+      visible: false,
       //人员列表懒加载
       personnelList: {
         queryParams: {
@@ -406,26 +408,81 @@ export default {
       return this.$store.state.dictMessage.dictMessage
     },
     scenario() {
-      console.log(this.$store.state.dictMessage);
       return this.$store.state.dictMessage.scenario || []
     }
   },
   created() { },
   mounted() {
-    // 获取所有产品
-    this.getAllProduct()
-    //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    this.getPermissionPersonnel()
-    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    this.getAllClientList()
     //获取所有部门列表
     this.getDepartment()
   },
   methods: {
+    /**
+     * 客户/委托方
+     */
+    //远程搜索委托方(建议调取接口获取)
+    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() {
 
     },
+
+    /**
+     * 事件
+     */
     //懒加载事件
     loadEvent() {
       if (this.eventList.queryParams.current * this.eventList.queryParams.size >= this.eventList.queryParams.total) {
@@ -485,6 +542,8 @@ export default {
         await this.onChange()
       }
     },
+
+
     //调查类型选择切换
     async onChange() {
       if (this.form.scenarioIds.length != 0) {
@@ -496,10 +555,12 @@ export default {
         this.show = false
       }
     },
+
     //打开弹窗
     async open(form) {
       var a = ''
       this.form = JSON.parse(JSON.stringify(form))
+      console.log(form);
       if (this.form.id) {
         if (this.$reportPermission(this.form.id, [0, 1])) {
           a = '编辑'
@@ -507,47 +568,41 @@ export default {
           a = '查看'
         }
       } else {
-        this.$set(this.form,'matterIds',[])
-        this.$set(this.form,'systemFileList',[])
-        this.$set(this.form,'fileGuids',[])
+        this.$set(this.form, 'matterIds', [])
+        this.$set(this.form, 'systemFileList', [])
+        this.$set(this.form, 'fileGuids', [])
         a = '创建'
+        console.log(1);
       }
+      console.log(2);
       var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.dictChildValue == this.form.reportType })[0].dictChildLabel
       this.title = a + reportType + '报告'
-      // 事件
-      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
         await this.getPermissionPersonnel(1)
         this.personnelList.queryParams.id = null
       }
+      console.log(3);
       // 委托方
-      if (this.form.entrustId) {
-        this.personnelList.queryParams.id = this.form.headId
-        await this.getPermissionPersonnel(1)
-        this.personnelList.queryParams.id = null
-      }
+      // if (this.form.entrustId) {
+      //   this.clientList.queryParams.id = this.form.entrustId
+      //   await this.getAllClientList(1)
+      //   this.clientList.queryParams.id = null
+      // }
+
       this.getPermissionPersonnel()
-      this.getEventList()
+      console.log(4);
+      // this.getAllClientList()
+      // this.getEventList()
       this.showDialog = true
+      console.log(5);
     },
+
+    /**
+     * 产品
+     * @param {*} query 
+     */
     // 产品列表远程搜索
     remoteMethodProduct(query) {
       this.productList.isLazy = true
@@ -594,6 +649,11 @@ export default {
       }).catch(error => {
       })
     },
+
+    /**
+    * 人员
+    * @param {*} query 
+    */
     // 人员列表远程搜索
     remoteMethodPerson(query) {
       this.personnelList.data = []
@@ -631,51 +691,14 @@ export default {
         }
       })
     },
-    // 客户列表远程搜索
-    remoteMethodClient(query) {
-      if (query != '') {
-        this.clientObj.loading = true;
-        this.clientObj.queryParams.current = 1
-        this.clientObj.queryParams.name = query
-        this.$api.getAllClientList(this.clientObj.queryParams).then(response => {
-          if (response.code == 200) {
-            this.clientObj.loading = false;
-            this.clientList = response.data.records
-          }
-        }).catch(error => {
-          this.clientObj.loading = false;
-        })
-      } else {
-        this.clientObj.queryParams.name = null
-        this.clientList = [];
-        this.getAllClientList()
-      }
-    },
-    // 获取所有客户列表懒加载
-    lazyLoadingClient() {
-      if (this.clientObj.queryParams.current * this.clientObj.queryParams.size >= this.clientObj.queryParams.total) {
-        return false
-      }
-      this.clientObj.queryParams.current += 1
-      this.getAllClientList()
-    },
-    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
-    getAllClientList() {
-      this.$api.getAdminClientList(this.clientObj.queryParams).then(response => {
-        this.clientList.push(...response.data.records)
-        this.clientObj.queryParams.total = response.data.total
-      }).catch(error => {
-        this.clientList = []
-        this.$message.error(error.message)
-      })
-    },
+
     //获取所有部门列表
-    //获取部门列表
     getDepartment() {
       this.$api.getPermissionDepartmentList().then((response) => {
         this.departmentList = response.data;
       });
     },
+
     //切换是否完成状态
     async changeStatus(val) {
       if (val == 3) {
@@ -685,11 +708,11 @@ export default {
           this.$set(this.form, 'cronIds', [])
         }
         let params = {
-          reportType:this.form.reportType
+          reportType: this.form.reportType
         }
         await this.$api.queryCrons(params).then(res => {
           if (res.code == 200) {
-            this.conclusion=res.data.data
+            this.conclusion = res.data.data
           }
         }).catch(error => {
           this.conclusion = []
@@ -703,13 +726,23 @@ export default {
         this.matterType = null
       }
     },
+
     //获取专利号且填入报告名称
     getPatentNo() {
       if (!this.form.name) {
         var a = this.dictMessage.REPORT_TYPE.filter(item => { return item.dictChildValue == this.form.reportType })[0].dictChildLabel
-        this.$set(this.form, 'name', this.form.signPatentNo + a)
+        if (this.form.signProjectId) {
+          let name=this.productList.data.filter(item => {
+            return item.id == this.form.signProjectId
+          })
+          this.$set(this.form,'name',name[0].name + a)
+        } else {
+          this.$set(this.form, 'name', this.form.signPatentNo + a)
+        }
+       
       }
     },
+
     //修改需要复制的选项
     changeCopyIds(val) {
       if (Object.keys(this.copyIndex).length > 0) {
@@ -736,6 +769,7 @@ export default {
         }
       }
     },
+
     // 上传的文件监听
     onchangeFile(file, fileList) {
       if (file.guid) {
@@ -744,35 +778,18 @@ 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)
       }
-
     },
     // 删除上传的文件
     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)
       }
     },
     //上传附件时点击查看附件内容
@@ -804,12 +821,27 @@ export default {
       })
       window.open(router.href, '_blank');
     },
+
+
     //提交填写的信息
     submit() {
       this.$refs.reportForm.validate((valid) => {
         if (valid) {
           this.form.type = 2//项目类型(1专题库 2报告 3专利挖掘项目)
-          if (this.form.scenarioIds && this.form.scenarioIds.length>0) {
+          // 判断文件是否都上传完毕
+          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) {
             var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
           }
           if (this.form.eventId) {
@@ -837,7 +869,7 @@ export default {
               this.$set(this.taskForm, 'taskName', this.form.name + '审核')
             }).catch(action => {//不审核直接创建报告
               // 调用创建报告公用,接口
-              this.addReport(formData)
+              this.addReport(formData, scenarioIds)
             });
 
           } else {//编辑报告
@@ -845,7 +877,7 @@ export default {
               if (response.code == 200) {
                 this.files = []
                 this.$message.success('报告更新成功')
-                this.$emit('getList', true)
+                this.$emit('getList', '更新成功')
                 this.handleClose()
               }
             })
@@ -857,7 +889,7 @@ export default {
     handleClose(val) {
       if (this.form.reportType == 7 && val) {
         this.showEvidenceAndRequest = true
-        this.$s.setSession('params', {})
+        // this.$s.setSession('params', {})
         this.reportId = val
       }
       this.personnelList.queryParams.name = ''
@@ -868,17 +900,33 @@ export default {
         fileGuids: [],
       }
       this.showDialog = false
+      this.clear()
+    },
+     //清空组件缓存数据
+    clear() {
+      // 清空事件相关
+      this.form.eventIds = []
+      this.eventList.queryParams.current = 1
+      this.eventList.data = []
+      // 清空负责人相关
+      this.personnelList.data = []
+      this.personnelList.queryParams.current = 1
+      this.personnelList.queryParams.name = null
     },
     // 创建报告创建接口公用
-    addReport(formData) {
+    addReport(formData, scenarioIds) {
       this.$api.addReportProject(formData).then(response => {
         if (response.code == 200) {
           this.files = []
           this.$message.success('报告创建成功')
-          this.$emit('getList', true)
+          this.$emit('getList', '新增成功')
           // response.data是创建成功后返回的报告id
           this.handleClose(response.data)
         }
+      }).catch(error => {
+        // 如果报告未创建成功,则赋值
+        this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
+        this.show = true
       })
     },
     //提交审核任务
@@ -948,18 +996,9 @@ export default {
         }
       })
     },
-    
-  },
-  // 组件销毁函数
-  destroyed() {
-    // 清空事件相关
-    this.form.eventIds = []
-    this.eventList.queryParams.current=1
-    this.eventList.data=[]
-     // 清空负责人相关
-    this.personnelList.data = []
-    this.personnelList.queryParams.current=1
+
   },
+ 
 };
 </script>
 <style lang="scss" scoped></style>

+ 180 - 212
src/views/report/components/dialog/addAndEditReport2.vue

@@ -7,22 +7,24 @@
         element-loading-background-color="rgba(0, 0, 0, 0.8)">
         <el-row>
           <el-col :span="12">
-            <template>
-              <div>
-                <el-form-item v-if="form.reportType == 3" label="标的产品" prop="signProjectId">
-                  <el-select style="width:100%" v-model="form.signProjectId" placeholder="请选择产品" filterable remote
-                    :popper-append-to-body="false" :remote-method="remoteMethodProduct"
-                    v-SelectLazyLoading="lazyLoadingProduct" :loading="productList.loading">
-                    <el-option v-for="item in productList.data" :key="item.id" :label="item.name"
-                      :value="item.id"></el-option>
-                  </el-select>
-                </el-form-item>
-                <el-form-item v-else label="标的专利" prop="signPatentNo">
-                  <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利"
-                    @change="getPatentNo"></el-input>
-                </el-form-item>
-              </div>
-            </template>
+            <!-- <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>
+            </el-form-item> -->
+            <el-form-item v-if="form.reportType == 3" label="标的产品" prop="signPatentNo">
+              <el-select style="width:100%" v-model="form.signProjectId" placeholder="请选择产品" filterable remote
+                :popper-append-to-body="false" :remote-method="remoteMethodProduct"
+                v-SelectLazyLoading="lazyLoadingProduct" :loading="productList.loading">
+                <el-option v-for="item in productList.data" :key="item.id" :label="item.name"
+                  :value="item.id"></el-option>
+              </el-select>
+              <!-- <el-input v-model="form.signProjectId" autocomplete="off"
+                placeholder="请输入标的产品" @change="getPatentNo"></el-input> -->
+            </el-form-item>
+            <el-form-item v-else label="标的专利" prop="signPatentNo">
+              <el-input v-model="form.signPatentNo" autocomplete="off" placeholder="请输入标的专利"
+                @change="getPatentNo"></el-input>
+            </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="报告名称" prop="name">
@@ -41,6 +43,8 @@
               <el-checkbox-group v-model="form.cronIds">
                 <el-checkbox v-for="item in conclusion" :key="item.value" :label="item.value">{{
                   item.label }}</el-checkbox>
+                <!-- <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="结论论述">
@@ -71,8 +75,8 @@
               <el-select style="width:100%" v-model="form.headId" placeholder="请选择负责人" filterable remote
                 :popper-append-to-body="false" :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson"
                 :loading="personnelList.loading">
-                <el-option v-for="item in personnelList.data" :key="Number(item.id)" :label="item.name"
-                  :value="Number(item.id)"></el-option>
+                <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name"
+                  :value="item.id"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -82,10 +86,11 @@
             <template>
               <div>
                 <el-form-item label="委托方" prop="entrustId" v-if="userinfo.tenantType == 1">
-                  <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>
+                  <el-select style="width:100%" v-model="form.entrustId" placeholder="请选择委托方" filterable remote
+                    :popper-append-to-body="false" :remote-method="remoteMethodClient"
+                    v-SelectLazyLoading="lazyLoadingClient" :loading="clientObj.loading">
+                    <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>
@@ -99,6 +104,13 @@
             </el-form-item>
           </el-col>
         </el-row>
+
+        <!-- <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-row>
           <el-col :span="24">
             <el-form-item label="产品/技术">
@@ -122,40 +134,35 @@
             </el-form-item>
           </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>
+          </el-col>
+        </el-row>
         <template v-if="form.reportType == 7">
           <div>
             <el-row>
@@ -199,7 +206,7 @@
       </div>
     </el-dialog>
 
-    <!-- 审核弹窗,做公用组件 -->
+    <!-- 审核弹窗 -->
     <el-dialog title="添加审核任务" :visible.sync="showTask" width="500px" @close="handleCloseTask">
       <el-form :model="taskForm" :rules="TaskRules" ref="TaskForm" label-width="120px" v-loading="loading">
         <el-form-item label="任务名称:" prop="taskName">
@@ -233,11 +240,6 @@
       </evidenceAndRequest>
     </el-dialog>
 
-    <!-- 委托方弹窗 -->
-    <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>
 
@@ -245,12 +247,10 @@
 import { mapGetters } from 'vuex'
 import evidenceAndRequest from './evidenceAndRequest.vue'
 import addMatter from './addMatter.vue'
-import ClientTable from '@/views/client'
 export default {
   components: {
     evidenceAndRequest,
     addMatter,
-    ClientTable,
   },
   props: {},
   data() {
@@ -296,8 +296,7 @@ export default {
       //表单规则
       rules: {
         name: [{ required: true, message: '请输入报告名称', trigger: 'blur' },],
-        signProjectId: [{ required: true, validator: isExist, trigger: 'blur' },],//产品
-        signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],//专利
+        signPatentNo: [{ required: true, validator: isExist, trigger: 'blur' },],
         headId: [{ required: true, message: '请选择负责人', trigger: 'change' },],
         entrustId: [{ required: true, message: '请选择委托方', trigger: 'change' },],
       },
@@ -313,6 +312,10 @@ export default {
       departmentList: [],
       //需要复制的选项集合
       copyList: [],
+      //人员列表
+      // personnelList: [],
+      //客户/委托方列表
+      clientList: [],
       //上传文件列表
       files: [],
       //核心结论类型字典
@@ -334,18 +337,17 @@ export default {
         "4": "TORT_COPY",
         "5": "AVOID_COPY",
       },
-      /**
-       * 委托方
-       */
-      clientList: {
+      // 客户懒加载obj
+      clientObj: {
         queryParams: {
           current: 1,
-          size: 10
+          size: 10,
         },
-        data: [],
-        cb: null
+        loading: false,
+        //是否懒加载
+        isLazy: true,
+        data:[],
       },
-      visible: false,
       //人员列表懒加载
       personnelList: {
         queryParams: {
@@ -404,81 +406,26 @@ export default {
       return this.$store.state.dictMessage.dictMessage
     },
     scenario() {
+      console.log(this.$store.state.dictMessage);
       return this.$store.state.dictMessage.scenario || []
     }
   },
   created() { },
   mounted() {
+    // 获取所有产品
+    this.getAllProduct()
+    //获取所有人员列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
+    this.getPermissionPersonnel()
+    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
+    this.getAllClientList()
     //获取所有部门列表
     this.getDepartment()
   },
   methods: {
-    /**
-     * 客户/委托方
-     */
-    //远程搜索委托方(建议调取接口获取)
-    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() {
 
     },
-
-    /**
-     * 事件
-     */
     //懒加载事件
     loadEvent() {
       if (this.eventList.queryParams.current * this.eventList.queryParams.size >= this.eventList.queryParams.total) {
@@ -538,8 +485,6 @@ export default {
         await this.onChange()
       }
     },
-
-
     //调查类型选择切换
     async onChange() {
       if (this.form.scenarioIds.length != 0) {
@@ -551,7 +496,6 @@ export default {
         this.show = false
       }
     },
-
     //打开弹窗
     async open(form) {
       var a = ''
@@ -563,13 +507,31 @@ export default {
           a = '查看'
         }
       } else {
-        this.$set(this.form, 'matterIds', [])
-        this.$set(this.form, 'systemFileList', [])
-        this.$set(this.form, 'fileGuids', [])
+        this.$set(this.form,'matterIds',[])
+        this.$set(this.form,'systemFileList',[])
+        this.$set(this.form,'fileGuids',[])
         a = '创建'
       }
       var reportType = this.dictMessage.REPORT_TYPE.filter(item => { return item.dictChildValue == this.form.reportType })[0].dictChildLabel
       this.title = a + reportType + '报告'
+      // 事件
+      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
@@ -578,21 +540,14 @@ export default {
       }
       // 委托方
       if (this.form.entrustId) {
-        this.clientList.queryParams.id = this.form.entrustId
-        await this.getAllClientList(1)
-        this.clientList.queryParams.id = null
+        this.personnelList.queryParams.id = this.form.headId
+        await this.getPermissionPersonnel(1)
+        this.personnelList.queryParams.id = null
       }
-
       this.getPermissionPersonnel()
-      this.getAllClientList()
-      // this.getEventList()
+      this.getEventList()
       this.showDialog = true
     },
-
-    /**
-     * 产品
-     * @param {*} query 
-     */
     // 产品列表远程搜索
     remoteMethodProduct(query) {
       this.productList.isLazy = true
@@ -639,11 +594,6 @@ export default {
       }).catch(error => {
       })
     },
-
-    /**
-    * 人员
-    * @param {*} query 
-    */
     // 人员列表远程搜索
     remoteMethodPerson(query) {
       this.personnelList.data = []
@@ -681,23 +631,51 @@ export default {
         }
       })
     },
-
-    /**
-     * 客户/委托方
-     * @param {*} query 
-     */
     // 客户列表远程搜索
-
-
-
+    remoteMethodClient(query) {
+      if (query != '') {
+        this.clientObj.loading = true;
+        this.clientObj.queryParams.current = 1
+        this.clientObj.queryParams.name = query
+        this.$api.getAllClientList(this.clientObj.queryParams).then(response => {
+          if (response.code == 200) {
+            this.clientObj.loading = false;
+            this.clientList = response.data.records
+          }
+        }).catch(error => {
+          this.clientObj.loading = false;
+        })
+      } else {
+        this.clientObj.queryParams.name = null
+        this.clientList = [];
+        this.getAllClientList()
+      }
+    },
+    // 获取所有客户列表懒加载
+    lazyLoadingClient() {
+      if (this.clientObj.queryParams.current * this.clientObj.queryParams.size >= this.clientObj.queryParams.total) {
+        return false
+      }
+      this.clientObj.queryParams.current += 1
+      this.getAllClientList()
+    },
+    //获取所有客户列表(修改不要一次性获取,可以使用懒加载加远程搜索 )
+    getAllClientList() {
+      this.$api.getAdminClientList(this.clientObj.queryParams).then(response => {
+        this.clientList.push(...response.data.records)
+        this.clientObj.queryParams.total = response.data.total
+      }).catch(error => {
+        this.clientList = []
+        this.$message.error(error.message)
+      })
+    },
     //获取所有部门列表
+    //获取部门列表
     getDepartment() {
       this.$api.getPermissionDepartmentList().then((response) => {
         this.departmentList = response.data;
       });
     },
-
-
     //切换是否完成状态
     async changeStatus(val) {
       if (val == 3) {
@@ -707,11 +685,11 @@ export default {
           this.$set(this.form, 'cronIds', [])
         }
         let params = {
-          reportType: this.form.reportType
+          reportType:this.form.reportType
         }
         await this.$api.queryCrons(params).then(res => {
           if (res.code == 200) {
-            this.conclusion = res.data.data
+            this.conclusion=res.data.data
           }
         }).catch(error => {
           this.conclusion = []
@@ -725,7 +703,6 @@ export default {
         this.matterType = null
       }
     },
-
     //获取专利号且填入报告名称
     getPatentNo() {
       if (!this.form.name) {
@@ -733,7 +710,6 @@ export default {
         this.$set(this.form, 'name', this.form.signPatentNo + a)
       }
     },
-
     //修改需要复制的选项
     changeCopyIds(val) {
       if (Object.keys(this.copyIndex).length > 0) {
@@ -760,7 +736,6 @@ export default {
         }
       }
     },
-
     // 上传的文件监听
     onchangeFile(file, fileList) {
       if (file.guid) {
@@ -769,7 +744,7 @@ export default {
         })
         if (index != -1) {
           this.form.systemFileList.splice(index, 1, file)
-          // this.form.fileGuids.push(file.guid)
+          this.form.fileGuids.push(file.guid)
         }
       } else {
         this.form.systemFileList.push(file.raw)
@@ -778,14 +753,28 @@ export default {
     },
     // 删除上传的文件
     onRemove(file, fileList) {
-      let index = this.form.systemFileList.findIndex(item => {
-        return item.uid == file.uid
-      })
-      if (index != -1) {
-        this.form.systemFileList.splice(index, 1)
+      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)
+        }
       }
     },
-
     //上传附件时点击查看附件内容
     onPreview(file) {
       var item = {
@@ -815,27 +804,12 @@ export default {
       })
       window.open(router.href, '_blank');
     },
-
-
     //提交填写的信息
     submit() {
       this.$refs.reportForm.validate((valid) => {
         if (valid) {
           this.form.type = 2//项目类型(1专题库 2报告 3专利挖掘项目)
-          // 判断文件是否都上传完毕
-          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) {
@@ -863,7 +837,7 @@ export default {
               this.$set(this.taskForm, 'taskName', this.form.name + '审核')
             }).catch(action => {//不审核直接创建报告
               // 调用创建报告公用,接口
-              this.addReport(formData, scenarioIds)
+              this.addReport(formData)
             });
 
           } else {//编辑报告
@@ -871,7 +845,7 @@ export default {
               if (response.code == 200) {
                 this.files = []
                 this.$message.success('报告更新成功')
-                this.$emit('getList', '更新成功')
+                this.$emit('getList', true)
                 this.handleClose()
               }
             })
@@ -883,7 +857,7 @@ export default {
     handleClose(val) {
       if (this.form.reportType == 7 && val) {
         this.showEvidenceAndRequest = true
-        // this.$s.setSession('params', {})
+        this.$s.setSession('params', {})
         this.reportId = val
       }
       this.personnelList.queryParams.name = ''
@@ -894,22 +868,17 @@ export default {
         fileGuids: [],
       }
       this.showDialog = false
-      this.$destroy()
     },
     // 创建报告创建接口公用
-    addReport(formData, scenarioIds) {
+    addReport(formData) {
       this.$api.addReportProject(formData).then(response => {
         if (response.code == 200) {
           this.files = []
           this.$message.success('报告创建成功')
-          this.$emit('getList', '新增成功')
+          this.$emit('getList', true)
           // response.data是创建成功后返回的报告id
           this.handleClose(response.data)
         }
-      }).catch(error => {
-        // 如果报告未创建成功,则赋值
-        this.form.scenarioIds = JSON.parse(JSON.stringify(scenarioIds))
-        this.show = true
       })
     },
     //提交审核任务
@@ -979,18 +948,17 @@ export default {
         }
       })
     },
-
+    
   },
   // 组件销毁函数
   destroyed() {
     // 清空事件相关
     this.form.eventIds = []
-    this.eventList.queryParams.current = 1
-    this.eventList.data = []
-    // 清空负责人相关
+    this.eventList.queryParams.current=1
+    this.eventList.data=[]
+     // 清空负责人相关
     this.personnelList.data = []
-    this.personnelList.queryParams.current = 1
-    this.personnelList.queryParams.name = null
+    this.personnelList.queryParams.current=1
   },
 };
 </script>

+ 47 - 35
src/views/report/components/index.vue

@@ -36,14 +36,14 @@
       </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" @on-sort="handleSort" :groupBy="groupingValue"
           :groupingOption="groupingOption" :commonData="commonData" :searchOption="searchOption" :column="columnList"
           @getRow="checkDetails" @params="getParams"></component>
       </el-main>
       <el-footer class="pagination" v-if="viewType != 'visual'">
         <el-pagination background layout="total,sizes, prev, pager, next, jumper" :current-page.sync="queryParams.current"
           :page-sizes="pageSize" :page-size.sync="queryParams.size" @current-change="handleCurrentChange"
-          @size-change="handleSizeChange" :total="total">
+          :handleMessage="handleMessage" @size-change="handleSizeChange" :total="total">
         </el-pagination>
       </el-footer>
     </el-container>
@@ -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/addAndEditReport2.vue'
+import CreateReport from './dialog/addAndEditReport.vue'
 import fields from '@/views/components/dialog/fields.vue';
 export default {
   components: {
@@ -126,7 +126,7 @@ export default {
       // 栏位信息数组
       columnList: [],
       // 子组件新增、编辑报告成功发送的字符串
-      handleMessage:'',
+      handleMessage: '',
     };
   },
   watch: {},
@@ -216,17 +216,16 @@ export default {
             type: 'type',
           })
           //先获取报告类型,报告状态,相关事件,再为报告类型,报告状态,相关事件添加选项
-          let arr = ['报告类型', '报告状态']
+          let arr = ['报告类型', '报告状态', '核心结论']
           arr.forEach(item => {
-            let obj=this.searchFiled.find(item2 => { 
+            let obj = this.searchFiled.find(item2 => {
               return item2.label == item
             })
-            // console.log(obj);
-            // if (obj) {
-            //   this.handleSearchArray(obj)
-            // }
+            console.log(obj);
+            if (obj) {
+              this.handleSearchArray(obj)
+            }
           })
-          // console.log(this.dictMessage.REPORT_TYPE.filter(item => !['6'].includes(item.dictChildValue)));
         }
       })
       this.showView = false
@@ -238,16 +237,30 @@ export default {
     handleSearchArray(obj) {
       switch (obj.label) {
         case '报告类型':
-            let dict=this.dictMessage.REPORT_TYPE.filter(item => !['6'].includes(item.dictChildValue))
-            obj.options = dict.map(item=>{
-              return {
-                label:item.dictChildLabel,
-                value:item.dictChildValue,
-              }
-            })
+          let dict = this.dictMessage.REPORT_TYPE.filter(item => !['6'].includes(item.dictChildValue))
+          obj.options = dict.map(item => {
+            return {
+              label: item.dictChildLabel,
+              value: item.dictChildValue,
+            }
+          })
           break;
         case '报告状态':
-          obj.options=[]
+          obj.options = [
+            { value: 0, label: '开卷审核' },
+            { value: 1, label: '创建中' },
+            { value: 2, label: '处理中' },
+            { value: 3, label: '完成' },
+            { value: 4, label: '取消开卷' },
+            { value: 5, label: '补资料中' },
+          ]
+          break;
+        case '核心结论':
+          this.$api.queryCrons().then(res => {
+            if (res.code == 200) {
+              obj.options = res.data.data
+            }
+          })
           break;
 
         default:
@@ -267,7 +280,7 @@ export default {
         }
       })
       // 返回字符串
-      this.searchOption=params
+      this.searchOption = params
       // 调用查询接口
       this.queryParams.current = 1
       this.getList()
@@ -276,7 +289,7 @@ export default {
     getList() {
       let params = {
         ...this.queryParams,//分页信息
-        searchQuery : this.$commonJS.objectToString(this.searchOption),//检索条件
+        searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
         orderDTOList: this.sort,//排序信息
       }
       this.loading = true
@@ -295,16 +308,15 @@ export default {
     },
     // 获取分组数据
     getGrouping() {
-      this.commonData = [{}]
-      return
       let params = {
         ...this.queryParams,//分页信息
+        searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
         orderDTOList: this.sort,//排序
         groupBy: this.groupingValue,//分组信息
       }
-      this.$api.query(params).then(res => {
+      this.$api.groupReportProject(params).then(res => {
         if (res.code == 200) {
-          this.commonData = res.data
+          this.commonData = res.data.data.values
           this.total = res.total
         }
       }).catch(error => {
@@ -373,9 +385,9 @@ export default {
     //切换分组值
     changeGrouping(val) {
       if (val != '') {
-        this.viewSelected = 'mergeTable'
+        this.viewType = 'mergeTable'
       } else {
-        this.viewSelected = 'Table'
+        this.viewType = 'Table'
       }
       this.queryParams.current = 1
       this.groupingValue = val
@@ -398,7 +410,7 @@ export default {
       this.$refs.ReportForm.open(form)
     },
     //操作列
-    handleOption({ option, row ,isLast}) {
+    handleOption({ option, row, isLast }) {
       this.$s.setSession('params', row)
       switch (option) {
         case '0'://分享
@@ -423,7 +435,7 @@ export default {
           this.handleImportPatent(row)
           break
         case '7'://删除
-          this.handleDelete(row,isLast)
+          this.handleDelete(row, isLast)
           break;
         case '8'://侵权分析技术特征对比
           this.$s.setSession('reportMessage1', row)
@@ -462,11 +474,11 @@ export default {
       }
     },
     // 删除
-    handleDelete(row,isLast) {
-      this.handleDeletes([row.id],isLast)
+    handleDelete(row, isLast) {
+      this.handleDeletes([row.id], isLast)
     },
     // 批量删除报告
-    handleDeletes(ids,isLast) {
+    handleDeletes(ids, isLast) {
       this.$confirm('此操作将永久删除该报告, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -474,7 +486,7 @@ export default {
       }).then(() => {
         this.$api.deleteReportProject(ids).then(res => {
           if (res.code == 200) {
-            if(isLast){
+            if (isLast) {
               this.isGrouping()
             } else {
               this.getList()
@@ -558,8 +570,8 @@ export default {
       this.clearMessage()
     },
     //清空信息
-    clearMessage(){
-      this.$nextTick(()=>{
+    clearMessage() {
+      this.$nextTick(() => {
         this.handleMessage = ''
       })
     },

+ 12 - 1
src/views/report/components/mixins/index.js

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

+ 3 - 2
src/views/report/components/view/mergeTable.vue

@@ -12,7 +12,8 @@
         show-overflow-tooltip>
         <template slot-scope="scope">
           <div>
-            {{ scope.row.name?scope.row.name:'--' }}
+            <span>{{ scope.row.name ? scope.row.name : '--' }}</span> 
+            <span>({{ scope.row.count?scope.row.count:'0' }})</span>
           </div>
         </template>
       </el-table-column>
@@ -69,7 +70,7 @@ export default {
   watch: {
   },
   mounted() {
-    
+    console.log(this.commonData);
   },
   methods: {
     // 排序

+ 55 - 11
src/views/report/components/view/table.vue

@@ -1,9 +1,10 @@
 <template>
-  <div>
-    <div class="height_100"  v-DivHeight="getDivHeight">
+  <div class="height_100">
+    <div class="height_100" v-DivHeight="getDivHeight">
       <el-table :data="tableData" border style="width: 100%" header-row-class-name="custom-table-header"
-      v-if="showTable" :maxHeight="tableHeight" @sort-change="sortChange"  v-el-table-infinite-scroll="getList" :infinite-scroll-distance="10" 
-        :infinite-scroll-disabled="disabled">
+      @sort-change="sortChange" v-if="showTable" :maxHeight="tableHeight" v-el-table-infinite-scroll="getList" :infinite-scroll-distance="10" 
+    :infinite-scroll-disabled="disabled"
+        >
         <el-table-column label="#" width="60" type="index" align="center">
           <template slot-scope="scope">
             <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
@@ -15,7 +16,8 @@
             <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','cronNames'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></div>
+            <div v-else-if="['eventName','cronNames'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></div>
+            <div v-else-if="['status'].includes(item.value)" v-html="getColumn(scope.row,item.value)"></div>
             <div v-else>{{ scope.row[item.value] }}</div>
           </template>
         </el-table-column>
@@ -68,7 +70,10 @@ export default {
           
         ]
       }
-    }
+    },
+    row: null,
+    //操作信息
+    handleMessage:''
   },
   data() {
     return {
@@ -91,13 +96,43 @@ export default {
         4:'取消开卷',
         5:'补资料中',
       },
+       //正在努力加载中
+       isFlag: false,
+      //没有更多啦!
+      isMore: false,
+      //禁用懒加载
+      disabled: true,
+      params: {
+        size: 5,
+        current: 0
+      },
+      // 排序数组
+      sort: [
+        {
+          "orderBy": "createTime",
+          "orderType": 1
+        }
+      ],
+      //事件类型及所选
+      action:{
+        type:'',//1表示删除,2表示其他,3表示新增
+        id:''
+      }
     };
   },
   watch: {
-    
+    handleMessage(val){
+      if(val){
+        this.updateData()
+      }
+    }
   },
   mounted() {
-    
+    if (!this.row) {
+      this.disabled = true
+    } else {
+      this.disabled = false
+    }
   },
   methods: {
      //更新数据
@@ -130,7 +165,7 @@ export default {
     },
 
     getList2(params,type){
-      this.$api.queryPatentProject(params).then(res => {
+      this.$api.queryReportProject(params).then(res => {
         if (res.code == 200) {
           if(type == 1){
             var startIndex = (params.current-1)*size
@@ -172,7 +207,7 @@ export default {
       }
       this.isMore = false;
       this.isFlag = true;
-      this.$api.queryPatentProject(params).then(res => {
+      this.$api.queryReportProject(params).then(res => {
         if (res.code == 200) {
           this.tableData.push(...res.data.data)
           this.params.total = res.data.total
@@ -218,7 +253,16 @@ export default {
       this.tableData.splice(0)
       this.getList()
     },
-
+    // 数据处理
+    getColumn(row, key) {
+      if (key == 'status') {
+        if (row[key]) {
+          return statusName[row[key]]
+        } else {
+          return '--'
+        }
+      }
+    },
   },
 };
 </script>