zhuliu 1 рік тому
батько
коміт
1b2e5013e8

+ 50 - 0
src/api/newApi/project.js

@@ -50,4 +50,54 @@ export default {
         return axios.post("/xiaoshi/patentProject/addProjectPatentToReport", data);
     },
     
+    /**
+     * 添加定时更新条件
+     * @param {*} data 
+     * @returns 
+     */
+    addQuartzCondition(data){
+        return axios.post("/xiaoshi/importTaskCondition/addQuartzCondition", data);
+    },
+    /**
+     * 编辑定时更新条件
+     * @param {*} data 
+     * @returns 
+     */
+    updateQuartzCondtion(data){
+        return axios.post("/xiaoshi/importTaskCondition/updateQuartzCondtion", data);
+    },
+    /**
+     * 查询定时更新条件
+     * @param {*} data 
+     * @returns 
+     */
+    queryQuartzCondition(data){
+        return axios.post("/xiaoshi/importTaskCondition/queryQuartzCondition", data);
+    },
+    /**
+     * 删除定时更新条件
+     * @param {*} data 
+     * @returns 
+     */
+    removeQuartzCondition(data){
+        return axios.post("/xiaoshi/importTaskCondition/removeQuartzCondition", data);
+    },
+
+     /**
+     * 查询专题库定时配置
+     * @param {*} data 
+     * @returns 
+     */
+     queryProjectQuartz(data){
+        return axios.post("/xiaoshi/importTaskCondition/queryProjectQuartz", data);
+    },
+    /**
+     * 配置专题库定时配置
+     * @param {*} data 
+     * @returns 
+     */
+    setProjectQuartz(data){
+        return axios.post("/xiaoshi/importTaskCondition/setProjectQuartz", data);
+    },
+
 };

+ 10 - 0
src/router/index.js

