<template>
  <div class="app-container">
    <div class="workHeader">
      <el-row>
        <el-col :sm="12" :lg="12" :xs="24">
          <div class="headerLeft">
            <div class="top">欢迎！</div>
            <div class="bottom">CSF-HK</div>
          </div>
        </el-col>
        <el-col :sm="12" :lg="12" :xs="24" class="right">
          <div class="headerRight">
            <div class="item" v-for="data in headerList" :key="data.id">
              <div class="top">{{ data.title }}</div>
              <div class="bottom">
                <div class="iconfont headerIcon" :class="data.icon"></div>
                {{ data.count }}
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <div class="workContent" :style="{ padding: gap }">
      <el-row>
        <!-- 左侧内容 -->
        <el-col :sm="16" :lg="18" :style="{ paddingRight: gap }">
          <el-card shadow="never" class="leftOneCard" :style="{ marginBottom: gap }">
            <div class="leftOneCardContent">
              <div class="item" v-for="data in staticList" :key="data.id">
                <div class="top">{{ data.title }}</div>
                <div class="bottom">
                  <div
                    class="iconfont staticIcon"
                    :class="data.icon"
                    :style="{ background: data.color }"
                  ></div>
                  <div>{{ data.count }}{{ data.unit }}</div>
                </div>
              </div>
            </div>
          </el-card>
          <el-row>
            <!-- 左侧内容 -->
            <el-col :sm="12" :lg="12">
              <el-card shadow="never" class="leftTwoCard" :style="{ marginBottom: gap }">
                <template #header>
                  <div>
                    <span class="commonCardTitle">工单处理</span>
                  </div>
                </template>
                <div class="leftTwoCardContent">
                  <div class="item" v-for="data in workList" :key="data.id">
                    <div class="left">
                      <div class="unit" :style="{ background: data.color }">{{ data.unit }}</div>
                      <div class="title">
                        <div class="oneTit">{{ data.title }}</div>
                        <div class="subTit">{{ data.subTitle }}</div>
                      </div>
                    </div>
                    <div class="right">
                      <el-icon style="margin-right: 10px"><EditPen /></el-icon>
                      <el-icon><Delete /></el-icon>
                    </div>
                  </div>
                </div>
                <template #footer>
                  <div class="leftTwoFooter">
                    加载更多
                    <el-icon><ArrowDown /></el-icon>
                  </div>
                </template>
              </el-card>
              <el-card shadow="never" class="leftThreeCard">
                <template #header>
                  <div class="leftThreeHeader">
                    <span class="commonCardTitle">最新资讯</span>
                    <span class="quitTit commonCardTitle">所有项目</span>
                  </div>
                </template>
                <div class="leftThreeCardContent">
                  <div class="item" v-for="data in infoList" :key="data.id">
                    <div class="top">
                      <div class="left">
                        <img class="iconBox" src="@/assets/images/icon1.png" alt="" />
                        <div class="title">{{ data.title }}</div>
                      </div>
                      <el-icon class="arrow"><ArrowRight /></el-icon>
                    </div>
                    <div class="bottom">{{ data.subTitle }}</div>
                  </div>
                </div>
              </el-card>
            </el-col>
            <!-- 右侧内容 -->
            <el-col :sm="12" :lg="12" :style="{ paddingLeft: gap }">
              <el-card shadow="never" class="tableCard">
                <template #header>
                  <div>
                    <span class="commonCardTitle">财务需求分析记录</span>
                  </div>
                </template>
                <div class="recordTable">
                  <div class="timeBox">
                    <div v-for="time in timeList">
                      <div
                        :style="{ borderRight: time.line ? '2px solid #E0E0E0' : '' }"
                        class="timeTitle"
                        :class="{ active: currentTimeId == time.id }"
                      >
                        {{ time.title }}
                      </div>
                    </div>
                  </div>
                  <div class="tableContent">
                    <div class="emptyBox">
                      <img class="emptyImg" src="@/assets/images/empty.png" alt="" />
                      <div class="emptyTit">暂无数据</div>
                    </div>
                  </div>
                </div>
              </el-card>
            </el-col>
          </el-row>
        </el-col>
        <!-- 右侧内容 -->
        <el-col :sm="8" :lg="6">
          <el-card shadow="never" class="rightOneCard">
            <template #header>
              <div>
                <span class="commonCardTitle">快捷操作</span>
              </div>
            </template>
            <div class="rightOneCardContent">
              <div class="item" v-for="data in quickList" :key="data.id">
                <div class="top">
                  <div class="iconfont quickIcon" :class="data.icon"></div>
                </div>
                <div class="bottom">
                  {{ data.title }}
                </div>
              </div>
            </div>
          </el-card>
          <el-carousel class="rightTwoCard" :interval="5000" arrow="always" autoplay>
            <el-carousel-item v-for="item in 4" :key="item">
              <h3 text="2xl" justify="center">{{ item }}</h3>
            </el-carousel-item>
          </el-carousel>
          <el-card shadow="never" class="rightThreeCard">
            <template #header>
              <div>
                <span class="commonCardTitle">文档</span>
              </div>
            </template>
            <div class="threeCardContent">
              <div class="item" v-for="data in documentList" :key="data.id">
                <div class="bottom">
                  {{ data.title }}
                </div>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup>
