Jing преди 3 месеца
родител
ревизия
a671a85d32
променени са 1 файла, в които са добавени 64 реда и са изтрити 16 реда
  1. 64 16
      src/views/crawler/webCrawlerList.vue

+ 64 - 16
src/views/crawler/webCrawlerList.vue

@@ -94,12 +94,17 @@
         <el-dialog title="关联导航池" :visible.sync="dialogTableVisible" width="50%" :close-on-click-modal="false">
             <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
                 <div class="dialogText">
-                    <el-form-item label="关联导航池:" prop="name">
+                    <!-- <el-form-item label="关联导航池:" prop="name">
                         <el-select v-model="ruleForm.name" placeholder="请选择关联的导航池名称">
                             <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
                             </el-option>
                         </el-select>
-                    </el-form-item>
+                    </el-form-item> -->
+
+                    <el-form-item label="关联导航池:" :label-width="formLabelWidth" class="custom-align-right">
+                            <el-cascader :key="parentKey" v-model="ruleForm.name" placeholder="请选择关联的导航池名称"
+                                :props="parentData" filterable clearable></el-cascader>
+                        </el-form-item>
                 </div>
                 <div class="dialogBtn">
                     <button class="cancel" @click="cancelForm">取消</button>
@@ -124,6 +129,7 @@ export default {
         tableTitle,//表格标题
     },
     data() {
+        let self = this;
         return {
             tableDivTitle: "任务规则列表",//表格标题
             // searchWebName: "", //搜索网站名称
@@ -145,6 +151,9 @@ export default {
             pageSize: 10,
             total: 20,
 
+            //查询状态
+            setTime: '',
+            listStatus: false,
 
             navigationPoolBoo: false, //是否关联导航池
 
@@ -173,7 +182,35 @@ export default {
                     value: '1',
                     label: '已导入'
                 },
-            ]
+            ],
+            formLabelWidth:'120px',
+            parentKey: 0,//获取父级导航
+            parentData: {
+                checkStrictly: true,
+                lazy: true,
+                async lazyLoad(node, resolve) {
+                    const { level, data } = node;
+                    if (data && data.children && data.children.length !== 0) {
+                        return resolve(node)
+                    }
+                    console.log(level)
+                    let parentId = level == 0 ? 0 : data.value
+                    let parames = {
+                        'pid': parentId
+                    }
+                    self.$store.dispatch('pool/categoryList', parames).then(res => {
+                        if (res.data) {
+                            const nodes = res.data.map(item => ({
+                                value: item.id,
+                                label: item.name,
+                                leaf: level >= 3,
+                                children: []
+                            }))
+                            resolve(nodes)
+                        }
+                    })
+                }
+            },
         }
     },
     mounted() {
@@ -198,26 +235,33 @@ export default {
 
                 this.total = data.data.count
                 this.tableData = data.data.rep
-                
-                let status = false;
+
                 for (let item of this.tableData) {
                     if (item.state == 1) {
                         item.state = "已导入"
                     } else {
                         item.state = "未导入";
-                        status = true;
+                        this.listStatus = true;
                     }
                 }
-                if(status){
-                    this.$message.error("有未导入的资讯!")
-                }else{
+
+                console.log(this.listStatus);
+                if (this.listStatus) {
+
+                } else {
+                    this.clearTask()
                     this.$message.success("导入成功!")
                 }
-
             })
         },
-        abc(){
-           this.$message.error("abc!")
+        setTask() {
+            let that = this;
+            this.setTime = setInterval(() => {
+                that.getData();
+            }, 5000)
+        },
+        clearTask() {
+            clearInterval(this.setTime)
         },
         //1.2 删除内容
         deleteRow(id, val) {
@@ -252,6 +296,7 @@ export default {
         },
         //1.3 修改网站状态
 
+
         //1.4 列表内容分页
         //直接跳转
         handleSizeChange(val) {
@@ -313,7 +358,7 @@ export default {
             addCatid({
                 rule_id: this.ruleId,
             }).then(data => {
-                console.log(data);
+                console.log('关联导航池', data);
                 if (data.code == 200) {
                     this.dialogTableVisible = true
                     this.options = data.data
@@ -336,9 +381,10 @@ export default {
 
         //关联导航池的提交按钮
         submitForm() {
+            //console.log(this.ruleForm.name);
             addCatid({
                 rule_id: this.ruleId,//任务规则id
-                catid: this.ruleForm.name,//导航池栏目id
+                catid: this.ruleForm.name,//导航池栏目id 
             }).then(data => {
                 console.log(this.ruleForm.name);
                 console.log(data);
@@ -365,9 +411,9 @@ export default {
         importMessage() {
             for (let item of this.tableData) {
                 if (!item.category) {
-                   this.navigationPoolBoo=true
+                    this.navigationPoolBoo = true
                 } else {
-                    this.navigationPoolBoo=false
+                    this.navigationPoolBoo = false
                 }
             }
             if (this.navigationPoolBoo) {
@@ -389,7 +435,9 @@ export default {
                                 message: '导入中',
                                 type: 'success'
                             })
+
                             this.getData()
+                            this.setTask()
                         }
                         if (data.code == 0) {
                             this.$message({