facetask.vue 26.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
<template>
  <div style="overflow:hidden">
    <el-row class="nav-bar-two"></el-row>
    <el-row :gutter="6">
      <el-col :span="4">
        <div class="left-box">
          <div class="left-header">任务列表</div>
          <div class="deploy-list" v-for="(item, index) in taskList" :key="item.unid" @click="selectTask(item, index)" :class="{activetask:index==curTaskIndex}">
            <i :class="{'el-icon-fa-pause':item.enabled,'el-icon-fa-play':!item.enabled,iceon:true,'taskstatus':true}" @click="setTaskStatus($event, item)"></i>
            <span class="deploy-name">{{item.name}}</span>
            <i class="el-icon-fa-edit icon" @click="editTask($event, item)"></i>
            <i class="el-icon-fa-trash pl10 icon" @click="deleteTask($event, item)"></i>
          </div>
          <el-button type="primary" class="task-btn" @click="newtask">新建布控任务</el-button>
        </div>
      </el-col>
      <el-col :span="20">
        <div class="right-box">
          <div class="right-content" v-if="taskDetail">
            <el-row style="overflow:hidden">
              <p class="right-title">布控类型</p>
              <el-col class="dbname-box">
                <i class="el-icon-document icon"></i>
                <span class="dbname">{{taskDetail.cate | filterDeployType}}</span>
              </el-col>
            </el-row>
            <p class="right-title">布控库</p>
            <el-col class="dbname-box" :xl="6" :lg="6" v-for="item in taskDetail.task_info.crucial_types" :key="item.code">
              <i class="el-icon-fa-folder-open icon"></i>
              <span class="dbname">{{formatDbName(item)}}</span>
            </el-col>
            <!--运行时间-->
            <el-row class="time-box" v-if="taskDetail.cate !='face_stay'"  v-show="taskDetail.task_info.period_type && taskDetail.task_info.period_type != 'none'">
              <p class="right-title">运行时间</p>
              <el-col :lg="10" v-for="(item, index) in taskDetail.task_info.periods" :key="index" class="deploy-time">
                <i class="el-icon-time"></i>
                {{formatShowTImer(item[0])}} - {{formatShowTImer(item[1])}}
              </el-col>
            </el-row>
            <!--/运行时间-->
            <!--非周期任务运行时间-->
            <el-row  class="time-box"  v-show="taskDetail.task_info.period_type && taskDetail.task_info.period_type == 'none'">
              <p class="right-title">运行时间</p>
              <el-col :lg="10" class="deploy-time">
                <i class="el-icon-time"></i>
                {{showLocalTime(taskDetail.task_info.start_dt)}} - {{showLocalTime(taskDetail.task_info.end_dt)}}
              </el-col>
            </el-row>
            <!--/非周期任务运行时间-->
            <!--滞留阈值-->
            <el-row class="time-box" v-show="taskDetail.cate =='face_stay'">
              <p class="right-title">滞留阈值</p>
              <el-col :lg="8"  class="deploy-time">
                <i class="el-icon-time"></i>
                {{stayMsec(taskDetail.task_info.stay_msec)}}
              </el-col>
            </el-row>
            <!--/滞留阈值-->
            <!--布控人员-->
            <el-row class="deploy-vchan-box" v-if="taskDetail.task_info.crucial_faces" v-show="taskDetail.task_info.crucial_faces.length > 0">
              <p class="right-title">布控人员</p>
              <el-col :lg="4" v-for="item in taskDetail.task_info.crucial_faces" :key="item" class="deploy-vchan">
                <i class="el-icon-fa-user icon"></i>
                <span>{{formatFaceName(item)}}</span>
              </el-col>
            </el-row>
            <!--/布控人员-->
            <!--运行设备-->
            <el-row class="deploy-vchan-box">
              <p class="right-title">运行设备</p>
              <el-col :lg="12" v-for="item in taskDetail.task_info.vchans" :key="item" class="deploy-vchan">
                <i class="el-icon-fa-desktop icon"></i>
                <span>{{formatVchanName(item)}}</span>
              </el-col>
            </el-row>
            <!--/运行设备-->
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-dialog :title="title" :visible.sync="taskVisible" width="50%">
        <div class="header" style="overflow:hidden">
          <el-form :model="taskForm" ref="taskRuleForm" :rules="taskRules" label-width="100px" class="demo-dynamic">
            <el-form-item label="任务名称"  prop="name">
              <el-col :span="10">
                <el-input v-model="taskForm.name" placeholder="请输入布控任务名称"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="布控库">
              <el-col :span="10">
                <el-select v-model="taskForm.task_info.crucial_types" multiple placeholder="请选择布控库">
                   <el-option v-for="item in dbdata" :key="item.unid" :label="item.name" :value="item.code"></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="布控类型" prop="cate">
              <el-col :span="10">
                <el-select v-model="taskForm.cate" :disabled="editstate" placeholder="请选择布控类型">
                  <el-option :label="item.name" :value="item.type" v-for="item in cate" :key="item.type"></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="任务周期">
              <el-col :span="10">
                <el-select v-model="taskForm.task_info.period_type" placeholder="请选择布周期">
                  <el-option label="周期任务" value="day"></el-option>
                  <el-option label="非周期任务" value="none"></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="滞留阈值" v-show="taskForm.cate =='face_stay'">
              <el-col :span="10">
                  <el-input-number v-model="day" :min="0"></el-input-number><span class="pl10 stay"></span>
                  <el-input-number  v-model="hours" class="mt10" :min="0" :max="24"></el-input-number><span class="pl10 stay">小时</span>
              </el-col>
            </el-form-item>
            <el-form-item  v-for="(item, index) in taskForm.task_info.periods" prop="periods" :key="index" label="运行时间"  v-if="taskForm.cate !='face_stay' && taskForm.task_info.period_type == 'day'">
              <el-col :span="19">
                <el-col :span="10" style="margin-bottom:10px;">
                  <el-time-picker is-range v-model="taskForm.task_info.periods[index]" placeholder="选择时间范围" value-format="HH:mm:ss" style="width:100%"></el-time-picker>
                </el-col>
                <el-col :span="1" :offset="1" v-show="index!=0">
                  <div class="el-icon-minus add-task" @click="deleteTimer(index)"></div>
                </el-col>
                <el-col :span="2" v-show="index==taskForm.task_info.periods.length-1" :class="{pl30:index==0}">
                  <div class="el-icon-plus add-task" @click="addTimer"></div>
                </el-col>
              </el-col>
            </el-form-item>
            <!--非周期性任务-->
            <el-form-item label="周期时间"  v-if="taskForm.cate !='face_stay' && taskForm.task_info.period_type != 'day'">
              <el-col :span="19">
                 <el-date-picker
                  v-model="periodtimer"
                  type="datetimerange"
                  value-format ="yyyy-MM-dd HH:mm:ss"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期">
                </el-date-picker>
              </el-col>
            </el-form-item>
            <!---->
            <el-form-item label="执勤人员"  v-if="taskForm.task_info.period_type != 'day'">
              <el-col :span="10">
              <el-select v-model="taskForm.task_info.crucial_faces" filterable multiple placeholder="请选择">
                <el-option
                  v-for="item in whiteList"
                  :key="item.unid"
                  :label="item.name"
                  :value="item.unid">
                </el-option>
              </el-select>
              </el-col>
            </el-form-item>
            <!--短息/彩信-->
            <el-col :span="18">
              <el-form-item label="信息推送">
               <el-switch
                  class="mt10 ml20"
                  width="50"
                  style="display: block"
                  v-model="taskForm.task_info.sms.if_send"
                  active-color="#13ce66"
                  inactive-color="#ff4949"
                  active-text="开启"
                  inactive-text="关闭">
              </el-switch>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="推送方式" v-show="taskForm.task_info.sms.if_send">
                <el-col :span="10">
                  <el-select v-model="taskForm.task_info.sms.use_mms" placeholder="请选择布周期">
                    <el-option label="短信推送" :value="false"></el-option>
                    <el-option label="彩信推送" :value="true"></el-option>
                  </el-select>
                </el-col>
              </el-form-item>
            </el-col>
            <!--/短息/彩信-->
            <!--短信或彩信发送人员-->
            <el-col :span="24" style="overflow:hidden">
              <el-form-item label="信息发送至"  v-show="taskForm.task_info.sms.if_send">
                <el-col :span="10">
                <el-select v-model="taskForm.task_info.sms.users" filterable multiple placeholder="请选择">
                  <el-option
                    v-for="item in smslistData"
                    :key="item.user_unid"
                    :label="item.name"
                    :value="item.user_unid">
                  </el-option>
                </el-select>
                </el-col>
              </el-form-item>
            </el-col>
            <!--/短信或彩信发送人员-->
            <el-col :span="24">
              <div style="overflow:hidden">
                <el-col :span="10" :offset="2">
                  <el-input v-model="devLike" placeholder="请输入设备名称"></el-input>
                </el-col>
                <el-col :span="5" :offset="1">
                  <el-button type="primary" @click="checkdev">查询</el-button>
                </el-col>
              </div>
              <div class="mt10">
                <el-form-item label="运行设备"  prop="taskdev">
                  <div  class="dev-box">
                      <el-checkbox-group v-model="taskForm.task_info.vchans">
                        <el-col :span="12" v-for="item in vchansList" :key="item.unid">
                          <el-checkbox :label="item.vchan_refid" class="dev-check">{{item.vchan_name}}</el-checkbox>
                        </el-col>
                      </el-checkbox-group>
                  </div>
                </el-form-item>
              </div>
            </el-col>
          </el-form>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button @click="taskVisible = false">取 消</el-button>
          <el-button type="primary" @click="addtask('taskRuleForm')">确 定</el-button>
        </div>
      </el-dialog>
    </el-row>
  </div>