import { computed, watch } from 'vue'
import useUserStore from '@/store/modules/user'
import AppCard from './components/AppCard.vue'
import { fa } from 'element-plus/es/locales.mjs'

const userStore = useUserStore()
const headerList = ref([
  {
    id: '1',
    title: '总保费(HKD)',
    icon: 'icon-zongbaofei',
    count: '--',
    url: '/todo'
  },
  {
    id: '2',
    title: '有效保单数',
    icon: 'icon-youxiaobaodan',
    count: '--',
    url: '/todo'
  },

  {
    id: '3',
    title: '待来佣保单',
    icon: 'icon-daijiesuan',
    count: '--',
    url: '/todo'
  }
])
const quickList = ref([
  {
    id: '1',
    title: '财务中心',
    icon: 'icon-huabi',
    url: '/todo'
  },
  {
    id: '2',
    title: '预约信息',
    icon: 'icon-yuyue',
    url: '/todo'
  },
  {
    id: '3',
    title: '新单跟进',
    icon: 'icon-genjinjilu',
    url: '/todo'
  },
  {
    id: '4',
    title: '保单查询',
    icon: 'icon-jianchafudao',
    url: '/todo'
  },
  {
    id: '5',
    title: '续期管理',
    icon: 'icon-xuqi',
    url: '/todo'
  },
  {
    id: '6',
    title: '客户管理',
    icon: 'icon-anquan',
    url: '/todo'
  },

  {
    id: '7',
    title: '财务需求分析',
    icon: 'icon-xiexian',
    url: '/todo'
  }
])
const documentList = ref([
  {
    id: '1',
    title: '使用手册',
    icon: 'el-icon-s-order',
    url: '/todo'
  },
  {
    id: '2',
    title: '业务流程',
    icon: 'el-icon-s-order',
    url: '/todo'
  },
  {
    id: '3',
    title: '公司介绍',
    icon: 'el-icon-s-order',
    url: '/todo'
  },
  {
    id: '4',
    title: '联系方式',
    icon: 'el-icon-s-order',
    url: '/todo'
  }
])
const staticList = ref([
  {
    id: '1',
    title: '财务需求分析数',
    icon: 'icon-xiexian',
    count: '--',
    unit: '条',
    url: '/todo',
    color: '#F53F3F'
  },
  {
    id: '2',
    title: '预约单数',
    icon: 'icon-xiexian',
    count: '--',
    unit: '单',
    url: '/todo',
    color: '#0FC6C2'
  },
  {
    id: '3',
    title: '新单数',
    icon: 'icon-xiexian',
    count: '--',
    unit: '单',
    url: '/todo',
    color: '#165DFF'
  },
  {
    id: '4',
    title: '续期保单数',
    icon: 'icon-xiexian',
    count: '--',
    unit: '份',
    url: '/todo',
    color: '#0FC6C2'
  }
])
const infoList = ref([
  {
    id: '1',
    title: '产品优惠',
    subTitle: '暂未开放'
  },
  {
    id: '2',
    title: '产品培训',
    subTitle: '暂未开放'
  },
  {
    id: '3',
    title: '重要通知',
    subTitle: '暂未开放'
  },
  {
    id: '4',
    title: '系统消息',
    subTitle: '暂未开放！'
  }
])
const timeList = ref([
  {
    id: '1',
    title: '本月',
    line: true
  },
  {
    id: '2',
    title: '近三个月',
    line: true
  },
  {
    id: '3',
    title: '近一年',
    line: false
  }
])
const workList = ref([
  {
    id: '1',
    title: '新单跟进',
    subTitle: '暂未开放',
    unit: 'Q',
    color: '#7BC616'
  },
  {
    id: '2',
    title: '续费提醒',
    subTitle: '暂未开放',
    unit: 'Y',
    color: '#14C9C9'
  },
  {
    id: '3',
    title: '预约单生成',
    subTitle: '暂未开放',
    unit: 'N',
    color: '#168CFF'
  }
])
const currentTimeId = ref('1')
const gap = ref('10px')
</script>

