<template>
  <div>
    <div v-if="tenantId == 1" class="dashboard-no-corps">
      <div class="dashboard-no-corp-title">你当前没有任何企业</div>
      <div class="dashboard-no-corp-content" @click="joinOrCreateCorp('加入')">
        <div class="no-corp-pic">
          <img src="https://g.jdycdn.com/app/pc/e3993c2b1a60.png">
        </div>
        <div class="no-corp-title">加入企业/团队</div>
        <div class="no-corp-subtitle">你需要邀请链接才能加入到企业/团队中，若此时没有邀请链接，你可以向管理员或创建者索要邀请链接加入到该企业/团队中。</div>
      </div>
      <div class="dashboard-no-corp-create" @click="joinOrCreateCorp('创建')">创建企业/团队</div>
    </div>
    <div v-else class="dashboard-corps">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-card class="box-card" style="height: 197px;">
            <div class="flow-center-wrapper">
              <div class="my-todo">
                <div class="todo-wrapper">
                  <div class="image-wrapper">
                    <img class="todo-image"
                      src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAJGElEQVR42u2de2wcRx3HDZRWKEB5hD6AgpN7NG0FRUSteEmUVKJIQKWqQlCglUgTKf2TVqFRQ8BSS8vd2rF9cYTSlkqpSpXYxHFjx484TZvYcUB9qbFdvxMnkSAVSiEutW9mdu/Hb+72Dt86l5s77+3t3fy+0lc+z83OjOczO7vz24drakgkEolEIpFIJBKJRCKRSCQSqWrUeAyujw2Z65sGzd2x4+Zr+PNfzYNWXFp+ttN2yzwyL/VYlahlCO5sHjB70GbzoAlKlnlxG7kt9WCFaucJuAlhHlGGnttHZFnUoxWk2HF4CMEtuAA/7YXYcesh6lmfq64OPoywWlwE73SLrIN62qdqPm7tKiH8lLEO6mkfqmnA2lJy+LZlXdTjftrzh8S3EIzwagAk68I6qef9cNx/Ba7Atfywh/BtW8OybiJQ7r1/EDYUPIUPmgx/Ho0NWrul5Wc7rcBBABuIQDkF8CEEOFXAXvvv2ID1aOxv8ElnUX/sh6vldzKPanmybtkGAlGu9f4x8V11+GIM4wMBhRhCQOZVHgTYBiJRtoC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ewsL7WtdVG2ich4qK4puAsBso4JAZezE5Zq/nzlvJRME3IQMdkWIlIG7Z807+sYN8X+cQGFusPh4srAurENRKKM6piCH7ePi/n2MQHS+x1udzhXeq58zvyZtHFzXtZNBPwwE4zB2n1j5sy+dwQU6vaxYmzOyDqp532k1hm4un3cfA6hJva9w+Gvo7YRcsrcYUe6nV9uuy/re9vJ70QC4T8n66Ie96naR8V3ENRQGwK7nNPAVdNlmbJs6uFKGQjjYl3bqOhoGxGsdYSDqttsJz+PCibLkGVRj1aoXpyYW7l3lK/fO8xfQKiz6ETrMIe9Dsu05HeYR+ZFr3/x9bmV1INVpuffhhV7Rvite0fE91pHzbul5WeZJr+jHiKRSCQSiUQikUgkEolEIpFI1af/ATNY/+DKfZRrAAAAAElFTkSuQmCC"
                      alt="">
                  </div>
                  <div class="todo-count" @click="handleSelect('/task/todo')"
                    v-loading.fullscreen.lock="fullscreenLoading">
                    <div class="todo-count-text">我的待办</div>
                    <div class="todo-count-number">{{ todoCount }}</div>
                  </div>
                </div>
              </div>
              <div class="x-divider x-divider-vertical wrapper-divider"></div>
              <div class="flow-steps">
                <div class="step-wrapper" @click="handleSelect('/task/done')"
                  v-loading.fullscreen.lock="fullscreenLoading">
                  <img class="step-image"
                    src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAACFlBMVEUAAAAAAP8A//8AgP8Aqv+qqv8AgP+Av/8Amf+ZzP8qgP8ggP+fv/+Oxv8agP8Xi/8ui+iL0f8VgOoqlf8niesnif+Stu0gj/8eh/+Oxv+PwvUnif8mhPYkifYiiPciiP8hjP8oh/coj/+Pw/gjjvgiivghifgkjPkji/mRxfmQyP8kh/okjfokivqRw/qQw/okifoki/Yki/sjiPsjjfsjivsijPuQw/sljPuQwfski/cki/sli/sljPuTxPySw/wkifgjifwlivkjiPkmi/mSw/wkifojivojjPojivolivqQxPqQwvokifqRw/qSxPojivokivgki/ski/uQw/uRw/uSxPskivkjifkli/kkifkki/uRwvmRxPuTxPskivsjivkli/kjivgjivokivoki/okivoki/qQw/oki/iRw/okivokivkkivqRxPwli/kki/kkivmRwvskivkkivkkivmSwvskivmRw/skivmRw/skifkkivkkivojivokivgkivoki/oki/oji/okivoki/okivokivokifkki/kki/ojivokivkkivkkivokivkkivkkivkjifkkivkkivkkivkkivkkivkjivkkifokivokivgkivokifgkivoli/ojivokivokivokivkkivoki/ojivojivkkivkkivkkivokivkkivokivkjivkkivkki/okivmSNfP3AAAAsXRSTlMAAQECAwMEBAUFBggICQoLCwsMDA0NDhAREhkaGxweHh8gICIkJScqLCwuMTEyMzc4OTk6Ojs8PD4+QEBERUlNTlBTWFhZXV5fYGBjZWprbG1xcnd4e36BgoSGhoaGhoeJipCQlJWWlpqcnKSlpaWnqaqsr7CxsbKys7O2t7q7vr+/wcPExcbP0NDQ0dLT09fa3t/h4uPk5efo6Onp6urt7u7v8fHx9fb29/f4+Pr8/v7IYf4CAAACFElEQVRYw2NgGAWjYBQMGsCq5xMaG4cXhPlZ8hJtnn5GFTEgz55I81wrqogEIezEmGdXRTzwJ8I8ySISDKzSImygNynmVcUQNjCLJAPLxAiZx1NFGtAkZKAUiQaaEzKQU5k0IDgM8jGXqpkVscBCXYCQcRq5SzaSAtbU2OAzjjF83UaSQT4fbgPTNpIDmrhwmee+kTyQjMM87mlkGrhWBbuBjhvJBRHYDUwh28A27AaWkm3gVOwGNpBt4FLsBjYSqX1KyzxqGrjAgYGBzXct1QxcbQJWG0gtAze4Q9PsMioZGA9TPIE6BpYwM1DVhV1CMLXUCcOZ8jClJqvJM3DhImTeKiOYSoVZZKXDDkMGBoN2RAS7wRQKd5OVsCeLgwSFamH8aJg65lLysl4QtNIqgHCLmWDqEsjMy7YwB6WDeJ38MGUeG8g00BMuEbFx4ww5GMd0NbmlTQvcjwwBKwxgTMU55BdfqQgTZWEMkR5KysMcDnQlzOWUFbDV6HV4IqUldqsEigovyquAPmkkBWarqVCnTFKFyyvNpUolNVsXKi3aS6Vab7E1JIIrqVaNrnQBZelMatbLzVFJE2lY0Q+cgXVkGzgfu4HZZBvYj93AYLINLMBuoNp6cg10xtHILiDXxyw4DJSZTpZ5q41x9lN0yDFxuROerpRMAcnh2KyNv7OnFpxT10gsqC+MNBgdNhsFo2AwAAAtOPG9B304zAAAAABJRU5ErkJggg=="
                    alt="">
                  <div class="step-text">我处理的</div>
                </div>
                <div class="step-wrapper" @click="handleSelect('/task/my')"
                  v-loading.fullscreen.lock="fullscreenLoading">
                  <img class="step-image"
                    src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAABGlBMVEUAAAAAAP8AgP8Aqv8AgP8zmf8qgP8ggP8Xi/8qlf8iiP8gj/8cgPEdif8kif8ikP8hjPchjP8ni/cjh/gjjvgmjPkji/kiiPkijv8jjPoiifoki/sjivgjiPgki/gkifgjifwlivkkjPwkifolivwji/oljPolivojivski/skifkki/kjjPkli/kkivokivokifglivolifkli/oki/oki/kkivskivklivkki/kjivoli/ojivojifgji/gji/okivokivkkivkkivkkivkkivkkivkki/okivkkivkkivkkivgkivgkivkjivkkivokivokifkkivojivkkivkkivokivkkivojivkjivkkivkkivkki/okivmdXVYCAAAAXXRSTlMAAQIDBAUGCAsMDxASGhweHx8hJCQoLC0tMzQ5SElNTlBTVF1gZWZvdHmAhomKjI6PkqCgoaKqrK64u8HCw8PDxMjL09TW19vi4+Tq6+3v7/Dz9Pb39/r6/P39/v7dYDghAAACJElEQVRYw+2YWTMDQRSF7zDELrGMMIg1CGaQCCJ2IvYlCYlx///f8KB40Hd6breOKlU5r3Pqq5ma7nMXgJZa+ifqijuu68S7TLB6Un6hHCAiIgblgp/q+Q2tN12s4w/Vi+leTdxotoakatlRDdxwvoGhauSHFXGxTBWlqmZiKrxkCSNVSvJ5ixVkqLLIxFkeMuVZHJ6dQ7ZyNuP9tlFBueh39FBJXuT/QEVF/JlkRRVYkZ6eWAmVVZKd8AxqKCO5v1UdYDX8XudRS/nQvGroARthaZal3I9LE/NnEcRsSD6TeToJAPbykxRYozM8TXmvP58N7EiJaRJ4SFnPv55OXkqARbK+1aVAaYjXqVqYQjkQYGQvlJgigH4kEGDuKgToE8ACAwjd3itpKxDAMgcIMHZE2cpE/xLwgGAt3Ii2QOx7EsgEAvTtir6E4HL4QGi7EHyOYHIVgLAm+NzfAbcYQJVPHn9mfHKcD5x7FH1x/WPTufnOOjbcgz10yjzYvKsHM/fsq8cJhw4/4IdDdHzB4IlKfEUFLMD0nVLAQlEOtNcDtRJAF6lv4MCxcpEiy+gXcOpWvYyShf7BAgBoX33TKPR0KzIPAP37eq0I2Sy9bMyu3Go2S+bbOeMNp/mW2HjTbn6sMD/4gJVT4TFGM7AVhr1txvBofrw1P4A3YUVgfolhfs3ShEXQ56rqQFxVHWivqpqwTPvuexKO6zoJI+u+llr6C30AImnPnDDxrmkAAAAASUVORK5CYII="
                    alt="">
                  <div class="step-text">我发起的</div>
                </div>

                <!-- <div class="step-wrapper flow-ccuser-my">
                    <img class="step-image"
                      src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAUKADAAQAAAABAAAAUAAAAAAx4ExPAAAJOklEQVR4Ae2cf2wcRxXH5+3t7iX9KZJUFKkRLdhnV86PWjkB+dFiV5VoU5q2lFRQKkFRRURFQ5OcLaU/IEFEqPbZVKGhqaIq+aNqSakSWgkQCAjqH/x0AYekdXyOmkRNIkgKdSB2bn89vmPlzOW6dze7t+ds7FvptLuzM29mPvvmzZu3YwvROBoEGgQaBBoEGgQaBBoELkkCdEm2OuJGN/dYN0HkzYKEpevG62+vo5OqVcxogK19nHI9exsz3zYJjMglpsdz3UbPZFqFixkJsGMnzzp+ynpCCOpmwaYfHy0hvjC8Ibnb71lxmlZ8MxOuU33OSsA7yEI8WQ6e5OC51K3CQ1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o6POCkFeB1yoTiTBjQobDdfelDLDHrHTwD2D+S3ozCJs9D7KwtuPVcjglWL2gc8sprPlOtnyAl/J/3ZXIDreiTlIDvl2uE4KH5no3CzTuP7AY/SPcrKrpccR4HfR6AuDBiQ84fFhbB0dJF0MJk3j7ZXN5begTewzPOPeok0MeQGoeCEl+w3l5AF5D+Qy+p5qkCo9jx3Avfvz30GH2ys2muj0/IXG19JUfhVTXL6tn+fYrvtp2NDlsHlYFvIJM2HuOrieRorzhbmOnQ3EuqP60oO8l1XhSSgA9S+c9p7/yaTIjtj5gVhWVQSIoTcyuCDpG7mJjEoAQbEDiLZXBOgKfn4TYR9zTI74ASSsmMsdzPs+vyjpG/oqV6Te6bGzgfh3D/4aSNq4o+u76g0kqPzYaSBmYF+AmEF33982MRkE7WNd88cOIGkfHMLYsnviPdt8va4kQgqPHUB2PziEddJ2rEmr+XwhOYQuFjuApRoIT3/g7oXmQOge1rlg7ABizTbZZawaHC1p7phMiOFF7AAi/vd/goJeu7uV6vtNusaXEjuACUr8CcMWMzGftP9r7K6xfzOz+J4/npm7c987dd97ODPpNnrdINAg0CDQINAg0CDQINAgEAWB/wFby0G6nREcUQAAAABJRU5ErkJggg=="
                      alt="">
                    <div class="step-text">抄送我的</div>
                  </div>
                  <div class="step-wrapper flow-new-launch">
                    <img class="step-image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAUKADAAQAAAABAAAAUAAAAAAx4ExPAAAGmUlEQVR4Ae2ca2xURRSA58zdPqS0CwR5BRRCS6RF3v+UIJLYtLYKBrHbqPDDoJHExJiIirQNSExIEEMwUf6oCaHlqdiHNETXB8QfgohANdAQFBVBSl8g6XZ3jucWN9mdvdK5u3dv96Yzyebec2bmzJlvZ+7MztwdxnTQBDQBTUAT0AQ0AU1AE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BtDfXP8CjZhzna7AgD3g52iwMAElBBo4gMreQa3vuYRIBxSuAaR3Y0rJ32UO+BxvAuDUCF92jbksI4eHgkEfTbY/pp9/1XKcU7JrAJ1yOM4OwDEjL7fiypLlXXF6EqYGg7k/3PhrH83/KuQ4J2XPAgRgrSMnjHziz4WV/8hAxrS0FHTcuPwZ6RfLcU7LnhyFaTqyr2jCjEoreJOCjWPDoutLN+CZX4YHWyCcnTLNePpEycKEJasxLQcm997oPUL1us+snBvBcy2Q3i/+5GzJypAMp6Bxf1FY9B0lvWvwTB88B5D+V5IwGR7V2DAHWf+3NFW5Vwabbtl7AJlYVXB4b2EUzOim+kWCia9okXB8VOfm1XPPQGplBRCOHC9o3n2I5sj5YURafR66nuQ5gGbrol8XflqVftZcmh7q4MEuPNTI4svXAON52JY0QNvI4jNogPE8bEsaoBWyLJ/y6KQBWgA0jFCnhdpSpQ4QIWHVw9IiKenVvbvkOFo9uSnrMlOG0ItLA3+r+qYMkH6D/q5qVCAk/Cqgv3op51ctJx3p6Mv/pg5A+QUlZYAGMHOJSCkg4FQ5IeegnF/O66YMjO+zU54ywPXFc87QOtwJJeMCl8rpCscVBukchd9kfSbJ9Ji5MHka/8iOT8oAB4xy/gpBVBmhZr/VfnpKrCMnFtL6HcC6WF1G3QOEwYA1Vktld/LTFsCambO/Jnyv38lgNC4SirwcvY9e6dXcBmqF26NyBl0FZ7C2uyyQ8E/7wXwc9PwDKwMpH3vS1FBLJy/QmTODn79gVb6TOgLQgZyvpm3RpmTs2mqB0QI2zJr3HvCcEurOu8zzYaL62CvthuVFROhDc182Vm8+AnoqA3UGGPNJ/yl166QOvIm1mcw9Pe9+pc9mI9c3PVl4ZrlxlUvGEUeOfuq/Pl8ATkz70U8gBNX4WpYv+2JH6YpfkqmvzqMJaAKagCagCWgCmoAmoAloAprA0BP4F2z58uG8qdOdAAAAAElFTkSuQmCC" alt="">
                    <div class="step-text">发起流程</div>
                  </div> -->
              </div>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card class="box-card" style="height: 197px; font-size: 16px;">
            <div class="card-title">
              <div class="title-left">
                消息
              </div>
              <div class="title-right">
                <el-button type="text" @click="goMyList">更多</el-button>
              </div>
            </div>
            <div class="card-content">
              <el-empty :image-size="50" v-if="notifyMessageList.length <= 0"></el-empty>
              <div class="step-list" v-else>
                <div class="step-item" v-for="(item, index) in notifyMessageList" :key="index" v-if="index < 3">
                  <div class="step-title-left" :title="item.templateContent">
                    {{ item.templateContent }}
                  </div>
                  <div class="step-title-right">
                    {{ parseTime(item.createTime) }}
                  </div>
                </div>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
      <app-list style="margin-top: 18px;" />
    </div>
    <el-dialog width="30%" :title="corpTitle + '企业/团队'" :visible.sync="joinOrCreateVisible" append-to-body>
      <el-form :model="form" :rules="rules" ref="ruleForm" label-position="top" label-width="80px" size="small">
        <el-form-item label="企业/团队名称" prop="name" v-if="corpTitle == '创建'">
          <el-input v-model="form.name" placeholder='请输入你的企业/团队名称'></el-input>
        </el-form-item>
        <el-form-item label="邀请码" prop="tenantId" v-if="corpTitle == '加入'">
          <el-input v-model="form.tenantId" placeholder='请输入你的邀请码'></el-input>
        </el-form-item>
        <el-button size="small" type="primary" style="text-align: center;width: 100%;margin-top: 10px;"
          @click="submitForm('ruleForm')">
          <span v-if="!loading"> {{ corpTitle }}</span>
          <span v-else> {{ corpTitle }}中...</span>
        </el-button>
      </el-form>
    </el-dialog>
    <el-dialog width="50%" title="新建应用" :visible.sync="dialogVisibleApp">
      <div class="scene-container">
        <div class="scene-wrapper">
          <!-- <div class="title-wrapper">
            <div class="icon-text">
              <i class="el-icon-thumb title-icon"></i>
              <span class="title-text">猜你想要</span>
            </div>
          </div> -->
          <div class="grid-row">
            <div class="grid-col">
              <div class="card-item create-blank-app" @click="innerVisible = true">
                <i class="el-icon-plus create-icon"></i>
                <div class="create-text">创建空白应用</div>
              </div>
            </div>
            <div class="grid-col">
              <div class="card-item scene-item" @click="confirmAdd()">
                <img src="https://g.jdycdn.com/app/pc/fc125acb88ce.png">
                <div class="item-info">
                  <div class="item-title">任务</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <el-dialog width="30%" title="创建空白应用" :visible.sync="innerVisible" append-to-body>
        <el-form :model="form" label-position="top" label-width="80px" size="small">
          <el-form-item label="名称">
            <el-input v-model="form.name" placeholder='给应用命名，例如‘‘客户管理系统’’'></el-input>
          </el-form-item>
          <el-form-item label="地址">
            <el-input v-model="form.url" placeholder='应用访问地址，例如‘‘https://www.baidu.com/’’'></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="innerVisible = false" size="small">取 消</el-button>
          <el-button type="primary" @click="innerVisible = false" size="small">确 定</el-button>
        </div>
      </el-dialog>
    </el-dialog>
    <el-dialog width="30%" title="编辑" :visible.sync="editVisible">
      <el-form :model="form" label-position="top" label-width="80px" size="small">
        <el-form-item label="名称">
          <el-input v-model="form.name" placeholder='给应用命名，例如‘‘客户管理系统’’'></el-input>
        </el-form-item>
        <el-form-item label="地址" v-show="form.type == 1">
          <el-input v-model="form.url" placeholder='应用访问地址，例如‘‘https://www.baidu.com/’’'></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="danger" @click="editVisible = false" size="small" style="float: left;">删 除</el-button>
        <el-button @click="editVisible = false" size="small">取 消</el-button>
        <el-button type="primary" @click="editVisible = false" size="small">确 定</el-button>
      </div>
    </el-dialog>
    <el-drawer title="消息管理" :visible.sync="messageTable" direction="btt" size="50%">
      <message-table />
    </el-drawer>
  </div>
