<!-- 外部情报 -->
<script setup lang="ts">
import HomeHead from '@/views/home/components/HomeHead.vue'
import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import Editor from './TinyECE.vue'
import { useDate } from '@/views/home/hooks/useDate'
import type { FormInst } from 'naive-ui'
import { useMessage } from 'naive-ui'
import { ref } from 'vue'
import {
  NModal,
  NCard,
  NForm,
  NButton,
  NFormItem,
  NInput,
  NRadio,
  NSelect,
  NSpace,
  NRadioGroup
} from 'naive-ui'
import { saveArticle } from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'

const store = useUserStore()
const { day, week } = useDate()
const { push } = useRouter()
</script>

<template>
  <HomeHead class="top">
    <template #content>
      <!-- <HomeHeadSearch /> -->
    </template>
  </HomeHead>
  <div class="h-full relative flex flex-col">
    <div class="font-600 flex items-end mt27px">
      <div class="text-36px">外部情报</div>
      <div class="text-18px ml40px mr25px">{{ day }}</div>
      <div class="text-18px flex-1">{{ week }}</div>
      <div
        style="margin-right: 8px"
        v-if="store.user.isPublish === 1 || store.user.roleCode === 'zhuxi'"
      >
        <div
          class="add text-18px px13px py11px cursor-pointer"
          @click="push({ path: '/Home/Process' })"
        >
          情报流程
        </div>
      </div>
      <div
        style="margin-right: 8px"
        v-if="store.user.isPublish === 1 || store.user.roleCode === 'zhuxi'"
      >
        <div
          class="add text-18px px13px py11px cursor-pointer"
          @click="push({ name: 'messageSelect' })"
        >
          留言板
        </div>
      </div>
      <div v-if="store.user.isPublish === 1">
        <div
          class="add text-18px px13px py11px cursor-pointer"
          @click="push({ name: 'InfosEdit' })"
        >
          + 新增
        </div>
      </div>
    </div>
    <div class="flex-1 mt30px text-#142142">
      <slot></slot>
    </div>
    <!-- <n-modal v-model:show="showModal" style="width: 974px;border-radius: 20px;">
      <n-card style="width: 974px;" title="情报新增" :bordered="false" role="dialog" aria-modal="true">
        <template #header-extra>
          <img src="../images/chac.png" alt="" class="cursor-pointer w19px h19px" @click="close">
        </template>
        <n-form ref="formRef" :label-width="900" :model="formValue" :rules="rules" size="medium"
          require-mark-placement="left">
          <n-form-item label="情报属性" path="type">
            <n-radio-group v-model:value="formValue.type" name="radiogroup" @update:modelValue="radios">
              <n-space >
                <n-radio  value="1">外部</n-radio>
                <n-radio  value="2">内部</n-radio>
   

              </n-space>
            </n-radio-group>
          </n-form-item>
          <n-form-item label="情报类型" path="cate">
            <div class="flex gap-20px cursor-pointer">
                <div v-if="formValue.type==='1'" :class="cate == 1 ? 'img yes' : 'img'" @click="change(1)">
                  <img src="../images/icon-1.svg" alt="" class="ml15px mt8px">
                  <div class="text-center text-14px text-#fff">外部环境</div>
                </div>
                <div v-if="formValue.type==='1'" :class="cate == 2 ? 'img yes' : 'img'" @click="change(2)">
                  <img src="../images/icon-2.svg" alt="" class="ml18px mt14px">
                  <div class="text-center text-14px text-#fff">竞争对手</div>
                </div>
                <div v-if="formValue.type==='1'" :class="cate == 3 ? 'img yes' : 'img'" @click="change(3)">
                  <img src="../images/icon-3.svg" alt="" class="ml19px mt8px">
                  <div class="text-center text-14px text-#fff">供方动向</div>
                </div>
              <div v-if="formValue.type==='2'" :class="cate == 4 ? 'img yes' : 'img'" @click="change(4)">
                <img src="../images/icon-4.svg" alt="" class="ml17px mt10px">
                <div class="text-center text-14px text-#fff">大金集团</div>
              </div>
              <div v-if="formValue.type==='1'" :class="cate == 7 ? 'img yes' : 'img'" @click="change(7)">
                    <img src="../images/news2@2x.png" alt="" class="ml19px mt8px w46px">
                    <div class="text-center text-14px text-#fff">News</div>
                    </div>
                    <div v-if="formValue.type==='1'" :class="cate == 8 ? 'img yes' : 'img'" @click="change(8)">
                    <img src="../images/zytz@2x.png" alt="" class="ml10px mt8px w55px">
                    <div class="text-center text-14px text-#fff">重要通知</div>
                      </div>
              <div v-if="formValue.type==='2'" :class="cate == 5 ? 'img yes' : 'img'" @click="change(5)">
                <img src="../images/icon-5.svg" alt="" class="ml17px mt9px">
                <div class="text-center text-14px text-#fff">中国据点</div>
              </div>
              <div v-if="formValue.type==='2'" :class="cate == 6 ? 'img yes' : 'img'" @click="change(6)">
                <img src="../images/icon-6.svg" alt="" class="ml15px mt8px">
                <div class="text-center text-14px text-#fff">调达本部</div>
              </div>

              
            </div>
          </n-form-item>
          <n-form-item label="情报标题" path="title">
            <n-input v-model:value="formValue.title" placeholder="" />
          </n-form-item>

          <n-form-item label="情报来源" path="source">
            <n-input v-model:value="formValue.source" placeholder="" />
          </n-form-item>
          <n-form-item label="情报内容" path="content">
            <Editor  @getChildData="handleChild"></Editor>
          </n-form-item>
          <n-form-item>
            <n-button attr-type="button" @click="cancel">
              取消
            </n-button>
            <n-button attr-type="button" @click="sure"
              style="background-color: #3870E5; border-radius: 5px; color: #fff;">
              确定
            </n-button>
          </n-form-item>
        </n-form>
      </n-card>
    </n-modal> -->
  </div>
</template>

<style scoped lang="less">
.top {
  position: absolute;
  right: 30px;
  top: -92px;
}

.add {
  border: 1px solid #ffffff;
  border-radius: 10px;
}

.img {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background-color: #c2c2c2;
}

.img.yes {
  background-color: #63bfb2;
}
</style>