<style lang="scss" scoped>
 :deep(.el-card ) {
  border: none !important;
}
 :deep(.el-carousel__button ) {
  width: 10px !important ;
}
.app-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 84.5px);
  padding: 0;
  background-color: #f2f3f5;

  .workHeader {
    background-color: #fff;
    width: 100%;
    flex-shrink: 0;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #e0e0e0;
    color: #4e5969;
    .headerLeft {
      margin-top: 20px;
      .top {
        font-size: 24px;
        font-weight: 600;
        margin-bottom: 5px;
      }
      .bottom {
        font-size: 14px;
        color: rgba(134, 144, 156, 1);
      }
    }
    .headerRight {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      margin-top: 20px;
      .item {
        display: flex;
        flex-direction: column;
        margin-right: 20px;
        .top {
          margin-bottom: 7px;
          font-size: 14px;
        }
        .bottom {
          font-size: 24px;
          font-weight: 600;
          color: #1d2129;
          display: flex;
          align-items: center;
          .headerIcon {
            margin-right: 5px;
            color: #4e5969;
            font-size: 14px;
          }
        }
      }
      .item:last-child {
        margin-right: 0;
      }
    }
  }
  .workContent {
    width: 100%;
    flex: 1;
    /* padding: 16px; */
    background-color: rgba(235, 238, 246, 0.5);
    overflow: auto;
    .commonCardTitle {
      font-size: 15px;
      font-weight: normal;
    }
    .rightOneCard {
      .rightOneCardContent {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        width: 100%;
        .item {
          width: 33%;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          margin-bottom: 10px;
          .top {
            background-color: #0fc6c2;
            border-radius: 5px;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 3px;
            .quickIcon {
              color: #fff;
              font-size: 14px;
            }
          }
          .bottom {
            color: #4e5969;
            font-size: 10px;
          }
        }
        .item:last-child {
          margin-bottom: 0px;
        }
      }
    }
    .rightTwoCard {
      height: 180px;
      margin: 16px 0;
      border-radius: 3px;
      .el-carousel__item h3 {
        color: #475669;
        opacity: 0.75;
        line-height: 300px;
        margin: 0;
        text-align: center;
      }

      .el-carousel__item:nth-child(2n) {
        background-color: #99a9bf;
      }

      .el-carousel__item:nth-child(2n + 1) {
        background-color: #d3dce6;
      }
    }
    .rightThreeCard {
      .threeCardContent {
        display: flex;
        flex-direction: column;
        .item {
          font-size: 14px;
          color: #86909c;
          margin-bottom: 8px;
        }
        .item:last-child {
          margin-bottom: 0px;
        }
      }
    }
    .leftOneCard {
      /* margin-bottom: 16px; */
      .leftOneCardContent {
        display: flex;
        justify-content: space-between;
        .item {
          display: flex;
          flex-direction: column;
          .top {
            margin-bottom: 7px;
            font-size: 12px;
            color: #4e5969;
          }
          .bottom {
            font-size: 20px;
            font-weight: 600;
            color: #1d2129;
            display: flex;
            align-items: center;
            justify-content: center;
            .staticIcon {
              margin-right: 5px;
              color: #fff;
              font-size: 8px;
              border-radius: 3px;
              padding: 3px;
            }
          }
        }
      }
    }
    .leftTwoCard {
      /* margin-bottom: 16px; */
      .leftTwoCardContent {
        .item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 10px;
          .left {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            .unit {
              width: 30px;
              height: 30px;
              border-radius: 50%;
              display: flex;
              align-items: center;
              justify-content: center;
              margin-right: 10px;
              color: #fff;
              font-size: 12px;
            }
            .title {
              .oneTit {
                font-size: 12px;
                color: #1d2129;
              }
              .subTit {
                font-size: 11px;
                color: #4e5969;
                margin-top: 5px;
                width: 300px; /* 设置宽度 */
                white-space: nowrap; /* 禁止换行 */
                overflow: hidden; /* 隐藏超出部分 */
                text-overflow: ellipsis; /* 显示省略号 */
              }
            }
          }
        }
        .item:last-child {
          margin-bottom: 0px;
        }
      }
      .leftTwoFooter {
        font-size: 12px;
        color: #165dff;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
      }
    }
    .leftThreeCard {
      .leftThreeHeader {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .quitTit {
          color: #165dff;
          font-size: 13px;
        }
      }
      .leftThreeCardContent {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        width: 100%;
        .item {
          width: 50%;
          padding-bottom: 16px;
          .top {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .left {
              display: flex;
              align-items: center;
              justify-content: flex-start;
              .iconBox {
                width: 20px;
                height: 20px;
                margin-right: 5px;
              }
              .title {
                font-size: 12px;
                color: #1d2129;
              }
            }
            .arrow {
              font-size: 12px;
              color: #4e5969;
              font-weight: bold;
            }
          }
          .bottom {
            font-size: 12px;
            color: #4e5969;
            margin-top: 10px;
            width: 230px; /* 设置宽度 */
            white-space: nowrap; /* 禁止换行 */
            overflow: hidden; /* 隐藏超出部分 */
            text-overflow: ellipsis; /* 显示省略号 */
          }
        }
        .item:nth-child(2n + 1) {
          padding-right: 10px;
          border-right: 1px solid #e4e6eb;
        }
        .item:first-child {
          border-bottom: 1px solid #e4e6eb;
        }
        .item:nth-child(2n) {
          padding-left: 16px;
        }
        .item:last-child {
          border-top: 1px solid #e4e6eb;
        }
        .item:nth-last-child(-n + 2) {
          padding-top: 16px;
        }
      }
    }
    .tableCard {
      .recordTable {
        width: 100%;
        .timeBox {
          display: flex;
          align-items: center;
          justify-content: flex-start;
          .timeTitle {
            padding: 0 10px;
            font-size: 13px;
            color: #4e5969;
            &.active {
              color: #165dff;
            }
          }
        }
        .tableContent {
          width: 100%;
          .emptyBox {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            height: 300px;
            .emptyImg {
              height: 80px;
            }
            .emptyTit {
              font-size: 14px;
              color: #4e5969;
              margin-top: 10px;
            }
          }
        }
      }
    }
  }
}
.workbench-container {
  padding: 20px;
  background-color: #f0f2f5;
  min-height: calc(100vh - 50px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
}

.app-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 10px 0;
}

.empty-container {
  padding: 40px 0;
}
@media only screen and (max-width: 768px) {
  .workHeader {
    .headerRight {
      justify-content: flex-start !important;
    }
  }
}
@media only screen and (min-width: 768px) {
  .workHeader {
    .headerRight {
      justify-content: flex-end !important;
    }
  }
  .workContent {
    .leftTwoCard {
      .leftTwoCardContent {
        .item {
          .left {
            .title {
              .subTit {
                width: 120px !important;
              }
            }
          }
        }
      }
    }
    .leftThreeCard {
      .leftThreeCardContent {
        .item {
          .bottom {
            width: 100px !important; /* 设置宽度 */
          }
        }
      }
    }
  }
}

@media only screen and (min-width: 1200px) {
  .workHeader {
    .headerRight {
      justify-content: flex-end !important;
    }
  }
  .workContent {
    .leftThreeCard {
      .leftThreeCardContent {
        .item {
          .bottom {
            width: 230px !important; /* 设置宽度 */
          }
        }
      }
    }
    .leftTwoCard {
      .leftTwoCardContent {
        .item {
          .left {
            .title {
              .subTit {
                width: 300px !important;
              }
            }
          }
        }
      }
    }
  }
}
</style>