@@ -67,6 +67,16 @@ const routes = [
             component: () => import('@/views/project/index.vue'),
           },
           {
+            path: '/updateCriteria',
+            meta: {
+              title: '更新条件',
+              sign: 'updateCriteria',
+              belong: 'project',
+              // permission:'xiaoshi/project'
+            },
+            component: () => import('@/views/project/components/updateCriteria/index.vue'),
+          },
+          {
             path: 'patentCollection',
             meta: {
               title: '专利列表',

+ 8 - 4
src/utils/constants.js

@@ -231,10 +231,10 @@ sourceId:process.env.NODE_ENV === 'production'?6:1,
 
 //更新周期
 updateCycle:[
-  {
-    label:'每天',
-    value:'day'
-  },
+  // {
+  //   label:'每天',
+  //   value:'day'
+  // },
   {
     label:'每周',
     value:'week'
@@ -244,6 +244,10 @@ updateCycle:[
     value:'month'
   },
   {
+    label:'每季',
+    value:'quarter'
+  },
+  {
     label:'每年',
     value:'year'
   },

+ 79 - 12
src/views/components/import/conditionImport/components/projectListDialog.vue

@@ -12,7 +12,7 @@
         <el-form ref="form" :model="form" :rules="rules" >
           <template v-if="firstShow">
             <div>
-              <el-form-item label="导入到:">
+              <el-form-item label="导入到:" prop="importToType">
                 <el-select v-model="form.importToType" clearable @change="changeImportToType" placeholder="请选择">
                     <el-option
                       v-for="(item,key) in importToTypes"
@@ -157,7 +157,7 @@
               </el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="是否更新" prop="ifUpdate">
+          <el-form-item label="是否更新" prop="ifUpdate" v-if="!form.patentNos || form.patentNos.length==0">
             <el-switch
               v-model="form.ifUpdate"
               :active-value="true"
@@ -166,11 +166,11 @@
             >
             </el-switch>
           </el-form-item>
-          <template v-if="form.ifUpdate == true">
+          <template v-if="form.ifUpdate == true && !update.ifUpdate">
             <div>
-              <el-form-item label="更新间隔" prop="dateType">
+              <el-form-item label="更新间隔" prop="updateCycle">
                 <el-select
-                  v-model="form.dateType"
+                  v-model="form.updateCycle "
                   @change="getDateType"
                   clearable
                   placeholder="请选择更新时间间隔"
@@ -185,22 +185,30 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="选择更新具体时间" v-if="form.dateType">
+              <!-- <el-form-item label="选择更新具体时间" v-if="form.dateType">
                 <myTimeChoose
                   :type="form.dateType"
                   @value="handleData"
                   :cron="form.crons"
                   style="width: 300px"
                 ></myTimeChoose>
-              </el-form-item>
+              </el-form-item> -->
             </div>
           </template>
         </el-form>
         <div class="button">
           <el-button
+            v-if="form.importToType == 0"
+            type="primary"
+            size="small"
+            @click="onSubmit(2)"
+            :loading="btnLoading2"
+            >仅保存为定期更新条件</el-button
+          >
+          <el-button
             type="primary"
             size="small"
-            @click="onSubmit"
+            @click="onSubmit(1)"
             :loading="btnLoading"
             >导入</el-button
           >
@@ -221,6 +229,7 @@ export default {
     return {
       title: "",
       btnLoading: false,
+      btnLoading2:false,
       dialogVisible: false,
       importToTypes:{
           0: "专题库",
@@ -235,8 +244,16 @@ export default {
           },
           loading:false,
       },
-      rules:{},
+      rules:{
+        importToId: [
+          {required: true, message: '请选择', trigger: 'change'},
+        ],
+        importToType: [
+          {required: true, message: '请选择', trigger: 'change'},
+        ],
+      },
       firstShow:true,
+      update:{}
     };
   },
   watch: {},
@@ -245,22 +262,42 @@ export default {
   mounted() {
   },
   methods: {
-    open(form) {
+    async open(form) {
       this.form = {
         ...form,
       };
       if (this.form.importToType) {
         this.title = `导入到${this.importToTypes[this.form.importToType]}`;
         this.firstShow = false
+        this.rules = {}
       } else {
           this.title = `导入专利`
           this.firstShow = true
+          this.rules={
+            importToId: [
+              {required: true, message: '请选择', trigger: 'change'},
+            ],
+            importToType: [
+              {required: true, message: '请选择', trigger: 'change'},
+            ],
+          }
       };
       if (this.form.importToId) {
 
       }
+      await this.getUpdateCycle()
       this.dialogVisible = true;
     },
+    async getUpdateCycle(){
+        var params = {
+            projectId:this.projectId
+        }
+        await this.$api.queryProjectQuartz(params).then(res=>{
+            if(res.code == 200){
+                this.update = res.data
+            }
+        })
+    },
     changeImportToType(val){
       this.ods = {
         name:'',
@@ -394,7 +431,7 @@ export default {
       this.dialogVisible = false;
     },
     //导入
-    onSubmit() {
+    onSubmit(type) {
       this.$refs.form.validate((valid) => {
         if (valid) {
           var importContent = []
@@ -429,10 +466,40 @@ export default {
                 }
             }
             // console.log(this.form)
-            this.addImportTask(this.form)
+            if(type == 1){
+               this.addImportTask(this.form)
+            }
+            else if(type == 2){
+              this.addUpdateCriteria(this.form)
+            }
+           
         }
       });
     },
+    //保存定期更新条件
+    addUpdateCriteria(form){
+      var conditionImport = this.$s.getSession('conditionImport')
+      var params = {
+        importToId:form.importToId,
+        // updateCycle:form.updateCycle,
+        importContent:form.importContent,
+        ifUpdate:true,
+        searchCondition:form.searchCondition,
+        searchSetting:conditionImport?JSON.stringify(conditionImport):'',
+        DBType:form.DBType,
+        fieldDTOS:form.fieldDTOS
+      }
+      this.btnLoading2 = true
+      this.$api.addQuartzCondition(params).then(response=>{
+        if(response.code == 200){
+          this.$message.success('定期更新条件保存成功')
+          this.btnLoading2 = false
+        }
+      }).catch(error=>{
+        this.$message.error('定期更新条件保存失败')
+        this.btnLoading2 = false
+      })
+    },
     
     
     //切换项目

+ 1 - 1
src/views/components/import/conditionImport/searchResult.vue

@@ -16,7 +16,7 @@
         <!-- <div style="max-width:calc(100% - 620px)">
           <p><span>条件:</span>{{ searchData.searchCondition }}</p>
         </div> -->
-        <div style="max-width: 800px;margin-top: 0px;display: flex;justify-content: center;align-items: center;" v-if="condition.component != 'patentNoSearch'">
+        <div style="max-width: 850px;margin-top: 0px;display: flex;justify-content: center;align-items: center;" v-if="condition.component != 'patentNoSearch'">
           <search :field="field" :searchResult="true" :searchValue="false" :countryList="queryParams.countryList"
             @search="search"></search>
           <p><el-link style="width: 50px;color: #409EFF;" @click="searches">检索式</el-link></p>

+ 2 - 2
src/views/project/components/drawer/form.vue

@@ -135,13 +135,13 @@
                 </el-form-item>
               </el-col>
             </el-row>
-            <el-row :gutter="24">
+            <!-- <el-row :gutter="24">
               <el-col :span="24">
                 <el-form-item label="更新具体时间" v-if="ruleForm.ifUpdate && ruleForm.updateTime" >
                   <my-Time-Choose :type="ruleForm.updateTime" @value="getValue" :cron="ruleForm.crons" style="width:300px"></my-Time-Choose>
                 </el-form-item>
               </el-col>
-            </el-row>
+            </el-row> -->
             <el-form-item label="附件" prop="systemFileList">
               <myUpload :file-list="ruleForm.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" style="height: 180px;" :autoUpload="true"></myUpload>
             </el-form-item>

+ 30 - 0
src/views/project/components/updateCriteria/index.vue

@@ -0,0 +1,30 @@
+<template>
+  <div class="height_100">
+    <updateCriteria :projectId="projectId"></updateCriteria>
+  </div>
+</template>
+
+<script>
+import updateCriteria from './updateCriteria.vue';
+export default {
+  components: {
+    updateCriteria
+  },
+  props: {},
+  data() {
+    return {
+    };
+  },
+  watch: {},
+  computed: {
+    projectId(){
+        return this.$route.query.projectId
+    }
+  },
+  created() {},
+  mounted() {},
+  methods: {},
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 300 - 0
src/views/project/components/updateCriteria/updateCriteria.vue

@@ -0,0 +1,300 @@
+<template>
+  <div class="height_100">
+    <el-container>
+        <el-header>
+            <div style="width:100%; padding:20px;display:flex;align-items: center;justify-content: space-between;">
+                <div>
+                    <span v-if="!update.ifUpdate">是否定期更新:{{ update.ifUpdate?'是':'否' }}</span>
+                    <span v-else>更新周期:<span>{{ update.updateCycle }}</span></span>
+                    <span style="margin-left:10px"><i class="iconfont icon-bianji" @click="editUpdate"></i></span>
+                </div>
+                <div style="">
+                    <el-button type="primary" size="small" @click="add">添加</el-button>
+                </div>
+            </div>
+        </el-header>
+        <el-main v-DivHeight="getDivHeight">
+            <el-table
+                ref="table"
+                :data="tableData"
+                row-key="id"
+                style="width: 100%"
+                :maxHeight="tableHeight - 40"
+                v-loading="loading"
+                @selection-change="handleSelectionChange"
+            >
+                <el-table-column type="selection" width="55" :reserve-selection="true">
+
+                </el-table-column>
+                <el-table-column prop="searchCondition" label="检索条件"></el-table-column>
+                <el-table-column prop="DBType" label="检索范围" width="140">
+                    <template slot-scope="scope">
+                    <div>
+                        {{ DBType[scope.row.DBType] }}
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="ifUpdate" label="是否更新" width="120">
+                    <template slot-scope="scope">
+                    <div>
+                        <el-switch
+                            v-model="scope.row.ifUpdate"
+                            @change="updateMessage(scope.row)"
+                            active-text="是"
+                            inactive-text="否">
+                        </el-switch>
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="createName" label="创建人" width="120">
+                    <template slot-scope="scope">
+                    <div>
+                        {{ scope.row.createName }}
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="createTime" label="创建时间" width="120">
+                    <template slot-scope="scope">
+                    <div>
+                        {{ scope.row.createTime }}
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column label="操作" width="140">
+                    <template slot-scope="scope">
+                        <div class="icon">
+                            <!-- <span @click="editSearch(scope.row)" class="margin-left_10">
+                            <el-tooltip class="item" effect="dark" content="编辑" placement="top">
+                                <i class="iconfont icon-bianji"></i>
+                            </el-tooltip>
+                            </span> -->
+                            <span @click="delSearch(scope.row)" class="margin-left_10">
+                                <el-tooltip class="item" effect="dark" content="删除" placement="top">
+                                    <i class="iconfont icon-shanchu"></i>
+                                </el-tooltip>
+                            </span>
+                        </div>
+                    </template>
+                </el-table-column>
+            </el-table>
+        </el-main>
+        <el-footer class="pagination" style="display:flex;justify-content:space-between;align-items:center">
+          <div style="display:flex;align-items:center">
+            <span v-if="multipleSelection.length > 0">
+              已勾选 <b>{{ multipleSelection.length }}</b> 条
+            </span>
+            <div v-show="multipleSelection.length" class="margin-left_10">
+              <el-button type="primary" size="small" @click="del">删除</el-button>
+            </div>
+          </div>
+          <div>
+            <el-pagination background layout="total, sizes, prev, pager, next, jumper"
+              :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
+              @current-change="handleCurrentChange" @size-change="changeSize" :total="total">
+            </el-pagination>
+          </div>
+
+        </el-footer>
+    </el-container>
+
+    <el-dialog title="编辑更新周期" :visible.sync="dialog.showDialog" width="500px" :close-on-click-modal="false" @close="handleClose" append-to-body>
+        <el-form :model="form" ref="form" label-width="120px" class="demo-ruleForm">
+            <el-form-item label="是否定期更新" prop="ifUpdate">
+                <el-switch
+                    v-model="form.ifUpdate"
+                    active-text="是"
+                    inactive-text="否">
+                </el-switch>
+            </el-form-item>
+            <el-form-item label="更新间隔" v-if="form.ifUpdate" prop="updateCycle">
+                <el-select
+                  v-model="form.updateCycle"
+                  clearable
+                  placeholder="请选择更新时间间隔"
+                  style="margin-right: 20px"
+                >
+                  <el-option
+                    v-for="item in $constants.updateCycle"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="handleClose">取 消</el-button>
+            <el-button type="primary" :loading="dialog.btnLoading" @click="submit">确 定</el-button>
+        </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getTableHeight } from '@/views/components/mixins'
+export default {
+  components: {},
+  props: {
+    projectId:{}
+  },
+  mixins:[getTableHeight],
+  data() {
+    return {
+        DBType:{
+            'CN':'中国',
+            "WD":"世界"
+        },
+        update:{
+            ifUpdate:false
+        },
+        tableData:[],
+        multipleSelection:[],
+        loading:false,
+        queryParams:{
+            current:1,
+            size:10,
+            projectId:this.projectId
+        },
+        total:0,
+        dialog:{
+            showDialog:false,
+            btnLoading:false
+        },
+        form:{},
+    };
+  },
+  watch: {},
+  computed: {},
+  created() {},
+  mounted() {
+    this.getUpdateCycle()
+    this.getUpdateCriteria()
+  },
+  methods: {
+    add(){
+        var form = {
+            importToId:this.projectId,
+            importToType:0,
+            type:4,
+            ifUpdate:this.update.ifUpdate,
+        }
+        this.$commonJS.toImportParent(form,4)
+    },
+    getUpdateCycle(){
+        var params = {
+            projectId:this.projectId
+        }
+        this.$api.queryProjectQuartz(params).then(res=>{
+            if(res.code == 200){
+                this.update = res.data
+            }
+        })
+    },
+    getUpdateCriteria(){
+        this.loading = true
+        this.$api.queryQuartzCondition(this.queryParams).then(response=>{
+            if(response.code == 200){
+                this.tableData = response.data.data
+                this.total = response.data.total
+                this.loading = false
+            }
+        }).catch(error=>{
+            this.tableData = []
+            this.loading = false
+        })
+    },
+    handleSelectionChange(val){
+        this.multipleSelection = val
+    },
+    handleCurrentChange(val){
+        this.queryParams.current = val
+        this.getUpdateCriteria()
+    },
+    //切换页大小
+    changeSize(val){
+      this.queryParams.size = val
+      this.queryParams.current = 1
+      this.getUpdateCriteria()
+    },
+    del(){
+        var ids = this.multipleSelection.map(item=>{
+            return item.id
+        })
+        this.removeSearchRecords(ids,1)
+    },
+    delSearch(row){
+        this.removeSearchRecords([row.id])
+    },
+    removeSearchRecords(ids,type){
+        this.$confirm('确认删除本条数据吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+        }).then(() => {
+            this.$api.removeQuartzCondition(ids).then(response=>{
+                if(response.code == 200){
+                    this.$message.success('删除成功')
+                    this.getUpdateCriteria()
+                    if(type){
+                        this.multipleSelection = []
+                        this.$refs.table.clearSelection();
+                    }else{
+                        var id = response.data.data[0]
+                        var index = this.multipleSelection.findIndex(item=>{
+                            return item.id == id
+                        })
+                        if(index!=-1){
+                            this.multipleSelection.splice(index,1)
+                        }
+                    }
+                    
+                }
+            }).catch(error=>{
+                this.$message.error('删除失败')
+            })
+        })
+    },
+    updateMessage(row){
+        this.$api.updateQuartzCondition(row).then(response=>{
+            if(response.code == 200){}
+        }).catch(error=>{
+            this.$message.error('修改失败')
+            this.$set(row,'ifUpdate',!row.ifUpdate)
+        })
+    },
+    editUpdate(){
+        this.form = {
+            ...this.update
+        }
+        this.dialog.showDialog = true
+    },
+    handleClose(){
+        this.dialog.btnLoading = false
+        this.dialog.showDialog = false
+    },
+    submit(){
+        this.dialog.btnLoading = true
+        var form = {
+            ...this.form,
+            projectId:this.projectId
+        }
+        if(!form.ifUpdate){
+            form.updateCycle = ''
+        }
+        this.$api.setProjectQuartz(form).then(response=>{
+            if(response.code == 200){
+                this.$message.success('更新成功')
+                this.update = response.data
+                this.handleClose()
+            }
+        }).catch(error=>{
+            this.$message.error('更新失败')
+            this.dialog.btnLoading = false
+        })
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 1 - 0
src/views/project/components/view/card.vue

@@ -21,6 +21,7 @@
                     </el-dropdown>
                   </el-dropdown-item>
                   <el-dropdown-item command="12">自定义栏位管理</el-dropdown-item>
+                  <el-dropdown-item command="15">定期更新条件</el-dropdown-item>
                 <el-dropdown-item command="11">任务分配</el-dropdown-item>
                 <el-dropdown-item command="14">导入导出历史</el-dropdown-item>
                   <el-dropdown-item command="3">任务清单</el-dropdown-item>

+ 1 - 0
src/views/project/components/view/table.vue

@@ -37,6 +37,7 @@
                   </el-dropdown>
                 </el-dropdown-item>
                 <el-dropdown-item command="12">自定义栏位管理</el-dropdown-item>
+                <el-dropdown-item command="15">定期更新条件</el-dropdown-item>
                 <el-dropdown-item command="11">任务分配</el-dropdown-item>
                 <el-dropdown-item command="14">导入导出历史</el-dropdown-item>
                 <el-dropdown-item command="3">任务清单</el-dropdown-item>

+ 12 - 0
src/views/project/index.vue

@@ -470,11 +470,23 @@ export default {
         case '14'://导入导出历史
           this.importAndExportHistory(row)
           break
+        case '15'://定期更新条件
+          this.updateCriteria(row)
+          break
         case 'e'://编辑
           this.handleEdit(row)
           break
       }
     },
+    //定期更新条件
+    updateCriteria(row){
+      this.$router.push({
+        path: "/updateCriteria",
+        query:{
+          projectId:row.id
+        }
+      });
+    },
     //导入导出历史
     importAndExportHistory(row){
       this.$router.push({