<template>
  <div class="full-height">
    <div class="row items-center">
      <q-avatar
        size="40px"
        font-size="20px"
        color="primary"
        class="q-mr-md"
        text-color="white"
        rounded
        :icon="`iconfont ${node.icon}`"
      />
      <div class="pingfang text-subtitle1">{{ node.name }}</div>
      <q-icon name="iconfont icon-bangzhu" class="q-ml-md">
        <q-tooltip anchor="bottom middle" :offset="[10, 10]">
          线索分配给我，但是从未跟进过的线索
        </q-tooltip>
      </q-icon>
    </div>
    <div class="q-my-md row items-center">
      <q-input
        standout
        v-model="msg.KeyWords"
        dense
        type="text"
        style="width:250px;"
        label="关键字（名称/微信/手机号）"
        class="q-mr-md"
      />
      <q-btn
        color="primary"
        class="q-px-md"
        label="查询"
        unelevated
        dense
        @click="searchKeyHandler"
      />
      <div class="col text-right text-grey-6 f12">
        TIPS：在线索资料-操作跟进-添加跟进信息后即可完成本项工作
      </div>
    </div>
    <div style="height:calc(100% - 158px)">
      <stulist
        :dataList="stus"
        @reload="getStudent"
        @success="refreshPage"
        :loading="loading"
        ref="stuList"
        :showHeader="false"
        :isJudgeTrans="isJudgeTrans"
        height="100%"
        :noSelect="true"
      ></stulist>
    </div>
    <div class="row" style="justify-content: flex-end;padding: 5px 20px">
      <q-pagination
        v-model="msg.PageIndex"
        :max="pageCount"
        @input="changePage"
        class="full-width justify-end"
        color="primary"
        :input="true"
      >
      </q-pagination>
    </div>
  </div>
</template>

<script>
import stulist from "../school/student/stulist";
import { getMyClue } from "../../api/stuMan/index";
export default {
  components: { stulist },
  props: ["node"],
  data() {
    return {
      stus: [],
      loading: false,
      isJudgeTrans: 1,
      pageCount: 0,
      msg: {
        PageIndex: 1,
        pageSize: 12,
        KeyWords: ""
      }
    };
  },
  mounted() {
    this.getStudent();
  },
  methods: {
    getStudent() {
      if (this.loading) return;
      this.loading = true;
      getMyClue(this.msg)
        .then(r => {
          this.stus = r.Data.PageData;
          this.pageCount = r.Data.PageCount;
          setTimeout(() => {
            this.loading = false;
          }, 1000);
        })
        .catch(e => {
          this.loading = false;
        });
    },
    refreshPage() {
      this.getStudent();
      this.$root.$emit("updateTodoList");
    },
    changePage() {
      this.getStudent();
    },
    searchKeyHandler() {
      this.msg.PageIndex = 1;
      this.getStudent();
    }
  }
};
</script>

<style></style>