</template>

<script>
import { getTodoCount } from '@/api/bpm/task'
import { getListByMenuId } from "@/api/home";
import { mapGetters } from 'vuex'
import { setTenantId } from "@/utils/auth";
import { getUnreadNotifyMessageList } from "@/api/system/notify/message";
import { createTenant, joinTenant } from "@/api/system/tenant";
import router from '@/router'
import store from '@/store'
import Homebar from '@/layout/components/Homebar'
import AppList from '@/components/AppList'
import TopNav from '@/components/TopNav'
import MessageTable from '@/components/MessageTable'

export default {
  name: 'Index',
  components: {
    Homebar,
    AppList,
    TopNav,
    MessageTable
  },
  data() {
    return {
      todoCount: 0,
      fullscreenLoading: false,
      loading: false,
      corpTitle: '',
      form: {
        type: 1,
        name: '',
        tenantId: '',
      },
      rules: {
        name: [
          { required: true, message: '请输入你的企业/团队名称', trigger: 'blur' },
          // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        tenantId: [
          { required: true, message: '请输入你的邀请码', trigger: 'blur' },
        ],
      },
      // 遮罩层
      loading: false,
      // 列表
      notifyMessageList: [
      ],
      dialogVisibleApp: false,
      innerVisible: false,
      editVisible: false,
      joinOrCreateVisible: false,
      messageTable: false
    }
  },
  computed: {
    ...mapGetters([
      'tenantId',
    ]),
  },
  created() {
    this.setTodoCount();
    this.getUnreadNotifyMessageList();
  },
  methods: {
    //获取我的待办任务数量
    setTodoCount() {
      getTodoCount().then(response => {
        this.todoCount = response.data;
      });
    },
    // 代办选择事件
    handleSelect(path) {
      let item = {
        id: 2781,
        parentId: 5,
        path: path,
      }
      const menus = [
        {
          "id": 1,
          "parentId": 0,
          "name": "审批中心",
          "path": "/task",
          "component": null,
          "componentName": null,
          "icon": "cascader",
          "visible": true,
          "keepAlive": true,
          "alwaysShow": true,
          "children": [
            {
              "id": 1207,
              "parentId": 1200,
              "name": "我的代办",
              "path": "todo",
              "component": "bpm/task/todo/index",
              "componentName": "BpmTodoTask",
              "icon": "eye-open",
              "visible": true,
              "keepAlive": true,
              "alwaysShow": true,
              "children": null
            },
            {
              "id": 1208,
              "parentId": 1200,
              "name": "已处理",
              "path": "done",
              "component": "bpm/task/done/index",
              "componentName": "BpmDoneTask",
              "icon": "eye",
              "visible": true,
              "keepAlive": true,
              "alwaysShow": true,
              "children": null
            },
            {
              "id": 1201,
              "parentId": 1200,
              "name": "已发起",
              "path": "my",
              "component": "bpm/processInstance/index",
              "componentName": "BpmProcessInstance",
              "icon": "people",
              "visible": true,
              "keepAlive": true,
              "alwaysShow": true,
              "children": null
            },


          ]
        },
      ]
      this.fullscreenLoading = true;
      getListByMenuId(item.id).then(response => {
        let menuList = response.data;
        localStorage.setItem("parentId", item.parentId)
        localStorage.setItem("menus", JSON.stringify(menuList))
        this.$store.dispatch('GenerateRoutes', menuList).then(accessRoutes => {
          console.log(accessRoutes);
          // 根据 roles 权限生成可访问的路由表
          router.addRoutes(accessRoutes) // 动态添加可访问路由表
        })
        setTimeout(() => {
          this.fullscreenLoading = false;
          this.$router.push({ path: item.path });
        }, 200);
      });
    },
    joinOrCreateCorp(val) {
      this.corpTitle = val;
      this.joinOrCreateVisible = true;
      this.form.name = '';
      this.form.tenantId = '';
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.loading = true;
          console.log(this.form);
          if (this.corpTitle == '创建') {
            createTenant({ status: 0, name: this.form.name }).then(response => {
              this.joinOrCreateVisible = false;
              this.$modal.msgSuccess("创建成功");
              let data = response.data;
              store.dispatch("ChangeTenant", data).then(() => {
                setTenantId(data.id)
                setTimeout(() => {
                  location.reload()
                }, 1500)
                  .catch(() => { });
              })
                .catch(() => { });

            }).catch(() => { 
              this.loading = false;
             });
          }
          else {
            joinTenant({ accountMode: 1, corpId: this.form.tenantId }).then(response => {
              this.joinOrCreateVisible = false;
              this.$modal.msgSuccess("加入成功");
              let data = response.data;
              store.dispatch("ChangeTenant", data).then(() => {
                setTenantId(data.id)
                setTimeout(() => {
                  location.reload()
                }, 1500)
                  .catch(() => { });
              })
                .catch(() => { });
            }).catch(() => { 
              this.loading = false;
            });
          }

        } else {
          console.log('error submit!!');
          this.loading = false;
          return false;
        }
      });
    },
    confirmAdd() {
      this.$confirm('确定添加此应用?', '添加应用', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(() => {
        this.$message({
          type: 'success',
          message: '添加成功!'
        });
      }).catch(() => {

      });
    },
    editApp(val) {
      console.log(val);
      this.form.type = val.type;
      this.form.name = val.title;
      this.form.url = val.path;
      this.editVisible = true;
    },
    openAppList() {
      this.dialogVisibleApp = true;
    },
    getUnreadNotifyMessageList: function () {
      this.loading = true;
      getUnreadNotifyMessageList().then(response => {
        this.notifyMessageList = response.data;
        this.loading = false;
      });
    },
    goMyList: function () {
      this.messageTable = true;
      // this.$router.push({
      //   name: 'MyNotifyMessage'
      // });
    },
  }
}
</script>
<style>
.el-drawer__header {
  color: black;
  font-size: 20px;
  font-weight: 500;
}