</template>

<script>
  export default {
    data() {
      const _this= this;
      const validateperiods = (rule, value, callback) => {
          _this.taskForm.task_info.periods.forEach((ev) => {
            if(ev == ''){
              callback(new Error(rule.message));
                return;
            } else {
             callback()
            }
          });
        }
      const validatortaskdev =  (rule, value, callback) => {
          if(_this.taskForm.task_info.vchans.length < 1){
              callback(new Error(rule.message));
                    return ;
          }else {
           callback()
          }
        }
      // const validatperiodtimer =(rule, value, callback) => {
      //   console.log(_this.periodtimer)
      //     if(_this.periodtimer.length < 1){
      //         callback(new Error(rule.message));
      //               return;
      //     }else {

      //      callback()
      //     }
      //   }
      return {
        value4:'',
        title:"新建布控任务",
        day:0,
        hours:0,
        vdev: "",
        devLike:"",
        curTaskIndex:0,
        vchansList:[],
        allvchanData:[],
        smslistData:[],
        taskDetail:"",
        editstatus:'',//编辑状态
        editunid:'',//编辑id
        taskList: [],
        cate:[],
        taskVisible: false,
        activeName: "first",
        begintime: "",
        endtime: "",
        value3: "",
        editstate:false,
        dbdata: [],
        whiteList:'',
        periodtimer:[],//开始结束日期
        taskForm: {
          cate: "", //必填,任务类型
          name: "", //必填,任务名称
          enabled: true,//必填,任务详细配置信息
          task_info: {
            periods: [
               ['00:00:00', '23:59:59']
            ],
            use_all_vchans: false, //是否对所有视频通道布控,不出现为false,如果为true,则vchans无效。
            vchans: [], //目标视频通道的refid列表
            crucial_types: [], //目标库列表
            sms: {
              if_send: false ,//是否发送短信,默认false
              use_mms: false,
              users:[]
            },
            stay_msec:'',
            period_type:'day',
            start_dt:'',
            end_dt:'',
            crucial_faces:[]
          }
        },
        taskRules:{
          name:[
             { required: true, message: '请输入任务名称', trigger: 'blur' },
          ],
          // periodtimer:[{
          //   required: true,validator: validatperiodtimer, message: '请输入周期时间', trigger: 'blur'
          // }],
          cate:[
                { required: true, message: '请选择布控类型', trigger: 'blur' },
              ],
          periods:[
            { required: true, validator: validateperiods, message: '时间范围不能为空!', trigger: 'blur' }
          ],
          taskdev:[
             { required: true, validator: validatortaskdev, message: '运行设备设置不能为空!', trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      /**@augments
       * 触发新建任务
       */
      newtask() {
        this.title = "新建布控任务";
        this.taskVisible = true;
        this.editstate = false;
        this.$refs.taskRuleForm.resetFields();
        this.taskForm.task_info.periods =[['00:00:00', '23:59:59']];
        this.taskForm.task_info.crucial_types = [];
        this.taskForm.task_info.vchans = [];
      },

      /**@augments
       * 获取任务列表
       */
      getTaskList() {
        return new Promise((resolve, reject) => {
          this.axios
            .get(FACEWEB + "/monitor_tasks", {
              params: {
                "is_deleted":false
              }
            })
            .then(response => {
              this.taskList = response.data.list_data;
              resolve(response.data.list_data);
            });
        });
      },

      /**@augments
       * 开启或关闭任务
       */
      setTaskStatus(event,data) {
        event.cancelBubble = true;
        this.editstatus = 1;
        let url = FACEWEB + "/monitor_tasks/" + data.unid;
        this.getTaskDetail(data.unid,(response)=>{
          this.taskDetail.enabled = !this.taskDetail.enabled;
          this.addtaskapi(url, this.taskDetail).then((response) => {
            this.getTaskList();
          });
        });
      },

      /**@augments
       * 当前选中的任务
       */
      selectTask(data, index) {
        this.curTaskIndex = index;
        this.getTaskDetail(data.unid);
      },

      /**@augments
       * 获取任务详情
       */
      getTaskDetail(unid, callback) {
          this.axios.get(FACEWEB + "/monitor_tasks/" + unid).then(response => {
          this.taskDetail = response.data;
          if(callback)callback(response);
          });
      },

      /**@augments
       * 添加任务操作
       */
      addtask(formName) {
        const _vthis = this;
        let url = FACEWEB + "/monitor_tasks/";
        if (this.editstatus == 1){//编辑任务
          url = FACEWEB + "/monitor_tasks/" + this.editunid;
        }
        if(this.taskForm.cate != "face_stay"){
            this.taskForm.task_info.periods.forEach((e,index) => {
              if(e[0] && e[1]) {
                e[0] = this.setUtcTime(e[0]);
                e[1] = this.setUtcTime(e[1]);
              } else {
                e[0] = '';
                e[1] = '';
              }
            });
        } else {
          this.taskForm.task_info.periods = [];
        }
        if(this.taskForm.task_info.period_type == 'none') {
          if(this.periodtimer.length > 0) {
            this.taskForm.task_info.start_dt = this.periodtimer[0];
            this.taskForm.task_info.end_dt = this.periodtimer[1];
          }
        }
        this.$refs["taskRuleForm"].validate((valid) => {
          if (valid) {
            _vthis.taskForm.task_info.stay_msec = _vthis.formatStayTime();
            _vthis.addtaskapi(url, this.taskForm).then(response => {
              _vthis.$refs["taskRuleForm"].resetFields();
              _vthis.taskForm.task_info.periods = [[]]; //清空时间
              _vthis.taskForm.task_info.vchans = [];//清空相机
              _vthis.taskForm.task_info.crucial_types = [];//清空布控库
              this.taskVisible = false;
              this.editstatus = 0
              this.getTaskList();
            })
          } else {
            console.log(valid);
            return false;
          }
        });
      },
      /**@augments
      *添加任务 API
       */
      addtaskapi (url, data) {
        return new Promise((resolve, reject) => {
          this.axios.post(url , data).then (response => {
            resolve(response)
          })
        })

      },

      /**@augments
       * 编辑任务
       */
      editTask(event, data) {
        this.title = "编辑任务";
        this.editstate = true;
        event.cancelBubble = true;
        this.axios
          .get(FACEWEB + "/monitor_tasks/" + data.unid)
          .then(response => {
            debugger
            this.taskForm = response.data;
            this.editstatus = 1;
            this.editunid = response.data.unid;
            if(this.taskForm.task_info.periods.length > 0) {
              this.taskForm.task_info.periods.forEach((e,index) => {
                e[0] = this.showLocalTime(e[0]);
                e[1] = this.showLocalTime(e[1]);
              });
            } else {
              this.taskForm.task_info.periods.push([]);
            }
            let timer= this.taskForm.task_info.stay_msec;
            this.day = parseInt(timer/(24*60*60));
            this.hours = (timer%(24*60*60))/(60*60);
            this.taskVisible = true;
            this.periodtimer = [data.task_info.start_dt,data.task_info.end_dt];
          });
      },

      /**@augments
       * 删除任务
       */
      deleteTask(event, data) {
        event.cancelBubble = true;
        this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            this.axios
              .delete(FACEWEB + "/monitor_tasks/" + data.unid)
              .then(response => {
                this.getTaskList();
                this.$message({
                  type: "success",
                  message: "删除成功!"
                });
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除"
            });
          });
      },
      /**@augments
       * 添加时间
       */
      addTimer() {
        this.taskForm.task_info.periods.push(['00:00:00', '23:59:59']);
      },
      /**@augments
       * 删除时间
       */
      deleteTimer(index) {
        this.taskForm.task_info.periods.splice(index, 1);
      },
      /**@augments
      *格式化滞留阈值以秒给后台
       */
       formatStayTime() {
         return this.day*24*60*60 + this.hours*60*60
       },
       /**@augments
       *格式化滞留阈值以
       *天+小时方式显示
        */
       stayMsec(data){
         let result = '';
         if(data) {
           if(data >= 24*60*60){
              let day = parseInt(data/(24*60*60));
              let hour = (data%(24*60*60))/(60*60);
              result = day + "天" + hour +"小时";
            } else {
              let hour = data/(60*60);
              result = hour + "小时";
            }
         } else {
           result = '';
         }

         return result;
       },
      /**@augments
       * 筛选设备
       */
      checkdev() {
         const searchData = [];
        if (this.devLike != '') {
          for (let i = 0; i < this.allvchanData.length; i++) {
            if (this.allvchanData[i].vchan_name.indexOf(this.devLike) > -1) {
              searchData.push(this.allvchanData[i]);
            }
          }
          this.vchansList = searchData;
        } else {
          this.vchansList = this.allvchanData;
        }
      },

      /**@augments
       * 格式化显示时间
       */
      formatShowTImer(data) {
      let date = this.formatPickerTimer(data);
      let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
      let mins = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
      let secondes = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();;
      return hours + ":" + mins + ":" + secondes;
      },

      /**@augments
       * 格式化timerpicker 所需时间
       */
      formatPickerTimer(timer) {
        if(timer) {
          let date = new Date();
          let Y = date.getFullYear(),
              M =  date.getMonth() + 1 < 10
                    ? "0" + (date.getMonth() + 1)
                    : date.getMonth() + 1,
              D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(),
              H = Number(timer.split(":")[0]) + 8,
              m = timer.split(":")[1],
              s = timer.split(":")[2];
          return new Date(Y ,M ,D ,H ,m ,s);
        } else {
          return '';
        }
      },
      /**@augments
       * 格式化布控人名
       */
      formatFaceName(data){
        let name = '';
        this.whiteList.forEach(ele => {
          if(ele.unid == data) {
            name = ele.name
          }
        })
          return name
      },
      /**@augments
       * 格式化库名
       */
      formatDbName(data) {
        let dbname = '';
        this.dbdata.forEach((ev) => {
          if(ev.code == data) {
            dbname = ev.name;
          }
        });
         return dbname
      },
      /**@augments
       * 格式化设备名称
       */
      formatVchanName(data) {
        let vchanName = '';
        this.allvchanData.forEach((ev) => {
          if(ev.vchan_refid == data) {
            vchanName = ev.vchan_name;
            return false
          }
        });
        return vchanName;
      },
      getVchanList(){
      this.axios
        .get(IP + "/api/v1/org/vchans/list", {}).then(response => {
          this.vchansList = response.data.list_data;
          this.allvchanData = response.data.list_data;
        });
      },
      /**@augments
      *获取布控名单
      */
      getwhiteList(){
        this.axios
          .get(FACEWEB + "/faces/crucial_faces", {
            params: {
              offset: 0,
              limit: 2000,
              is_crucial: true,
              is_active: true,
              sex: this.facesex,
              name__like: '',
              card_id__like: '',
              crucial_type: 'dl_white',
              resident_unids: '',
            }
          }).then( (response)=> {
            this.whiteList = response.data.list_data;
          });
      },
      /**@augments
       * 获取短信推送名单
       */
      getSmsList(){
        this.axios.get(IP + "/api/v1/auth/users", {
          params: {
            limit: 10000,
            offset: 0,
            user_type: "user",
            norm_type: "login"
          }
        }).then((response) => {
          this.smslistData = response.data.list_data;
        });
      },
    },
    created() {
      this.getwhiteList();
      this.getVchanList();
      this.getSmsList();
      /**@augments
       * 获取任务列表并初始化首个任务
       */
      this.getTaskList().then(response => {
        if(response.length > 0)
          this.getTaskDetail(response[0].unid);
      });
      this.faceapi.getFaceDbData().then(res => {
         this.dbdata = res.list_data;
      });
      this.cate = this.$store.state.alarmtype;
    }
  };

</script>
<style lang="stylus" scoped>
  .left-box {
    height: 750px;
    box-shadow:0px 0px 7px 2px #2bc7ef inset;
    overflow: hidden;
    color: #fff;
    position: relative;

    .task-btn {
      position: absolute;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
    }
  }

  .right-box {
    box-shadow:0px 0px 7px 2px #2bc7ef inset;
    height: 750px;
    overflow: hidden;
  }

  .left-header {
    height: 60px;
    line-height: 60px;
    border-bottom: 2px solid #2A2C3B;
    color: #9E9FA5;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
  }

  .deploy-list {
    height: 50px;
    line-height: 50px;
    padding-left: 15px;

    .icon {
      font-size: 16px !important;
      cursor: pointer;
    }
  }

  .deploy-name {
    padding-left: 15px;
    display: inline-block;
    width: 60%;
  }

  .right-title {
    font-size: 18px;
    color: #9E9FA5;
    font-weight: 600;
  }

  .right-content {
    width: 96%;
    margin: 20px auto;
  }

  .dbname-box {
    .icon {
      font-size: 40px !important;
      color: #fff;
      vertical-align: top;
    }

    .dbname {
      color: #ffffff;
      font-size: 18px;
      display: inline-block;
      height: 50px;
      line-height: 50px;
      padding-left: 10px;
    }
  }

  .deploy-time {
    color: #fff;
    margin-bottom: 20px;
  }

  .time-box {
    margin-top: 80px;
  }

  .deploy-vchan {
    color: #fff;
    margin-bottom: 10px;
    font-size: 20px;

    .icon {
      font-size: 20px !important;
    }
  }

  .add-task {
    cursor: pointer;
  }

  .dev-check {
    width: 100%;
    margin-left: 0px;
    color: #fff;
  }

  .el-form-item__content {
    margin-left: 10px !important;
    overflow: hidden;
  }

  .dev-box {
    height: 200px;
    overflow: auto;
  }

  .plr10 {
    padding: 0 10px;
  }

  .mb10 {
    margin-bootm: 10px;
  }

  .pl30 {
    padding-left: 30px;
  }
  .activetask {
    background rgba(43,199,239,0.8)
  }
  .taskstatus{
    cursor pointer
  }
  .stay{
    color: #fff
  }

</style>