<template>
  <m-card mode="border">
    <m-card class="card" title="指挥体系">
      <div class="command">
        <div class="flag">
          <img src="/src/assets/images/zheng.png" />
          <img src="/src/assets/images/jing.png" />
        </div>
        <div class="leader">
          <div v-for="(item, i) in leaders" :key="i">
            <img :src="`/src/assets/images/${item.img}`" />
            <div>
              <p>{{ item.type }}</p>
              <span>{{ item.name }}</span>
            </div>
          </div>
        </div>
      </div>
      <div class="disposal">
        <m-sub>处置力量</m-sub>
        <div class="duty">
          <div>
            <p>值班人员</p>
            <p>日间值班 · 08:00 ~ 18:00</p>
          </div>
          <span />
          <div>
            <p>值班人员</p>
            <p>夜间值班 · 18:00 ~ 08:00</p>
          </div>
        </div>
        <m-table
          class="duty-table"
          :template="[
            '工作小组|组长|电话*1.2|常驻人数|报道制人数',
            'group|leader|phone|number1|number2',
          ]"
          :data="dutyTableData"
        />
      </div>
      <div class="soldier">
        <m-sub>单兵巡查边量</m-sub>
        <div class="btns">
          <div v-for="btn in btns" :key="btn.name">
            <img :src="`/src/assets/images/${btn.icon}`" />
            {{ btn.name }}
          </div>
        </div>
        <div class="list">
          <div v-for="soldier in soldierList" :key="soldier.id">
            <p>{{ soldier.name }}</p>
            <p>{{ soldier.phone }}</p>
            <span>查看点位</span>
          </div>
        </div>
      </div>
    </m-card>
    <m-card class="card" title="党建和经济"></m-card>
  </m-card>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'LeftComponent',
  setup() {
    const leaders = ref([
      {
        img: 'avatar1.png',
        type: '指挥长',
        name: '姓名',
      },
      {
        img: 'avatar2.png',
        type: '指挥长',
        name: '姓名',
      },
      {
        img: 'avatar1.png',
        type: '指挥长',
        name: '姓名',
      },
      {
        img: 'avatar2.png',
        type: '指挥长',
        name: '姓名',
      },
    ])
    const dutyTableData = ref([
      {
        group: '第一小组',
        leader: '组长名',
        phone: '1356249823',
        number1: 5,
        number2: 5,
      },
      {
        group: '第一小组',
        leader: '组长名',
        phone: '1356249823',
        number1: 5,
        number2: 5,
      },
      {
        group: '第一小组',
        leader: '组长名',
        phone: '1356249823',
        number1: 5,
        number2: 5,
      },
    ])
    const btns = ref([
      {
        icon: 'icon1.png',
        name: '单兵专题',
      },
      {
        icon: 'icon2.png',
        name: '排班表',
      },
    ])
    const soldierList = ref([
      {
        id: '1',
        name: '姓名',
        phone: '13652103974',
      },
      {
        id: '2',
        name: '姓名',
        phone: '13652103974',
      },
      {
        id: '3',
        name: '姓名',
        phone: '13652103974',
      },
    ])
    return {
      leaders,
      dutyTableData,
      btns,
      soldierList,
    }
  },
})
</script>

<style lang="stylus" scoped>
.card
  flex 1
  &:first-child
    flex 2
.command
  display flex
  .flag
    display flex
    flex-direction column
    justify-content space-around
    margin-right .3rem
    >img
      display block
      width .34rem
      height @width
      margin .05rem 0
  .leader
    display flex
    flex-wrap wrap
    >div
      width 50%
      display flex
      align-items center
      p
        font-size .12rem
        font-weight bold
      img
        width .3rem
        height @width
        margin-right .1rem
      span
        color #ccc
.disposal
  .duty
    display flex
    align-items center
    margin-bottom .05rem
    >span
      width .01rem
      height .14rem
      margin 0 .2rem
      background #5bd5ff
    >div
      flex 1
      >p
        &:last-child
          color #ccc
.soldier
  margin .05rem 0
  .btns
    display flex
    justify-content flex-end
    >div
      display flex
      align-items center
      color #47B3FF
      margin-left .2rem
      cursor pointer
      transition .3s ease-in-out
      &:hover
        transform scale(1.1)
        text-decoration underline
      img
        width .1rem
        height @width
        margin-right .05rem
  .list
    display flex
    justify-content space-between
    >div
      width 30%
      background url('/src/assets/images/border.png') 100% / 100% 100% no-repeat
      padding .05rem .1rem
      box-sizing border-box
      span
        color #47B3FF
        cursor pointer
</style>
<style lang="stylus">
$blue = #2F86EE
$border = .01rem solid $blue
.duty-table
  .table-title
    border $border
    border-bottom none
    >div
      color #fff
      background rgba(0, 118, 255, .3)
    >div+div
        border-left $border
  .table-content
    border-bottom $border
    >div
      border $border
      border-bottom none
      >div
        background rgba(0, 118, 255, .15)
      >div+div
        border-left $border
</style>