.el-drawer__open .el-drawer.btt {
  height: auto !important;
  top: 45px;
}
</style>
<style lang="scss" scoped>
.el-empty {
  padding: 10px 0 !important;
}

.dashboard-no-corps {
  align-items: center;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  left: 0;
  min-width: 800px;
  position: absolute;
  right: 0;
  top: 0;

  .dashboard-no-corp-title {
    color: #141e31;
    font-size: 24px;
    line-height: 32px;
  }

  .dashboard-no-corp-content:hover {
    box-shadow: 0 0 14px 0 rgba(31, 45, 61, .1);
  }

  .dashboard-no-corp-content {
    align-items: center;
    background: #fff;
    border: 1px solid #ebecee;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 350px;
    margin: 20px 0 24px;
    padding: 35px;
    width: 600px;

    .no-corp-pic {
      height: 200px;
      width: 350px;

      img {
        height: 100%;
        width: 100%;
      }
    }

    // .no-corp-pic>img {
    //     height: 100%;
    //     width: 100%;
    // }
    .no-corp-title {
      color: #141e31;
      font-size: 16px;
      line-height: 24px;
      margin-top: 25px;
    }

    .no-corp-subtitle {
      color: #525967;
      font-size: 12px;
      line-height: 18px;
      margin-top: 6px;
      text-align: center;
      width: 420px;
    }
  }

  .dashboard-no-corp-create {
    color: #00b899;
    cursor: pointer;
    font-size: 14px;
    line-height: 22px;
  }
}

.switch-corp-pane {
  min-height: 400px;

  .corp-block {
    .corp-desc {
      color: #525967;
      margin-bottom: 10px;
    }

    .corp-wrapper {
      border-radius: 4px;
      box-shadow: 0 1px 6px 0 rgba(0, 0, 0, .1);
      margin-bottom: 12px;
      max-height: 200px;
      overflow: auto;

      .corp-item {
        align-items: center;
        display: flex;
        height: 50px;
        justify-content: space-between;
        line-height: 50px;

        .is-owner {
          font-size: 18px;
          font-weight: 700;
        }

        .corp-name {
          flex: auto;
          max-width: 350px;
          overflow: hidden;
          padding: 0 30px;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .corp-op {
          flex: none;

          .style-text {
            padding: 0 16px;
          }

          .op-current {
            color: #838892;
            padding-right: 20px;
          }
        }
      }
    }

    .corp-switch-btn {
      text-align: center;
      width: 100%;
    }

  }
}

.scene-container {
  // max-height: 500px;
  height: 500px;

  .scene-wrapper {
    margin-bottom: -10px;

    .title-wrapper {
      align-items: center;
      display: flex;
      height: 20px;
      justify-content: space-between;
      line-height: 20px;
      margin-bottom: 12px;

      .icon-text {
        align-items: center;
        display: flex;

        .title-icon {
          color: #525967;
          font-size: 16px;
          margin-right: 4px;
        }

        .title-text {
          color: #141e31;
          font-size: 14px;
          font-weight: 500;
        }
      }
    }

    .grid-row {
      margin-left: -10px;
      margin-right: -10px;
      row-gap: 0px;
      display: flex;
      flex-flow: row wrap;

      .grid-col {
        min-height: 1px;
        position: relative;
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 20px;
        display: block;
        flex: 0 0 25%;
        max-width: 25%;

        .card-item {
          height: 120px;
          border-radius: 8px;
          cursor: pointer;
          overflow: hidden;
          position: relative;
          transition: all .2s;
        }

        .card-item:hover {
          box-shadow: 0 6px 18px 2px rgba(0, 0, 0, .06);
          transform: translateY(-6px);
        }

        .scene-item {
          img {
            height: 100%;
            width: 100%;
          }

          .item-info {
            bottom: 0;
            color: #fff;
            left: 0;
            padding: 0 20px;
            position: absolute;
            right: 0;
            top: 0;

            .item-title {
              font-size: 16px;
              font-weight: 500;
              line-height: 26px;
              margin-top: 20px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
        }

        .create-blank-app {
          background-color: #f5f6f8;
          border: 1px solid #ebecee;
          text-align: center;

          .create-icon {
            color: #00b899;
            font-size: 32px;
            line-height: 32px;
            margin-top: 30px;
          }

          .create-text {
            color: #525967;
            font-size: 14px;
            line-height: 20px;
            margin-top: 8px;
          }
        }
      }
    }
  }
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-content {

  // padding: 10px;
  .step-list {
    margin: 0 10px;

    .step-item {
      margin: 10px 0;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .step-title-left {
        max-width: 70%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}

.fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;
  width: 100%;
  transition: width 0.28s;
}

.dashboard-container {
  //margin-top: 50px;
  // padding: 32px;
  // background-color: rgb(240, 242, 245);
  // position: relative;
  // height: 100%;
  background: #f5f6f8;
  bottom: 0;
  left: 0;
  overflow: auto;
  position: absolute;
  right: 0;
  top: 60px;
  padding: 32px;
}


.flow-center-wrapper {
  background: #fff;
  border-radius: 6px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 160px;
  position: relative;
  width: 100%;
}

.my-todo {
  border-radius: 6px;
  height: 100%;
  padding: 20px;
  width: 32%;
}

.flow-center-wrapper .my-todo .todo-wrapper {
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  height: 100%;
  justify-content: center;
}

.flow-center-wrapper .my-todo .todo-wrapper .image-wrapper {
  height: 64px;
  margin-right: 5px;
  width: 64px;
}

.flow-center-wrapper .my-todo .todo-wrapper .image-wrapper .todo-image {
  height: 100%;
  width: 100%;
}

.flow-center-wrapper .my-todo .todo-wrapper .todo-count {
  height: 64px;
}

.flow-center-wrapper .my-todo .todo-wrapper .todo-count .todo-count-text {
  font-size: 18px;
  font-weight: 500;
  height: 24px;
  line-height: 24px;
  margin-bottom: 5px;
}

.flow-center-wrapper .my-todo .todo-wrapper .todo-count .todo-count-number {
  font-size: 36px;
  font-weight: 700;
  height: 36px;
  line-height: 36px;
}

.flow-center-wrapper .wrapper-divider {
  height: 120px;
  left: 32%;
  margin: 0;
  position: absolute;
  top: 20px;
}

.x-divider-vertical {
  border: solid #EBECEE;
  border-width: 0 0 0 1px;
  display: inline-block;
  height: .9em;
  margin: 0 15px;
  vertical-align: middle;
}

.flow-center-wrapper .flow-steps .step-wrapper {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  align-items: center;
  border-radius: 12px;
  cursor: pointer;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  line-height: 0;
  width: 23%;
}

.flow-center-wrapper .flow-steps .step-wrapper .step-image {
  height: 40px;
  margin-bottom: 16px;
  width: 40px;
}

.flow-center-wrapper .flow-steps .step-wrapper .step-text {
  font-size: 16px;
  height: 22px;
  line-height: 22px;
  white-space: nowrap;
}

.flow-center-wrapper .flow-steps {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  border-radius: 6px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  height: 100%;
  justify-content: space-around;
  padding: 20px 20px 20px 16px;
  width: 68%;
}
</style>
